/* ==========================================================================
   COMPONENTS — reusable UI. No component sets its own outer vertical margin;
   spacing between sections belongs to .section alone, so nothing can fight it.
   ========================================================================== */

/* ---- Buttons -------------------------------------------------------------
   The primary CTA is an amber FILL with near-black type (6.33:1). Amber never
   sets type on a light ground — that is what --accent-text exists for. */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: .8rem 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-text);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-micro) var(--e-state),
              border-color var(--t-micro) var(--e-state),
              color var(--t-micro) var(--e-state),
              transform var(--t-micro) var(--e-state);
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--accent); color: var(--text-on-accent); }
.btn--primary:hover { background: var(--accent-hover); }

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn--ghost:hover { border-color: var(--border-strong); background: var(--bg-inset); }

.band-ink .btn--ghost { color: var(--ink-text); border-color: var(--ink-border); }
.band-ink .btn--ghost:hover { background: rgba(255,255,255,.06); border-color: var(--ink-text-dim); }

/* Text link with an amber underline that grows on hover. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--accent-text);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-veil);
  padding-bottom: 2px;
  transition: border-color var(--t-micro) var(--e-state), gap var(--t-micro) var(--e-state);
}
.link-arrow:hover { border-bottom-color: var(--accent); gap: .7rem; }
.band-ink .link-arrow { color: var(--accent); }

/* ---- Nav ------------------------------------------------------------------ */

/* Transparent at rest so it sits on the hero's faceted ground without a seam;
   it only takes a background once there is scrolled content to separate from. */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--t-state) var(--e-state),
              border-color var(--t-state) var(--e-state);
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--bg-base) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom-color: var(--border-hairline);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--s6);
  height: var(--nav-h);
}

.nav__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-stretch: 108%;
  font-size: 1.0625rem;
  letter-spacing: -.02em;
  text-decoration: none;
  margin-right: auto;
}
.nav__mark .dot { color: var(--accent-text); }

.nav__links { display: flex; gap: var(--s6); align-items: center; }
/* :not(.btn) matters. `.nav__links a` is (0,1,1) and outranks `.btn--primary`
   at (0,1,0), so without it the in-menu CTA inherited this colour and the
   display font — light text on camel, effectively illegible. */
.nav__links a:not(.btn) {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--t-micro) var(--e-state);
}
.nav__links a:not(.btn):hover,
.nav__links a:not(.btn)[aria-current="page"] { color: var(--text-primary); }

.nav__tools { display: flex; align-items: center; gap: var(--s3); }

/* The in-menu CTA exists only for the mobile overlay, where .nav__cta is hidden. */
.nav__cta-m { display: none; }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  /* Translucent currentColor, not a fixed token: the nav is transparent over
     the hero, where --border-hairline (#2C2726 on a #1F1B1A ground) was
     invisible and the controls read as floating icons. This adapts to whatever
     is behind it in either theme. */
  border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
  border-radius: var(--r-pill);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--t-micro) var(--e-state), background var(--t-micro) var(--e-state);
}
.theme-toggle:hover { border-color: var(--border-strong); background: var(--bg-inset); }
.theme-toggle svg { width: 17px; height: 17px; fill: none;
                    stroke: var(--text-secondary); stroke-width: 1.6; }
/* Show the icon for the theme you'd switch TO, not the one you're in. */
.theme-toggle .i-sun  { display: none; }
[data-theme="dark"] .theme-toggle .i-sun  { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.nav__burger { display: none; }

@media (max-width: 860px) {
  .nav__links {
    position: fixed;
    inset: var(--nav-h) 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s4);
    padding: var(--s8) var(--page-pad) var(--s12);
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-hairline);
    /* Must clear its own height PLUS the nav offset it is anchored to.
       translateY(-104%) only lifts it 1.04x its height while `top` holds it
       var(--nav-h) down the page, so the panel's bottom edge landed 56px into
       the page — a dark slab with the CTA peeking out under the header. */
    transform: translateY(calc(-100% - var(--nav-h) - 4px));
    /* visibility also keeps the off-screen links out of the tab order. It is
       switched with a delay equal to the slide, so closing still animates. */
    visibility: hidden;
    transition: transform var(--t-state) var(--e-enter),
                visibility 0s linear var(--t-state);
  }
  .nav.is-open .nav__links {
    transform: translateY(0);
    visibility: visible;
    transition: transform var(--t-state) var(--e-enter), visibility 0s;
  }
  .nav__links a:not(.btn) { font-size: var(--fs-m); font-family: var(--font-display); font-weight: 600; }
  .nav__burger {
    /* flex + explicit gap, not grid auto-placement: grid spread the bars ~15px
       apart across the button, so no fixed translate could close them into an
       X. Here the pitch is exactly 1.5px + 5px, which the rotations below use. */
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0;
    background: transparent;
    border: 1px solid color-mix(in srgb, currentColor 24%, transparent);
    border-radius: var(--r-pill); cursor: pointer;
  }
  .nav__burger span {
    display: block; width: 17px; height: 1.5px; background: var(--text-primary);
    transition: transform var(--t-state) var(--e-state), opacity var(--t-micro) linear;
  }
  .nav.is-open .nav__burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav.is-open .nav__burger span:nth-child(2) { opacity: 0; }
  .nav.is-open .nav__burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  .nav__cta { display: none; }
  .nav__cta-m { display: inline-flex; margin-top: var(--s2); }
  .theme-toggle { width: 44px; height: 44px; }
  /* The wordmark is the widest thing in the bar at 320px; drop it a notch so it
     never crowds the two controls. */
  .nav__mark { font-size: 1rem; }
  .nav__inner { gap: var(--s3); }
}

/* ---- The Scroll Window ---------------------------------------------------
   Signature #1. A fixed 3:4 frame holding the WHOLE capture; hover or focus
   pans it to the bottom, then holds. One transform, compositor-only.
   --pan is set per card by tools/generate-cards.js from the real aspect ratio,
   so it is correct at every viewport width with no measurement in JS. */

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: var(--s6);
}
/* Pin to exactly three above the breakpoint. Left to auto-fill, a 1176px
   container yields four columns, which makes these tall cards read as thumbnails. */
@media (min-width: 940px) {
  .work-grid { grid-template-columns: repeat(3, 1fr); }
}

.work-card { min-width: 0; }
.work-card[hidden] { display: none; }

.work-card__link {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-state) var(--e-state),
              box-shadow var(--t-state) var(--e-state),
              transform var(--t-state) var(--e-state);
}
.band-ink .work-card__link { background: #3A3331; }

.work-card__link:hover,
.work-card__link:focus-visible {
  border-color: var(--accent-veil);
  box-shadow: 0 0 0 1px var(--accent-veil), 0 32px 80px -32px rgba(0,0,0,.65);
  transform: translateY(-3px);
}

/* Chrome bar: real metadata, not cartoon traffic-light dots. */
.work-card__chrome,
.work-card__spec {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: .6rem .85rem;
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.work-card__chrome { border-bottom: 1px solid var(--border-hairline); }
.work-card__spec   { border-top: 1px solid var(--border-hairline); }
.work-card__client { color: var(--text-primary); overflow: hidden;
                     text-overflow: ellipsis; white-space: nowrap; }
.work-card__cat, .work-card__view { flex: none; }

/* The page-height label: true, and it turns the tall-aspect-ratio liability
   into a spec — the same instinct as a photographer printing the focal length. */
.work-card__height { color: var(--accent-text); }
.work-card__view   { opacity: 0; transition: opacity var(--t-state) var(--e-state); }
.work-card__link:hover .work-card__view,
.work-card__link:focus-visible .work-card__view { opacity: 1; }

.work-card__frame {
  display: block;
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg-inset);
}
.work-card__frame img {
  width: 100%;
  height: auto;
  transform: translateY(0);
  transition: transform var(--t-return) var(--e-enter);
  will-change: transform;
}
.work-card__link:hover .work-card__frame img,
.work-card__link:focus-visible .work-card__frame img {
  transform: translateY(calc(-1 * var(--pan)));
  transition: transform var(--t-pan) var(--e-pan);
}

/* Every 7th card spans two columns as a wide top crop. A perfectly uniform
   grid is the strongest "this is a template" signal; a periodic break makes
   the wall read as art-directed.

   Scoped to the full gallery on purpose: 24 cards + 3 double-width cells is
   exactly 27 cells = 9 clean rows of 3. Applying it to the homepage's 9 cards
   instead orphans the last card in a row of its own. */
@media (min-width: 940px) {
  .work-grid--full > .work-card:nth-child(7n) { grid-column: span 2; }
  .work-grid--full > .work-card:nth-child(7n) .work-card__frame { aspect-ratio: 16 / 7; }
}

/* Touch has no hover. Show the affordance permanently and let the pan run
   once when the card is scrolled into view (js adds .is-seen). */
@media (hover: none) {
  .work-card__view { opacity: 1; }
  .work-card.is-seen .work-card__frame img {
    transform: translateY(calc(-1 * var(--pan)));
    transition: transform var(--t-pan) var(--e-pan);
  }
}

@media (prefers-reduced-motion: reduce) {
  .work-card__link:hover .work-card__frame img,
  .work-card__link:focus-visible .work-card__frame img,
  .work-card.is-seen .work-card__frame img { transform: none; }
  .work-card__view { opacity: 1; }
}

/* ---- Filter chips -------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s8);
}
.filters--mid { justify-content: center; }
.chip {
  padding: .5rem 1rem;
  border: 1px solid var(--border-default);
  border-radius: var(--r-pill);
  background: var(--bg-base);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--fs-data);
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--t-micro) var(--e-state),
              border-color var(--t-micro) var(--e-state),
              background var(--t-micro) var(--e-state);
}
.chip:hover { color: var(--text-primary); border-color: var(--border-strong); }
.chip[aria-pressed="true"] {
  color: #FFF;
  border-color: var(--brand-deep);
  background: var(--brand-deep);
}

/* ---- Lightbox ------------------------------------------------------------
   Panels are :target sections, so the gallery works with JS disabled. They are
   display:none until opened, which also stops the browser fetching the full
   captures until one is actually requested. JS layers focus management,
   Esc/arrow keys and a fade on top of exactly this markup. */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 120;
}
.lightbox:target,
.lightbox.is-open { display: block; }

.lightbox__scrim {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 10, .96);
  backdrop-filter: blur(2px);
}

.lightbox__inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin-inline: auto;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--page-pad);
  color: var(--ink-text);
  border-bottom: 1px solid var(--ink-hairline);
  background: rgba(5, 7, 10, .9);
}
.lightbox__meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lightbox__meta strong {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-title);
  letter-spacing: -.02em;
}
.lightbox__meta .micro { color: var(--ink-text-dim); text-transform: uppercase; }
.lightbox__close {
  flex: none;
  padding: .5rem 1rem;
  border: 1px solid var(--border-default);
  border-radius: var(--r-pill);
  color: var(--ink-text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}
.lightbox__close:hover { border-color: var(--accent); color: var(--accent); }

.lightbox__scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.lightbox__scroll img { width: 100%; height: auto; }

/* 2px amber progress rail on the right edge — tells you how much page is left.
   Width is driven by JS; without it the rail simply never appears. */
.lightbox__rail {
  position: absolute;
  top: 0; right: 0;
  width: 2px;
  height: var(--progress, 0%);
  background: var(--accent);
  transition: height 80ms linear;
  pointer-events: none;
}

body.is-locked { overflow: hidden; }

/* ---- Cards (services etc.) ----------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-md);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--shadow-sm), var(--inset-top);
  transition: border-color var(--t-state) var(--e-state),
              box-shadow var(--t-state) var(--e-state),
              transform var(--t-state) var(--e-state);
}
.card:hover { border-color: var(--border-default); box-shadow: var(--shadow-md), var(--inset-top); }

.card h3 { margin-bottom: var(--s3); }
.card p  { color: var(--text-secondary); }
.card__tools {
  display: block;
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--border-hairline);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: .05em;
  color: var(--text-muted);
  line-height: 1.9;
}

/* ---- Form ---------------------------------------------------------------- */

.field { display: block; margin-bottom: var(--s6); }
.field__label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-sm);
  margin-bottom: var(--s2);
}
.field__hint {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--s3);
}
.field__req { color: var(--accent-text); font-weight: 400; }

.input, .textarea, .select {
  width: 100%;
  padding: .8rem 1rem;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  font-size: var(--fs-body);
  transition: border-color var(--t-micro) var(--e-state),
              background var(--t-micro) var(--e-state);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-base);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.textarea { min-height: 8.5rem; resize: vertical; line-height: 1.6; }

/* :user-invalid, not :invalid — it does not scream at someone before they
   have typed a single character. */
.input:user-invalid, .textarea:user-invalid, .select:user-invalid {
  border-color: var(--state-error);
}

.choices { display: grid; gap: var(--s2); }
.choices--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }

.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: .75rem 1rem;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--t-micro) var(--e-state),
              background var(--t-micro) var(--e-state);
}
.choice:hover { border-color: var(--border-strong); }
.choice input { margin-top: .18rem; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-wash);
}
.choice:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Honeypot. Positioned off-screen rather than display:none, which bots detect. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}
