/* ==========================================================================
   Scroll motion — fade-ins, reveals and parallax
   Accessible by design:
   • Content is fully visible unless JS has confirmed motion is OK (html.motion).
   • prefers-reduced-motion and the on-page "Reduce motion" toggle switch it all off.
   • Nothing is hidden from screen readers; keyboard focus reveals content instantly.
   ========================================================================== */

:root {
  --m-ease: cubic-bezier(.33, 0, .2, 1);  /* gentle in, long soft settle */
  --m-dur: 1200ms;
  --m-shift: 6px;                          /* barely-there lift; the fade does the work */
  /* Brand kit 2025 */
  --accent: #825200;   /* Cognac — 6.4:1 on Cream */
  --amber: #a86a00;    /* Amber — accents on dark */
  --ink: #0d0d0d;
  --paper: #fafaf7;
}

/* ---- Fade up ---- */
html.motion [data-m="fade"] {
  opacity: 0;
  transform: translate3d(0, var(--m-shift), 0);
  transition: opacity var(--m-dur) var(--m-ease), transform var(--m-dur) var(--m-ease);
  transition-delay: var(--m-delay, 0ms);
}

/* ---- Headings and images: a pure, slightly slower fade (no wipe, no movement) ---- */
html.motion [data-m="reveal"] {
  opacity: 0;
  transition: opacity calc(var(--m-dur) * 1.4) var(--m-ease);
  transition-delay: var(--m-delay, 0ms);
}

html.motion [data-m].is-in {
  opacity: 1;
  transform: none;
}

/* ---- Parallax images: a little extra room so movement never shows an edge ---- */
html.motion img[data-parallax] {
  transform: translate3d(0, var(--py, 0px), 0) scale(var(--ps, 1.08));
  will-change: transform;
}

/* ---- Belt and braces: the OS setting always wins, even if JS misjudges it ---- */
@media (prefers-reduced-motion: reduce) {
  html.motion [data-m] { opacity: 1 !important; transform: none !important; transition: none !important; }
  html.motion img[data-parallax] { transform: none !important; }
}

/* ==========================================================================
   Accessibility helpers
   ========================================================================== */

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 1000;
  padding: 12px 18px; background: var(--ink); color: var(--paper);
  font: 400 12px/1 "DM Mono:Regular", "DM Mono", ui-monospace, monospace;
  letter-spacing: .12em; text-transform: uppercase;
  transition: top .15s;
}
.skip-link:focus { top: 16px; }

/* two-tone ring stays visible on both Cream and Ink sections */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; box-shadow: 0 0 0 5px var(--paper); border-radius: 2px; }
#main:focus { outline: none; }

/* Reduce-motion toggle: small, quiet, keyboard and screen-reader friendly */
.motion-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 900;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: rgba(250, 250, 247, .92); color: var(--ink);
  border: 1px solid rgba(21, 13, 0, .18); border-radius: 999px;
  font: 400 12px/1 "DM Mono:Regular", "DM Mono", ui-monospace, monospace;
  letter-spacing: .12em; text-transform: uppercase; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: .8; transition: opacity .2s;
}
.motion-toggle:hover, .motion-toggle:focus-visible { opacity: 1; }
.motion-toggle .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}
.motion-toggle[aria-pressed="true"] .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
@media print { .motion-toggle, .skip-link { display: none; } }

@media print { html.motion [data-m] { opacity: 1 !important; transform: none !important; } }

/* Mobile menu */
[data-menu][hidden] { display: none !important; }
html.motion #mobile-menu.menu-in { animation: mf-menu-in .5s var(--m-ease) both; }
@keyframes mf-menu-in { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   Project-page buttons — one shared style (outline; current tab filled)
   ========================================================================== */
.mf-btns { display: inline-flex; flex-wrap: wrap; justify-content: center; flex-shrink: 0; max-width: 100%; position: relative; padding-top: 1px; }
.mf-btn {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; margin: 0;
  font: 400 15px/1 "DM Mono:Regular", "DM Mono", ui-monospace, monospace;
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; text-decoration: none;
  color: #150d00; background: transparent; border: 1px solid #150d00; cursor: pointer;
  transition: background-color .5s var(--m-ease), color .5s var(--m-ease);
}
.mf-btns .mf-btn { margin-top: -1px; }
.mf-btns .mf-btn + .mf-btn { margin-left: -1px; }
.mf-btn.is-active, .mf-btn:hover { background: #150d00; color: #f2ede6; }
@media (max-width: 480px) { .mf-btn { min-height: 44px; padding: 0 11px; font-size: 12px; letter-spacing: .04em; } }
@media (prefers-reduced-motion: reduce) { .mf-btn { transition: none; } }
.mf-btn.is-disabled, .mf-btn.is-disabled:hover { cursor: default; background: transparent; color: rgba(21, 13, 0, .45); }

/* About hero collage (desktop): run the photos to the right edge of the section.
   The portrait takes the extra width (it crops cleanly); the two right-hand photos keep
   Figma's crop because their files carry built-in padding. */
@media (min-width: 1280px) {
  [data-collage="d"] { margin-right: calc((1280px - 100vw) / 2); }
  [data-collage="d"] > :first-child { flex: 1 1 auto !important; width: auto !important; }
  [data-collage="d"] > :first-child img { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; object-fit: cover; }
}


.mf-btn--solid { background: #150d00; color: #f2ede6; }
.mf-btn--solid:hover { background: #3a2a14; }

/* Light variant of the shared button, for dark/colour bands */
.mf-btn--light { color: #fff; border-color: #fff; }
.mf-btn--light:hover { background: #fff; color: #3e4e88; }

/* Work → Prism Collective: larger, right-aligned type that balances the laptop on the left */
[data-prism] { align-items: flex-end !important; text-align: right; gap: 28px !important; }
[data-prism] > :nth-child(2) { width: auto !important; max-width: 470px; }
[data-prism] > :nth-child(2), [data-prism] > :nth-child(2) * { text-align: right !important; white-space: normal !important; }
[data-prism] .mf-btn { margin-top: 6px; }
[data-prism="d"] { left: auto !important; right: calc((100% - 1280px) / 2 + 33px); }   /* lines up with the nav's right edge */
[data-prism="d"] > :first-child, [data-prism="d"] > :first-child * { font-size: 68px !important; }
[data-prism="d"] > :nth-child(2), [data-prism="d"] > :nth-child(2) * { font-size: 24px !important; line-height: 1.4 !important; }
[data-prism="t"] { width: 460px !important; right: 40px !important; }
[data-prism="t"] > :first-child, [data-prism="t"] > :first-child * { font-size: 56px !important; }
[data-prism="t"] > :nth-child(2), [data-prism="t"] > :nth-child(2) * { font-size: 21px !important; line-height: 1.4 !important; }
[data-prism="m"] { align-items: center !important; text-align: center; }
[data-prism="m"] > :nth-child(2), [data-prism="m"] > :nth-child(2) * { text-align: center !important; font-size: 19px !important; line-height: 1.4 !important; }
[data-prism="m"] > :first-child, [data-prism="m"] > :first-child * { font-size: 48px !important; }
[data-prism] > :nth-child(2), [data-prism] > :nth-child(2) * { text-wrap: balance; }

/* ==========================================================================
   Fluid, scroll-linked fades (browsers with scroll-driven animations:
   Chrome / Edge / Arc / Safari 26+). Opacity follows the scroll position
   continuously — content brightens as it rises into view, with no timers or
   stagger. Other browsers keep the timed fades above.
   ========================================================================== */
@supports (animation-timeline: view()) {
  html.motion.sd [data-m] {
    opacity: 1; transition: none !important;
    animation: mf-rise linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 200px;   /* same 200px of scroll for every element, whatever its size */
  }
  html.motion.sd [data-m="reveal"] { animation-name: mf-fade; }
  @keyframes mf-rise { from { opacity: 0; transform: translate3d(0, var(--m-shift), 0); } to { opacity: 1; transform: none; } }
  @keyframes mf-fade { from { opacity: 0; } to { opacity: 1; } }
  /* a photo that hasn't finished downloading waits, then fades in on its own */
  html.motion.sd [data-m] img { transition: opacity .8s var(--m-ease); }
  html.motion.sd [data-m] img:not([data-loaded]) { opacity: 0; }
  /* whatever is on screen when the page opens eases in once */
  html.motion.sd #container { animation: mf-fade .9s var(--m-ease) both; }
}

/* ---- Contrast fixes (WCAG AA). Colors only; no layout changes. ---- */
/* nav links on cream: gray #8E8E93 (3.1:1) -> #6E6E73 (4.9:1) */
#container [role="banner"] .css-391gwe { color: #6e6e73; -webkit-text-fill-color: #6e6e73; }
/* current-page nav link on cream: Amber (4.2:1) -> Cognac #825200 (6.4:1) */
#container [role="banner"] .css-eivqeq { color: #825200; -webkit-text-fill-color: #825200; }
/* home hero role labels on #150D00: Amber (4.3:1) -> light gold #C08A2A (6.3:1) */
#container .css-eivqeq { color: #c08a2a; -webkit-text-fill-color: #c08a2a; }
#container [role="banner"] .css-eivqeq { color: #825200; -webkit-text-fill-color: #825200; }
/* gold buttons ("View My Work", "Get in touch"): cream on Amber (4.2:1) -> cream on Cognac (6.4:1) */
#container .css-8o5qq7 { background-color: #825200; }
/* About 01 / 02 / 03 numerals: #AEAEB2 (1.9:1) -> #86868B (3.1:1, large text) */
#container .css-2cvmsa { color: #86868b; -webkit-text-fill-color: #86868b; }

/* ==========================================================================
   Page-to-page transitions: a soft, muted dissolve (no white flash).
   Chrome / Edge / Arc / Safari 18.2+. Off with reduced motion or the toggle.
   ========================================================================== */
html { background: #fafaf7; }          /* never flash white/black between pages */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
/* outgoing page fades a touch faster than the new one arrives: less double-exposure */
::view-transition-old(root) { animation: mf-vt-out 420ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: mf-vt-in 700ms cubic-bezier(.2, 0, .2, 1) both; mix-blend-mode: normal; }
@keyframes mf-vt-out { to { opacity: 0; } }
@keyframes mf-vt-in { from { opacity: 0; } }
/* arriving by dissolve: the page is already composed, so skip the on-load fade */
html.vt #container { animation: none !important; visibility: visible !important; }
