/* colours are set per section from main.js */
@property --accent { syntax: "<color>"; inherits: true; initial-value: #b9c8ff; }
@property --bg1 { syntax: "<color>"; inherits: true; initial-value: #111a52; }
@property --bg2 { syntax: "<color>"; inherits: true; initial-value: #6a4bc8; }

:root {
  --ink: #ece6da;           /* warm paper white */
  --dim: rgba(236, 230, 218, 0.8);
  --faint: rgba(236, 230, 218, 0.36);
  --bar: clamp(40px, 7.5vh, 68px);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Inter", system-ui, sans-serif;
  --ease: cubic-bezier(.65, 0, .35, 1);   /* smooth, for big movements */
  --pop: cubic-bezier(.34, 1.56, .64, 1);  /* springy overshoot, for text */
  /* ultrawide: content stays in a centred 16:9 frame (keep MAX_ASPECT in main.js in sync) */
  --frame-off: max(0px, (100vw - 177.78vh) / 2);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(ellipse 90% 80% at 68% 38%, var(--bg2), var(--bg1) 78%) fixed var(--bg1);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#track { position: relative; z-index: -1; pointer-events: none; }
.snap { position: absolute; left: 0; width: 1px; height: 1px; scroll-snap-align: start; scroll-snap-stop: always; }

/* intro screen (src/loader.js) */
#loader { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: #04060f; transition: opacity .45s ease, transform .45s var(--pop); }
#loader .boot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font: 500 clamp(20px, 4.4vw, 34px)/1 ui-monospace, Consolas, monospace; letter-spacing: .28em; color: #a9c1ff;
}
#loader .word span { display: inline-block; min-width: .62em; text-align: center; opacity: .55; }
#loader .word span.on { color: #fff; opacity: 1; text-shadow: 0 0 18px rgba(169, 193, 255, .9); }
#loader .pct { font-size: 12px; letter-spacing: .3em; color: rgba(169, 193, 255, .7); }
#loader.done { opacity: 0; transform: scale(1.06); pointer-events: none; }

/* ---------- Letterbox bars ---------- */
.bar {
  position: fixed; left: 0; right: 0; height: var(--bar); z-index: 30; background: #000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 calc(var(--frame-off) + clamp(16px, 4vw, 56px));
  transition: transform .55s var(--pop);
}
.bar.top { top: 0; }
.bar.bottom { bottom: 0; gap: 24px; transition-delay: .12s; }
/* the build: bars wait off-screen until the intro clears, then slide in */
body.booting .bar.top { transform: translateY(-100%); }
body.booting .bar.bottom { transform: translateY(100%); }
.wordmark {
  font-family: var(--serif); font-size: 20px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.bar nav { display: flex; gap: clamp(14px, 2.6vw, 36px); }
.bar nav a {
  display: inline-block; color: var(--faint); text-decoration: none; font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  transition: color .4s ease, transform .35s var(--pop);
}
.bar nav a i { font-family: var(--serif); font-style: normal; font-size: 13px; letter-spacing: .05em; margin-right: 6px; }
.bar nav a:hover { color: var(--ink); transform: translateY(-2px); }
.bar nav a.active { color: var(--ink); }
.bar nav a.active i { color: var(--accent); }

.chapter-label, .hint { font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--faint); white-space: nowrap; min-width: 130px; }
/* fixed width so the timeline never shifts when the section name changes */
.chapter-label { color: var(--dim); flex: none; width: 170px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hint { text-align: right; }
/* draggable timeline */
.reel {
  position: relative; flex: 1; max-width: 420px; height: 30px; cursor: grab; touch-action: none;
  display: flex; justify-content: space-between; align-items: center;
}
.reel::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(236,230,218,.18); }
.reel span { position: relative; width: 1px; height: 7px; background: var(--faint); transition: transform .25s var(--pop), background .2s; }
.reel span.near { background: var(--accent); transform: scaleY(2.2); }
.reel-fill { position: absolute; left: 0; top: 50%; height: 2px; margin-top: -1px; width: 0; background: var(--accent); transition: width .5s var(--pop); }
.reel-knob {
  position: absolute; top: 50%; left: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; padding: 0;
  border: 0; border-radius: 50%; background: var(--accent); cursor: grab;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: transform .2s var(--pop), left .5s var(--pop);
}
.reel:hover .reel-knob { transform: scale(1.25); }
.reel.dragging, .reel.dragging .reel-knob { cursor: grabbing; }
/* while dragging: stretched, and following the finger directly (no glide) */
.reel.dragging .reel-knob { transform: scale(1.5, 1.2); transition: transform .2s var(--pop); }
.reel.dragging .reel-fill { transition: none; }
/* let go: it flies to the nearest section, overshoots and lands with a squash */
.reel.snap .reel-knob { transition: left .45s cubic-bezier(.3, 1.9, .5, 1); animation: squash .5s var(--pop); }
.reel.snap .reel-fill { transition: width .45s cubic-bezier(.3, 1.9, .5, 1); }
@keyframes squash { 0% { transform: scale(1.5, 1.2); } 45% { transform: scale(.7, 1.45); } 70% { transform: scale(1.3, .8); } 100% { transform: none; } }

/* ---------- Sections (captions over the footage) ---------- */
.chapter {
  position: fixed; left: 0; right: 0; top: var(--bar); bottom: var(--bar); z-index: 10;
  display: flex; padding: clamp(24px, 5vh, 56px) calc(var(--frame-off) + clamp(20px, 6vw, 96px));
  pointer-events: none;
}
.caption {
  position: relative; isolation: isolate;
  pointer-events: auto; opacity: 0; visibility: hidden; max-width: 500px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6), 0 0 24px rgba(0,0,0,.5);
}
/* soft shade behind the text so it always reads over the app windows */
.caption::before {
  content: ""; position: absolute; inset: -70px -90px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0,0,0,.42), transparent);
}
.pos-left { align-items: center; }
.pos-lower { align-items: center; }   /* every section's text sits at the same height: vertically centred */
.pos-right { align-items: center; justify-content: flex-end; }
.pos-lower-right { align-items: center; justify-content: flex-end; }
.pos-center { align-items: center; justify-content: center; text-align: center; }
.pos-center .caption { max-width: 560px; }

.kicker { font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0 0 18px; line-height: .95; letter-spacing: -.005em; }
h1 { font-size: clamp(64px, 9.5vw, 148px); }
h2 { font-size: clamp(54px, 6.5vw, 96px); font-style: italic; }
.caption p { margin: 0 0 14px; color: var(--dim); font-size: 15.5px; max-width: 46ch; }
.sub { font-size: 13px !important; letter-spacing: .26em; text-transform: uppercase; color: var(--ink) !important; white-space: nowrap; }
.lede { font-size: 17px !important; color: var(--ink) !important; max-width: 34ch !important; margin-top: 18px !important; }
.cue { display: flex; align-items: center; gap: 14px; margin-top: 40px !important; font-size: 10.5px !important; letter-spacing: .3em; text-transform: uppercase; color: var(--faint) !important; }
.cue span { width: 1px; height: 34px; background: linear-gradient(var(--accent), transparent); animation: drip 2.8s var(--ease) infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* skills: pill tags that pop */
.skills { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.skills li {
  padding: 8px 16px; border-radius: 999px; font-size: 14.5px; color: var(--ink); cursor: default;
  border: 1px solid rgba(236,230,218,.18); background: rgba(0,0,0,.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.pos-right .skills { justify-content: flex-end; }

/* solutions: a broad grid of ideas */
.solutions { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.solutions li {
  padding: 8px 11px; border-radius: 11px; border: 1px solid rgba(236,230,218,.14); background: rgba(0,0,0,.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); text-shadow: none;
}
.solutions b { display: block; font-family: var(--serif); font-weight: 500; font-size: 17px; line-height: 1.15; color: var(--ink); }
.solutions span { display: block; margin-top: 2px; font-size: 12px; line-height: 1.35; color: var(--dim); }
.solutions li:hover { transform: translateY(-3px) scale(1.03); border-color: var(--accent); box-shadow: 0 12px 30px -14px var(--accent); }
.solutions li:hover b { color: var(--accent); }
.solutions .r { transform: translateY(14px) scale(.85); }
.more { margin-top: 10px !important; font-size: 13.5px !important; }
.more a { color: var(--accent); white-space: nowrap; }

/* how it works: three numbered steps */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 18px 0 4px; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; }
.steps li::before {
  content: counter(step); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font: 500 13px var(--sans); color: #0b0d14; background: var(--accent);
}
.steps b { font-weight: 500; color: var(--ink); font-size: 15.5px; }
.steps span { font-size: 14px; color: var(--dim); }
.caption .steps .r { --d: calc(.25 + var(--i, 0) * .08); }

/* projects: rows that pop on hover */

.credits { margin-top: 44px !important; font-size: 10.5px !important; letter-spacing: .26em; text-transform: uppercase; color: var(--faint) !important; }
a:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

/* ---------- Hover: quick and springy ---------- */
.skills li, .solutions li {
  transition: transform .45s var(--pop), color .25s ease, background-color .3s ease,
              border-color .3s ease, opacity .3s ease, background-size .45s var(--pop), box-shadow .4s ease;
}
.skills li:hover {
  transform: translateY(-4px) scale(1.08); color: #05080c; text-shadow: none;
  background-color: var(--accent); border-color: var(--accent);
  box-shadow: 0 10px 30px -8px var(--accent);
}

/* leaving text is driven frame by frame from ui.js: no CSS transitions in the way,
   and each part gets its own GPU layer while it flies, so moving it is cheap */
.caption.leaving .r, .caption.leaving .portrait { transition: none !important; animation: none !important; will-change: transform, opacity; }
.caption { will-change: opacity; }

/* phones: crossfading background layers (see bgTo in main.js) */
.bg-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .7s ease; will-change: opacity; }
.bg-layer.on { opacity: 1; }

/* ---------- Reveals: quick and poppy, staggered ---------- */
.r { opacity: 0; transform: translateY(18px) scale(.96); }
.caption.on .r {
  opacity: 1; transform: none;
  transition: opacity .45s ease, transform .7s var(--pop);
  transition-delay: calc(var(--d, 0) * 1s);
}
.caption .r:nth-child(1) { --d: 0; }
.caption .r:nth-child(2) { --d: .08; }
.caption .r:nth-child(3) { --d: .18; }
.caption .r:nth-child(4) { --d: .26; }
.caption .r:nth-child(5) { --d: .34; }
.caption .r:nth-child(6) { --d: .42; }
.caption .r:nth-child(7) { --d: .5; }
.caption .r:nth-child(8) { --d: .58; }
/* titles pop with a little extra punch */
.caption .title { transform: translateY(28px) scale(.9); }
/* list items pop in one by one */
.caption .skills .r, .caption .solutions .r { --d: calc(.3 + var(--i, 0) * .06); }
.skills .r { transform: translateY(12px) scale(.6); }
.caption.on .skills .r { transition-duration: .35s, .6s; }
/* once the reveal is done, hovers respond instantly */
.caption.settled .r {
  transition: opacity .3s ease, transform .45s var(--pop), color .25s ease, background-color .3s ease,
              border-color .3s ease, box-shadow .4s ease;
  transition-delay: 0s;
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --bar: 46px; }
  .wordmark { font-size: 15px; letter-spacing: .24em; }
  .bar nav, .hint { display: none; }
  .bar.bottom { gap: 16px; }
  .reel { max-width: none; }
  .chapter-label { width: 128px; font-size: 9.5px; letter-spacing: .1em; }
  .chapter { align-items: flex-end !important; justify-content: flex-start !important; text-align: left; padding: 20px 18px 26px; }
  /* one shared fade behind all captions */
  body::before {
    content: ""; position: fixed; inset: 0; z-index: 4; pointer-events: none;
    background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.72) 75%);
  }
  .pos-center .caption { text-align: left; }
  .pos-right .skills { justify-content: flex-start; }
  h1 { font-size: 60px; }
  h2 { font-size: 50px; }
  .sub { white-space: normal; letter-spacing: .2em; }
  .caption p { font-size: 14.5px; }
  .skills li { padding: 6px 12px; font-size: 13.5px; }
  .cue, .steps span, .solutions span, .more, .ch-3 .intro { display: none; }
  .solutions li { padding: 6px 10px; }
  .solutions b { font-size: 15px; }
  .ch-1 .kicker, .ch-2 .kicker, .ch-3 .kicker { display: none; }   /* the bottom bar already shows the number */   /* keep captions short enough to sit below the app window */
  .kicker { letter-spacing: .2em; }
}

@media (prefers-reduced-motion: reduce) {
  .r, .caption.on .r { transition: opacity .3s ease !important; transform: none !important; }
  .skills li:hover, .solutions li:hover { transform: none; }
}

/* ---------- Contact: portrait + intro on the left, form on the right ---------- */
.ch-4 .caption {
  max-width: 980px; width: 100%; text-align: left;
  display: grid; grid-template-columns: 1fr 1.05fr; gap: 20px 56px; align-items: center;
}
.ch-4 .caption::before { display: none; }
/* never cut off: if the content is taller than the screen, it scrolls within the section */
/* Never cut off: if the content is taller than the screen, the whole section scrolls (not a box inside it),
   so its only edges are the letterbox bars and the screen itself, and nothing vanishes into an invisible wall.
   Auto margins centre the content when it fits and top-align it when it doesn't (so its top stays reachable). */
.ch-4 { overflow: hidden; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.ch-4:has(.caption.on) { overflow-y: auto; pointer-events: auto; }
.ch-4 .caption { margin: auto; align-self: flex-start; padding: 12px 6px; }
.contact-intro { position: relative; }
.contact-intro > :not(.portrait) { position: relative; z-index: 1; }   /* the text sits in front of the portrait */
.contact-intro p { max-width: 40ch; }
.direct { font-size: 14px !important; }
.direct a { color: var(--accent); }
.ch-4 .credits { grid-column: 1 / -1; margin-top: 4px !important; }
.credits a { color: inherit; }

.portrait {
  position: relative; z-index: 0; width: 210px; height: 210px; margin: 0 auto -40px;   /* centred; the headline overlaps its lower edge */
  border-radius: 50%; overflow: hidden; pointer-events: none; user-select: none;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 70%, #2a1d0c) 0%, #120c06 78%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, transparent),
              0 0 0 6px rgba(0, 0, 0, .35),
              0 0 0 7px color-mix(in srgb, var(--accent) 25%, transparent),
              0 20px 50px -12px rgba(0, 0, 0, .7);
  opacity: 0; transform: translateY(18px) scale(.75);
}
.portrait img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 0%;
  transform: scale(1.32) translateY(9%);          /* frame head and shoulders */
  filter: saturate(.92) contrast(1.04);
}
.caption.on .portrait { opacity: 1; transform: none; transition: opacity .5s ease, transform .8s var(--pop); }
.caption.settled .portrait { transition: none; }

/* the form */
.contact-form {
  display: flex; flex-direction: column; gap: 12px; padding: 24px 26px; border-radius: 18px;
  background: rgba(14, 12, 18, .92); border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, .7); text-shadow: none;
}
.contact-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.contact-form label { display: block; font-size: 12px; letter-spacing: .04em; color: var(--dim); }
.contact-form label > input, .contact-form label > textarea { display: block; width: 100%; margin-top: 5px; }
.contact-form label span[aria-hidden] { color: var(--accent); }
.contact-form label em { font-style: normal; opacity: .6; }
.contact-form input, .contact-form textarea {
  font: 400 15px/1.4 var(--sans); color: var(--ink); padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  transition: border-color .2s, background .2s;
}
.contact-form textarea { resize: vertical; min-height: 92px; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, .09); }
.contact-form .invalid { border-color: #ff8a80 !important; animation: shake .3s; }
.contact-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .consent { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; line-height: 1.5; letter-spacing: 0; }
.contact-form .consent input { display: inline-block; width: 17px; height: 17px; margin: 2px 0 0; flex: none; accent-color: var(--accent); padding: 0; }
.contact-form .consent input.invalid { outline: 2px solid #ff8a80; outline-offset: 2px; }
.contact-form .consent a { color: var(--accent); }
.form-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn-send {
  font: 500 15px var(--sans); color: #0b0d14; background: var(--accent); border: 0; border-radius: 999px;
  padding: 11px 24px; cursor: pointer; transition: transform .35s var(--pop), box-shadow .3s;
}
.btn-send:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 10px 30px -8px var(--accent); }
.btn-send:disabled { opacity: .6; cursor: wait; transform: none; }
.form-status { margin: 0 !important; font-size: 13px !important; flex: 1; min-width: 180px; }
.form-status.ok { color: #7ff0b8 !important; }
.form-status.error { color: #ffb3ab !important; }
.form-status a { color: inherit; }

@media (max-width: 860px) {
  .ch-4 .caption {
    grid-template-columns: 1fr; gap: 14px;
    padding-right: 4px;
  }
  .portrait { width: 128px; height: 128px; margin: 10px auto -26px; }   /* room for the outer ring */
  .contact-form { padding: 18px; }
  .contact-form .row { grid-template-columns: 1fr; }
}

/* ---------- Floating app windows (placed in 3D by main.js) ---------- */
#apps { position: fixed; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
#apps .app-host { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform, opacity; }   /* own GPU layer: moving it is cheap */
.app {
  --ink2: rgba(233, 237, 245, .55);
  width: 560px; height: 400px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 16px; color: #e9edf5; font: 400 13px/1.45 var(--sans);
  background: linear-gradient(160deg, rgba(22, 26, 40, .96), rgba(12, 14, 24, .98));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .7), 0 0 60px -20px color-mix(in srgb, var(--accent) 60%, transparent);
  user-select: none; text-shadow: none; color-scheme: dark;   /* dark native date picker */
}
.app-bar { display: flex; align-items: center; gap: 7px; padding: 11px 14px; background: rgba(255, 255, 255, .04); border-bottom: 1px solid rgba(255, 255, 255, .07); }
.app-bar b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar span { margin-left: auto; font-size: 11px; color: var(--accent); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.app-body { position: relative; flex: 1; padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.app small { display: block; font-size: 10.5px; color: var(--ink2); text-transform: uppercase; letter-spacing: .08em; }
.app strong { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; }
.app button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.app button:disabled { opacity: .45; cursor: default; }
.app input, .app select {
  font: inherit; color: inherit; width: 100%; padding: 6px 9px; border-radius: 7px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); user-select: text;
}
.app select option { background: #161a28; }
.app input:focus, .app select:focus { outline: none; border-color: var(--accent); }
.app input:disabled { opacity: .7; }
.app .primary { padding: 8px 16px; border-radius: 999px; background: var(--accent); color: #0b0d14; font-weight: 500; transition: transform .3s var(--pop); }
.app .primary:not(:disabled):hover { transform: scale(1.05); }
.app-foot { margin: 0; font-size: 11px; color: var(--ink2); }
@keyframes pop { 0% { transform: scale(.7); } 100% { transform: none; } }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.pop { animation: pop .45s var(--pop); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpis > div { padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .05); min-width: 0; }
.kpis em { display: block; font-style: normal; font-size: 11px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis strong.warn { color: #ffb15c; }
.chart { flex: 1; display: flex; gap: 10px; min-height: 80px; }
.chart div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.chart i { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(color-mix(in srgb, var(--accent) 60%, transparent), color-mix(in srgb, var(--accent) 15%, transparent)); transition: height .9s var(--pop); }
.chart .today i { background: linear-gradient(var(--accent), color-mix(in srgb, var(--accent) 30%, transparent)); }
.chart span { font-size: 10.5px; color: var(--ink2); }
.chart .today span { color: var(--accent); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); transition: opacity .5s, transform .5s var(--pop); }
.feed li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed li.new { opacity: 0; transform: translateY(-8px); }
.feed b { color: #5fe0a5; font-weight: 500; white-space: nowrap; }
.feed b.out { color: #ff8a80; }

/* booking calendar */
.cal-bar { display: flex; align-items: center; gap: 6px; }
.cal-bar b { flex: 1; font-weight: 500; font-size: 13px; }
.app .cal-bar button { width: 26px; height: 26px; border-radius: 7px; background: rgba(255, 255, 255, .07); font-size: 16px; line-height: 1; transition: background .2s, transform .25s var(--pop); }
.app .cal-bar button:hover { background: rgba(255, 255, 255, .16); transform: scale(1.08); }
.app .cal-bar [data-today] { width: auto; padding: 0 10px; font-size: 12px; }
.app .cal-bar input { width: 132px; padding: 3px 7px; font-size: 12px; }
.sched-head, .sched-grid { display: grid; grid-template-columns: 40px repeat(7, 1fr); gap: 3px; }
.sched-head span { font-size: 10.5px; text-align: center; color: var(--ink2); line-height: 1.15; }
.sched-head b { display: block; font-size: 13px; font-weight: 500; color: #e9edf5; }
.sched-head .today, .sched-head .today b { color: var(--accent); }
.sched-grid { flex: 1; grid-auto-rows: 1fr; }
.hour { font-size: 10.5px; color: rgba(233, 237, 245, .45); align-self: center; }
.app .slot { border-radius: 6px; background: rgba(255, 255, 255, .04); padding: 0 5px; text-align: left; line-height: 1.05; overflow: hidden; transition: background .25s; }
.app .slot:hover { background: rgba(255, 255, 255, .12); }
.slot b, .slot span { display: block; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot b { font-weight: 600; }
.app .slot.booked { background: color-mix(in srgb, var(--accent) 70%, #000); color: #0b0d14; }
.app .slot.billed { background: color-mix(in srgb, var(--accent) 30%, #1a1d29); color: #e9edf5; }
.app .slot.past:not(.booked) { opacity: .35; cursor: default; }
.app .slot.past:not(.booked):hover { background: rgba(255, 255, 255, .04); }
.sheet-error { margin: 0; min-height: 15px; font-size: 11.5px; color: #ff8a80; }
.sheet {
  position: absolute; inset: 8px; z-index: 2; display: flex; flex-direction: column; gap: 7px;
  padding: 14px 16px; border-radius: 12px; background: #171b29; border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(14px) scale(.97); pointer-events: none; transition: opacity .25s, transform .4s var(--pop);
}
.sheet.open { opacity: 1; transform: none; pointer-events: auto; }
.sheet label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink2); }
.sheet .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.sheet-head .x { font-size: 20px; line-height: 1; padding: 0 4px; }
.sheet-actions { margin-top: auto; display: flex; justify-content: space-between; }
.sheet .danger { color: #ff8a80; }
.sheet .danger[hidden] { display: block; visibility: hidden; }
.app input.invalid { border-color: #ff8a80; animation: shake .3s; }

/* inventory */
.inv-table { flex: 1; }
.st-row { display: grid; grid-template-columns: 1fr 100px 40px 80px; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.st-head span { font-size: 10.5px; color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty b { min-width: 22px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.app .qty button { width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, .08); transition: transform .25s var(--pop), background .2s; }
.app .qty button:hover { background: rgba(255, 255, 255, .18); transform: scale(1.12); }
.pill { font-style: normal; font-size: 11px; padding: 2px 9px; border-radius: 999px; }
.pill.ok { background: rgba(95, 224, 165, .15); color: #5fe0a5; }
.pill.low { background: rgba(255, 177, 92, .15); color: #ffb15c; }
.pill.out { background: rgba(255, 110, 110, .18); color: #ff8a80; }
.pill.order { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.inv-foot { display: flex; justify-content: space-between; align-items: center; color: var(--ink2); }

/* invoicing */
.pick { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink2); }
.inv-lines { display: flex; flex-direction: column; gap: 4px; }
.inv-row { display: grid; grid-template-columns: 1fr 44px 64px 64px; gap: 6px; align-items: center; }
.inv-head span { font-size: 10.5px; color: rgba(233, 237, 245, .45); text-transform: uppercase; letter-spacing: .06em; }
.app .inv-row input { padding: 4px 7px; }
.inv-row [data-amt], .inv-head span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.add-dish { display: flex; gap: 8px; align-items: center; }
.add-dish select { flex: 1; padding: 4px 8px; }
.app .add { flex: none; padding: 4px 4px; color: var(--accent); font-size: 12px; font-weight: 500; }
.inv-sum { margin-top: auto; margin-left: 190px; display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: center; }
.inv-sum select { width: auto; justify-self: end; padding: 2px 6px; }
.app .inv-sum input { width: 74px; justify-self: end; padding: 2px 6px; text-align: right; }
.inv-sum [hidden] { display: none; }
.inv-sum span { color: var(--ink2); }
.inv-sum b { font-weight: 500; justify-self: end; font-variant-numeric: tabular-nums; }
.app .inv-sum small { grid-column: 1 / -1; text-align: right; text-transform: none; letter-spacing: 0; }
.send { position: absolute; left: 18px; bottom: 16px; }
.stamp {
  position: absolute; right: 50px; top: 175px; padding: 4px 16px; border: 3px solid #5fe0a5; border-radius: 8px;
  color: #5fe0a5; font: 700 30px/1 var(--sans); letter-spacing: .12em; transform: rotate(-14deg) scale(2.2); opacity: 0; pointer-events: none;
}
.app.paid .stamp { opacity: .9; transform: rotate(-14deg); transition: transform .45s var(--pop), opacity .2s; }

/* "try it" hints in the captions */
.try { font-size: 12.5px !important; letter-spacing: .04em; color: var(--accent) !important; margin-top: 18px !important; }
@media (max-width: 760px) { .try { display: none; } }

/* phones: narrower windows so the text stays readable once scaled to the screen */
@media (max-width: 760px) {
  .app { width: 400px; height: 430px; font-size: 13px; }
  .app-body { padding: 12px 14px; }
  .kpis { gap: 6px; }
  .kpis > div { padding: 8px 9px; }
  .app strong { font-size: 17px; }
  .st-row { grid-template-columns: 1fr 96px 30px 64px; gap: 6px; }
  .inv-row { grid-template-columns: 1fr 38px 54px 56px; gap: 5px; }
  .inv-sum { margin-left: 130px; }
  .sheet .two { grid-template-columns: 1fr; gap: 9px; }
}

/* touch devices: no blur effects and lighter shadows (expensive to draw on phones) */
@media (pointer: coarse) {
  .skills li, .solutions li, .contact-form { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .skills li, .solutions li { background: rgba(10, 12, 20, .72); }
  .contact-form { background: rgba(14, 12, 18, .96); box-shadow: 0 16px 40px -20px rgba(0, 0, 0, .7); }
  .caption { text-shadow: 0 1px 3px rgba(0, 0, 0, .75); }
  .app { box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .7); }
}

/* short phone screens: compact text so the app window above keeps enough room */
@media (max-width: 760px) and (max-height: 760px) {
  h1 { font-size: 46px; margin-bottom: 12px; }
  h2 { font-size: 40px; margin-bottom: 10px; }
  .kicker { font-size: 10px; margin-bottom: 8px; }
  .sub { font-size: 11.5px !important; }
  .lede { font-size: 15px !important; margin-top: 10px !important; }
  .caption p { font-size: 13.5px; line-height: 1.55; margin-bottom: 8px; }
  .skills { gap: 6px; margin-top: 10px; }
  .skills li { padding: 4px 10px; font-size: 12.5px; }
  .steps { gap: 6px; margin-top: 10px; }
  .steps b { font-size: 14px; }
  .steps li::before { width: 22px; height: 22px; font-size: 12px; }
  .solutions { margin-top: 8px; gap: 5px; }
  .solutions b { font-size: 14px; }
  .chapter { padding-bottom: 16px !important; }
}

/* shorter desktop / laptop screens: a more compact contact section */
@media (min-width: 761px) and (max-height: 860px) {
  .portrait { width: 150px; height: 150px; margin-bottom: -28px; }
  .ch-4 h2 { font-size: 60px; margin-bottom: 10px; }
  .ch-4 .caption p { font-size: 14.5px; margin-bottom: 10px; }
  .contact-form { padding: 18px 22px; gap: 9px; }
  .contact-form input, .contact-form textarea { padding: 8px 11px; }
  .contact-form textarea { min-height: 0; height: 72px; }
  .ch-4 .credits { margin-top: 0 !important; }
}
@media (min-width: 761px) and (max-height: 680px) {
  .portrait { width: 116px; height: 116px; margin-bottom: -22px; }
  .ch-4 h2 { font-size: 50px; }
}

/* phones & tablets: swipes switch sections (see ui.js), so the page itself doesn't pan.
   Only the Contact section scrolls natively, when it is taller than the screen. */
html.swipe-nav, html.swipe-nav body { touch-action: none; overscroll-behavior: none; }
html.swipe-nav .ch-4, html.swipe-nav .ch-4 .caption, html.swipe-nav textarea { touch-action: pan-y; }

/* ---------- Flat mode (phones, see main.js): no 3D, hardware-animated slides ---------- */
html.flat #apps .app-host {
  opacity: 0; visibility: hidden; will-change: transform, opacity;
  transition: transform .42s var(--ease), opacity .3s ease, visibility 0s linear .42s;
}
html.flat #apps .app-host.flat-on {
  opacity: 1; visibility: visible;
  transition: transform .42s var(--ease), opacity .35s ease .08s, visibility 0s;
}
html.flat .caption.exit .r, html.flat .caption.exit .portrait {
  opacity: 0 !important; transform: translateY(calc(var(--exit, -1) * 26px)) !important;
  transition: opacity .22s ease, transform .22s ease !important; transition-delay: 0s !important;
}

/* ---------- Industry picker (home) and switcher (dashboard window) ---------- */
.industry { margin: 22px 0 0; }
.industry > span { display: block; margin-bottom: 8px; font-size: 10.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: 400 14px var(--sans); color: var(--ink); cursor: pointer; padding: 7px 15px; border-radius: 999px;
  border: 1px solid rgba(236,230,218,.22); background: rgba(0,0,0,.3); text-shadow: none;
  transition: transform .35s var(--pop), background-color .25s ease, border-color .25s ease, color .25s ease;
}
.chips button:hover { transform: translateY(-2px); border-color: var(--accent); }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #05080c; }
.chips button:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.app .app-bar select.ind-pick { width: auto; margin-left: auto; padding: 2px 6px; font-size: 11.5px; flex: none; }
.app .app-bar select.ind-pick + span { margin-left: 4px; }
/* a newly picked business's windows pop in */
@keyframes swap { 0% { opacity: .2; transform: scale(.96); } 100% { opacity: 1; transform: none; } }
.app.swap { animation: swap .45s var(--pop); }

/* ---------- Founding-client offer ---------- */
.founding { font-size: 13.5px !important; margin-top: 16px !important; }
.founding b { color: var(--accent); font-weight: 500; }
.founding a, .offer a { color: var(--accent); white-space: nowrap; }
.offer {
  margin: 16px 0 14px; padding: 14px 16px; border-radius: 14px; max-width: 44ch; text-shadow: none;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, rgba(0,0,0,.35));
}
.offer b { display: block; font: 500 11px var(--sans); letter-spacing: .26em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.caption .offer p { margin: 0; font-size: 14px; color: var(--ink); }

/* ---------- Contact form: choices ---------- */
.contact-form select {
  display: block; width: 100%; margin-top: 5px; font: 400 15px/1.4 var(--sans); color: var(--ink); padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); color-scheme: dark;
}
.contact-form select option { background: #161a28; }
.contact-form select:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, .09); }
.contact-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.contact-form legend { padding: 0; margin-bottom: 6px; font-size: 12px; letter-spacing: .04em; color: var(--dim); }
.reply { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-form .reply label { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .14); font-size: 13px; letter-spacing: 0; color: var(--ink); transition: border-color .2s, background .2s; }
.contact-form .reply input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.contact-form .reply label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.contact-form .reply label:has(input:focus-visible) { outline: 1px solid var(--accent); outline-offset: 2px; }
.contact-form .phone[hidden] { display: none; }

@media (max-width: 760px) {
  .industry { margin-top: 12px; }
  .industry > span { margin-bottom: 6px; }
  .chips { gap: 6px; }
  .chips button { padding: 5px 11px; font-size: 13px; }
  .founding { font-size: 12.5px !important; margin-top: 10px !important; }
  .offer { padding: 11px 13px; }
}
@media (min-width: 761px) and (max-height: 860px) {
  .offer { margin: 10px 0; padding: 10px 14px; }
  .contact-form select { padding: 8px 11px; }
}

/* shorter desktop / laptop screens: a more compact home section, so the picker always fits */
@media (min-width: 761px) and (max-height: 860px) {
  .ch-0 h1 { font-size: clamp(56px, 12.5vh, 110px); margin-bottom: 12px; }
  .ch-0 .kicker { margin-bottom: 6px; }
  .ch-0 .lede { margin-top: 10px !important; }
  .ch-0 .cue { display: none; }
  .industry { margin-top: 14px; }
  .ch-0 .try { margin-top: 12px !important; }
  .founding { margin-top: 10px !important; }
}

/* Contact scrolls as a whole section: hide its scrollbar while the section is flying out
   (transparent rather than overflow:hidden, so the content doesn't shift sideways) */
.ch-4:has(.caption.leaving), .ch-4:has(.caption.exit) { scrollbar-color: transparent transparent; }

/* ---------- Phones: short sections, tools opened full-screen ("Try mode", see main.js) ---------- */
.try-open { display: none; }
html.flat .try-open {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font: 500 15px var(--sans); color: #0b0d14; background: var(--accent); border: 0; border-radius: 999px;
  padding: 10px 20px; cursor: pointer; text-shadow: none;
}
html.flat .try-open::before { content: ""; width: 0; height: 0; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor; }
@media (max-width: 760px) {
  /* only the essentials next to the app windows; everything stays on the desktop version */
  .ch-0 .kicker, .ch-0 .sub, .ch-0 .founding { display: none; }
  .ch-1 .caption > p:not(.try), .ch-2 .caption > p:not(.try) { display: none; }
  .steps { gap: 4px; margin-top: 8px; }
  .steps li { grid-template-columns: 26px 1fr; }
  .steps li::before { grid-row: auto; width: 20px; height: 20px; font-size: 11px; }
}

/* try mode: the story steps aside, the tool fills the screen */
#trymode { position: fixed; inset: 0; z-index: 40; pointer-events: none; animation: try-in .3s ease; }
#trymode[hidden] { display: none; }
@keyframes try-in { from { opacity: 0; } }
.try-top, .try-bottom { position: absolute; left: 0; right: 0; background: #000; pointer-events: auto; }
.try-top {
  top: 0; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 14px 12px 18px;
}
.try-step { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.try-hint { grid-column: 1; margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink); }
.try-close {
  grid-row: 1 / span 2; grid-column: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: var(--ink); font-size: 24px; line-height: 1;
}
.try-bottom {
  bottom: 0; display: flex; justify-content: space-between; gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
}
.try-bottom button {
  font: 500 14.5px var(--sans); padding: 11px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .2); background: none; color: var(--ink);
}
.try-bottom button:disabled { opacity: .35; cursor: default; }
.try-bottom [data-try-next] { background: var(--accent); border-color: var(--accent); color: #0b0d14; }
html.trying .chapter { opacity: 0; transition: opacity .2s ease; }
html.trying .caption { pointer-events: none !important; }
html.trying .bar { transform: translateY(var(--bar-off, -100%)); }
html.trying .bar.bottom { --bar-off: 100%; }
html.trying body::before { opacity: 0; }
body::before { transition: opacity .3s ease; }

/* ---------- Plain page: the 3D scene couldn't load (see loader.js) ----------
   Every section is shown one below the other, like the no-JavaScript version, and the contact form still works. */
html.plain #track, html.plain .bar.bottom, html.plain .try, html.plain .try-open, html.plain .cue, html.plain .industry { display: none; }
html.plain body { padding-top: var(--bar); }
html.plain .chapter { position: relative; inset: auto; min-height: 0; pointer-events: auto; padding-top: 48px; padding-bottom: 48px; }
html.plain .caption, html.plain .r, html.plain .portrait { opacity: 1 !important; visibility: visible !important; transform: none !important; }
html.plain body::before { display: none; }
html.plain .chapter { scroll-margin-top: var(--bar); }   /* menu links land below the top bar */

/* ---------- Phones: message first, the demo one tap away ----------
   No app windows beside the text (they only appear full-screen in the demo), so every
   section can say what it's about in full. The Home card opens the demo ("Try mode"). */
.phone-only { display: none; }
html.flat .phone-only { display: block; }
html.flat:not(.trying) #apps { opacity: 0; }
#apps { transition: opacity .3s ease; }
html.flat body::before { display: none; }
html.flat .chapter:not(.ch-4) { align-items: center !important; align-items: safe center !important; padding-top: 24px; padding-bottom: 24px; }   /* safe: if it's ever too tall, the top stays visible */

/* Home: who, what, and the next step */
html.flat .ch-0 .kicker { display: block; font-size: 10.5px; letter-spacing: .16em; margin-bottom: 10px; }
html.flat .ch-0 h1 { margin-bottom: 14px; }
html.flat .ch-0 .lede { margin-top: 0 !important; }
html.flat .pitch { font-size: 14.5px; line-height: 1.6; color: var(--dim); margin: 0 0 18px; }
html.flat .cta {
  display: inline-block; font: 500 15px var(--sans); color: #0b0d14; background: var(--accent); text-decoration: none;
  padding: 12px 24px; border-radius: 999px; text-shadow: none;
}
html.flat .demo-teaser {
  margin-top: 22px; padding: 16px 16px 18px; border-radius: 16px; text-shadow: none;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: rgba(8, 10, 22, .55);
}
html.flat .demo-teaser .teaser-head { margin: 0 0 4px; font: 400 italic 26px/1.1 var(--serif); color: var(--ink); }
html.flat .demo-teaser .teaser-text { margin: 0 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--dim); }
html.flat .demo-teaser .industry { margin: 0; }
html.flat .demo-teaser .industry > span { display: none; }   /* the card's text already says it */
html.flat .demo-teaser .chips { gap: 5px; flex-wrap: nowrap; }
html.flat .demo-teaser .chips button { padding: 5px 9px; font-size: 12.5px; white-space: nowrap; }
html.flat .demo-teaser .try-open {
  margin-top: 14px; background: none; color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
}

/* the other sections: their explanations are back */
html.flat .ch-1 .caption > p:not(.try), html.flat .ch-2 .caption > p:not(.try),
html.flat .ch-3 .intro, html.flat .more { display: block; }
html.flat .caption p { font-size: 14.5px; line-height: 1.6; }
html.flat .steps { gap: 12px; margin-top: 16px; }
html.flat .steps li { grid-template-columns: 30px 1fr; }
html.flat .steps li::before { grid-row: span 2; width: 22px; height: 22px; font-size: 12px; margin-top: 2px; }
html.flat .steps span { display: block; font-size: 13.5px; line-height: 1.45; }
html.flat .solutions { grid-template-columns: 1fr; gap: 6px; }
html.flat .solutions li { display: flex; align-items: baseline; gap: 10px; padding: 7px 12px; }
html.flat .solutions b { flex: none; font-size: 15.5px; }
html.flat .solutions span { display: none; }
html.flat .more { font-size: 13.5px !important; margin-top: 14px !important; }

/* short phones: a more compact Home so everything fits on one screen */
@media (max-height: 760px) {
  html.flat .ch-0 .kicker { display: none; }
  html.flat .ch-0 .lede { font-size: 15px !important; line-height: 1.5; margin-bottom: 8px !important; }
  html.flat .pitch { font-size: 13.5px; line-height: 1.5; margin-bottom: 14px; }
  html.flat .cta { padding: 10px 22px; }
  html.flat .demo-teaser { margin-top: 16px; padding: 13px 14px 14px; }
  html.flat .demo-teaser .teaser-head { font-size: 23px; }
  html.flat .demo-teaser .teaser-text { margin-bottom: 10px; }
  html.flat .demo-teaser .try-open { margin-top: 12px; padding: 8px 18px; }
}
