/* ============================================================
   base.css — design tokens, typography, theme, layout, sections
   Owns the CSS custom properties (tokens) the whole site reads.
   Style: "Luxe / high-fashion" — warm near-white ground, graphite
   text, one restrained champagne-gold accent used sparingly. Much
   negative space, centred composition. Both themes meet WCAG AA.
   ============================================================ */

/* ---- Design tokens: light theme (default) ------------------ */
:root {
  /* Warm near-white ground */
  --bg:            #fbfaf7;  /* warm almost-white */
  --surface:       #f5f2ec;  /* soft panel */
  --surface-2:     #efeae1;
  --border:        #e6e0d4;  /* hairline */

  --text:          #2a2723;  /* graphite — ~13:1 on --bg */
  --text-muted:    #6a635a;  /* ~5.5:1 on --bg */

  /* One restrained champagne / gold accent.
     --accent is AA on --bg for text & links; --gold-line is the
     lighter champagne reserved for hairline rules / decorative edges. */
  --accent:        #8f6b32;  /* antique gold — AA on --bg (~4.5:1) */
  --accent-strong: #6f5324;  /* deeper gold for hover */
  --accent-contrast: #ffffff;/* text on filled accent */
  --gold-line:     #c9ab7a;  /* champagne hairline (decorative only) */

  --focus:         #8f6b32;

  /* Typography — high-contrast serif display, neutral sans for labels */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  /* Logo wordmark — Forum (Google Font). If Google Fonts can't load, the
     stack falls back to a system serif (Georgia → Times → generic serif). */
  --font-logo: "Forum", Georgia, "Times New Roman", serif;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.85rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.6rem, 1.4rem + 1vw, 2.25rem);
  --step-3:  clamp(2.2rem, 1.8rem + 2.2vw, 3.25rem);
  --step-4:  clamp(3.4rem, 2.4rem + 5vw, 7rem);

  /* Space & shape */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
  --space-7: 9rem;

  --radius: 2px;
  --radius-lg: 3px;
  --shadow: 0 1px 2px rgba(40, 34, 24, 0.05),
            0 18px 48px rgba(40, 34, 24, 0.08);
  --maxw: 1600px;
  --transition: 300ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- Dark theme: system preference (unless forced light) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #14120f;   /* warm near-black */
    --surface:     #1c1915;
    --surface-2:   #26221c;
    --border:      #332e26;
    --text:        #f2ece1;
    --text-muted:  #b6ab9a;   /* ~7:1 on --bg */
    --accent:      #cda86a;   /* light champagne, high contrast on dark */
    --accent-strong: #ddbd85;
    --accent-contrast: #14120f;
    --gold-line:   #6d5a3b;
    --focus:       #cda86a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5),
              0 20px 56px rgba(0, 0, 0, 0.55);
  }
}

/* ---- Dark theme: explicit toggle (wins over system) -------- */
:root[data-theme="dark"] {
  --bg:          #14120f;
  --surface:     #1c1915;
  --surface-2:   #26221c;
  --border:      #332e26;
  --text:        #f2ece1;
  --text-muted:  #b6ab9a;
  --accent:      #cda86a;
  --accent-strong: #ddbd85;
  --accent-contrast: #14120f;
  --gold-line:   #6d5a3b;
  --focus:       #cda86a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5),
            0 20px 56px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem; /* clear the sticky header on anchor jumps */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* no horizontal scroll */
  /* Sticky footer: full-height column so the footer sits at the bottom
     even when the page content is short (e.g. Home). */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body > main { flex: 1 0 auto; }
body > .site-footer { flex-shrink: 0; }

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.005em;
  margin: 0 0 var(--space-2);
}

p { margin: 0 0 var(--space-2); }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover { color: var(--accent-strong); }

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

/* ---- Visible focus for keyboard users --------------------- */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-1) var(--space-2);
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---- Layout primitives ------------------------------------ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.section {
  /* Top gap between the (sticky) header and the page title flexes with the
     viewport height: tight on laptops (~60px at 768), full 9rem only on tall
     screens. Bottom stays generous. Sections with their own padding override
     (Home carousel, work-detail) are unaffected. */
  padding-top: clamp(2.5rem, 8vh, var(--space-7));
  padding-bottom: var(--space-7);
}

/* Small-caps, letter-spaced label used for overlines & eyebrows. */
.section__eyebrow {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-3);
}

.section__title {
  font-size: var(--step-3);
  font-weight: 400;
}

.lead { font-size: var(--step-1); color: var(--text-muted); max-width: 60ch; }

/* A centred hairline rule with a gold centre — a recurring luxe motif. */
.rule-gold {
  display: block;
  width: 64px;
  height: 1px;
  border: 0;
  background: var(--gold-line);
  margin: var(--space-3) auto;
}

/* ---- Buttons ---------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
  padding: 1.1em 2em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
    border-color var(--transition);
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn--primary:hover {
  background: var(--accent-strong);
  color: var(--accent-contrast);
}
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Header / nav ----------------------------------------- */
/* Minimal, light, sticky. A single gold hairline underneath. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.1) blur(12px);
  backdrop-filter: saturate(1.1) blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
  min-height: 4.5rem;
  /* On narrow screens the nav wraps under the logo instead of overflowing. */
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-logo);
  /* Logo runs ~6px larger than the base step-1 scale (keeps the
     responsive curve, just shifted up). */
  font-size: calc(var(--step-1) + 0.4rem);
  font-weight: 400; /* Forum ships a single (regular) weight */
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  transition: color var(--transition);
}
.brand:hover { color: var(--accent); }
.site-nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  align-items: center;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color var(--transition);
}
.site-nav a:hover { color: var(--accent); }
/* Underline on hover and for the active page — a 1px line (same weight as the
   header's bottom hairline), the width of the tab. Drawn with an absolutely
   positioned ::after so the header height never changes. The Instagram icon
   link is excluded. */
.site-nav a:not(.site-nav__social-link) { position: relative; }
.site-nav a:not(.site-nav__social-link)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2em;
  height: 1px;
  /* 70% of the tab's text colour in each state (normal or gold on hover). */
  background: color-mix(in srgb, currentColor 70%, transparent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition);
}
.site-nav a:not(.site-nav__social-link):hover::after,
.site-nav a:not(.site-nav__social-link):focus-visible::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) {
  .site-nav a:not(.site-nav__social-link)::after { transition: none; }
}
/* Instagram icon at the end of the nav (same glyph as the footer). */
.site-nav__social { display: flex; align-items: center; }
.site-nav__social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition);
}
.site-nav__social-link svg { width: 20px; height: 20px; display: block; }
.site-nav__social-link:hover,
.site-nav__social-link:focus-visible { color: var(--accent); }

/* Nav collapses gracefully on very small screens */
@media (max-width: 560px) {
  .container { padding-inline: var(--space-3); }
  .site-header__inner { gap: var(--space-1); }
  .site-nav ul { gap: var(--space-2); }
  .site-nav a { letter-spacing: 0.1em; }
}
@media (max-width: 400px) {
  .site-nav ul { gap: 0.6rem; }
  .site-nav a { letter-spacing: 0.06em; }
}

/* ---- Cover: centred light "cover", not a full-bleed image -- */
.cover {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: min(84vh, 760px);
  padding-block: var(--space-7);
}
.cover__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cover__overline {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 500;
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--space-4);
  padding-left: 0.44em;
}
.cover__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-4);
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--text);
}
.cover__rule {
  display: block;
  width: 88px;
  height: 1px;
  background: var(--gold-line);
  margin: var(--space-4) 0;
}
.cover__subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 34ch;
  margin: 0 0 var(--space-5);
}
.cover__scroll {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--gold-line);
  transition: color var(--transition), border-color var(--transition);
}
.cover__scroll:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Work section ----------------------------------------- */
/* Gallery listing pages (work.html / masterstudies.html) and any home
   gallery block share the .section--work wrapper: centred, airy head. */
.section--work .section__head {
  margin-bottom: var(--space-6);
  text-align: center;
}
.section--work .section__head .section__title { font-size: var(--step-3); }

#gallery { min-height: 4rem; }

/* ---- About — restrained, centred --------------------------- */
.section--about {
  /* Top divider only — the bottom one sat right above the footer's own line. */
  border-top: 1px solid var(--border);
}
/* Heading + rule stay centred; the body block below sets its own width. */
.about__grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-inline: auto;
}
.about__grid .section__eyebrow { margin-bottom: var(--space-2); }
.about__grid .section__title { font-size: var(--step-3); margin-bottom: 0; }
.about__rule {
  display: block;
  width: 64px;
  height: 1px;
  background: var(--gold-line);
  margin: var(--space-4) 0 var(--space-5);
}

/* Portrait (left) + text (right, left-aligned) as one centred block spanning
   3/5 of the page width. */
.about__body {
  display: flex;
  align-items: flex-start; /* text starts at the top edge of the photo */
  gap: var(--space-5);
  width: 60%;
  margin-inline: auto;
  text-align: left;
}
.about__portrait {
  /* Half of the (centred) 60% block, so the photo's right edge lands exactly
     on the page centre; the text begins just past centre. */
  flex: 0 0 50%;
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--gold-line);
}
.about__portrait img { width: 100%; display: block; }
.about__text { flex: 1 1 auto; }
.about__text p { color: var(--text-muted); }
/* Optional per-paragraph subtitle (a small serif heading above a paragraph). */
.about__subtitle {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 400;
  color: var(--text);
  line-height: 1.2;
  margin: var(--space-3) 0 var(--space-1);
}
.about__subtitle:first-child { margin-top: 0; }

/* Narrow screens: stack the block, centre it, use the full width. */
@media (max-width: 900px) {
  .about__body {
    flex-direction: column;
    align-items: center;
    width: 100%;
    text-align: center;
    gap: var(--space-4);
  }
  .about__portrait { flex: 0 0 auto; width: clamp(160px, 60vw, 240px); }
}

/* ---- Contact — luxe close with a large CTA ---------------- */
.section--contact { text-align: center; }
.section--contact .section__head { margin-bottom: var(--space-5); }
.section--contact .section__title { font-size: var(--step-3); }

/* Page headings on Work, Master Studies, A studio practice and Contact match
   the work-detail title (.work__title): same family (Fraunces), pinned optical
   size and lighter 300 weight, and the same ~step-3*0.75 size — so they read
   as one and the same type treatment. Placed after the per-page rules above so
   it wins the font-size. (Home carousel heading is untouched.) */
.section--work .section__head .section__title,
.about__grid .section__title,
.section--contact .section__title {
  font-weight: 300;
  font-variation-settings: "opsz" 17, "wght" 300;
  font-size: calc(var(--step-3) * 0.75);
}

.contact__grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
}

/* Commission block: the large, elegant call to action. */
.commission { order: -1; max-width: 44ch; }

/* ---- Contact form (Web3Forms) ---------------------------- */
.contact-form {
  width: 100%;
  max-width: 34rem;
  margin-inline: auto;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.contact-form__row { display: flex; gap: var(--space-3); }
.contact-form__row .contact-form__field { flex: 1 1 0; min-width: 0; }
.contact-form__field { display: flex; flex-direction: column; gap: 0.35rem; }
.contact-form__label {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.contact-form__input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.contact-form__input:hover { border-color: var(--gold-line); }
.contact-form__input:focus-visible {
  outline: none;
  border-color: var(--gold-line);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.contact-form__textarea { resize: vertical; min-height: 6.5rem; }
/* Honeypot — visually and from AT hidden, but still fillable by bots. */
.contact-form__hp {
  position: absolute !important;
  left: -9999px; width: 1px; height: 1px; opacity: 0;
}
.contact-form__consent {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-muted);
}
.contact-form__consent input { margin-top: 0.2em; flex: 0 0 auto; }
.contact-form__privacy {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  color: var(--text-muted);
  margin: 0;
}
.contact-form__submit { align-self: flex-start; margin-top: var(--space-1); }

/* ---- Snackbar / toast (form feedback) -------------------- */
.toast-host {
  position: fixed;
  left: 50%;
  top: 22vh;                 /* upper third of the screen */
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: min(92vw, 30rem);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  line-height: 1.4;
  padding: 0.75rem 0.9rem 0.75rem 1.15rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--text);
  color: var(--bg);
  opacity: 0;
  transform: translateY(-12px); /* drops in from above */
  transition: opacity 260ms ease, transform 260ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast__msg { flex: 1 1 auto; }
.toast__close {
  flex: 0 0 auto;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 0.1em;
  margin: -0.25em -0.15em -0.25em 0;
  opacity: 0.75;
  transition: opacity var(--transition);
}
.toast__close:hover,
.toast__close:focus-visible { opacity: 1; }
.toast__close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 3px; }
.toast.is-ok  { background: #5b7d5e; color: #fff; }  /* muted green */
.toast.is-err { background: #b23b3b; color: #fff; }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 120ms linear; transform: none; }
  .toast.is-visible { transform: none; }
}

@media (max-width: 480px) {
  .contact-form__row { flex-direction: column; }
}

/* Intro paragraph sits directly above the form (spacing via the grid gap);
   holds one line or several. Contact otherwise uses the same section rhythm
   as every other page — the title starts at the same height. */
.commission p { margin-bottom: 0; }
.contact__grid { gap: var(--space-4); }
.commission h3 {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--step-3);
  margin-bottom: var(--space-3);
}
.commission p { color: var(--text-muted); margin-bottom: var(--space-4); }
.commission .btn--primary { font-size: var(--step--1); }

.contact__email {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-2);
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--gold-line);
  transition: color var(--transition), border-color var(--transition);
}
.contact__email:hover { color: var(--accent); border-color: var(--accent); }
.contact__grid > div > p { color: var(--text-muted); }

.social {
  list-style: none;
  display: flex;
  gap: var(--space-2);
  padding: 0;
  margin: var(--space-3) 0 0;
  justify-content: center;
}
.social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  transition: border-color var(--transition), color var(--transition);
}
.social a:hover { border-color: var(--accent); color: var(--accent); }
.social svg { width: 1.1rem; height: 1.1rem; }

/* ---- Scroll-reveal for content bands (About / Contact) ---- */
.about__grid.is-reveal-pending,
.contact__grid.is-reveal-pending {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 800ms cubic-bezier(0.22, 0.61, 0.36, 1),
              transform 800ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: opacity, transform;
}
.about__grid.is-reveal-in,
.contact__grid.is-reveal-in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .about__grid.is-reveal-pending,
  .contact__grid.is-reveal-pending {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---- Footer ----------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  /* Footer sits a touch shorter than the 4.5rem header (~61px vs ~73px). */
  padding-block: 1.25rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.08em;
}
/* Footer social icons (Instagram + Email) — sit where the note used to be. */
.site-footer__note {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.footer-social__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  transition: color var(--transition);
}
.footer-social__link:hover,
.footer-social__link:focus-visible { color: var(--accent); }
.footer-social__link svg { width: 22px; height: 22px; display: block; }

/* ---- Utility ---------------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.placeholder-note {
  font-size: var(--step--1);
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.02em;
}
