/* Shared styles for hiten.dev case studies. Matches the visual language
   from the main site (Satoshi headings, cyan accent, dark theme by default). */

:root {
  --bg: #0b0d12;
  --surface: #121723;
  --surface-2: #0e1320;
  --line: #243045;
  --line-strong: #33425c;
  --text: #e8edf5;
  --text-dim: #9fb0c8;
  --text-faint: #7d8da6;
  --accent: #7cc4ff;
  --accent-ink: #04121f;
  --accent-soft: #a6d8ff;
  --ring: #7cc4ff;
  --serif: "Satoshi", "Inter", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 980px;
  --radius: 4px;
  --radius-lg: 10px;
  --gap: clamp(1rem, 2.5vw, 2rem);
  --shadow: 0 1px 0 rgba(255,255,255,.02) inset, 0 30px 60px -40px rgba(0,0,0,.9);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-2: #eef2f8;
    --line: #dde4ef;
    --line-strong: #c2cee0;
    --text: #0f1722;
    --text-dim: #4b5a72;
    --text-faint: #6b7a92;
    --accent: #1976d2;
    --accent-ink: #ffffff;
    --shadow: 0 1px 0 rgba(0,0,0,.03) inset, 0 20px 50px -40px rgba(15,23,34,.4);
  }
}

@font-face { font-family: "Satoshi"; src: url("/fonts/satoshi-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url("/fonts/satoshi-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

* { 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; line-height: 1.1; letter-spacing: -.03em; 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(--accent); background: var(--surface-2); padding: .15em .42em; border-radius: 5px; 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 solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  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.1rem; 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);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  padding: .35rem .75rem; border-radius: 999px;
  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; }

.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: 999px;
  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(--line-strong); transform: translateY(-2px); }
.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; }
