/* =============================================================
   juancastelli.uy
   Newsreader is self-hosted; nothing is fetched from a third party.
   ============================================================= */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/newsreader-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/newsreader-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* =============================================================
   THEME — "Marfil y carbón"
   Swap this block (and its dark counterpart) to restyle the site.
   ============================================================= */

:root {
  color-scheme: light dark;

  --paper: #faf6ec;
  --paper-warm: #f2ebda;
  --ink: #1a1814;
  --ink-muted: #5f584a;
  --rule: #ded4be;
  --accent: #b4501f;
  --accent-soft: #e8dcc4;
  --shadow: 26 24 20;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130f;
    --paper-warm: #1d1b16;
    --ink: #ece5d5;
    --ink-muted: #968d7d;
    --rule: #34302a;
    --accent: #e0864c;
    --accent-soft: #2a251d;
    --shadow: 0 0 0;
  }
}

/* -------------------------------------------------------------
   ALTERNATIVAS. Para probar una, reemplazá los dos bloques de
   arriba (:root y el @media dark) por el par correspondiente.

   ── B. "Costa" — hueso y verde profundo, más frío y ambiental ──
   :root {
     --paper: #f7f7f3;  --paper-warm: #ecedE6;  --ink: #141a17;
     --ink-muted: #55605a;  --rule: #d3d8d0;
     --accent: #1f6b4a;  --accent-soft: #e0e8e0;
   }
   @media (prefers-color-scheme: dark) {
     :root {
       --paper: #0f1512;  --paper-warm: #161d19;  --ink: #e4eae5;
       --ink-muted: #8b978f;  --rule: #2a3430;
       --accent: #5fbf8f;  --accent-soft: #1a2521;
     }
   }

   ── C. "Expediente" — gris papel y azul tinta, sobrio y legal ──
   :root {
     --paper: #f6f5f2;  --paper-warm: #eae8e3;  --ink: #16171a;
     --ink-muted: #585b63;  --rule: #d6d4ce;
     --accent: #2b4c8c;  --accent-soft: #e2e5ee;
   }
   @media (prefers-color-scheme: dark) {
     :root {
       --paper: #111215;  --paper-warm: #191a1e;  --ink: #e8e8e6;
       --ink-muted: #8d9099;  --rule: #2e3036;
       --accent: #7ba3e8;  --accent-soft: #1c2029;
     }
   }
   ------------------------------------------------------------- */

:root {
  --serif: "Newsreader", ui-serif, Iowan Old Style, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.9rem);
  --step-0: clamp(1.075rem, 1.02rem + 0.28vw, 1.225rem);
  --step-1: clamp(1.3rem, 1.2rem + 0.5vw, 1.6rem);
  --step-2: clamp(1.6rem, 1.4rem + 1vw, 2.15rem);
  --step-3: clamp(2rem, 1.6rem + 2vw, 3rem);
  --step-4: clamp(2.9rem, 1.9rem + 5vw, 6rem);

  --space: clamp(1.5rem, 1rem + 2.5vw, 3rem);
}

/* ---------- reset ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

body,
h1, h2, h3, h4, p, figure, blockquote, ol, ul, dl, dd {
  margin: 0;
}

ol[class], ul[class] {
  list-style: none;
  padding: 0;
}

img { max-width: 100%; height: auto; display: block; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.62;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

main { flex: 1; }

::selection {
  background: var(--accent);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- layout ---------- */

.wrap {
  width: min(100% - 2.5rem, var(--w, 44rem));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.1rem;
  z-index: 10;
  font-family: var(--mono);
  font-size: var(--step--1);
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- shared bits ---------- */

.label {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
}

.label--rule {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 0.5rem;
}
.label--rule::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.link {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  white-space: nowrap;
}
.link:hover { text-decoration-thickness: 2px; }

/* ---------- masthead ---------- */

.masthead {
  padding-block: clamp(1.2rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  --w: 52rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: inherit;
  text-decoration: none;
  font-size: var(--step-1);
  letter-spacing: -0.015em;
}

.wordmark__mark {
  width: 0.72em;
  height: 0.72em;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--ink) 0 50%, var(--accent) 50% 100%);
  flex: none;
}

.wordmark:hover .wordmark__text { color: var(--accent); }

.nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding-block: 0.2rem;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(3.5rem, 11vw, 8rem) clamp(2.5rem, 7vw, 5rem);
}

.hero .label { margin-bottom: clamp(1rem, 3vw, 1.75rem); }

.hero__title {
  font-size: var(--step-4);
  font-weight: 300;
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-wrap: balance;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

.hero__tagline {
  font-size: var(--step-1);
  font-style: italic;
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink);
  max-width: 32rem;
  text-wrap: pretty;
}

.hero__blurb {
  margin-top: 1.5rem;
  max-width: 30rem;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.hero .wrap { --w: 52rem; }

/* ---------- writing index ---------- */

.index {
  padding-block: 0 clamp(3rem, 8vw, 6rem);
}
.index .wrap { --w: 52rem; }

.index--archive { padding-top: clamp(2.5rem, 7vw, 5rem); }
.index--archive .post__head { margin-bottom: clamp(2rem, 5vw, 3.5rem); }

.entries { display: grid; }

.entry { border-top: 1px solid var(--rule); }
.entry:last-child { border-bottom: 1px solid var(--rule); }

.entry__link {
  display: grid;
  gap: 0.55rem;
  padding: clamp(1.6rem, 4vw, 2.6rem) clamp(0.5rem, 2vw, 1.25rem);
  margin-inline: clamp(-1.25rem, -2vw, -0.5rem);
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.entry__link:hover { background: var(--accent-soft); }

.entry__title {
  font-size: var(--step-2);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.entry__link:hover .entry__title { color: var(--accent); }

.entry__standfirst {
  color: var(--ink-muted);
  max-width: 40rem;
  text-wrap: pretty;
}

.entry__more {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-0.35rem);
  transition: opacity 0.2s, transform 0.2s;
}
.entry__link:hover .entry__more,
.entry__link:focus-visible .entry__more {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .entry__more { opacity: 1; transform: none; }
}

/* ---------- post ---------- */

.post { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(3rem, 8vw, 6rem); }

/* Same measure as .prose so the title sits exactly over its text column. */
.post__head { --w: 34rem; margin-bottom: clamp(2rem, 5vw, 3rem); }
.post__head--wide { --w: 52rem; }
.post__head .label { margin-bottom: 1rem; }

.post__head h1 {
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

.standfirst {
  margin-top: 1.25rem;
  font-size: var(--step-1);
  font-style: italic;
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink-muted);
  max-width: 34rem;
  text-wrap: pretty;
}

.post__figure {
  width: min(100% - 2.5rem, 62rem);
  margin: 0 auto clamp(2.5rem, 6vw, 4rem);
}

.post__figure img {
  width: 100%;
  border-radius: 2px;
}

.post__figure--inset {
  width: min(100% - 2.5rem, 22rem);
  margin-inline: auto;
}

/* Aligned with the page title rather than bleeding wider, as posts do. */
.post__figure--page { width: min(100% - 2.5rem, 52rem); }

.post__figure .credit,
.bio__figure .credit {
  display: block;
  margin-top: 0.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9em;
}

.post__figure figcaption {
  margin-top: 0.75rem;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  text-align: center;
}

.post__nav {
  --w: 34rem;
  margin-top: clamp(3rem, 7vw, 5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.post__nav a { color: var(--ink-muted); text-decoration: none; }
.post__nav a:hover { color: var(--accent); }

/* ---------- prose ---------- */

.prose { --w: 34rem; }

.prose > * + * { margin-top: 1.35em; }

.prose p { text-wrap: pretty; }

.prose > p:first-of-type::first-letter {
  float: left;
  font-size: 3.5em;
  line-height: 0.78;
  font-weight: 400;
  padding-right: 0.07em;
  padding-top: 0.04em;
  color: var(--accent);
}

.prose a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
.prose a:hover { color: var(--accent); }

.prose em { font-style: italic; }
.prose strong { font-weight: 650; }

.prose blockquote {
  margin-block: 2em;
  padding-left: 1.4rem;
  border-left: 2px solid var(--accent);
  font-size: 0.95em;
  font-style: italic;
  color: var(--ink-muted);
}

.prose h2 {
  margin-top: 2em;
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.45em; }

.prose hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin-block: 2.5em;
}

/* ---------- bio (About) ---------- */
/* A grid rather than CSS multi-column: columns clip a floated drop cap. */

.bio {
  --w: 52rem;
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

@media (min-width: 60rem) {
  .bio { grid-template-columns: 15rem minmax(0, 1fr); }
}

.bio__figure { margin: 0; }

.bio__figure img {
  width: 100%;
  border-radius: 2px;
}

.bio__figure figcaption {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--ink-muted);
}

/* ---------- colophon ---------- */

.colophon {
  border-top: 1px solid var(--rule);
  background: var(--paper-warm);
  padding-block: clamp(2.5rem, 7vw, 4.5rem);
}

.colophon .wrap { --w: 52rem; }

.epigraph {
  max-width: 34rem;
}

.epigraph p {
  font-size: var(--step-1);
  font-style: italic;
  font-weight: 300;
  line-height: 1.42;
  text-wrap: pretty;
  text-indent: -0.4em;
}

.epigraph p::before { content: "\201C"; }
.epigraph p::after { content: "\201D"; }

.epigraph cite {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: var(--step--1);
  font-style: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.epigraph cite::before { content: "— "; }

.colophon__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.colophon__meta a { color: inherit; text-decoration-color: var(--rule); }
.colophon__meta a:hover { color: var(--accent); }

/* ---------- print ---------- */

@media print {
  .masthead, .nav, .post__nav, .colophon__meta, .skip, .entry__more { display: none; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .prose, .post__head { --w: 100%; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 0.8em; word-break: break-all; }
  .post__figure { break-inside: avoid; }
}
