/* ==========================================================================
   Penedo Labs
   Direction: a night survey of a granite outcrop. Wet Galician granite is
   blue-slate, not neutral black; mica reads as a muted mineral teal. The
   contour canvas is the one loud thing — everything else stays quiet.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* wet granite, dusk */
  --abyss:  #070C10;
  --deep:   #0E161C;
  --mid:    #17222A;
  --line:   #24333D;
  --fog:    #8FA5B2;
  --quartz: #E2ECF1;
  --mica:   #64C9B4;

  /* The page colour as an rgb triplet, for the veil gradients. */
  --page-rgb: 7, 12, 16;

  /* Raised surfaces need their own pair. On the paper theme --deep sits at
     1.08:1 against the page, so a panel built from it simply is not there. */
  --elevated: #131C23;
  --elevated-line: #5E7380;

  /* Contour ink, read by the canvas. Low elevation to high. */
  --survey-near: 60, 120, 130;
  --survey-far: 100, 205, 190;
  --survey-alpha: 1;

  --font-display: 'Bricolage Grotesque', Georgia, serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-data: 'Martian Mono', ui-monospace, monospace;

  /* Built-in easings are too weak to read as intentional. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --measure: 62ch;
  --page: 1180px;
  --gutter: clamp(1.5rem, 5vw, 5.5rem);
  --rail: 4.5rem;
}

/* The paper sheet. A topographic map's natural light form is printed stock,
   so this is warm paper with ink contours rather than an inverted night. */
:root[data-theme="light"] {
  color-scheme: light;

  --abyss:  #EFEDE7;
  --deep:   #F7F6F2;
  --mid:    #E4E1D9;
  --line:   #D2CEC4;
  --fog:    #575C63;
  --quartz: #14181C;
  --mica:   #1B6E5C;

  --page-rgb: 239, 237, 231;

  --elevated: #FFFFFF;
  --elevated-line: #918C80;

  --survey-near: 168, 162, 148;
  --survey-far: 27, 110, 92;
  --survey-alpha: 1.7;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }

body {
  min-height: 100dvh;
  background: var(--abyss);
  color: var(--quartz);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(100, 201, 180, 0.18);
  transition: background-color 320ms var(--ease-out), color 320ms var(--ease-out);
}

svg { display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.02; letter-spacing: -0.03em; }
p { text-wrap: pretty; }
i { font-style: italic; color: var(--quartz); }

:where(a, button):focus-visible {
  outline: 2px solid var(--mica);
  outline-offset: 4px;
  border-radius: 3px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 999;
  padding: 0.75rem 1.25rem; background: var(--mica); color: var(--abyss);
  font-weight: 500; border-radius: 4px;
  transition: top 200ms var(--ease-out);
}
.skip-link:focus { top: 1rem; }

/* --- The survey ----------------------------------------------------------
   Full-bleed contour field. Fixed so the terrain stays put while the page
   scrolls over it, which reads as looking down at a map rather than at a
   decorated background. */

#survey {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Darkens the left column so the type always has a floor to sit on, and
   leaves the right side of the terrain legible. */
.veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(100deg,
      rgba(var(--page-rgb), .94) 0%, rgba(var(--page-rgb), .72) 34%,
      rgba(var(--page-rgb), .12) 62%, rgba(var(--page-rgb), .30) 100%),
    linear-gradient(180deg,
      rgba(var(--page-rgb), .55) 0%, transparent 22%,
      transparent 74%, rgba(var(--page-rgb), .7) 100%);
}

/* Lift the flowing content above the canvas. Named explicitly: a
   `body > *:not(#survey)` rule would carry id-level specificity from the
   :not() and silently override position on .rail and .skip-link, dropping
   both back into the flow. */
main, .colophon { position: relative; z-index: 2; }

/* --- Masthead ------------------------------------------------------------- */

.masthead {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem var(--gutter);
  padding-top: max(1.5rem, env(safe-area-inset-top));
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(var(--page-rgb), .85), rgba(var(--page-rgb), 0));
}

.brand {
  display: inline-flex; align-items: center; gap: 0.65rem;
  min-height: 44px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
  letter-spacing: -0.02em; text-decoration: none;
}
.brand-mark { width: 24px; height: 24px; color: var(--mica); flex: none; }
.brand-mark svg { width: 100%; height: 100%; }

.masthead-nav { display: none; gap: 2rem; }
.masthead-nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-data); font-size: 0.68rem;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fog); text-decoration: none;
  transition: color 160ms ease;
}
.masthead-nav a:hover { color: var(--mica); }

/* --- Language switch ------------------------------------------------------ */

.lang {
  display: flex; align-items: center; gap: 0.15rem; flex: none;
  font-family: var(--font-data); font-size: 0.62rem; letter-spacing: 0.08em;
}
.lang > * {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  text-decoration: none;
}
.lang a { color: var(--fog); transition: color 160ms ease; }
.lang a:hover { color: var(--mica); }
.lang [aria-current] { color: var(--quartz); }

/* --- Theme toggle --------------------------------------------------------- */

/* Borderless, like the language switch beside it. A boxed control was both
   the odd one out in this masthead and effectively invisible: --line sits at
   1.3:1 against the paper and 1.5:1 against the night. */
.theme-toggle {
  display: grid; place-items: center; flex: none;
  width: 44px; height: 44px;
  background: transparent; border: 0; padding: 0;
  cursor: pointer; color: var(--fog);
  transition: color 160ms ease;
}
.theme-toggle svg { width: 19px; height: 19px; grid-area: 1 / 1; }
:root:not([data-theme="light"]) .icon-sun,
:root[data-theme="light"] .icon-night { display: none; }

@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover { color: var(--mica); }
}

/* --- Margin rail ---------------------------------------------------------
   Real coordinates for Ames. A map sheet carries its location in the margin;
   so does this one. */

.rail {
  display: none;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 40;
  width: var(--rail);
  flex-direction: column; align-items: center; justify-content: center;
  gap: 1.25rem;
  font-family: var(--font-data); font-size: 0.6rem;
  letter-spacing: 0.16em; color: var(--fog);
}
.rail-coord, .rail-place { writing-mode: vertical-rl; white-space: nowrap; }
.rail-place { text-transform: uppercase; opacity: 0.55; }
.rail-line { width: 1px; height: 5rem; background: linear-gradient(var(--line), transparent); }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  padding: clamp(1.25rem, 0.75rem + 1.6vw, 3rem) var(--gutter) clamp(2.5rem, 1.25rem + 4.5vw, 6rem);
  max-width: var(--page);
}

.kicker {
  font-family: var(--font-data); font-size: 0.65rem;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--mica); margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2.7rem, 1.5rem + 5.4vw, 5.4rem);
  letter-spacing: -0.045em;
  margin-bottom: 2rem;
}
.hero h1 .dim { color: var(--fog); }

.lede {
  max-width: 48ch; font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.3rem);
  color: var(--fog); margin-bottom: 2.5rem;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 1.5rem;
  background: var(--mica); color: var(--abyss);
  font-family: var(--font-data); font-size: 0.72rem;
  letter-spacing: 0.06em;
  border: 1px solid var(--mica); border-radius: 4px;
  text-decoration: none;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.btn:active { transform: scale(0.97); }

.btn-quiet { background: transparent; color: var(--quartz); border-color: var(--line); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: #7FD9C5; }
  .btn-quiet:hover { background: var(--deep); border-color: var(--fog); }
}

/* --- Bands ---------------------------------------------------------------- */

.band { padding: clamp(2rem, 1rem + 3.6vw, 4.25rem) var(--gutter); max-width: var(--page); }
.band-quiet { border-top: 1px solid var(--line); }

.band-head { max-width: var(--measure); margin-bottom: clamp(1.5rem, 1rem + 2.2vw, 3rem); }
.band-head h2, .prose h2, .hello h2 {
  font-size: clamp(1.8rem, 1.3rem + 2vw, 2.9rem);
  margin-bottom: 1rem;
}
.band-head p { color: var(--fog); max-width: 52ch; }

/* --- Works ---------------------------------------------------------------
   Deliberately not a grid of identical cards. Each entry is a full-width
   row with a hairline above it, like items on a survey legend. */

.works { list-style: none; padding: 0; display: flex; flex-direction: column; }

.work {
  display: grid; gap: 0.75rem;
  padding: clamp(1.25rem, 0.9rem + 1.6vw, 2.5rem) 0;
  border-top: 1px solid var(--line);
  transition: border-color 240ms ease;
}
.work:last-child { border-bottom: 1px solid var(--line); }

.work-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem;
  font-family: var(--font-data); font-size: 0.62rem;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.work-stamp { color: var(--mica); }
.work-stamp-open { color: var(--fog); }
.work-stack { color: var(--fog); opacity: 0.8; letter-spacing: 0.08em; }

.work h3 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.2rem); }
.work p { color: var(--fog); max-width: var(--measure); }

.work-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; margin-top: 0.25rem;
  font-family: var(--font-data); font-size: 0.68rem; letter-spacing: 0.06em;
  color: var(--mica); text-decoration: none;
}
.work-link svg { width: 15px; height: 15px; transition: transform 200ms var(--ease-out); }

@media (hover: hover) and (pointer: fine) {
  .work:hover { border-top-color: var(--mica); }
  .work-link:hover svg { transform: translateX(4px); }
}

/* The unshipped entry is marked by its stamp, not by dimming the copy —
   fading body text below 4.5:1 to signal state fails contrast. Only the
   heading is softened, and it is large enough to need just 3:1. */
.work-next h3 { opacity: 0.74; }

/* --- Prose ---------------------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose p { color: var(--fog); margin-bottom: 1.25rem; }
.prose p:last-child { margin-bottom: 0; }

/* --- Hello ---------------------------------------------------------------- */

.hello { display: grid; gap: clamp(2rem, 1rem + 4vw, 4rem); }
.hello-copy p { color: var(--fog); max-width: 44ch; margin-bottom: 2rem; }

.elsewhere { list-style: none; padding: 0; }
.elsewhere a {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; min-height: 52px;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-data); font-size: 0.72rem; letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 180ms ease, border-color 180ms ease;
}
.elsewhere-h { color: var(--fog); opacity: 0.8; }

@media (hover: hover) and (pointer: fine) {
  .elsewhere a:hover { color: var(--mica); border-bottom-color: var(--mica); }
  .elsewhere a:hover .elsewhere-h { opacity: 1; }
}

/* --- Colophon ------------------------------------------------------------- */

.colophon {
  display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
  padding: 2.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-data); font-size: 0.62rem;
  letter-spacing: 0.1em; color: var(--fog);
}
.colophon-note { opacity: 0.8; }

/* --- Load sequence -------------------------------------------------------
   One orchestrated moment on arrival, then the page stops performing.
   No scroll-triggered reveals: too much motion is its own kind of noise. */

.js .hero > * {
  opacity: 0;
  transform: translateY(10px);
  animation: settle 700ms var(--ease-out) forwards;
}
.js .hero > *:nth-child(1) { animation-delay: 120ms; }
.js .hero > *:nth-child(2) { animation-delay: 200ms; }
.js .hero > *:nth-child(3) { animation-delay: 290ms; }
.js .hero > *:nth-child(4) { animation-delay: 370ms; }

@keyframes settle { to { opacity: 1; transform: none; } }

/* --- Breakpoints ---------------------------------------------------------- */

@media (min-width: 760px) {
  .hello { grid-template-columns: 1.15fr 0.85fr; gap: 4rem; align-items: start; }
  .work { grid-template-columns: 1fr; }
}

@media (min-width: 1024px) {
  .masthead-nav { display: flex; }
  .rail { display: flex; }
  body { padding-left: var(--rail); }
  .work {
    grid-template-columns: 15rem 1fr;
    grid-template-areas: "meta title" "meta body" "meta link";
    column-gap: 3rem; row-gap: 0.6rem;
  }
  .work-meta { grid-area: meta; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .work h3 { grid-area: title; }
  .work p { grid-area: body; }
  .work-link { grid-area: link; }
}

/* --- Reduced motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .hero > * { opacity: 1; transform: none; }
}

/* --- Print ---------------------------------------------------------------- */

@media print {
  #survey, .veil, .rail, .masthead { display: none; }
  body { background: #fff; color: #000; padding-left: 0; }
  .js .hero > * { opacity: 1; transform: none; animation: none; }
}

/* --- Consent -------------------------------------------------------------
   Sits in the corner rather than across the page: it is a question, not a
   toll gate. Accept and decline are styled identically on purpose, because a
   quiet decline beside a loud accept is not a free choice. */

.consent {
  position: fixed; z-index: 200;
  left: var(--gutter); bottom: var(--gutter);
  right: var(--gutter);
  max-width: 34rem;
  display: grid; gap: 1rem;
  padding: 1.25rem 1.4rem;
  background: var(--elevated);
  border: 1px solid var(--elevated-line);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.consent p { font-size: 0.86rem; color: var(--fog); }

.consent-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.consent-btn {
  min-height: 44px; padding: 0 1.2rem;
  font-family: var(--font-data); font-size: 0.68rem; letter-spacing: 0.06em;
  color: var(--quartz); background: transparent;
  border: 1px solid var(--fog); border-radius: 4px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), border-color 160ms ease, color 160ms ease;
}
.consent-btn:active { transform: scale(0.97); }

.consent-manage {
  font-family: var(--font-data); font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fog); background: none; border: 0; padding: 0;
  min-height: 44px; cursor: pointer;
  transition: color 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .consent-btn:hover { color: var(--mica); border-color: var(--mica); }
  .consent-manage:hover { color: var(--mica); }
}

@media (prefers-reduced-motion: reduce) {
  .consent-btn:active { transform: none; }
}

.colophon-link {
  font-family: var(--font-data); font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fog); text-decoration: none;
  display: inline-flex; align-items: center; min-height: 44px;
  transition: color 160ms ease;
}
.consent-more {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-data); font-size: 0.66rem; letter-spacing: 0.05em;
  color: var(--fog); text-decoration: underline; text-underline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .colophon-link:hover, .consent-more:hover { color: var(--mica); }
}

/* --- Availability ---------------------------------------------------------
   Sits beside the kicker rather than in the contact section at the bottom.
   If someone is actually free for work, that is a headline, and the top of
   the page is the only place a visitor is guaranteed to read. */

.hero-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1.25rem;
  margin-bottom: 2rem;
}
.hero-meta .kicker { margin-bottom: 0; }

.status {
  display: inline-flex; align-items: center; gap: 0.55rem;
  /* It is a link, so it carries a link's touch target even though the pill
     itself reads small. */
  min-height: 44px;
  font-family: var(--font-data); font-size: 0.65rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--quartz); text-decoration: none;
  padding: 0.35rem 0.9rem 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 200ms ease, color 200ms ease;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mica); flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mica) 22%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .status:hover { border-color: var(--mica); color: var(--mica); }
}

/* Two links on the unreleased entries: the product page, and a way to be told
   when it ships. Interest with nowhere to go is interest thrown away. */
.work-links {
  grid-area: link;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.5rem;
}
.work-links .work-link { margin-top: 0; }

.work-notify {
  display: inline-flex; align-items: center;
  min-height: 44px;
  font-family: var(--font-data); font-size: 0.68rem; letter-spacing: 0.06em;
  color: var(--fog); text-decoration: underline; text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 160ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .work-notify:hover { color: var(--mica); }
}
