/* ============================================================
   site.css — shared chrome for benediktwendlinger.com
   Loaded by index.html, contact.html, journey.html.
   Page-specific rules stay in each page's own <style>.
   ============================================================ */

@import url("fonts.css");

/* ── 1. Custom properties + reset ─────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper:           #FAF7F1;
  --linen:           #EDE7DA;
  --ink:             #15161B;
  --stone:           #5A5C66;
  --stone-soft:      #b0a698;
  --rule:            #D9D3C4;
  --navy:            #0A1A6B;
  --navy-deep:       #06123F;
  --terracotta:      #C04A2C;
  --terracotta-deep: #8E3520;
  --mono:            ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Text on navy. Every light text colour on dark surfaces uses one of these; the
     old 15–45 % alphas measured 1.5–4.2:1 and failed WCAG AA (review 2026-10-02). */
  --on-dark-1: rgba(250, 247, 241, 0.88);   /* primary body on navy   ≈ 13:1 */
  --on-dark-2: rgba(250, 247, 241, 0.72);   /* secondary              ≈ 8:1  */
  --on-dark-3: rgba(250, 247, 241, 0.58);   /* labels, meta (floor)   ≈ 5.8:1 */
  --rule-on-dark: rgba(217, 211, 196, 0.4); /* input lines, dividers  ≥ 3:1  */
  --terracotta-on-dark: #DE6A48;            /* small terracotta text on navy ≈ 5.4:1 */

  /* Motion tokens (brand guide § Motion) */
  --ease-reveal: cubic-bezier(0.23, 1, 0.32, 1);

  /* Body copy: 17 px on phones, 18 px from tablet up (was 14 px) */
  --body-size: 1.0625rem;
}
@media (min-width: 768px) { :root { --body-size: 1.125rem; } }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* Skip link: first focusable element, visible only on keyboard focus */
.skip-link {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 300;
  padding: 12px 16px;
  background: var(--navy-deep);
  color: var(--paper);
  font-size: 0.875rem;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ── 2. Section helper ─────────────────────────────── */
.section-dark { background: var(--navy-deep); }

/* ── 3. Nav ────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 48px;
  background: rgba(250, 247, 241, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  /* Only colours animate: padding transitions re-ran layout on every scroll */
  transition: background-color 200ms ease, border-color 200ms ease;
}
#nav.scrolled { border-bottom-color: var(--rule); }

/* Over the navy hero the bar is transparent with light type (site.js toggles .over-hero) */
#nav.over-hero {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: transparent;
}
#nav.over-hero .wm-first { color: var(--paper); }
#nav.over-hero .wm-last  { color: rgba(176, 166, 152, 0.75); }
#nav.over-hero .nav-links a { color: var(--on-dark-2); }
#nav.over-hero .nav-links a:hover { color: var(--paper); }
#nav .wm-first, #nav .wm-last, #nav .nav-links a { transition: color 200ms ease; }

.nav-wordmark {
  font-family: 'EB Garamond', serif;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}
.wm-first { color: var(--navy-deep); font-weight: 500; }
.wm-last  { color: var(--stone-soft); font-weight: 400; }
.wm-dot   { color: var(--terracotta); }

.nav-links {
  display: flex;
  gap: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
/* 12 px of invisible padding above/below: ≥ 24 px tap target without moving the type */
.nav-links a { color: var(--stone); padding: 12px 0; margin: -12px 0; }
.nav-links a:hover { color: var(--navy); }
.nav-links a.nav-active,
.nav-links a.active { color: var(--terracotta) !important; }
.nav-links a.nav-active:hover,
.nav-links a.active:hover { color: var(--terracotta-deep) !important; }

/* Dark-page nav variant (contact.html, journey.html) */
body.page-dark #nav {
  background: var(--navy-deep);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.page-dark #nav.scrolled { border-bottom-color: rgba(217, 211, 196, 0.12); }
body.page-dark .wm-first { color: var(--paper); }
body.page-dark .wm-last  { color: rgba(176, 166, 152, 0.55); }
body.page-dark .nav-links a { color: var(--on-dark-2); }
body.page-dark .nav-links a:hover { color: var(--paper); }

/* ── 4. Section eyebrow ────────────────────────────── */
.section-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-eyebrow::after {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  background: var(--rule);
}
.section-eyebrow .ey-num {
  font-family: var(--mono);
  color: var(--terracotta);
  letter-spacing: 0.05em;
  font-weight: 500;
  text-transform: none;
}
.contact-eyebrow,
body.page-dark .section-eyebrow { color: var(--on-dark-3); }
.contact-eyebrow::after,
body.page-dark .section-eyebrow::after { background: var(--rule-on-dark); }
/* Terracotta at 9–12 px on navy is 3.6:1 — the lighter tone passes */
.section-dark .ey-num,
body.page-dark .ey-num,
.modal-contact-inner .ey-num { color: var(--terracotta-on-dark); }

/* ── 6. Scroll-linked headline reveal ──────────────── */
/* Each line carries --t (0 → 1), written by site.js from the headline's
   own scroll progress through a short band as it enters view. Motion is
   tied to scroll position, not a one-shot. Default without JS / under
   reduced motion: --t resolves to 1 → fully visible, final colour. */
.reveal-headline {
  font-family: 'EB Garamond', serif;
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 56px;
}
.reveal-line {
  display: block;
  color: var(--navy-deep);
}
.reveal-line.accent { color: var(--terracotta); font-style: italic; }
.contact-headline .reveal-line { color: var(--paper); }
.contact-headline .reveal-line.accent { color: var(--terracotta); font-style: italic; }

@media (prefers-reduced-motion: no-preference) {
  html.js .reveal-line {
    opacity: calc(0.28 + 0.72 * var(--t, 1));
    transform: translateY(calc((1 - var(--t, 1)) * 9px));
    will-change: opacity, transform;
  }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-line { opacity: 1 !important; transform: none !important; }
}

/* ── 7a. Scroll progress bar ─────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--terracotta);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 101;
  pointer-events: none;
  opacity: 0.85;
}
/* scaleX is written by site.js on scroll (progress indicator, kept even
   under reduced motion — it informs rather than decorates). */

/* ── 7b. Press feedback ───────────────────────────── */
.contact-cta,
.hero-cta,
.form-submit,
.copy-email-btn,
.modal-close,
.about-link {
  transition-property: color, background-color, border-color, text-decoration-color, transform, opacity;
  transition-duration: 180ms;
  transition-timing-function: ease-out;
}
@media (prefers-reduced-motion: no-preference) {
  .contact-cta:active,
  .hero-cta:active,
  .form-submit:active:not(:disabled),
  .about-link:active {
    transform: scale(0.97);
    transition-duration: 100ms;
  }
}

.hero-headline,
.reveal-headline,
.modal-contact-title { text-wrap: balance; }

/* ── 7c. Keyboard focus ───────────────────────────── */
:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
}
.form-input:focus-visible,
.form-textarea:focus-visible {
  outline: none;
  border-bottom-color: var(--terracotta) !important;
}

/* ── 8. Modals ─────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}
.modal-inner {
  position: relative;
  background: var(--paper);
  padding: 48px;
  max-width: 520px;
  width: calc(100% - 48px);
  max-height: 80vh;
  overflow-y: auto;
  opacity: 1;
  transform: scale(1);
  transition: opacity 240ms var(--ease-reveal), transform 240ms var(--ease-reveal);
}
@media (prefers-reduced-motion: no-preference) {
  @starting-style {
    .modal:not([hidden]) .modal-inner {
      opacity: 0;
      transform: scale(0.97);
    }
  }
  /* #12 — exit is the faster half (site.js adds .modal--closing before hiding) */
  .modal--closing .modal-inner {
    opacity: 0;
    transform: scale(0.985);
    transition-duration: 150ms;
  }
}
.modal-close {
  position: absolute;
  top: 20px; right: 24px;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--stone);
  line-height: 1;
  padding: 4px 8px;
  transition: color 180ms ease;
}
.modal-close:hover { color: var(--ink); }
.modal-inner h3 {
  font-family: 'EB Garamond', serif;
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--navy-deep);
  margin-bottom: 20px;
}
.modal-note { font-size: 0.75rem; color: var(--stone); font-style: italic; margin-bottom: 20px; }
.modal-inner p { font-size: 0.825rem; color: var(--stone); line-height: 1.7; }
.modal-inner p + p { margin-top: 0.875rem; }
.modal-inner a { color: var(--navy); text-decoration: underline dotted; text-underline-offset: 3px; }
.modal-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 0.825rem;
}
.modal-dl dt { color: var(--stone); font-weight: 500; }
.modal-dl dd { color: var(--ink); }

.modal-contact-inner {
  background: var(--navy-deep);
  max-width: 600px;
  max-height: 90vh;
  padding: 48px;
}
.modal-contact-inner .modal-close { color: var(--on-dark-3); }
/* .modal-inner p (generic paper modal) outranked these and painted them stone grey
   on navy (2.7:1) — scope them to the contact modal explicitly */
.modal-contact-inner p.modal-contact-sub,
.modal-contact-inner p.form-consent { color: var(--on-dark-2); }
.modal-contact-inner p.section-eyebrow { font-size: 0.75rem; line-height: normal; color: var(--on-dark-3); }
.modal-contact-inner p.form-status { font-size: 0.95rem; }
.modal-contact-inner .modal-close:hover { color: var(--paper); }
.modal-contact-eyebrow { margin-bottom: 20px; }
.modal-contact-title {
  font-family: 'EB Garamond', serif;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 400;
  color: var(--paper);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
.modal-contact-title em { color: var(--terracotta); font-style: italic; }
.modal-contact-sub {
  font-size: 1rem;
  color: var(--on-dark-2);
  line-height: 1.65;
  margin-bottom: 32px;
  max-width: 400px;
  font-style: normal;
}
button.contact-cta {
  background: none;
  border: none;
  padding: 0;
  font-family: 'EB Garamond', serif;
}

/* ── 9. Contact form ───────────────────────────────── */
.contact-form-wrap { max-width: 560px; }
.contact-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 40px 0 32px;
}
.contact-divider::before {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  background: rgba(217, 211, 196, 0.15);
  flex-shrink: 0;
}
.contact-divider-label {
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--on-dark-3);
  white-space: nowrap;
}
.contact-form { display: flex; flex-direction: column; gap: 24px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.form-field { display: flex; flex-direction: column; gap: 8px; }
.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--on-dark-2);
  transition: color 200ms ease;
}
.form-label-optional { font-weight: 400; text-transform: none; letter-spacing: 0.02em; color: var(--on-dark-3); }
.form-field:focus-within .form-label { color: var(--paper); }
.form-input,
.form-textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-on-dark);
  color: var(--paper);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  padding: 4px 0 10px;
  outline: none;
  transition: border-color 200ms ease;
  caret-color: var(--terracotta);
}
.form-textarea {
  resize: none;
  line-height: 1.65;
  min-height: 88px;
}
.form-input:focus  { border-bottom-color: rgba(192, 74, 44, 0.55); }
.form-textarea:focus { border-bottom-color: rgba(192, 74, 44, 0.55); }
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--on-dark-3);
  font-family: 'EB Garamond', serif;
  font-style: italic;
}
.form-input[aria-invalid="true"],
.form-textarea[aria-invalid="true"] { border-bottom-color: var(--terracotta-on-dark); }
.form-error {
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--terracotta-on-dark);
  min-height: 1em;
}
.form-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.form-submit {
  background: none;
  border: none;
  padding: 0;
  font-family: 'EB Garamond', serif;
  font-size: 1.4rem;
  color: var(--terracotta);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 180ms ease;
}
.form-submit:hover:not(:disabled) { color: var(--terracotta-deep); }
.form-submit:disabled { opacity: 0.45; }
.form-status {
  font-family: 'EB Garamond', serif;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--on-dark-2);
}
.form-status.success { color: var(--on-dark-1); }
.form-status.error {
  font-style: normal;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--terracotta-on-dark);
}
.form-hp { display: none; }
.arr { color: var(--terracotta); }

/* ── 10. Footer ────────────────────────────────────── */
#footer {
  margin-top: 80px;
  padding: 24px 0;
  border-top: 1px solid rgba(217, 211, 196, 0.16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.footer-wm { font-family: 'EB Garamond', 'Hoefler Text', Garamond, serif; font-size: 0.9rem; }
.footer-wm .wm-first { color: var(--paper); font-weight: 500; }
.footer-wm .wm-last  { color: rgba(176, 166, 152, 0.55); font-weight: 400; }
.footer-wm .wm-dot   { color: var(--terracotta); }
.footer-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.footer-links a,
.footer-links .footer-legal {
  color: var(--on-dark-3);
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 8px 0;
  margin: -8px 0;
  transition: color 180ms ease;
}
.footer-links a:hover,
.footer-links .footer-legal:hover { color: var(--paper); }
.footer-copy { font-size: 0.75rem; color: var(--on-dark-3); letter-spacing: 0.04em; }

/* ── 11. Shared responsive ─────────────────────────── */
@media (max-width: 640px) {
  #nav, #nav.scrolled { padding: 20px 24px; }
  .form-row { grid-template-columns: 1fr; }
  .modal-inner { padding: 32px 24px; }
}
@media (max-width: 900px) {
  #footer { flex-direction: column; gap: 16px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
}

/* ════════════════════════════════════════════════════
   FULL BUILD — points 7–12
   ════════════════════════════════════════════════════ */

/* ── 10. Selected work strip ───────────────────────── */
#work {
  background: var(--paper);
  padding: 0 48px 96px;
  position: relative;
  z-index: 1;
}
.work-list {
  list-style: none;
  border-top: 1px solid var(--rule);
}
.work-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto;
  align-items: baseline;
  gap: 16px 40px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
  color: inherit;
}
@media (hover: hover) { .work-row:hover .work-org { color: var(--terracotta); } }
.work-org {
  font-family: 'EB Garamond', serif;
  font-size: 1.6rem;
  color: var(--navy-deep);
  transition: color 180ms ease;
}
.work-role {
  display: block; /* was inline: the margin had no effect and the role ran on right after the name */
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stone);
  margin-top: 8px;
}
.work-note {
  font-size: var(--body-size);
  color: var(--stone);
  line-height: 1.65;
  max-width: 62ch;
}
.work-years {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--stone);  /* stone-soft is a logo colour: 2.2:1 as text */
  letter-spacing: 0.04em;
  white-space: nowrap;
  justify-self: end;
}
.work-row .arr { color: var(--terracotta); }
@media (prefers-reduced-motion: no-preference) {
  html.js .work-row {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 420ms ease-out, transform 420ms ease-out;
  }
  html.js .work-row.visible { opacity: 1; transform: none; }
}
@media (max-width: 760px) {
  .work-row { grid-template-columns: 1fr; gap: 8px; }
  .work-years { justify-self: start; }
}
@media (max-width: 640px) {
  #work { padding: 0 24px 64px; }
}

/* ── 11. Arrows appear on hover only (brand guide v1.6) ─ */
.hero-cta,
.about-link,
button.contact-cta,
.form-submit { position: relative; }
.hero-cta > .arr,
.about-link > .arr,
button.contact-cta > .arr,
.form-submit > .arr {
  position: absolute;
  left: 100%;
  margin-left: 5px;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.hero-cta:hover > .arr,
.hero-cta:focus-visible > .arr,
.about-link:hover > .arr,
.about-link:focus-visible > .arr,
button.contact-cta:hover > .arr,
button.contact-cta:focus-visible > .arr,
.form-submit:hover:not(:disabled) > .arr,
.form-submit:focus-visible > .arr {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .hero-cta > .arr, .about-link > .arr,
  button.contact-cta > .arr, .form-submit > .arr { transition: opacity 120ms linear; transform: none; }
}

/* ── 12. Reduced-motion safety net ─────────────────── */
/* Any element a reveal script may have hidden is forced visible. */
@media (prefers-reduced-motion: reduce) {
  .hero-inner > *,
  .hero-portrait,
  .fact-row,
  .reveal-line,
  .work-row {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}

/* Contact-form consent note */
.form-consent { font-size: 0.8rem; line-height: 1.6; color: var(--on-dark-2); margin-top: 4px; }
.form-consent a { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }

/* Phones: wordmark + three nav links must fit in 390 px (JOURNEY was cut off) */
@media (max-width: 480px) {
  #nav, #nav.scrolled { padding-left: 16px; padding-right: 16px; }
  .nav-links { gap: 0.875rem; letter-spacing: 0.08em; font-size: 0.6875rem; }
  /* Four links don't fit beside the wordmark — Work sits right below About when scrolling */
  .nav-links a[href$="#work"] { display: none; }
}

/* Social links as a real list; 44 px tap targets around the 22 px icons */
.social-icons { list-style: none; }
.social-icons li { display: flex; }
.social-icon { width: 44px; height: 44px; }

/* Jump links (#about, #work, #contact, #main) land below the fixed nav, not under it */
section[id], main[id] { scroll-margin-top: 88px; }

/* "Send message" is 22 px — under the 24 px large-text line, so it needs 4.5:1 on navy */
.modal-contact-inner .form-submit,
body.page-dark .form-submit { color: var(--terracotta-on-dark); }
.modal-contact-inner .form-submit:hover:not(:disabled),
body.page-dark .form-submit:hover:not(:disabled) { color: var(--paper); }
.section-dark .arr, body.page-dark .arr, .modal-contact-inner .arr { color: var(--terracotta-on-dark); }
