/* =========================================================
   Illumina — light & water motion layer (prototype v2)
   Loads after style.css. Adds:
     · a scroll-driven sky (dawn → ocean → golden hour → sunset → night)
     · the sunrise hero scene and the sunset contact scene
     · wave dividers, cursor light, fog-lifting thumbnails,
       light-catching headings, wave underlines, button sheen
     · Day / Night themes with a sunrise/sunset switch
   ========================================================= */

:root {
  --amber: #ffaa00;
  --sun-orange: #f37a22;
  --teal: #00acc8;
  --sea-a: rgba(0, 172, 200, .10);
  --sea-b: rgba(0, 172, 200, 0);
  --glint: #ffd38a;
  --line: #00acc8;
  --spot: rgba(255, 170, 0, .55);
  --catch-a: #ffcf6e;
  --catch-b: #fff4d6;
  /* colour of the sunny glow in the sky (homepage: Illumina amber) */
  --glow-a: 255, 150, 40;
  --glow-b: 243, 122, 34;
  --glow-day-a: 255, 190, 90;
  --glow-day-b: 255, 170, 0;
  --accent-text: #ffc266;
  --wave-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='6' viewBox='0 0 20 6'%3E%3Cpath d='M0 3 Q5 0 10 3 T20 3' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
}

/* ---------- Sky (fixed, behind everything) ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, var(--sky-top, #04060d) 0%, var(--sky-mid, #0b1224) 55%, var(--sky-bot, #3b1c12) 100%);
}
/* The sunny glow sits in the middle of the screen and travels with you as you scroll */
.sky__glow {
  position: absolute; left: 50%; top: 50%; width: 160vw; height: 110vh; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(var(--glow-a), .552), rgba(var(--glow-b), .24) 45%, rgba(var(--glow-b), .072) 70%, transparent 100%);
  opacity: var(--sky-glow, .5);
}
.sky__stars { position: absolute; inset: 0; width: 100%; height: 100%; opacity: var(--stars, 0); }

/* ---------- Horizon scenes (sunrise hero, sunset contact) ---------- */
.horizon { position: relative; z-index: 1; pointer-events: none; }
/* overflow visible: glow and rays carry on past the scene and fade into the sky, with no box edge */
.horizon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.contact__card { position: relative; z-index: 2; }

.hero--sunrise { position: relative; padding-bottom: 0; }
.hero--sunrise .hero__inner { position: relative; z-index: 2; }
.horizon--rise {
  height: clamp(240px, 31.25vw, 500px);
  margin: clamp(-24px, -1vw, 0px) calc(-1 * var(--gutter)) 0;
}
/* The sunset scene has deeper water below the horizon (1600×720 scene),
   which gives the sun more scrolling time to set while it's on screen. */
.horizon--set {
  height: clamp(300px, 45vw, 650px);
  margin: -24px calc(-1 * var(--gutter)) 0;
}


.horizon--rise .horizon__rise { animation: sun-rise 2.8s cubic-bezier(.16, 1, .3, 1) .1s both; }
.horizon--rise .horizon__glow { animation: glow-in 3s ease-out .1s both; }
@keyframes sun-rise { from { transform: translateY(270px); } to { transform: none; } }
@keyframes glow-in { from { opacity: 0; } to { opacity: 1; } }

.horizon__line { fill: none; stroke: var(--line); stroke-linecap: round; }
.horizon--rise .horizon__line { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw 2.4s cubic-bezier(.65, 0, .35, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.glint { fill: var(--glint); opacity: 0; animation: glint var(--dur, 3s) ease-in-out var(--del, 0s) infinite; }
@keyframes glint { 0%, 100% { opacity: 0; } 50% { opacity: var(--o, .9); } }

/* ---------- Wave dividers between sections ---------- */
.wave-divider { position: relative; z-index: 1; height: 72px; pointer-events: none; }
.wave-divider svg { display: block; width: 100%; height: 100%; }
.wave-divider path { fill: none; stroke: var(--line); stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* Give the projects the same breathing room either side of its dividers as the FAQ divider has (.section padding) */
#case-study .cases { padding-top: 96px; padding-bottom: 96px; }

/* ---------- Cursor light ---------- */
.cursor-light {
  position: fixed; left: 0; top: 0; z-index: 2; pointer-events: none;
  width: 230px; height: 230px; margin: -115px 0 0 -115px; border-radius: 50%;
  /* one soft disc of light (no faint outer halo), fading out at its own edge */
  background: radial-gradient(closest-side, rgba(255, 176, 60, .15), rgba(255, 166, 54, .11) 45%, rgba(255, 150, 45, .04) 80%, transparent 100%);
  mix-blend-mode: screen; opacity: 0; transition: opacity .6s; will-change: transform;
}
.cursor-light.is-on { opacity: 1; }

/* Case cards: frosted glass, so the sunny glow shines softly through them */
.case__card {
  background: rgba(20, 20, 20, .72);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  overflow: clip;   /* clip the glow without making the card scrollable (focus could shift its contents up) */
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .case__card { background: rgba(20, 20, 20, .9); }
}

/* Case cards: a rim of light follows the pointer */
.case__card::before, .case__card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .4s;
}
.case__card::before { z-index: -1; background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 170, 0, .07), transparent 45%); }
.case__card::after {
  padding: 1px;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.case__card:hover::before, .case__card:hover::after { opacity: 1; }

/* ---------- Fog lifting: thumbnails come into focus ---------- */
.js-fog .case__side > a { display: block; position: relative; overflow: hidden; border-radius: 8px; }
.js-fog .case__img {
  filter: blur(12px) saturate(.35) brightness(.65); transform: scale(1.05);
  transition: filter 1.4s cubic-bezier(.22, 1, .36, 1), transform 1.6s cubic-bezier(.22, 1, .36, 1);
}
.js-fog .is-clear .case__img { filter: none; transform: none; }
.js-fog .case__side > a::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 214, 140, .45) 50%, transparent 65%);
  transform: translateX(-120%); mix-blend-mode: screen;
}
.js-fog .case__side > a.is-clear::after { animation: sweep 1.4s cubic-bezier(.45, 0, .2, 1) .35s both; }
@keyframes sweep { to { transform: translateX(120%); } }

/* ---------- Headings catch the light once ---------- */
.catch {
  background-image: linear-gradient(100deg, var(--text) 0 42%, var(--catch-a) 48%, var(--catch-b) 50%, var(--catch-a) 52%, var(--text) 58% 100%);
  background-size: 300% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.catch.is-lit { animation: catch 1.8s cubic-bezier(.45, 0, .2, 1) .2s forwards; }
@keyframes catch { to { background-position: 0 0; } }

/* ---------- Wave underlines on links ---------- */
.nav__links a:not(.btn), .contact__links a, .footer__links a { position: relative; }
.nav__links a:not(.btn)::after, .contact__links a::after, .footer__links a::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 6px;
  background: currentColor;
  -webkit-mask: var(--wave-mask) repeat-x 0 0 / 20px 6px; mask: var(--wave-mask) repeat-x 0 0 / 20px 6px;
  opacity: 0; transform: translateY(3px); transition: opacity .25s, transform .25s;
}
.contact__links a::after, .footer__links a::after { left: 0; right: 0; bottom: -7px; }
.nav__links a:not(.btn)::after, .contact__links a::after, .footer__links a::after { background: var(--line); }   /* link waves in the logo's sea blue */
.nav__links a:not(.btn):hover::after, .contact__links a:hover::after, .footer__links a:hover::after {
  opacity: 1; transform: none; animation: wave-run 2.2s linear infinite;
}
@keyframes wave-run { to { -webkit-mask-position: 20px 0; mask-position: 20px 0; } }

/* The "See my work" running light is now sunlight */
.btn-run::before {
  background: conic-gradient(from var(--angle), transparent 0deg, transparent 250deg, rgba(255, 170, 0, 0) 270deg, #ffe2a6 320deg, #ffaa00 340deg, transparent 360deg);
}

/* Nav logo 20% smaller, keeping its left edge and vertical centre in place */
.nav__logo img { transform: scale(.8); transform-origin: 0 50%; }

/* FAQ chevrons follow the text colour (needed for Day) */
.faq__chev { color: var(--text); }
.faq__chev path { stroke: currentColor; }

/* ---------- Day / Night switch ---------- */
.nav__end { display: flex; align-items: center; gap: 10px; }
.sky-toggle {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px var(--border); color: var(--text);
  transition: box-shadow .25s, background .25s;
}
.sky-toggle:hover { background: rgba(255, 170, 0, .08); box-shadow: inset 0 0 0 1px rgba(255, 170, 0, .5); }
.sky-toggle svg { width: 24px; height: 24px; overflow: visible; }
.st-sun, .st-moon { transform-box: view-box; transition: transform .8s cubic-bezier(.65, 0, .35, 1); }
[data-theme="night"] .st-sun { transform: translateY(13px); }
[data-theme="day"] .st-moon { transform: translateY(13px); }
/* The whole nav arrives with the logo: same zoom, same moment */
.sky-toggle, .nav__toggle { animation: zoom-in-nav .7s cubic-bezier(.22, 1, .36, 1) .5s both; }
@media (min-width: 810px) {
  .nav__links { animation: none; }
  .nav__links > * { animation: zoom-in-nav .7s cubic-bezier(.22, 1, .36, 1) .5s both; }
}
@media (prefers-reduced-motion: reduce) { .sky-toggle, .nav__toggle, .nav__links > * { animation: none; } }

/* Theme switch: the new sky spreads out from the button (see JS) */
html.is-theme-switch::view-transition-old(root),
html.is-theme-switch::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* =========================================================
   DAY theme
   ========================================================= */
[data-theme="day"] {
  --black: #f7f2ea;
  --card: #ffffff;
  --tile: #ffffff;
  --text: #1d2733;
  --text-muted: #4d5a66;
  --text-strong: #111821;
  --highlight: #d97a00;
  --border: rgba(15, 21, 31, .14);
  --sea-a: rgba(0, 140, 170, .16);
  --sea-b: rgba(0, 140, 170, 0);
  --glint: #ffffff;
  --line: #0097b2;
  --spot: rgba(243, 122, 34, .6);
  --catch-a: #f37a22;
  --catch-b: #ffaa00;
}
[data-theme="day"] .sky__glow { background: radial-gradient(closest-side, rgba(var(--glow-day-a), .72), rgba(var(--glow-day-b), .24) 45%, rgba(var(--glow-day-b), .06) 70%, transparent 100%); }
[data-theme="day"] .noise { opacity: .045; }
[data-theme="day"] .cursor-light { mix-blend-mode: multiply; background: radial-gradient(closest-side, rgba(255, 196, 120, .28), rgba(255, 196, 120, .2) 45%, rgba(255, 196, 120, .07) 80%, transparent 100%); }
[data-theme="day"] .nav__links a:not(.btn):hover { color: #000; }
[data-theme="day"] .lead-in,
[data-theme="day"] .statement__row .a { color: var(--text-strong); }
[data-theme="day"] .pill-wrap { background: #fff; }
[data-theme="day"] .pill { background-image: linear-gradient(100deg, #5b6570 30%, #000 50%, #5b6570 70%); }
[data-theme="day"] .btn-run { color: var(--text-strong); background: #fff; }
[data-theme="day"] .btn-run::after { background: #fff; }
/* Buttons wear the brand blue in both themes (the logo's #00acc8, deepened so white text passes AA) */
.btn:not(.btn--ghost) { background: #007b91; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 1px 3px rgba(0,0,0,.25); }
.btn:not(.btn--ghost):hover { background: #006f84; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 4px 18px rgba(0,172,200,.25); }
[data-theme="day"] .btn:not(.btn--ghost) { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 1px 3px rgba(0,80,95,.18); }
[data-theme="day"] .btn:not(.btn--ghost):hover { box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 4px 16px rgba(0,100,120,.25); }
/* Hero: "See my work" leads, so "Let's talk" steps back to a blue outline */
.hero__ctas .btn { color: #7fdcec; background: rgba(0,172,200,.06); box-shadow: inset 0 0 0 1.5px #00a3bd; }
.hero__ctas .btn:hover { color: #fff; background: #007b91; box-shadow: inset 0 0 0 1.5px #007b91, 0 4px 18px rgba(0,172,200,.25); }
[data-theme="day"] .hero__ctas .btn { color: #006f84; background: rgba(255,255,255,.35); box-shadow: inset 0 0 0 1.5px #007b91; }
[data-theme="day"] .hero__ctas .btn:hover { color: #fff; background: #007b91; box-shadow: inset 0 0 0 1.5px #007b91, 0 4px 16px rgba(0,100,120,.22); }
[data-theme="day"] .tag { border-color: rgba(0, 0, 0, .14); background: rgba(0, 0, 0, .03); }
[data-theme="day"] .case__card { background: rgba(255, 255, 255, .7); box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, inset 0 0 0 1px rgba(255, 255, 255, .5), 0 24px 60px rgba(80, 50, 10, .08); }
[data-theme="day"] .case__glow { opacity: .3; }
[data-theme="day"] .case__card::before { background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 170, 0, .12), transparent 45%); }
[data-theme="day"] .tool__tile { box-shadow: inset 0 0 0 1px var(--border); }
[data-theme="day"] .tool__label { background: #1d2733; color: #fff; }
[data-theme="day"] .rings circle { stroke: rgba(0, 0, 0, .08); }
[data-theme="day"] .quote__logo img { filter: brightness(0); opacity: .72; }
[data-theme="day"] .skill { background: #fff; }
[data-theme="day"] .contact__title { background-image: linear-gradient(90deg, #8a96a3 0%, #1d2733 25%, #000 45%, #1d2733 60%, #8a96a3 100%); }
[data-theme="day"] .js-fog .case__img { filter: blur(12px) saturate(.4) brightness(1.15); }
[data-theme="day"] .js-fog .is-clear .case__img { filter: none; }
@media (max-width: 809.98px) {
  [data-theme="day"] .nav__links { background: rgba(255, 255, 255, .96); }
}

/* ---------- Phone ---------- */
@media (max-width: 809.98px) {
  .nav__end { gap: 6px; }
  .sky-toggle { order: 1; }
  .nav__toggle { order: 2; }
  .wave-divider { height: 52px; }
  #case-study .cases { padding-top: 88px; padding-bottom: 88px; }
  .horizon--rise { margin-top: 28px; }
}

/* ---------- Reduced motion: everything rests in its final state ---------- */
@media (prefers-reduced-motion: reduce) {
  .glint { animation: none; }
  .glint { opacity: calc(var(--o, .9) * .6); }
  .horizon--rise .horizon__line { stroke-dasharray: none; }
}

/* =========================================================
   Project pages
   ========================================================= */

/* Each project page steps into its own colour of light.
   Set on <body data-sky="…">; the matching sky colours live in illumina-light.js. */
body[data-sky="green"] {
  --glow-a: 130, 201, 94;  --glow-b: 96, 170, 82;
  --glow-day-a: 160, 215, 120;  --glow-day-b: 120, 190, 90;
  --accent-text: #a6dc86;
}
[data-theme="day"] body[data-sky="green"] { --accent-text: #33661f; }
body[data-sky="purple"] {   /* AI-Powered Documentation — #ba8ad6 */
  --glow-a: 186, 138, 214;  --glow-b: 150, 100, 190;
  --glow-day-a: 205, 165, 230;  --glow-day-b: 170, 120, 210;
  --accent-text: #cfa8e6;
}
[data-theme="day"] body[data-sky="purple"] { --accent-text: #6e3594; }
body[data-sky="blue"] {     /* Usage Visibility — #0f6499 */
  --glow-a: 50, 145, 215;  --glow-b: 15, 100, 153;
  --glow-day-a: 110, 175, 230;  --glow-day-b: 45, 135, 205;
  --accent-text: #7fc3ee;
}
[data-theme="day"] body[data-sky="blue"] { --accent-text: #0c5687; }
body[data-sky="orange"] {   /* Design System — #d48740 */
  --glow-a: 222, 145, 70;  --glow-b: 190, 110, 50;
  --glow-day-a: 240, 180, 110;  --glow-day-b: 215, 140, 70;
  --accent-text: #f0b27a;
}
[data-theme="day"] body[data-sky="orange"] { --accent-text: #7f400c; }

/* Results that count up */
.count { color: var(--accent-text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Role / Tools / Year in a frosted-glass panel */
.cs-meta {
  align-self: flex-start; padding: 24px 26px; border-radius: 20px;
  background: rgba(20, 20, 20, .5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
  -webkit-backdrop-filter: blur(24px) saturate(1.2); backdrop-filter: blur(24px) saturate(1.2);
}
[data-theme="day"] .cs-meta { background: rgba(255, 255, 255, .6); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), 0 18px 40px rgba(40, 60, 20, .06); }

/* Images come into focus as they scroll into view */
.js-fog .cs-img {
  filter: blur(14px) saturate(.4) brightness(.7); transform: scale(1.02);
  transition: filter 1.4s cubic-bezier(.22, 1, .36, 1), transform 1.6s cubic-bezier(.22, 1, .36, 1);
}
.js-fog .cs-img.is-clear { filter: none; transform: none; }
[data-theme="day"] .js-fog .cs-img:not(.is-clear) { filter: blur(14px) saturate(.4) brightness(1.15); }

/* End of the page: the next project's sun rises behind the link */
.cs-next { position: relative; padding-bottom: 0; }
.cs-next .btn { position: relative; z-index: 2; }
.cs-next__label { display: block; margin-bottom: 18px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.horizon--next { height: clamp(200px, 26vw, 400px); margin: -10px calc(-1 * var(--gutter)) 0; }

/* Between pages: a soft wave washes the new page in (replaces the straight wipe) */
@keyframes wave-in { from { -webkit-mask-position: 0 100%; mask-position: 0 100%; } to { -webkit-mask-position: 0 0; mask-position: 0 0; } }
::view-transition-new(root) {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 200' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V96C88 103 75 89 62 96S38 103 25 96 10 89 0 96Z' fill='%23000'/%3E%3C/svg%3E") no-repeat 0 100% / 100% 220%;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 200' preserveAspectRatio='none'%3E%3Cpath d='M0 0H100V96C88 103 75 89 62 96S38 103 25 96 10 89 0 96Z' fill='%23000'/%3E%3C/svg%3E") no-repeat 0 100% / 100% 220%;
  animation: wave-in .8s cubic-bezier(.65, 0, .35, 1) both;
}
html.is-theme-switch::view-transition-new(root) { -webkit-mask: none; mask: none; }

@media (max-width: 809.98px) {
  .cs-meta { align-self: stretch; padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .js-fog .cs-img { filter: none; transform: none; }
}

/* ---------- Sections surface as you scroll ----------
   A softer, longer fade with a gentle rise, like things coming into the light. */
.reveal {
  transform: translateY(32px);
  transition: opacity 1s cubic-bezier(.22, 1, .36, 1) var(--d, 0s), transform 1.2s cubic-bezier(.22, 1, .36, 1) var(--d, 0s);
}
.reveal--rise { transform: translateY(16px); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal--rise { opacity: 1; transform: none; transition: none; }
}

/* Lower homepage sections fade up piece by piece (classes added by JS) */
.has-fade.reveal { opacity: 1; transform: none; transition: none; }
.fade-up {
  opacity: 0; transform: translateY(28px);
  transition: opacity .9s cubic-bezier(.22, 1, .36, 1) var(--fd, 0s), transform 1.1s cubic-bezier(.22, 1, .36, 1) var(--fd, 0s);
}
.fade-up.is-up { opacity: 1; transform: none; }
