/* ============================================================================
   TRANSRANTS — neo-brutalist theme  (standalone; costarica uses style.css)
   ----------------------------------------------------------------------------
   This file is fully self-contained: build.py copies it to the transrants
   output as static/style.css, so it must define EVERY component (nav, hero,
   cards, haiku modal, post body, footer). Costa Rica is untouched.

   HOW TO RETUNE: almost the entire look is driven by the THEME KNOBS block
   below. Change border width, shadow offset, palette, radius, or fonts there
   and the whole site follows. A full rework = rewrite/replace just this file;
   templates and the other site do not depend on it.

   NOTE: --accent (#7c3aed purple) and --accent-2 (#db2777 pink) are injected
   per-site by base.html.j2 in an inline <style> AFTER this file loads, so they
   win; reference them, do not redefine them here.
   ========================================================================== */

:root {
  /* ---- THEME KNOBS ---------------------------------------------------- */
  --ink: #14121a;           /* near-black: text, borders, default shadow    */
  --paper: #f3efe4;         /* warm off-white page background                */
  --panel: #eae3d2;         /* slightly darker block (nav/footer/soft areas) */
  --card: #ffffff;          /* card surface                                  */
  --accent-3: #f7c948;      /* third flat block colour (acid yellow)         */
  --accent-4: #1fb6a6;      /* fourth flat block colour (teal)               */

  --bw: 3px;                /* standard border width                         */
  --bw-thick: 4px;          /* hero / emphasis border                        */
  --sx: 7px;                /* hard shadow offset X                          */
  --sy: 7px;                /* hard shadow offset Y                          */
  --radius: 0px;            /* neo-brutalist = square. bump to soften.       */

  --font-display: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --maxw: 1120px;
  --readw: 42rem;
  /* ---- end knobs ------------------------------------------------------ */

  --fg: var(--ink);
  --muted: #5b5666;
  --line: var(--ink);
  --shadow: var(--sx) var(--sy) 0 var(--ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--paper);
  /* faint paper grid so flat colour never feels sterile (cheap, no asset) */
  background-image:
    linear-gradient(rgba(20,18,26,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,18,26,.035) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.04;
  letter-spacing: -.01em;
  font-weight: 800;
}
.muted { color: var(--muted); }

/* shared block label: flat colour box, mono caps, ink border. used for tags */
.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); background: var(--accent);
  border: var(--bw) solid var(--ink);
  padding: .18rem .5rem; margin-bottom: .6rem;
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: var(--bw-thick) solid var(--ink);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: .8rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand {
  font-family: var(--font-display);
  font-weight: 800; font-size: 1.4rem; letter-spacing: -.02em; text-transform: uppercase;
  color: var(--paper); background: var(--ink);
  border: var(--bw) solid var(--ink);
  padding: .15rem .6rem; white-space: nowrap;
  box-shadow: 4px 4px 0 var(--accent);
}
.brand:hover { box-shadow: 4px 4px 0 var(--accent-2); }
.nav .brand { font-size: 1.4rem; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink); padding: .25rem .45rem; border: 2px solid transparent;
  transition: none;
}
.nav-links a:hover { border-color: var(--ink); background: var(--accent-3); }
.nav-pdf {
  background: var(--accent); color: var(--paper) !important;
  border: 2px solid var(--ink) !important;
  font-weight: 700 !important; box-shadow: 3px 3px 0 var(--ink);
}
.nav-pdf:hover { background: var(--accent) !important; color: var(--paper) !important; }
.nav-rss { background: var(--accent-4); }
.nav-toggle {
  display: none; margin-left: auto; background: var(--ink); border: var(--bw) solid var(--ink);
  color: var(--paper); font-size: 1.2rem; line-height: 1; padding: .1rem .5rem; cursor: pointer;
}

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- hero ---------- */
.hero { margin: 2.25rem 0 1.25rem; }
.hero-link {
  display: block; background: var(--card);
  border: var(--bw-thick) solid var(--ink);
  box-shadow: var(--sx) var(--sy) 0 var(--accent);
  transition: transform .08s, box-shadow .08s;
}
.hero-link:hover {
  transform: translate(3px, 3px);
  box-shadow: calc(var(--sx) - 3px) calc(var(--sy) - 3px) 0 var(--accent-2);
}
.hero-media { aspect-ratio: 21 / 9; background: var(--panel); border-bottom: var(--bw) solid var(--ink); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { padding: 1.5rem 1.8rem 1.8rem; }
.hero-title { font-size: 2.1rem; margin: .2rem 0 .5rem; max-width: 24ch; text-transform: uppercase; }
.hero-meta { font-family: var(--font-mono); color: var(--muted); font-size: .82rem; margin: 0 0 .8rem; }
.hero-excerpt {
  color: #2c2935; margin: 0 0 1rem; max-width: 70ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.read-more {
  font-family: var(--font-mono); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink); border-bottom: 3px solid var(--accent);
}

/* hero overlay variant (text-free images) — unused by transrants but kept intact */
.hero--overlay .hero-link { position: relative; }
.hero--overlay .hero-media { aspect-ratio: 2 / 1; border-bottom: 0; }
.hero--overlay .hero-text {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2rem 2rem 1.6rem;
  background: linear-gradient(to top, rgba(12,10,18,.92), rgba(12,10,18,.4) 60%, transparent);
}
.hero--overlay .kicker { color: var(--ink); }
.hero--overlay .hero-title,
.hero--overlay .hero-excerpt { color: #fff; }
.hero--overlay .hero-meta { color: rgba(255,255,255,.82); }
.hero--overlay .read-more { color: #fff; }

/* ---------- sections + grid ---------- */
.section { margin: 2.75rem 0; }
.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.2rem; }
.section-title {
  font-family: var(--font-display); font-size: 1.1rem; margin: 0; text-transform: uppercase;
  letter-spacing: .02em; color: var(--ink);
  background: var(--accent-3); border: var(--bw) solid var(--ink);
  padding: .25rem .7rem; box-shadow: 4px 4px 0 var(--ink);
}
/* view toolbar: All / Featured tabs + a Random action, all chunky blocks */
.view-tabs { flex-wrap: wrap; gap: .6rem; }
.view-tab, .random-btn {
  cursor: pointer; -webkit-appearance: none; appearance: none;
  font-family: var(--font-display); font-weight: 800;
}
.view-tab:not(.is-active) { background: var(--card); color: var(--ink); box-shadow: 4px 4px 0 var(--muted); }
.view-tab:not(.is-active):hover { box-shadow: 4px 4px 0 var(--ink); }
.view-tab.is-active { background: var(--accent-3); box-shadow: 4px 4px 0 var(--ink); }
.random-btn { background: var(--accent-2); color: var(--paper); box-shadow: 4px 4px 0 var(--ink); }
.random-btn:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.random-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

/* featured view: a clean row of up to three, matching the desktop columns */
.featured-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.featured-grid[hidden] { display: none; }
@media (max-width: 900px) { .featured-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .featured-grid { grid-template-columns: 1fr; } }

/* masonry: cards pack by height so varied-height cards nest with no rigid rows */
.card-grid {
  column-width: 280px;
  column-gap: 1.5rem;
}
.card-grid > .card { width: 100%; margin: 0 0 1.6rem; break-inside: avoid; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.card:hover {
  transform: translate(3px, 3px);
  box-shadow: calc(var(--sx) - 3px) calc(var(--sy) - 3px) 0 var(--ink);
}
/* loud neo-brutalist: cycle the hard-shadow colour per card */
.card:nth-child(4n+1) { box-shadow: var(--sx) var(--sy) 0 var(--accent); }
.card:nth-child(4n+1):hover { box-shadow: calc(var(--sx) - 3px) calc(var(--sy) - 3px) 0 var(--accent); }
.card:nth-child(4n+2) { box-shadow: var(--sx) var(--sy) 0 var(--accent-2); }
.card:nth-child(4n+2):hover { box-shadow: calc(var(--sx) - 3px) calc(var(--sy) - 3px) 0 var(--accent-2); }
.card:nth-child(4n+3) { box-shadow: var(--sx) var(--sy) 0 var(--accent-4); }
.card:nth-child(4n+3):hover { box-shadow: calc(var(--sx) - 3px) calc(var(--sy) - 3px) 0 var(--accent-4); }
.card--featured { border-width: var(--bw-thick); }
.card-link { display: flex; flex-direction: column; height: 100%; }
.card-thumb {
  position: relative;
  aspect-ratio: 16/9; overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-bottom: var(--bw) solid var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.card-flag {
  position: absolute; top: .55rem; left: .55rem; z-index: 2;
  font-family: var(--font-mono);
  background: var(--accent-3); color: var(--ink); font-size: .6rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; padding: .2rem .5rem;
  border: 2px solid var(--ink);
}
/* vary thumbnail proportions so the masonry reads as editorial, not gridded */
.card:nth-child(6n+1) .card-thumb { aspect-ratio: 4 / 5; }
.card:nth-child(6n+2) .card-thumb { aspect-ratio: 16 / 9; }
.card:nth-child(6n+3) .card-thumb { aspect-ratio: 1 / 1; }
.card:nth-child(6n+4) .card-thumb { aspect-ratio: 3 / 2; }
.card:nth-child(6n+5) .card-thumb { aspect-ratio: 5 / 4; }
.card:nth-child(6n)   .card-thumb { aspect-ratio: 4 / 3; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb-fallback { font-family: var(--font-display); color: var(--paper); font-size: 2.6rem; font-weight: 800; }
.card-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.card-tag {
  align-self: flex-start; font-family: var(--font-mono);
  font-size: .66rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink); background: var(--accent-3);
  border: 2px solid var(--ink); padding: .15rem .45rem;
}
.card-title { font-size: 1.12rem; margin: .15rem 0 0; text-transform: uppercase; letter-spacing: -.005em; }
.card-meta { font-family: var(--font-mono); color: var(--muted); font-size: .76rem; margin-top: auto; padding-top: .5rem; }
.card-excerpt { color: #3a3743; font-size: .92rem; margin: .35rem 0 0; }

/* ---------- haiku cards (open a modal, no page) ---------- */
button.card-link {
  width: 100%; border: 0; background: none; font: inherit; color: inherit;
  text-align: left; cursor: pointer; padding: 0;
}
.card--haiku {
  background: var(--accent);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
}
/* override the per-nth-child shadow cycle so every haiku reads the same */
.card--haiku,
.card--haiku:nth-child(4n+1),
.card--haiku:nth-child(4n+2),
.card--haiku:nth-child(4n+3) { box-shadow: var(--sx) var(--sy) 0 var(--ink); }
.card--haiku:hover,
.card--haiku:nth-child(4n+1):hover,
.card--haiku:nth-child(4n+2):hover,
.card--haiku:nth-child(4n+3):hover {
  box-shadow: calc(var(--sx) - 3px) calc(var(--sy) - 3px) 0 var(--ink);
}
.card--haiku .card-body {
  align-items: center; text-align: center; justify-content: center; gap: .5rem;
  padding: 1.1rem 1rem 1.2rem;
}
.card--haiku .card-tag {
  align-self: center; background: var(--ink); color: var(--accent-3);
  letter-spacing: .12em; font-size: .58rem;
}
.card--haiku .card-title { color: rgba(255,255,255,.92); font-size: .8rem; font-weight: 700; }
.card--haiku .card-meta { margin-top: 0; padding-top: 0; font-size: .68rem; color: rgba(255,255,255,.7); }
.haiku-lines {
  margin: .15rem 0; font-family: Georgia, "Times New Roman", serif;
  font-style: italic; font-size: 1rem; line-height: 1.55; color: var(--paper);
}

/* ---------- haiku modal ---------- */
body.modal-open { overflow: hidden; }
.haiku-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.haiku-modal[hidden] { display: none; }
.haiku-modal-backdrop { position: absolute; inset: 0; background: rgba(20,18,26,.72); }
.haiku-modal-card {
  position: relative; z-index: 1; width: 100%; max-width: 32rem;
  background: var(--card);
  border: var(--bw-thick) solid var(--ink);
  box-shadow: 12px 12px 0 var(--accent);
  padding: 3rem 2.5rem 2.4rem; text-align: center; animation: haikuPop .12s ease;
}
@keyframes haikuPop { from { opacity: 0; transform: translate(6px, 6px); } to { opacity: 1; transform: none; } }
.haiku-modal-close {
  position: absolute; top: -.2rem; right: -.2rem; transform: translate(35%, -35%);
  width: 2.2rem; height: 2.2rem;
  border: var(--bw) solid var(--ink); background: var(--accent-2); color: var(--ink);
  font-size: 1.4rem; line-height: 1; cursor: pointer; box-shadow: 3px 3px 0 var(--ink);
}
.haiku-modal-close:hover { background: var(--accent-3); }
.haiku-modal-lines { margin: .3rem 0 1.4rem; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.6rem; line-height: 1.7; color: var(--ink); }
.haiku-modal-title { margin: 0 0 .35rem; font-family: var(--font-mono); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink); background: var(--accent-3); display: inline-block; padding: .15rem .5rem; border: 2px solid var(--ink); }
.haiku-modal-date { margin: .5rem 0 0; font-family: var(--font-mono); color: var(--muted); font-size: .8rem; }
@media (max-width: 640px) {
  .haiku-modal-card { padding: 2.4rem 1.6rem 2rem; box-shadow: 8px 8px 0 var(--accent); }
  .haiku-modal-lines { font-size: 1.3rem; }
}

/* ---------- page head (tag/author) ---------- */
.page-head { margin: 2.5rem 0 1.5rem; padding-bottom: 1.2rem; border-bottom: var(--bw-thick) solid var(--ink); }
.page-head h1 { font-size: 2.1rem; margin: 0 0 .25rem; text-transform: uppercase; }

/* ---------- post ---------- */
.post { max-width: var(--readw); margin: 2.5rem auto 0; }
.post-hero { margin: 0 0 1.8rem; }
.post-hero-media { border: var(--bw) solid var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.post-hero img { width: 100%; max-height: 460px; object-fit: cover; display: block; }
.img-credit { margin: .7rem .1rem 0; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); text-align: right; }
.img-credit a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.img-credit a:hover { color: var(--ink); }
.post-head { margin-bottom: 1.8rem; }
.post-kicker { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .8rem; }
.post-kicker a {
  font-family: var(--font-mono); font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink); background: var(--accent-3); border: 2px solid var(--ink); padding: .18rem .5rem;
}
.post-head h1 { font-size: 2.5rem; margin: 0 0 .6rem; text-transform: uppercase; }
.post-meta { font-family: var(--font-mono); color: var(--muted); font-size: .82rem; }
.post-meta .dot { margin: 0 .45rem; }
.post-meta a:hover { color: var(--ink); }
.post-body { font-size: 1.08rem; }
.post-body > *:first-child { margin-top: 0; }
.post-body h2 { font-size: 1.55rem; margin: 2.2rem 0 .6rem; text-transform: uppercase; }
.post-body h3 { font-family: var(--font-mono); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.8rem 0 .4rem; }
.post-body p { margin: 0 0 1.15rem; }
.post-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 3px; }
.post-body a:hover { background: var(--accent-3); }
.post-body img { border: var(--bw) solid var(--ink); margin: 1.6rem 0; box-shadow: var(--shadow); }
.post-body ul, .post-body ol { padding-left: 1.3rem; margin: 0 0 1.15rem; }
.post-body li { margin: .35rem 0; }
.post-body blockquote {
  margin: 1.6rem 0; padding: .8rem 1.1rem; border: var(--bw) solid var(--ink);
  border-left-width: var(--bw-thick); background: var(--panel);
  color: #2c2935; font-style: italic;
}
.post-body hr { border: 0; border-top: var(--bw) dashed var(--ink); margin: 2.4rem 0; }
.post-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-top: 3rem; padding-top: 1.5rem; border-top: var(--bw-thick) solid var(--ink);
}
.back, .nav-pdf {
  font-family: var(--font-mono); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.back { color: var(--ink); border: 2px solid var(--ink); padding: .35rem .7rem; box-shadow: 3px 3px 0 var(--accent); }
.back:hover { box-shadow: 3px 3px 0 var(--accent-2); }

/* ---------- footer ---------- */
.site-footer { margin-top: 4.5rem; border-top: var(--bw-thick) solid var(--ink); background: var(--panel); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }
.footer-desc { color: #2c2935; margin: 1rem 0 1.2rem; max-width: 36rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: .6rem; }
.footer-links a {
  font-family: var(--font-mono); color: var(--ink); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em;
  border: 2px solid var(--ink); padding: .2rem .5rem;
}
.footer-links a:hover { background: var(--accent-3); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .hero-media { aspect-ratio: 16/9; }
  .hero-text { padding: 1.3rem 1.4rem 1.6rem; }
  .hero-title { font-size: 1.7rem; }
}
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: .5rem;
    margin: .6rem 0 0; padding-top: .8rem; border-top: var(--bw) solid var(--ink);
  }
  body.nav-open .nav-links { display: flex; }
  .nav-links a { width: 100%; }
  .nav-inner { flex-wrap: wrap; }
  .post-head h1 { font-size: 1.9rem; }
}
