:root {
  color-scheme: light dark;
  --bg: light-dark(#fbf6ec, #140f17);
  --surface: light-dark(#fffdf8, #211a26);
  --text: light-dark(#241a1c, #f4ecdf);
  --muted: light-dark(#6b5a55, #b9aab4);
  --border: light-dark(#e8dac3, #3a2f40);
  --accent: light-dark(#a32638, #f0b64a);
  --on-accent: light-dark(#fff, #1b1220);
  --success: light-dark(#176b35, #7ddc9b);
  --error: light-dark(#b3261e, #ffa8a2);
  --gold: #e8b04b;

  /* Hero scene: dusk in light mode, night in dark mode */
  --sky-top: light-dark(#241d4f, #05061a);
  --sky-mid: light-dark(#8a3b63, #151a44);
  --sky-low: light-dark(#f08a4b, #34406f);
  --orb: light-dark(#ffd27a, #e8ecff);
  --far: light-dark(#5b3a63, #232a52);
  --water: light-dark(#6fd0cb, #4a8fb0);
  --mid: light-dark(#3d2a4d, #171c3a);
  --near: light-dark(#241a30, #0d1022);
  --front: light-dark(#120d1a, #05060f);
  --glow: light-dark(#ffcf6b, #ffc14d);

  --radius: .75rem;
  --space: 1rem;
  --shadow: 0 1px 2px #0000000f, 0 4px 12px #0000000a;
  --shadow-lift: 0 2px 4px #0000000f, 0 18px 36px #00000029;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; font-size: clamp(100%, .5rem + .55vw, 160%); }
body { background: var(--bg); color: var(--text); font: 1rem/1.6 system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
main, footer { width: min(100% - 2rem, 64rem); margin-inline: auto; }
main section { padding-block: 4rem; }
main h2 { text-align: center; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, min(10vw, 13svh), 6rem); line-height: 1; }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: var(--space); }
p { text-wrap: pretty; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hero { position: relative; isolation: isolate; overflow: hidden; height: 100svh; min-height: 40rem; color: #fff; background: var(--sky-top); }
.layer { position: absolute; inset: -2% -4%; width: 108%; height: 104%; pointer-events: none;
  transform: translate3d(calc(var(--mx, 0) * var(--d) * -36px), calc(var(--sy, 0) * (1 - var(--d)) * .45px + var(--my, 0) * var(--d) * -14px), 0); }
.land { top: auto; bottom: -2%; height: 54%; }
.sky { background: linear-gradient(var(--sky-top), var(--sky-mid) 45%, var(--sky-low) 75%); }
.orb { position: absolute; left: 78%; top: 5%; width: clamp(3rem, 8vw, 7rem); aspect-ratio: 1; border-radius: 50%; background: var(--orb); box-shadow: 0 0 80px 24px color-mix(in srgb, var(--orb) 45%, transparent); }
.hero-copy { position: relative; display: grid; justify-items: center; gap: .6rem; width: min(100% - 2rem, 64rem); margin-inline: auto; min-height: 60svh; align-content: center; text-align: center; text-shadow: 0 2px 16px #0009; }
.hero-copy > p { max-width: 36rem; }
.tagline { color: #ffd98a; font-weight: 600; letter-spacing: .04em; }
.hero .btn { background: var(--gold); border-color: var(--gold); color: #1b1220; text-shadow: none; }
.hero .btn.ghost { background: #0004; color: #fff; }

/* Songket weave band */
.songket { height: 20px; background-color: #8f1f30;
  background-image: linear-gradient(45deg, var(--gold) 25%, transparent 25% 75%, var(--gold) 75%), linear-gradient(-45deg, var(--gold) 25%, transparent 25% 75%, var(--gold) 75%);
  background-size: 20px 20px; border-block: 3px solid #241a30; }

.stage { padding: 3rem 1rem; }
.stage > h2 { text-align: center; }
.track { display: grid; gap: 1.5rem; max-width: 40rem; margin-inline: auto; }
.panel { display: grid; justify-items: center; align-content: center; gap: .75rem; text-align: center; }
.panel svg { width: min(100%, 34rem); max-height: 48svh; background: linear-gradient(#f6c78f, #f9e6c4); border: 2px solid var(--gold); border-radius: 12rem 12rem var(--radius) var(--radius); transition: scale .4s, rotate .4s; --near: #2c1d24; --glow: #ffcf6b; }
.panel svg:hover { scale: 1.03; rotate: -1deg; }
.panel p { max-width: 30rem; color: var(--muted); }

/* Vertical scroll drives a sideways walk */
.motion .journey { height: 300vh; }
.motion .stage { position: sticky; top: 0; display: grid; grid-template-rows: auto 1fr; height: 100svh; overflow: hidden; padding-inline: 0; }
.motion .track { grid-template-columns: repeat(3, 1fr); gap: 0; width: 300%; max-width: none; margin: 0; transform: translateX(calc(var(--p, 0) * -66.6667%)); }
.motion .panel { padding-inline: 1rem; }

.actions, .filters, .tags, .links, footer, footer nav { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn, .pill { font: inherit; cursor: pointer; min-height: 44px; border: 1px solid var(--accent); border-radius: 999px; transition: translate .2s, scale .15s, box-shadow .2s, background-color .2s; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1.25rem; background: var(--accent); color: var(--on-accent); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: .6; cursor: wait; }
.pill { padding: .3rem 1rem; background: transparent; color: var(--text); border-color: var(--border); }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:hover, .pill:hover { translate: 0 -2px; box-shadow: var(--shadow-lift); }
.btn:active, .pill:active { scale: .96; }

.filters { justify-content: center; margin-bottom: 1.5rem; }
.grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.grid > .card { flex: 0 1 30rem; min-width: 0; }
.tags, .links { justify-content: center; }
.card { text-align: center; }
.card { display: flex; flex-direction: column; gap: .75rem; padding: 1.25rem; border: 1px solid var(--border); border-top: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); view-transition-class: card;
  background: radial-gradient(16rem circle at var(--x, -20rem) var(--y, -20rem), color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%), var(--surface);
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .15s, translate .25s, box-shadow .25s, border-color .25s; }
.card:hover, .card:focus-within { translate: 0 -6px; box-shadow: var(--shadow-lift); border-color: var(--accent); }
.card p { color: var(--muted); }
.tags { list-style: none; padding: 0; gap: .4rem; font-size: .8rem; }
.tags li { border: 1px solid var(--border); border-radius: 999px; padding: 0 .6rem; }
.links { margin-top: auto; }
.links a, footer a { display: inline-flex; align-items: center; min-height: 44px; }

form { display: grid; gap: var(--space); max-width: 32rem; margin-inline: auto; }
label { display: grid; gap: .25rem; }
input, textarea { font: inherit; width: 100%; padding: .6rem; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .2s, box-shadow .2s; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.honeypot { display: none; }
.spinner { display: none; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
[aria-busy="true"] .spinner { display: inline-block; }
.toast { text-align: center; margin-top: var(--space); font-weight: 600; }
.toast[data-type="success"] { color: var(--success); }
.toast[data-type="error"] { color: var(--error); }

footer { flex-direction: column; align-items: center; padding-block: 2rem; }
footer nav { justify-content: center; }
.cursor-glow { position: fixed; z-index: 2; top: 0; left: 0; width: 18rem; height: 18rem; margin: -9rem; border-radius: 50%; pointer-events: none; opacity: 0; background: radial-gradient(closest-side, #e8b04b33, transparent); translate: var(--cx, 0) var(--cy, 0); }
.pointer .cursor-glow { opacity: 1; }

@keyframes spin { to { transform: rotate(1turn); } }
@keyframes rise { from { opacity: 0; transform: translateY(1.5rem); } }
@keyframes appear { from { opacity: 0; scale: .9; } }
@keyframes progress { from { scale: 0 1; } }

@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: rise .7s ease-out both; }
  .hero-copy > :nth-child(2) { animation-delay: .1s; }
  .hero-copy > :nth-child(3) { animation-delay: .2s; }
  .hero-copy > :nth-child(4) { animation-delay: .3s; }
  .hero-copy > :nth-child(5) { animation-delay: .4s; }

  @supports (animation-timeline: view()) {
    main h2, .card, form { animation: appear linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
    body::before { content: ""; position: fixed; inset: 0 0 auto; height: 4px; z-index: 3; background: var(--gold); transform-origin: left; animation: progress linear; animation-timeline: scroll(); }
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0s !important; }
}
