/* Base styles — reset, 12-column grid, nav, links, buttons, work card, dark footer.
   Requires tokens.css. Shared by the homepage and case pages. */

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img { display: block; max-width: 100%; height: auto; }
ul { list-style: none; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }
/* Dark surfaces: light focus ring (the accent ring is too low-contrast on #0F1115) */
.on-dark :focus-visible { outline-color: var(--dark-text); }

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

/* ── Container & 12-column grid ─────────────────────── */
.w { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

/* 12 columns (4 under 600px). Use inside .w. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}
.grid-label   { grid-column: 1 / 5; }   /* section labels: columns 1–4 */
.grid-content { grid-column: 5 / 13; }  /* section content: columns 5–12 */
.grid-full    { grid-column: 1 / -1; }

@media (max-width: 960px) {
  .grid-label, .grid-content { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Type helpers ──────────────────────────────────── */
.eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--subtle);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
}
.muted { color: var(--muted); }

/* Body text — calm reading size for paragraphs (homepage About / Off screen, case pages) */
.body-text { max-width: 62ch; font-size: 18px; line-height: 1.6; color: var(--text); }
.body-text + .body-text { margin-top: var(--space-6); }
@media (max-width: 600px) {
  .body-text { font-size: 17px; }
}

/* ── Accessibility utilities ───────────────────────── */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: 10px 16px;
  background: var(--text);
  color: var(--on-dark);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ── Links ─────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }
.link {
  color: var(--accent);
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
}

/* ── Nav ───────────────────────────────────────────── */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6) 0;
  font-size: var(--fs-base);
}
.nav__brand { font-weight: var(--fw-semibold); text-decoration: none; color: var(--text); }
.nav__links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-7); }
.nav__links a { color: var(--muted); transition: color .2s; }
.nav__links a:hover,
.nav__links a:last-child { color: var(--text); }
/* Nav on a dark surface */
.on-dark .nav__brand,
.on-dark .nav__links a { color: var(--dark-text); }

/* Dark site header (homepage + case pages). It overlays the dark hero that
   follows it, so the hero's background effects run behind the nav too. */
.site-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  color: var(--dark-text);
}
.site-header .nav { min-height: var(--nav-h); padding-block: 0; }
@media (max-width: 600px) {
  .site-header .nav__links { column-gap: 14px; }
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-base);
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  background: var(--bg);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  transition: border-color .2s, background-color .2s;
}
.btn:hover { border-color: var(--text); }
.btn--primary { background: var(--text); color: var(--on-dark); border-color: var(--text); }
.btn--primary:hover { background: #262A31; border-color: #262A31; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Pills ─────────────────────────────────────────── */
.pills { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.pill {
  font-size: var(--fs-sm);
  line-height: 1.3;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  color: var(--text);
}
.pill b { color: var(--accent); font-weight: var(--fw-semibold); }

/* ── Work card (image 16:10, eyebrow, title, line, link) ── */
.work-card { position: relative; display: flex; flex-direction: column; }
.work-card__img {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--media-bg);
  margin-bottom: var(--space-5);
}
.work-card__img img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; transition: transform .5s ease; }
.work-card:hover .work-card__img img { transform: scale(1.03); }
.work-card__eyebrow { font-size: var(--fs-xs); letter-spacing: .05em; text-transform: uppercase; color: var(--subtle); }
.work-card__title { margin-top: 6px; font-size: 24px; font-weight: var(--fw-medium); line-height: 1.25; letter-spacing: -.015em; }
.work-card__text { margin-top: 6px; font-size: var(--fs-base); line-height: 1.5; color: var(--muted); }
.work-card__link { margin-top: var(--space-3); align-self: flex-start; font-size: var(--fs-base); }
/* Whole card is clickable via the "Read case" link */
.work-card__link::after { content: ""; position: absolute; inset: 0; }
.work-card__link:focus-visible { outline: none; }
.work-card:has(.work-card__link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--radius-sm); }

/* ── Dark footer (all pages) ────────────────────────── */
.site-footer {
  background: var(--dark-bg);
  color: var(--dark-text);
  padding: var(--section) 0 40px;
}
.site-footer__label { font-size: 14px; font-weight: var(--fw-medium); color: var(--dark-muted); }
.site-footer__title {
  font-weight: var(--fw-medium);
  font-size: clamp(32px, 4.4vw, 56px);
  line-height: 1.08;
  letter-spacing: -.03em;
}
.site-footer__title span { color: var(--dark-muted); }
.site-footer__mail {
  display: inline-block;
  margin-top: 40px;
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: var(--fw-medium);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}
.site-footer__links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin-top: var(--space-5); font-size: var(--fs-base); }
.site-footer__bottom {
  margin-top: var(--section);
  padding-top: var(--space-5);
  border-top: 1px solid var(--dark-line);
  font-size: 14px;
  color: var(--dark-muted);
}
.site-footer__bottom > :first-child { grid-column: 1 / 5; }
.site-footer__bottom > :last-child  { grid-column: 5 / 13; }
@media (max-width: 960px) {
  .site-footer .grid { row-gap: var(--space-6); }
  .site-footer__bottom.grid { row-gap: var(--space-1); }
  .site-footer__bottom > :first-child,
  .site-footer__bottom > :last-child { grid-column: 1 / -1; }
}

/* ── Mobile ────────────────────────────────────────── */
@media (max-width: 760px) {
  .nav { flex-wrap: wrap; row-gap: var(--space-3); }
  .nav__links { column-gap: var(--space-5); }
}

/* ── Decorative effects (js/effects.js) ─────────────── */
/* Dark blocks marked [data-fx]: blobs + layout grid behind the content */
[data-fx] { position: relative; overflow: hidden; isolation: isolate; }
[data-fx] > :not(.fx) { position: relative; z-index: 1; }
.fx { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.fx__blob {
  position: absolute; left: 0; top: 0;
  border-radius: 50%;
  filter: blur(50px);
  will-change: transform;
}
.fx__blob--1 { width: 360px; height: 360px; margin: -180px 0 0 -180px; background: radial-gradient(circle, #0FB5A6, transparent 65%); opacity: .16; }  /* reference .5 — dimmed so muted text stays ≥4.5:1 (measured 4.66:1 worst case) */
.fx__blob--2 { width: 320px; height: 320px; margin: -160px 0 0 -160px; background: radial-gradient(circle, #6D4AFF, transparent 65%); opacity: .14; }  /* reference .45 */
/* The page's real 12 columns, revealed in a 300px circle around the cursor */
.fx__grid {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity .4s;
  -webkit-mask-image: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), #000, transparent 72%);
          mask-image: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), #000, transparent 72%);
}
.fx__grid .w, .fx__grid .grid { height: 100%; }
.fx__grid i {
  display: block; height: 100%;
  background: rgba(255, 255, 255, .035);
  border-left: 1px solid rgba(255, 255, 255, .09);
  border-right: 1px solid rgba(255, 255, 255, .09);
}
.is-hovering > .fx .fx__grid { opacity: 1; }
@media (max-width: 600px) {
  .fx__grid i:nth-child(n+5) { display: none; }
}

/* "View case →" circle on project links marked [data-cursor] */
.fx-cursor {
  position: fixed; left: 0; top: 0; z-index: 40;
  pointer-events: none;
  mix-blend-mode: difference;
}
.fx-cursor__dot {
  display: grid; place-items: center;
  width: 96px; height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  background: #fff; color: #000;
  font: 500 14px/1.2 var(--font);
  text-align: center;
  transform: scale(0);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.fx-cursor.is-shown .fx-cursor__dot { transform: scale(1); }
.fx-on [data-cursor],
.fx-on [data-cursor] a { cursor: none; }

/* Off for reduced motion and touch / coarse pointers (JS also skips them) */
@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse) {
  .fx, .fx-cursor { display: none !important; }
  .fx-on [data-cursor], .fx-on [data-cursor] a { cursor: auto; }
  .fx-on [data-cursor] a { cursor: pointer; }
}
