/* ============================================================================
   Base85 — one-page corporate site
   Depends on css/tokens.css. Never hardcode a colour, radius or duration here.

   THE ONE-RED RULE. Exactly one red element per screen. On this page that is
   the hero primary button and the Contact submit — 3900px apart, so no
   viewport can hold both. Every section index is faint, deliberately. If you
   add a red element, measure its distance from those two first.
   ========================================================================= */

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  font-weight: var(--weight-regular);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

img, svg { max-width: 100%; display: block; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------------------------- primitives */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--margin-mobile);
}
@media (min-width: 768px) { .container { padding-inline: var(--gutter); } }

.mono {
  font-family: var(--font-mono);
  font-size: var(--size-mono-label);
  line-height: var(--lh-mono-label);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
}

.section { padding-block: var(--space-24); border-top: 1px solid var(--border); }
@media (min-width: 768px) { .section { padding-block: var(--space-32); } }
.section--alt { background: var(--surface); }

.section-header { margin-bottom: var(--space-12); }
.section-header .eyebrow { color: var(--text-faint); display: block; margin-bottom: var(--space-8); }
.section-header h2 {
  font-family: var(--font-display);
  font-size: var(--size-h2);
  line-height: var(--lh-h2);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  max-width: 20ch;
}

.lede {
  font-size: var(--size-body-lg);
  line-height: var(--lh-body-lg);
  color: var(--text-muted);
  max-width: var(--measure);
  margin: var(--space-6) 0 0;
}

/* ---------------------------------------------------------------- buttons
   Primary  red fill + INK text (4.64:1). Hover #FF4930 (5.89:1). Press
            returns to base red + 1px translate + 1px inset Ink ring. The ring
            carries the press for touch users, who never see hover. It is a
            border, not an elevation shadow.
   Ghost    1px outline in the text colour's border token.
   Tertiary mono link with a red underline that sweeps in from the left. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 24px;
  border-radius: var(--radius-md);       /* 8. Never a pill. */
  font-family: var(--font-body);
  font-size: var(--size-body);
  font-weight: var(--weight-bold);
  line-height: 1;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}

.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:active {
  background: var(--accent);
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px var(--b85-ink);
}

.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--border-strong); }
.btn--ghost:active { transform: translateY(1px); }

.btn--sm { padding: 10px 16px; font-size: var(--size-small); }

.link {
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
  transition: color var(--dur-fast) var(--ease);
}
.link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 100%; height: 2px;
  background: var(--accent-text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.link:hover { color: var(--text); }
.link:hover::after { transform: scaleX(1); }

/* -------------------------------------------------------------------- nav
   Wordmark without tagline, minimum 60px wide. Gains a 1px bottom border on
   scroll. The nav CTA is a ghost, not red — the hero button owns the red. */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur) var(--ease);
}
.nav[data-scrolled="true"] { border-bottom-color: var(--border); }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  height: 72px;
}

.nav__logo { display: block; }
.nav__logo img { width: 104px; min-width: 60px; height: auto; }

.nav__links { display: none; gap: var(--space-8); align-items: center; }
@media (min-width: 900px) { .nav__links { display: flex; } }
.nav__links a { color: var(--text-faint); }
.nav__links a:hover { color: var(--text); }

/* ------------------------------------------------------------------- hero */

.hero { position: relative; overflow: hidden; padding-block: var(--space-24) var(--space-32); }

.hero__eyebrow { color: var(--text-faint); display: block; margin-bottom: var(--space-8); }

.hero h1 {
  font-family: var(--font-display);
  font-weight: var(--weight-display);
  font-size: clamp(40px, 7vw, var(--size-display-xl));
  line-height: var(--lh-display-xl);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  max-width: 16ch;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-12); }

/* Encoding motif — low-opacity mono character strings. Texture, never noise.
   Never behind body copy. 0.08 on Ink, 0.10 on Paper. */
.motif {
  position: absolute;
  inset-block: 0;
  right: -2%;
  width: 46%;
  display: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.05em;
  color: var(--text);
  opacity: var(--motif-opacity);
  white-space: pre-wrap;
  word-break: break-all;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  /* Fades out toward the headline and off the bottom edge, so it never
     terminates on a hard cut and never crowds the copy. Texture, not noise. */
  -webkit-mask-image:
    linear-gradient(to left,  #000 40%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 18%, #000 72%, transparent 100%);
  mask-image:
    linear-gradient(to left,  #000 40%, transparent 100%),
    linear-gradient(to bottom, transparent 0%, #000 18%, #000 72%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
@media (min-width: 1024px) { .motif { display: block; } }

/* ------------------------------------------------------------------ cards
   Ink-2 fill, 1px border, radius 17. No shadow on dark — the border is what
   separates surfaces. Light gets the one permitted shadow. */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}
@media (min-width: 768px) { .card { padding: var(--space-8); } }

.section--alt .card { background: var(--bg); }

/* ------------------------------------------------------------------- work
   Screenshots at native aspect ratio, no browser chrome, no device frames.
   The client product's own colours live inside the screenshot only — the
   frame, labels and page stay in Base85 tokens. */

/* Capped at three columns so five tiles read as a deliberate 3 + 2, rather
   than the 4 + 1 orphan that auto-fit gives at desktop widths. */
.work {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
}
@media (min-width: 900px) { .work { grid-template-columns: repeat(3, 1fr); } }

.work__shot {
  aspect-ratio: 16 / 10;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  margin: calc(var(--space-6) * -1) calc(var(--space-6) * -1) var(--space-6);
  display: grid;
  place-items: center;
  overflow: hidden;
}
@media (min-width: 768px) {
  .work__shot { margin: calc(var(--space-8) * -1) calc(var(--space-8) * -1) var(--space-8); }
}
.work__shot .mono { color: var(--text-faint); }

/* Each tile carries the product's own brand mark, not a screenshot. The
   client's colours live inside the mark; the plate stays in Base85 tokens.
   A fixed box with object-fit: contain, NOT max-width/max-height. Caps only
   shrink art that is already too big — a 85px-wide SVG would sit next to a
   900px one at its own intrinsic size. The box gives every mark the same
   space and the aspect ratio is preserved inside it. */
.work__logo {
  width: 62%;
  height: 46%;
  object-fit: contain;
  object-position: center;
}

/* Every mark ships in two cuts. Show the one made for the current ground —
   never recolour someone else's logo to make it fit. */
.work__logo--light { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .work__logo--dark  { display: none; }
  :root:not([data-theme="dark"]) .work__logo--light { display: block; }
}
:root[data-theme="light"] .work__logo--dark  { display: none; }
:root[data-theme="light"] .work__logo--light { display: block; }
:root[data-theme="dark"]  .work__logo--dark  { display: block; }
:root[data-theme="dark"]  .work__logo--light { display: none; }

/* Fallback only. If a mark fails to load, JS sets .is-empty and the tile
   names the project rather than showing a blank plate. */
.work__shot:not(.is-empty) .work__placeholder { display: none; }
.work__shot.is-empty .work__logo { display: none; }

.work__meta { color: var(--text-faint); display: block; margin-bottom: var(--space-3); }
.work__desc { color: var(--text-muted); margin: 0; }

/* ---------------------------------------------------------------- process */

.process {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-8);
}
.process__step { border-top: 1px solid var(--border); padding-top: var(--space-6); }
.process__index { color: var(--text-faint); display: block; margin-bottom: var(--space-4); }
.process__step h3 {
  font-family: var(--font-display);
  font-size: var(--size-h3);
  line-height: var(--lh-h3);
  font-weight: var(--weight-bold);
  margin: 0 0 var(--space-3);
}
.process__step p { color: var(--text-muted); margin: 0; }

/* ---------------------------------------------------------------- founder
   Deliberately empty. No name, bio or portrait has been supplied and none
   will be invented. Fill CONTENT TODO 2 in index.html. */

.founder { display: grid; gap: var(--space-8); align-items: start; }
@media (min-width: 768px) { .founder { grid-template-columns: 220px 1fr; } }

.founder__portrait {
  aspect-ratio: 3 / 4;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.founder__portrait img { width: 100%; height: 100%; object-fit: cover; }
.founder__portrait .mono { color: var(--text-faint); }
.founder__portrait:not(.is-empty) .founder__placeholder { display: none; }
.founder__portrait.is-empty img { display: none; }

.founder__body p { color: var(--text-muted); max-width: var(--measure); }
.founder__body p:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- contact */

.contact { display: grid; gap: var(--space-12); align-items: start; }
@media (min-width: 900px) { .contact { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); } }

.field { display: block; margin-bottom: var(--space-6); }
.field > .mono { color: var(--text-faint); display: block; margin-bottom: var(--space-2); }

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);      /* 4 */
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--lh-body);
  transition: border-color var(--dur-fast) var(--ease);
}
.field textarea { min-height: 128px; resize: vertical; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-faint); }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--border-strong); }
.field :where(input, select, textarea):user-invalid { border-color: var(--accent-text); }

/* The native control renders as a bright white box on Ink, which is louder
   than anything else on the screen. Restyled to the system's own shapes: a
   4px well with a 1px border, and the design system's 2px polyline tick. */
.check { display: flex; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-8); }
.check input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  flex: none;
  margin: 2px 0 0;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.check input:hover { border-color: var(--border-strong); }
.check input::before {
  content: "";
  width: 10px; height: 10px;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease);
  background: var(--bg);
  clip-path: polygon(14% 47%, 0 61%, 39% 100%, 100% 22%, 85% 9%, 38% 70%);
}
/* Checked is an INK fill, not a red one. The Contact submit 52px below it is
   this screen's single red element; a red tick here would make two. */
.check input:checked { background: var(--text); border-color: var(--text); }
.check input:checked::before { transform: scale(1); }
.check span { color: var(--text-muted); font-size: var(--size-small); line-height: var(--lh-small); }

/* Status message under the submit button. Success uses --b85-success, not
   red — the submit button is already this screen's one red element.
   Error stays in muted text rather than introducing a second accent color. */
.form-status { margin: var(--space-4) 0 0; min-height: 1em; color: var(--text-muted); }
.form-status[data-tone="success"] { color: var(--b85-success); }
.form-status[data-tone="error"] { color: var(--text-muted); }

/* ----------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--border); padding-block: var(--space-16); }
.footer__inner { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: center; justify-content: space-between; }
.footer__mark { width: 34px; height: 34px; }
.footer__links { display: flex; flex-wrap: wrap; gap: var(--space-6); }
.footer__links a { color: var(--text-faint); }
.footer__links a:hover { color: var(--text); }
.footer__tagline { color: var(--text-faint); }

/* ----------------------------------------------------------- theme toggle */

.theme-toggle {
  position: fixed;
  right: var(--space-6);
  bottom: var(--space-6);
  z-index: 60;
  background: var(--surface);
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* ----------------------------------------------------------- scroll reveal
   Fade + 12px rise, 60ms sibling stagger, transform and opacity only. */

.reveal {
  opacity: 0;
  transform: translateY(var(--reveal-y));
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

/* Reduced motion: no reveal at all. Content is simply there. */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

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