/* ──────────────────────────────────────
   crudodev — sistema de estilos
   Color: paleta cálida (papel / tinta / sage)
   Tipografía: JetBrains Mono
   ────────────────────────────────────── */

:root {
  --base:        #ECECEA;
  --surface:     #E0E0DD;
  --text:        #1B1B1A;
  --muted:       #6F6F6C;
  --ghost:       #BEBEBB;
  --sage:        #000000;
  --terracotta:  #3A3A37;
  --slate:       #3A3A37;

  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-6: 48px;
  --s-8: 64px;
  --s-12: 96px;
  --s-16: 128px;

  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --serif: var(--mono);
  --sans:  var(--mono);

  --t-display: clamp(1.75rem, 4.8vw, 3rem);
  --t-h1: 1.6rem;
  --t-h2: 1.05rem;
  --t-body: 0.95rem;
  --t-small: 0.7rem;

  --content: 680px;
  --wide: 920px;

  --t-fast: 120ms ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--base);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--t-body);
  line-height: 1.7;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

/* Scrollbar */
html { scrollbar-width: thin; scrollbar-color: var(--muted) var(--base); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--base); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 0; }

::selection { background: var(--sage); color: var(--base); }

/* Tipografía */
h1, h2, h3, h4 {
  font-family: var(--mono);
  font-weight: 500;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
p  { margin: 0; }

.label {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
}

.label--ghost { color: var(--ghost); }

/* Enlaces */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--ghost);
  text-decoration-thickness: 0.5px;
  text-underline-offset: 2px;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

a:hover {
  color: var(--sage);
  text-decoration-color: transparent;
}

a:focus-visible {
  outline: 1px solid var(--sage);
  outline-offset: 3px;
}

a.plain { text-decoration: none; }
a.plain:hover { color: var(--sage); }

/* Layout */
.page {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--s-3);
}

.page--wide { max-width: var(--wide); }

main { padding-bottom: var(--s-16); }

.rule {
  border: 0;
  border-top: 0.5px solid var(--ghost);
  margin: var(--s-8) 0;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: var(--s-6);
  align-items: end;
  padding-top: var(--s-12);
  padding-bottom: var(--s-8);
}

.hero__name {
  font-family: var(--mono);
  font-size: var(--t-display);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 0;
  white-space: nowrap;
}

.wm-brace { color: var(--muted); font-weight: 400; }
.wm-dot   { color: var(--ghost); padding: 0 0.04em; }
.wm-name  { color: var(--text); }
.wm-dev   { letter-spacing: -0.02em; }

.hero__sub {
  color: var(--muted);
  margin-top: var(--s-2);
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero__statement {
  margin-top: var(--s-4);
  max-width: 36ch;
  color: var(--text);
}

.hero__statement p + p { margin-top: 0; }

.hero__figure {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--text);
  margin-bottom: -24px;
  align-self: end;
  overflow: hidden;
}

.hero__figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__figure::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 0.5px solid rgba(247, 245, 241, 0.18);
  pointer-events: none;
}

.hero__nav {
  margin-top: var(--s-6);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-3);
  font-family: var(--sans);
  align-items: baseline;
}

.hero__nav a {
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.hero__nav a:hover { color: var(--sage); }

.hero__nav .sep { color: var(--ghost); user-select: none; }

.stack {
  margin-top: var(--s-6);
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Sección */
.section { padding: var(--s-8) 0; }

.section__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.section__title {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.section__idx { color: var(--ghost); }
.section__sep { color: var(--ghost); margin: 0 6px; }

.section__more {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* Lista */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 0.5px solid var(--ghost);
}

.list__row {
  display: grid;
  grid-template-columns: 64px 1fr 1.4fr;
  align-items: baseline;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-2);
  border-bottom: 0.5px solid var(--ghost);
  border-left: 1px solid transparent;
  transition: border-left-color var(--t-fast), padding-left var(--t-fast), background var(--t-fast);
}

.list__row:hover {
  border-left-color: var(--sage);
  padding-left: calc(var(--s-2) + 7px);
}

.list__row--empty { color: var(--ghost); pointer-events: none; }
.list__row--empty:hover { border-left-color: transparent; padding-left: var(--s-2); }

.list__year {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  color: var(--muted);
}
.list__row--empty .list__year { color: var(--ghost); }

.list__name {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.list__name a { text-decoration: none; color: inherit; }
.list__row:hover .list__name a { color: var(--sage); }

.list__desc { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.list__desc em { font-style: italic; color: var(--muted); }

/* About */
.about { padding: var(--s-8) 0; }
.about__text { color: var(--text); }
.about__text p + p { margin-top: var(--s-2); }

/* Terminal */
.term {
  margin: 0;
  background: var(--surface);
  border: 0.5px solid var(--ghost);
  border-radius: 6px;
  font-family: var(--mono);
  line-height: 1.7;
  overflow: hidden;
}

.term__bar {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 0.5px solid var(--ghost);
  background: rgba(28, 26, 22, 0.025);
}

.term__dots { display: inline-flex; gap: 6px; }
.term__dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--text); display: block; }
.term__dots i:nth-child(1) { opacity: 0.22; }
.term__dots i:nth-child(2) { opacity: 0.34; }
.term__dots i:nth-child(3) { opacity: 0.48; }

.term__title {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.term__pad { display: block; }
.term__body { padding: 14px 16px 12px; color: var(--slate); font-size: 0.82rem; }
.term__last { margin: 0 0 4px; color: var(--muted); opacity: 0.75; }
.term__cmt { margin: 0 0 10px; color: var(--ghost); font-style: italic; }
.term__line { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 0; }
.term__line + .term__line { margin-top: 4px; }
.term__path { color: var(--ghost); font-weight: 500; }
.term__sigil { color: var(--muted); font-weight: 500; }
.term__cmd { color: var(--text); white-space: nowrap; }

.term__out {
  list-style: none;
  margin: 6px 0 10px;
  padding: 0 0 0 4px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 2px 18px;
  color: var(--slate);
}

.term__out li { position: relative; padding-left: 14px; }
.term__out li::before { content: "›"; position: absolute; left: 0; color: var(--ghost); }

.term__caret {
  display: inline-block;
  width: 7px;
  height: 0.95em;
  background: var(--slate);
  transform: translateY(2px);
  animation: term-caret 1.1s steps(1) infinite;
  border: 0; padding: 0; font: inherit;
  vertical-align: baseline;
  cursor: default;
}

.term__ee-quote { margin: 4px 0 2px; color: var(--text); font-style: italic; }
.term__ee-attr { margin: 0 0 10px; color: var(--ghost); font-style: italic; }

@keyframes term-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term__caret { animation: none; } }
@media (max-width: 480px) {
  .term__bar { grid-template-columns: 56px 1fr; }
  .term__pad { display: none; }
  .term__title { text-align: left; padding-left: 8px; }
}

/* Footer */
.foot {
  border-top: 0.5px solid var(--ghost);
  padding: var(--s-3) 0 var(--s-6);
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ghost);
}

.foot__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}

.foot__row > span { white-space: nowrap; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--sage); }
.foot .sep { user-select: none; color: var(--ghost); }

/* Encabezado de páginas internas */
.page-head {
  padding-top: var(--s-8);
  padding-bottom: var(--s-6);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: var(--s-3);
}

.page-head__back {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.page-head__back:hover { color: var(--sage); }
.page-head__back .pg-prompt { color: var(--muted); margin-right: 6px; }
.page-head__back .pg-cmd { color: var(--text); }

.page-head__title {
  font-family: var(--mono);
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.page-head__path {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ghost);
  margin-top: 2px;
  letter-spacing: 0;
}

.page-head__lede {
  grid-column: 1 / -1;
  color: var(--muted);
  max-width: 42ch;
  margin-top: var(--s-2);
}

.page-head__lede em.coda { font-style: italic; color: var(--muted); }

/* Artículo (lectura larga) */
.prose { max-width: var(--content); font-size: 1rem; line-height: 1.7; }
.prose h2 { margin: var(--s-6) 0 var(--s-2); }
.prose h3 { margin: var(--s-4) 0 var(--s-2); font-size: 1rem; }
.prose p { margin-top: var(--s-2); }
.prose p + p { margin-top: var(--s-2); }
.prose ul, .prose ol { margin: var(--s-2) 0; padding-left: var(--s-3); }
.prose li { margin-top: 4px; }
.prose img { margin: var(--s-3) 0; border: 0.5px solid var(--ghost); }
.prose blockquote {
  margin: var(--s-3) 0;
  padding-left: var(--s-2);
  border-left: 1px solid var(--sage);
  color: var(--muted);
  font-style: italic;
}
.prose a { text-decoration-color: var(--muted); }
/* El componente .list se usa dentro de páginas (Trabajo / Estante) */
.prose .list { padding-left: 0; margin: var(--s-2) 0 0; }
.prose .list li { margin-top: 0; }
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--surface);
  color: var(--slate);
  padding: 1px 6px;
  border-radius: 2px;
}
.prose pre {
  background: var(--surface);
  border: 0.5px solid var(--ghost);
  border-radius: 4px;
  padding: var(--s-2);
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; }

/* ──────────────────────────────────────
   Adiciones CMS — posts, paginación, contacto
   ────────────────────────────────────── */

/* Tarjeta de post con excerpt */
.posts { list-style: none; margin: 0; padding: 0; border-top: 0.5px solid var(--ghost); }

.post-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-2);
  border-bottom: 0.5px solid var(--ghost);
  border-left: 1px solid transparent;
  transition: border-left-color var(--t-fast), padding-left var(--t-fast);
}
.post-row:hover { border-left-color: var(--sage); padding-left: calc(var(--s-2) + 7px); }

.post-row__date {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  padding-top: 3px;
}

.post-row__title {
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}
.post-row__title a { text-decoration: none; color: inherit; }
.post-row:hover .post-row__title a { color: var(--sage); }

.post-row__excerpt { color: var(--muted); font-size: 0.9rem; margin-top: 6px; max-width: 56ch; }

.post-row__thumb {
  margin-top: var(--s-2);
  aspect-ratio: 16 / 9;
  max-width: 220px;
  overflow: hidden;
  background: var(--surface);
  border: 0.5px solid var(--ghost);
}
.post-row__thumb img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 640px) {
  .post-row { grid-template-columns: 1fr; row-gap: 6px; }
}

/* Imagen destacada del post */
.post-hero {
  margin: var(--s-3) 0 var(--s-6);
  border: 0.5px solid var(--ghost);
  overflow: hidden;
  max-height: 420px;
}
.post-hero img { width: 100%; object-fit: cover; }

.post-meta {
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s-2);
}

/* Video incrustado (YouTube) — responsive 16:9 */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: var(--s-3) 0 var(--s-6);
  background: var(--text);
  border: 0.5px solid var(--ghost);
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Paginación */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-6);
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pagination a, .pagination span {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border: 0.5px solid var(--ghost);
  border-radius: 3px;
}
.pagination a:hover { color: var(--sage); border-color: var(--sage); }
.pagination .is-disabled { color: var(--ghost); border-color: var(--ghost); opacity: 0.5; }
.pagination__status { border: 0; color: var(--ghost); }

/* Formulario de contacto */
.form-field { margin-bottom: var(--s-3); }
.form-field label {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.input, .textarea, select {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--ghost);
  border-radius: 3px;
  padding: 10px 12px;
  line-height: 1.5;
}
.input:focus, .textarea:focus, select:focus { outline: 1px solid var(--sage); outline-offset: 1px; }
.textarea { resize: vertical; min-height: 140px; }

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--t-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--base);
  background: var(--text);
  border: 1px solid var(--text);
  border-radius: 3px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--base); color: var(--text); }

.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { background: var(--text); color: var(--base); }

.notice {
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 10px 14px;
  border-radius: 3px;
  border: 0.5px solid var(--ghost);
  margin-bottom: var(--s-3);
}
.notice--ok { border-left: 2px solid var(--sage); }
.notice--err { border-left: 2px solid var(--terracotta); color: var(--terracotta); }

.empty-state {
  color: var(--muted);
  font-style: italic;
  padding: var(--s-4) 0;
}

/* Responsive hero */
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: var(--s-4); padding-top: var(--s-8); }
  .hero__figure { width: 120px; order: -1; margin-bottom: 0; }
  .list__row { grid-template-columns: 52px 1fr; row-gap: 4px; }
  .list__desc { grid-column: 2 / -1; }
  .about { padding: var(--s-6) 0; }
}
