/* =========================================================
   Tortxu — Cuaderno de opinión
   Diseño editorial: serif display + sans UI + papel cálido
   ========================================================= */

:root {
  --paper: #f6f1e7;
  --paper-dim: #ede6d6;
  --ink: #1a1814;
  --ink-soft: #3a342c;
  --ink-muted: #6b6356;
  --rule: #d9cfba;
  --accent: #b0513a;
  --accent-deep: #7a3524;
  --highlight: #f3d9a4;
  --header-bg: rgba(246, 241, 231, 0.93);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", Menlo, Consolas, monospace;
  --content-w: 1200px;
  --narrow-w: 720px;
  --radius: 4px;
  --shadow-soft: 0 1px 2px rgba(26,24,20,.04), 0 8px 24px rgba(26,24,20,.06);
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --paper: #242220;
  --paper-dim: #2e2b28;
  --ink: #e8e2d6;
  --ink-soft: #c8c0b4;
  --ink-muted: #8c8278;
  --rule: #3c3834;
  --accent: #c96848;
  --accent-deep: #e07850;
  --highlight: #3a3020;
  --header-bg: rgba(30, 28, 26, 0.95);
  --shadow-soft: 0 1px 2px rgba(0,0,0,.2), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  background: var(--paper);
  color: var(--ink);
  transition: background .25s ease, color .25s ease;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; height: auto; }
a { color: var(--accent-deep); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 .6em; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.container { max-width: var(--content-w); margin: 0 auto; padding: 0 2rem; }
.container.narrow { max-width: var(--narrow-w); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ================= HEADER ================= */
.site-header {
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 50;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background: var(--header-bg);
  transition: background .25s ease, border-color .25s ease;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; gap: 1.5rem;
}
.site-brand {
  display: flex; align-items: center; gap: .75rem;
  color: var(--ink); text-decoration: none; flex-shrink: 0;
}
.brand-mark-img { width: 38px; height: 38px; flex-shrink: 0; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); }
.brand-sub { font-size: .7rem; color: var(--ink-muted); letter-spacing: .08em; text-transform: uppercase; }

/* Acciones del header (dark toggle + hamburguesa) */
.header-actions {
  display: flex; align-items: center; gap: .5rem; margin-left: auto;
}

/* Botón modo oscuro */
.dark-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--paper-dim); border: 1px solid var(--rule);
  cursor: pointer; font-size: 1rem; line-height: 1;
  color: var(--ink-soft); transition: background .2s, border-color .2s, color .2s;
  flex-shrink: 0; -webkit-appearance: none; appearance: none;
}
.dark-toggle:hover { background: var(--rule); color: var(--ink); }
.icon-sun { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Hamburguesa — oculto en desktop */
.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: var(--paper-dim); border: 1px solid var(--rule);
  border-radius: 4px; cursor: pointer; padding: 0;
  flex-shrink: 0; -webkit-appearance: none; appearance: none;
  transition: background .2s, border-color .2s;
}
.nav-toggle:hover { background: var(--rule); }
.nav-toggle span {
  display: block; width: 18px; height: 1.5px;
  background: var(--ink); border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.6rem; }
.site-nav a {
  color: var(--ink-soft); font-size: .9rem; font-weight: 500;
  position: relative; padding: .3rem 0;
  transition: color .15s;
}
.site-nav a:hover, .site-nav a.active { color: var(--ink); }
.site-nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--accent);
}

/* ================= HEADER MÓVIL ================= */
@media (max-width: 680px) {
  .header-inner { padding: .85rem 1.1rem; gap: .75rem; }
  .brand-sub { display: none; }
  .nav-toggle { display: flex; }

  .site-nav {
    position: fixed; inset: 0; top: 62px;
    background: var(--paper);
    border-top: 2px solid var(--accent);
    padding: 1.5rem 1.25rem;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1), background .25s;
    z-index: 49; overflow-y: auto;
  }
  .site-nav.is-open { transform: translateX(0); }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li { border-bottom: 1px solid var(--rule); }
  .site-nav a { display: block; padding: 1rem 0; font-size: 1.1rem; }
  .site-nav a.active::after { bottom: 0; }
}

/* ================= HERO ================= */
.hero { padding: 5rem 0 4rem; border-bottom: 1px solid var(--rule); }
.hero-inner {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 4rem; align-items: center;
}
.eyebrow {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent-deep); font-weight: 600; margin: 0 0 1.2rem;
}
.hero-title {
  font-size: clamp(2.6rem, 5.5vw, 4.4rem); font-weight: 400;
  letter-spacing: -0.02em; margin: 0 0 1.5rem;
}
.hero-title em { font-style: italic; color: var(--accent-deep); font-weight: 300; }
.hero-lead { font-size: 1.12rem; color: var(--ink-soft); max-width: 54ch; margin-bottom: 2rem; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-art img { width: 100%; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .85rem 1.5rem; font-size: .95rem; font-weight: 500;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: all .18s ease; cursor: pointer; font-family: var(--sans);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent-deep); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

/* ================= SECTION LABEL ================= */
.section-label {
  display: flex; align-items: center; gap: 1rem; margin: 0 0 2.5rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--ink-muted); font-weight: 600;
}
.section-label::before, .section-label::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}
.section-label span { white-space: nowrap; }

/* ================= FEATURED ================= */
.featured { padding: 4.5rem 0 3rem; }
.featured-card {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 3rem; align-items: center;
}
.featured-media {
  display: block; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--paper-dim);
  box-shadow: var(--shadow-soft);
}
.featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.featured-media:hover img { transform: scale(1.03); }
.featured-body h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem); margin: .6rem 0 1rem;
}
.featured-body h2 a { color: var(--ink); }
.featured-body h2 a:hover { color: var(--accent-deep); }
.read-more { font-weight: 600; font-size: .95rem; color: var(--accent-deep); border-bottom: 1px solid var(--accent); padding-bottom: 2px; }

/* ================= GRID SECTION ================= */
.grid-section { padding: 3rem 0 5rem; }
.post-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem 2rem;
}
.post-card { display: flex; flex-direction: column; gap: 1rem; }
.card-media {
  display: block; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--radius); background: var(--paper-dim);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card-media:hover img { transform: scale(1.04); }
.card-body h3 {
  font-size: 1.35rem; margin: .4rem 0 .6rem; line-height: 1.25;
}
.card-body h3 a { color: var(--ink); }
.card-body h3 a:hover { color: var(--accent-deep); }

.post-meta {
  font-size: .78rem; color: var(--ink-muted); margin: 0;
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  letter-spacing: .02em;
}
.post-meta .dot { color: var(--rule); }
.post-meta .cat { color: var(--accent-deep); font-weight: 600; text-transform: uppercase; font-size: .7rem; letter-spacing: .1em; }
.post-summary { color: var(--ink-soft); font-size: .95rem; margin: 0; }

.see-all { text-align: center; margin-top: 3rem; }

/* ================= NEWSLETTER ================= */
.newsletter {
  background: var(--ink); color: var(--paper); padding: 4rem 0; margin-top: 2rem;
}
.newsletter-inner {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center;
}
.newsletter .eyebrow { color: var(--highlight); }
.newsletter h2 { color: var(--paper); font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: .8rem; }
.newsletter p { color: rgba(246,241,231,.75); max-width: 52ch; }
.newsletter-form { display: flex; gap: .6rem; }
.newsletter-form input {
  flex: 1; padding: .9rem 1rem; font-size: .95rem; font-family: var(--sans);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2);
  color: var(--paper); border-radius: var(--radius);
}
.newsletter-form input::placeholder { color: rgba(246,241,231,.5); }
.newsletter-form input:focus { outline: 2px solid var(--highlight); outline-offset: 1px; }
.newsletter-form .btn-primary { background: var(--highlight); color: var(--ink); }
.newsletter-form .btn-primary:hover { background: var(--paper); }

/* ================= PAGE HEADER (list) ================= */
.page-header { padding: 5rem 0 2.5rem; border-bottom: 1px solid var(--rule); }
.page-title { font-size: clamp(2.4rem, 5vw, 3.6rem); margin: 0 0 1rem; }
.page-intro { font-size: 1.1rem; color: var(--ink-soft); max-width: 60ch; }

/* ================= LIST ================= */
.list-section { padding: 3rem 0 5rem; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list-item { border-bottom: 1px solid var(--rule); }
.post-list-item:first-child { border-top: 1px solid var(--rule); }
.list-link {
  display: grid; grid-template-columns: 1fr 220px; gap: 2.5rem; align-items: center;
  padding: 2rem 0; color: var(--ink); transition: padding .2s ease;
}
.list-link:hover { padding-left: 1rem; }
.list-link:hover h2 { color: var(--accent-deep); }
.list-text h2 { font-size: 1.7rem; margin: .5rem 0 .6rem; line-height: 1.25; }
.list-media { aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--paper-dim); }
.list-media img { width: 100%; height: 100%; object-fit: cover; }

.pagination {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2.5rem 0 0; margin-top: 2rem; border-top: 1px solid var(--rule);
  font-size: .9rem; color: var(--ink-muted);
}
.pagination a { color: var(--ink); font-weight: 500; }

/* ================= ARTICLE ================= */
.article-header { padding: 5rem 0 3rem; text-align: left; }
.article-title {
  font-size: clamp(2.3rem, 5vw, 3.6rem); margin: .6rem 0 1.2rem;
  font-weight: 500; letter-spacing: -0.02em;
}
.article-lead {
  font-family: var(--serif); font-size: 1.35rem; font-style: italic;
  color: var(--ink-soft); line-height: 1.5; max-width: 60ch; margin: 0 0 2rem;
  font-weight: 300;
}
.article-byline { display: flex; align-items: center; gap: .9rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.byline-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--paper-dim); }
.byline-name { font-size: .95rem; font-weight: 600; margin: 0; }
.byline-meta { font-size: .82rem; color: var(--ink-muted); margin: .15rem 0 0; }

.article-cover {
  margin: 0 0 3rem; max-width: 1100px; margin-left: auto; margin-right: auto;
  padding: 0 2rem;
}
.article-cover img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-soft); }

.article-body { font-size: 1.08rem; line-height: 1.8; color: var(--ink-soft); }
.article-body h2 {
  font-size: 1.9rem; margin: 2.8rem 0 1rem; color: var(--ink);
  font-weight: 500; letter-spacing: -0.01em;
}
.article-body h3 { font-size: 1.35rem; margin: 2.2rem 0 .8rem; color: var(--ink); }
.article-body p { margin: 0 0 1.4em; }
.article-body p:first-of-type::first-letter {
  font-family: var(--serif); font-size: 4.2em; float: left;
  line-height: .85; padding: .08em .12em 0 0; color: var(--accent-deep);
  font-weight: 400;
}
.article-body a { color: var(--accent-deep); border-bottom: 1px solid var(--rule); }
.article-body a:hover { border-bottom-color: var(--accent); color: var(--accent); }
.article-body blockquote {
  border-left: 3px solid var(--accent); padding: .3rem 0 .3rem 1.5rem;
  margin: 2rem 0; font-family: var(--serif); font-style: italic;
  font-size: 1.2rem; color: var(--ink); line-height: 1.5;
}
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body ul, .article-body ol { padding-left: 1.4rem; margin: 0 0 1.4em; }
.article-body li { margin-bottom: .5em; }
.article-body code {
  font-family: var(--mono); font-size: .9em; background: var(--paper-dim);
  padding: .15em .4em; border-radius: 3px;
}
.article-body pre {
  background: var(--ink); color: var(--paper); padding: 1.2rem 1.4rem;
  border-radius: var(--radius); overflow-x: auto; font-size: .88rem;
  line-height: 1.55;
}
.article-body pre code { background: transparent; padding: 0; color: inherit; }
.article-body figure { margin: 2rem 0; }
.article-body figure img { border-radius: var(--radius); }
.article-body figcaption { font-size: .85rem; color: var(--ink-muted); text-align: center; margin-top: .7rem; font-style: italic; }
.article-body hr { border: 0; text-align: center; margin: 3rem 0; }
.article-body hr::before {
  content: "· · ·"; letter-spacing: .8em; color: var(--ink-muted); font-size: 1.2rem;
}

/* ================= ARTICLE FOOTER ================= */
.article-footer { padding: 3rem 2rem 5rem; }
.tags { list-style: none; padding: 0; margin: 0 0 3rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.tags a {
  display: inline-block; padding: .35rem .8rem; font-size: .78rem;
  background: var(--paper-dim); color: var(--ink-soft); border-radius: 20px;
  border-bottom: 0;
}
.tags a:hover { background: var(--ink); color: var(--paper); }

.post-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem;
  padding-top: 2rem; border-top: 1px solid var(--rule);
}
.post-nav a { padding: 1.2rem; border: 1px solid var(--rule); border-radius: var(--radius); color: var(--ink); border-bottom-width: 1px; transition: all .15s ease; }
.post-nav a:hover { background: var(--paper-dim); border-color: var(--ink); }
.post-nav span { display: block; font-size: .75rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .3rem; }
.post-nav strong { font-family: var(--serif); font-size: 1.05rem; font-weight: 500; line-height: 1.3; }
.nav-next { text-align: right; }

/* ================= ABOUT PAGE ================= */
.about-hero {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 3rem; align-items: center;
  padding: 5rem 0 3rem;
}
.about-portrait img { border-radius: var(--radius); box-shadow: var(--shadow-soft); }

/* ================= FOOTER ================= */
.site-footer { background: var(--paper-dim); border-top: 1px solid var(--rule); margin-top: 4rem; padding: 3.5rem 0 1.5rem; color: var(--ink-soft); }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 3rem; margin-bottom: 2.5rem; }
.footer-brand { font-family: var(--serif); font-size: 1.3rem; font-weight: 500; color: var(--ink); margin: 0 0 .3rem; }
.footer-tag { color: var(--ink-muted); font-size: .9rem; }
.footer-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; color: var(--ink); margin: 0 0 .8rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: .4rem; }
.footer-col a { color: var(--ink-soft); font-size: .9rem; }
.footer-col a:hover { color: var(--accent-deep); }
.footer-bottom { display: flex; justify-content: space-between; padding-top: 1.5rem; border-top: 1px solid var(--rule); color: var(--ink-muted); font-size: .82rem; }

/* ================= RESPONSIVE ================= */
@media (max-width: 900px) {
  .hero-inner, .featured-card, .newsletter-inner, .about-hero { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero-art { max-width: 380px; margin: 0 auto; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .list-link { grid-template-columns: 1fr; }
  .list-media { max-width: 280px; order: -1; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-col:first-child { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { padding: 0 1.25rem; }
  .header-inner { padding: 1rem 1.25rem; }
  .site-nav ul { gap: 1.1rem; }
  .site-nav a { font-size: .85rem; }
  .brand-sub { display: none; }
  .hero { padding: 3rem 0 2.5rem; }
  .post-grid { grid-template-columns: 1fr; }
  .post-nav { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: .5rem; text-align: center; }
  .newsletter-form { flex-direction: column; }
  .article-body p:first-of-type::first-letter { font-size: 3.4em; }
}
