/* Shared styles for hiten.dev case studies. Matches the "hand-built, no page
   builder" system from the main site: Gabarito display, Hanken body, Newsreader
   italic notes, lime accent, warm charcoal dark by default (light via toggle). */

@import url("https://fonts.googleapis.com/css2?family=Gabarito:wght@400..800&family=Hanken+Grotesk:wght@400..800&family=Newsreader:ital,opsz,wght@1,6..72,400..600&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #12100c;
  --surface: #1c1914;
  --surface-2: #171410;
  --line: rgba(240, 234, 223, 0.11);
  --line-strong: rgba(240, 234, 223, 0.26);
  --text: #f0eadf;
  --text-dim: #b5ab9b;
  --text-faint: #948b7a;
  --accent: #c4e36f;
  --accent-ink: #131904;
  --ring: #c4e36f;
  --serif: "Gabarito", "Avenir Next", "Segoe UI", sans-serif;
  --sans: "Hanken Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --note: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 980px;
  --radius: 3px;
  --radius-lg: 6px;
  --gap: clamp(1rem, 2.5vw, 2rem);
}

:root[data-theme="light"] {
  --bg: #f6f1e7;
  --surface: #fbf8f1;
  --surface-2: #f0e9db;
  --line: rgba(33, 28, 20, 0.13);
  --line-strong: rgba(33, 28, 20, 0.32);
  --text: #211c14;
  --text-dim: #5e5749;
  --text-faint: #6e6553;
  --accent: #4f6a0e;
  --accent-ink: #f8ffe8;
  --ring: #4f6a0e;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f1e7;
    --surface: #fbf8f1;
    --surface-2: #f0e9db;
    --line: rgba(33, 28, 20, 0.13);
    --line-strong: rgba(33, 28, 20, 0.32);
    --text: #211c14;
    --text-dim: #5e5749;
    --text-faint: #6e6553;
    --accent: #4f6a0e;
    --accent-ink: #f8ffe8;
    --ring: #4f6a0e;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(15px, 1vw + 12px, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 700; font-optical-sizing: auto; line-height: 1.08; letter-spacing: -.015em; margin: 0; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 1.9rem); margin-top: 3.2rem; margin-bottom: .8rem; }
h3 { font-size: 1.1rem; margin-top: 1.8rem; margin-bottom: .4rem; }

p { margin: 0 0 1.1rem; max-width: 68ch; color: var(--text); }
strong { color: var(--text); font-weight: 600; }
ul, ol { padding-left: 1.2rem; margin: .2rem 0 1.4rem; }
ul li, ol li { margin: .35rem 0; max-width: 68ch; }

a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); transition: border-color .15s ease; }
a:hover { border-bottom-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 2px; }

code { font-family: var(--mono); font-size: .9em; color: var(--text); background: var(--surface-2); padding: .15em .42em; border-radius: 3px; border: 1px solid var(--line); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gap); }
.thin { max-width: 720px; }

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: var(--radius);
  font-weight: 600; z-index: 99;
}
.skip:focus { left: 1rem; top: 1rem; }

.nav {
  border-bottom: 1px dashed var(--line-strong);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .9rem var(--gap);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.2rem;
}
.nav .brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--text); border: 0; letter-spacing: -.01em; }
.nav .brand:hover { color: var(--accent); }
.nav .crumb { font-family: var(--mono); font-size: .78rem; color: var(--text-faint); letter-spacing: .06em; text-transform: uppercase; }

@media (max-width: 480px) {
  .nav-inner { padding: .75rem 1rem; gap: .8rem; }
  .nav .brand { font-size: 1rem; }
  .nav .crumb { font-size: .68rem; letter-spacing: .04em; }
  /* Tighten the meta grid so 320px viewports don't overflow */
  .meta { grid-template-columns: 1fr; gap: .8rem; }
  .hero { padding-top: clamp(2rem, 6vw, 3rem); padding-bottom: 1rem; }
}

.hero { padding: clamp(3rem, 7vw, 5.5rem) 0 1.2rem; }
.hero .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .78rem; letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--line-strong);
  padding: .35rem .75rem; border-radius: var(--radius);
  margin-bottom: 1.4rem;
}
.hero .lede {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--text-dim);
  max-width: 60ch;
  margin: 1.2rem 0 0;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem 1.6rem;
  margin: 2.4rem 0 0;
  padding: 1.4rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.meta dt { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: .3rem; }
.meta dd { margin: 0; color: var(--text); font-weight: 500; }
.meta dd a { font-weight: 500; }
.case-dates {
  margin: 1rem 0 0;
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: .76rem;
  letter-spacing: .04em;
  color: var(--text-faint);
}
.case-dates time { color: inherit; }

.stack {
  list-style: none; padding: 0; margin: .4rem 0 0;
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.stack li {
  font-family: var(--mono); font-size: .78rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: .3rem .7rem; border-radius: var(--radius);
  margin: 0; max-width: none;
}

.section { padding: 0; margin-top: 0; }
.section .lead { font-size: 1.1rem; color: var(--text); max-width: 64ch; margin-top: .2rem; }

.callout {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.2rem; border-radius: var(--radius);
  margin: 1.4rem 0;
}
.callout p:last-child { margin-bottom: 0; }

footer {
  border-top: 1px solid var(--line);
  margin-top: 5rem;
  padding: 2.4rem 0 3rem;
  color: var(--text-faint);
  font-size: .9rem;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 1.2rem; justify-content: space-between; align-items: baseline; }
footer a { color: var(--text-dim); border-bottom-color: var(--line); }
footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Screenshot gallery used on individual case studies */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.4rem;
  margin: 1.6rem 0 .8rem;
}
.gallery--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.gallery--mixed { grid-template-columns: 2fr 1fr; gap: 1.4rem; align-items: start; }
@media (max-width: 700px) { .gallery--mixed { grid-template-columns: 1fr; } }
/* On phones, force one image per row and tighten the frame so the screenshot
   uses the full viewport width with a tap target the user can actually hit. */
@media (max-width: 600px) {
  .gallery, .gallery--3 { grid-template-columns: 1fr; gap: 1rem; }
  .gallery figure { padding: .5rem; }
}
.gallery figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: .8rem;
  display: flex; flex-direction: column;
  /* keep figures from ever exceeding their grid track */
  min-width: 0;
  max-width: 100%;
}
.gallery figure a.thumb {
  display: block;
  border: 0;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.gallery figure img {
  display: block;
  width: 100%; height: auto; max-width: 100%;
  border-radius: 8px;
  background: #000;
  transition: transform .25s ease;
}
.gallery figure a.thumb:hover img,
.gallery figure a.thumb:focus-visible img { transform: scale(1.02); }
.gallery figure img.is-square { aspect-ratio: 1/1; max-width: 260px; margin: 0 auto; }
.gallery figcaption {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: .8rem;
  text-align: center;
}
.gallery--wear { display: flex; justify-content: center; }
.gallery--wear figure { max-width: 320px; }

/* CSS-only :target lightbox. Each .lightbox is hidden until its #id is the URL
   hash. Backdrop + close are anchor links to "#" so they dismiss it. */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.92);
  display: none;
  z-index: 999;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.lightbox:target { display: flex; }
.lightbox__backdrop {
  position: absolute; inset: 0;
  border: 0;
  /* invisible full-area dismiss button */
}
.lightbox img {
  position: relative; z-index: 2;
  max-width: 96vw; max-height: 92vh;
  width: auto; height: auto;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 30px 90px -20px rgba(0,0,0,.7);
}
.lightbox__close {
  position: absolute; top: 1rem; right: 1rem;
  z-index: 3;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.14);
  color: #fff;
  border: 0;
  border-radius: 50%;
  font-size: 1.5rem; line-height: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.lightbox__close:hover, .lightbox__close:focus-visible { background: rgba(255,255,255,.24); border-color: transparent; }
.lightbox__caption {
  position: absolute; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  z-index: 3;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: rgba(255,255,255,.75);
  text-align: center;
  pointer-events: none;
}

/* Card grid used on /work/ index */
.cards { display: grid; grid-template-columns: 1fr; gap: 1.2rem; margin-top: 1.4rem; }
@media (min-width: 760px) { .cards { grid-template-columns: 1fr 1fr; } }
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.4rem;
  color: var(--text);
  border-bottom-width: 1px;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: .5rem 0 .4rem; font-size: 1.25rem; }
.card .tag { font-family: var(--mono); font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.card p { color: var(--text-dim); margin: .2rem 0 0; font-size: .96rem; max-width: none; }


/* ---------- card thumbnails (work/index): small hand-drawn-feel SVG glyphs ---------- */
.cards .card { display: block; }
.cards .card .thumb {
  width: 60px;
  height: 60px;
  color: var(--accent);
  margin-bottom: 1rem;
  opacity: .85;
  transition: opacity .2s ease, transform .2s ease;
}
.cards .card:hover .thumb { opacity: 1; transform: rotate(-2deg); }

/* ---------- stat callout: display-font number with a lime hand-drawn underline ---------- */
.stat {
  font-family: var(--serif, "Gabarito", system-ui);
  font-weight: 700;
  color: var(--text);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 10 1 18 4 T 34 4 T 50 4 T 66 4 T 82 4 T 98 4 T 118 4' fill='none' stroke='%23c4e36f' stroke-width='1.6' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 0.22em;
  padding-bottom: 0.16em;
  white-space: nowrap;
}
