/* ==========================================================================
   Depth layer: liquid glass, neomorphism, bento grid, purposeful motion.
   Loaded last. Brand rules still hold: only Nocturne tokens (plus alpha of
   them), square corners, Cormorant / Manrope / IBM Plex Mono. Nothing here
   adds a colour, a font or a rounded corner.
   ========================================================================== */

:root {
  /* Motion has a job. Fast = feedback, base = state change, slow = orientation. */
  --dur-fast: .16s;
  --dur: .35s;
  --dur-slow: .8s;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-press: cubic-bezier(.3, 0, .2, 1);

  /* Light and shadow for the dark ground: warm highlight from the top-left, plain black below-right. */
  --hi: rgba(227, 220, 203, .05);     /* --color-text at 5% */
  --hi-strong: rgba(244, 238, 224, .2); /* --color-accent-100 at 20% */
  --lo: rgba(0, 0, 0, .55);
  --glass-fill: linear-gradient(140deg, rgba(227, 220, 203, .075), rgba(227, 220, 203, .018) 55%, rgba(198, 178, 124, .04));
  --glass-edge: rgba(216, 199, 154, .24);   /* --color-accent-300 at 24% */
}

/* ---------- 1. Liquid glass ---------------------------------------------
   Translucent, blurred, with a specular edge and a highlight that follows
   the pointer. Used where a surface floats above content: masthead, the
   specimen record, dialogs, the lead panel, the featured tier. */
.glass, .record, dialog, .masthead.solid, .tier.featured, .lead-panel {
  position: relative;
}
.glass, .lead-panel, .tier.featured {
  background: var(--glass-fill), rgba(18, 17, 26, .55);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--hi-strong),          /* specular top edge */
    inset 1px 0 0 rgba(244, 238, 224, .07),
    inset 0 -1px 0 rgba(0, 0, 0, .45),
    0 24px 60px -28px var(--lo);
}
.glass::before, .lead-panel::before, .record::before {
  /* pointer-following sheen */
}
.glass > *, .lead-panel > * { position: relative; z-index: 1; }
.sheen {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity var(--dur) var(--ease-out);
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(244, 238, 224, .13), transparent 65%);
}
.glass:hover > .sheen, .lead-panel:hover > .sheen, .record:hover > .sheen { opacity: 1; }

.masthead.solid {
  background: linear-gradient(180deg, rgba(227, 220, 203, .06), rgba(12, 11, 18, .72));
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 -1px 0 rgba(216, 199, 154, .16), 0 10px 30px -18px var(--lo);
}
.record {
  background: var(--glass-fill), rgba(18, 17, 26, .5);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: inset 0 1px 0 var(--hi-strong), inset 0 0 0 4px rgba(12, 11, 18, .45), inset 0 0 0 5px var(--a800), 0 30px 80px -30px var(--lo);
}
.record > * { position: relative; z-index: 1; }
dialog {
  background: var(--glass-fill), rgba(18, 17, 26, .78);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--hi-strong), 0 40px 100px -30px #000;
}
dialog::backdrop { background: rgba(6, 5, 10, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.lead-panel { padding: clamp(22px, 3vw, 36px); }

/* ---------- 2. Neomorphism -----------------------------------------------
   Extruded and pressed surfaces on the same ground. Square-cornered, and
   used only where physical state helps: inputs are pressed IN (you put
   something there), toggles and buttons stand OUT and press in on click. */
input[type=text], input[type=email], textarea, select {
  background: rgba(12, 11, 18, .9);
  border: 1px solid transparent;
  box-shadow: inset 3px 3px 8px var(--lo), inset -2px -2px 6px var(--hi);
  transition: box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--a400);
  box-shadow: inset 4px 4px 10px var(--lo), inset -2px -2px 6px var(--hi), 0 0 0 3px rgba(198, 178, 124, .12);
}
.seg { border: 0; box-shadow: 5px 5px 14px var(--lo), -4px -4px 12px var(--hi); background: var(--surface); }
.seg button { transition: box-shadow var(--dur-fast) var(--ease-press), background var(--dur) var(--ease-out), color var(--dur) var(--ease-out); }
.seg button[aria-pressed=true] { background: rgba(12, 11, 18, .9); color: var(--a300); box-shadow: inset 3px 3px 8px var(--lo), inset -2px -2px 6px var(--hi); }
.btn.ghost {
  background: var(--surface);
  border-color: rgba(127, 106, 46, .55);
  box-shadow: 5px 5px 14px var(--lo), -4px -4px 12px var(--hi);
}
.btn:active, .btn.ghost:active { transform: translateY(1px); box-shadow: inset 3px 3px 8px var(--lo), inset -2px -2px 6px var(--hi); transition-duration: var(--dur-fast); }
.btn:not(.ghost) { box-shadow: 5px 5px 14px var(--lo), -3px -3px 10px var(--hi); }
.step-n, .p-code {
  display: inline-grid; place-items: center;
  background: var(--surface); box-shadow: 4px 4px 10px var(--lo), -3px -3px 8px var(--hi);
}
.step-n { width: 76px; height: 76px; font-size: 40px; color: var(--a600); margin-bottom: 20px; }
.chip { box-shadow: inset 2px 2px 5px var(--lo), inset -1px -1px 4px var(--hi); border-color: transparent; }
.status i { box-shadow: 0 0 0 3px var(--surface), 2px 2px 6px var(--lo); }
.check input { box-shadow: 2px 2px 5px var(--lo), -1px -1px 4px var(--hi); }

/* ---------- 3. Bento grid -----------------------------------------------
   Tiles of different weights on one 6-column grid. The biggest tile is the
   one that should be read first. Hairline gaps keep the Nocturne look. */
.bento {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: minmax(150px, auto); gap: 1px;
  background: var(--divider); border: 1px solid var(--divider);
}
.bento > .card { background: var(--bg); min-width: 0; }
.band .bento > .card { background: var(--surface); }
.bento .card:hover { background: #16141e; }
/* platforms */
.bento.platforms > :nth-child(1) { grid-column: 1 / span 3; grid-row: span 2; }
.bento.platforms > :nth-child(2) { grid-column: 4 / span 3; }
.bento.platforms > :nth-child(3) { grid-column: 4 / span 3; }
.bento.platforms > :nth-child(4) { grid-column: 1 / span 2; }
.bento.platforms > :nth-child(5) { grid-column: 3 / span 4; }
.bento.platforms > :nth-child(6) { grid-column: 1 / -1; }
.bento.platforms > :nth-child(1) h3 { font-size: clamp(40px, 5vw, 64px); line-height: 1; margin-bottom: 10px; }
.bento.platforms > :nth-child(1) p { font-size: 16px; }
.bento.platforms > :nth-child(1) { background: linear-gradient(160deg, rgba(43, 37, 19, .55), var(--surface) 60%); }
.bento.platforms > :nth-child(5) { background: linear-gradient(200deg, rgba(43, 37, 19, .4), var(--surface) 65%); }
.bento.platforms > :nth-child(6) { flex-direction: row; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.bento.platforms > :nth-child(6) .more { margin-top: 0; padding-top: 0; }
.bento.platforms > :nth-child(6) p { margin: 0; }
/* problem */
.bento.cost > :nth-child(1) { grid-column: 1 / span 3; grid-row: span 2; }
.bento.cost > :nth-child(2) { grid-column: 4 / span 3; }
.bento.cost > :nth-child(3) { grid-column: 4 / span 3; }
.bento.cost > :nth-child(1) h3 { font-size: clamp(34px, 4vw, 52px); line-height: 1.05; }
.bento.cost > :nth-child(1) p { font-size: 16px; max-width: 34ch; }
/* loop */
.bento.loop > :nth-child(1) { grid-column: 1 / span 2; }
.bento.loop > :nth-child(2) { grid-column: 3 / span 2; }
.bento.loop > :nth-child(3) { grid-column: 5 / span 2; }
.bento.loop > :nth-child(4) { grid-column: 1 / -1; }
.bento.loop > :nth-child(4) { flex-direction: row; gap: 28px; align-items: center; }
.bento.loop > :nth-child(4) .step-n { margin: 0; flex: none; }

/* ---------- 4. Purposeful motion ----------------------------------------
   Every moving thing answers one of: where am I, what changed, what can I
   do, or which way does this flow. Nothing moves just to move. */

/* Where am I: reading progress along the masthead, and the current section in the nav. */
.progress {
  position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%; transform-origin: left; transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--a700), var(--a300)); transition: transform var(--dur-fast) linear; pointer-events: none;
}
#nav a.here { color: var(--a300); }
#nav a.here::after { transform: scaleX(1); }

/* What can I do: affordances answer the pointer, quickly. */
.card, .linklist a, .offers li, .spine li, .tbl tbody tr { transition-duration: var(--dur); transition-timing-function: var(--ease-out); }
.card .more span, .btn span { transition: transform var(--dur) var(--ease-out); }
.plate .asks, .plate .chip { transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
@media (hover: hover) {
  .bento .plate .asks { opacity: .72; }
  .bento .plate:hover .asks, .bento .plate:focus-within .asks { opacity: 1; transform: translateX(3px); }
}

/* Which way does this flow: evidence rises through the Spine, one plane after another. */
.spine.flow li { opacity: .35; transition: opacity var(--dur-slow) var(--ease-out); transition-delay: calc((7 - var(--k, 0)) * 110ms); }
.spine.flow.in li { opacity: 1; }
.spine li:nth-child(1) { --k: 0; } .spine li:nth-child(2) { --k: 1; } .spine li:nth-child(3) { --k: 2; } .spine li:nth-child(4) { --k: 3; }
.spine li:nth-child(5) { --k: 4; } .spine li:nth-child(6) { --k: 5; } .spine li:nth-child(7) { --k: 6; } .spine li:nth-child(8) { --k: 7; }

/* What changed: a confirmed form announces itself with one gentle rise, not a flourish. */
.done.show { animation: rise var(--dur-slow) var(--ease-out); }

@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento > .card, .bento.platforms > .card, .bento.cost > .card, .bento.loop > .card { grid-column: auto !important; grid-row: auto !important; }
  .bento.platforms > :nth-child(1), .bento.platforms > :nth-child(6), .bento.cost > :nth-child(1), .bento.loop > :nth-child(4) { grid-column: 1 / -1 !important; }
}
@media (max-width: 600px) {
  .bento { grid-template-columns: 1fr; }
  .bento > .card, .bento.platforms > :nth-child(n), .bento.cost > :nth-child(n), .bento.loop > :nth-child(n) { grid-column: 1 / -1 !important; }
  .bento.platforms > :nth-child(6), .bento.loop > :nth-child(4) { flex-direction: column; align-items: flex-start; }
}

/* Reduced motion keeps the information and drops the travel. */
@media (prefers-reduced-motion: reduce) {
  .spine.flow li { transition: opacity 1s ease; transition-delay: 0s; }
  .sheen { display: none; }
  .btn:active { transform: none; }
  .progress { transition: none; }
}
/* No backdrop-filter support: fall back to a more opaque fill so text stays readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .lead-panel, .tier.featured, .record, dialog { background: rgba(18, 17, 26, .94); }
  .masthead.solid { background: rgba(12, 11, 18, .96); }
}
