@font-face {
  font-family: "Instrument Sans";
  src: url("media/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
:root {
  --bg: #101622;
  --ink: #f5f5f2;
  --muted: #d2d6dc;
  --accent: #ffca76;
  --panel: #172235;
  --gutter: clamp(20px, 4.4vw, 76px);
  --header: 72px;
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 1rem; line-height: 1.52; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--accent); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
img { display: block; max-width: 100%; }
figure, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
.frame { margin-inline: auto; width: calc(100% - 2 * var(--gutter)); }
.skip { position: fixed; z-index: 12; inset: 8px auto auto 12px; padding: 12px; background: var(--accent); color: var(--bg); transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site-header { position: sticky; top: 0; z-index: 7; background: #101622; }
.header-inner { min-height: var(--header); display: flex; align-items: center; justify-content: space-between; gap: 12px 28px; }
.identity, .site-header nav { display: flex; align-items: center; gap: clamp(14px, 2.5vw, 38px); }
.wordmark { font-size: 1.05rem; font-weight: 700; text-decoration: none; }
.availability { color: #afe7c0; font-weight: 650; font-size: .92rem; text-decoration: none; white-space: nowrap; }
.site-header nav a { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; white-space: nowrap; min-height: 42px; }
.contact-link { color: var(--accent); }

.story { --stage-height: calc(100svh - var(--header)); position: relative; isolation: isolate; }
.stage-control-track, .stage-track { position: sticky; top: var(--header); height: var(--stage-height); margin-bottom: calc(0px - var(--stage-height)); }
.stage-control-track { z-index: 3; pointer-events: none; }
.stage-control-track button { pointer-events: auto; }
.stage-track { z-index: 0; }
.stage, .stage-view { width: 100%; height: 100%; position: relative; }
.stage-view { isolation: isolate; overflow: hidden; background: linear-gradient(154deg, #2c2442 8%, #1c203a 56%, #1a2a40); touch-action: pan-y pinch-zoom; }
.stage-view[data-shot="flight"] { background: #78a8cb; }
.stage-poster, .stage-canvas, .butterfly-field, .scene-curtain { position: absolute; inset: 0; width: 100%; height: 100%; }
.butterfly-field { pointer-events: none; }
.stage-poster, .stage-canvas { z-index: 1; }
.google-photo-cut, .scene-curtain, .hobby-transition { z-index: 2; }
.stage-poster { object-fit: contain; }
.stage-canvas { opacity: 0; }
.stage-canvas.is-ready { opacity: 1; }
#flutter-butterflies { position: absolute; z-index: 3; top: 12px; left: var(--gutter); min-height: 44px; padding: 6px 10px; border: 1px solid #696283; background: #171a2d; color: #ded9f5; font-size: .82rem; }
#flutter-butterflies:hover { border-color: #a69ed4; color: #fff7ee; }
.stage-view:not([data-scene="opening"]) #flutter-butterflies:not(:focus-visible) { clip-path: inset(50%); width: 1px; min-height: 1px; padding: 0; overflow: hidden; }
.google-photo-cut { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: radial-gradient(ellipse at 72% 50%, #3d2d27, #17131b 72%); opacity: 0; visibility: hidden; }
.google-photo-cut[data-active] { visibility: visible; }
.google-photo-cut img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 78% center; }
.scene-curtain { opacity: 0; pointer-events: none; background: #ffd6b1; }
.hobby-transition { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); pointer-events: none; visibility: hidden; }
.hobby-transition[data-active] { visibility: visible; }
.hobby-transition i { background: #ad5049; }
.hobby-transition i:nth-child(2) { background: #b37c47; }
.hobby-transition i:nth-child(3) { background: #573b7d; }
.stage-navigation { position: absolute; right: var(--gutter); bottom: 20px; display: flex; align-items: center; gap: 18px; padding: 8px 12px; color: var(--ink); background: #111925; font-size: .88rem; pointer-events: auto; }
.stage-navigation a, .stage-navigation select { pointer-events: auto; }
.stage-navigation a { color: var(--accent); white-space: nowrap; }
.chapter-select { min-width: 0; }
#chapter-select { width: auto; max-width: min(31vw, 260px); min-height: 40px; border: 0; color: var(--ink); background: #202c3d; padding: 5px 8px; font: inherit; text-overflow: ellipsis; cursor: pointer; }
#chapter-select:focus-visible, .demo-form select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chapter-progress { position: absolute; z-index: 4; inset: auto 0 0; height: 4px; background: #111925; }
.chapter-progress i { display: block; background: var(--accent); height: 100%; transform: scaleX(0); transform-origin: left; }
.stage-controls { position: absolute; z-index: 3; right: var(--gutter); top: 20px; display: flex; gap: 12px; align-items: center; max-width: calc(100% - 2 * var(--gutter)); background: #141c2a; padding: 10px 14px; font-size: .91rem; }
/* Keep the control groups blended over the stage instead of occluding its canvas. */
.stage-navigation, .stage-controls { opacity: .98; }
#reset-view { min-height: 38px; padding: 6px 10px; border: 0; background: var(--accent); color: var(--bg); font-weight: 700; }

.chapters { position: relative; z-index: 1; pointer-events: none; }
.chapter { position: relative; min-height: 142svh; padding: clamp(30px, 7svh, 88px) var(--gutter) clamp(50px, 10svh, 120px); scroll-margin-top: var(--header); }
.chapter-opening { min-height: 129svh; }
.chapter-dublin, .chapter-serving, .chapter-room { min-height: 172svh; }
.chapter-now { min-height: 112svh; }
.chapter-content { position: sticky; top: calc(var(--header) + clamp(25px, 6svh, 68px)); width: min(35vw, 495px); min-width: 305px; padding: clamp(19px, 2.1vw, 34px); background: #101622eb; pointer-events: auto; }
.chapter-content { transition: opacity .24s ease; }
.is-interactive .chapter:not(.current-chapter) .chapter-content:not(:focus-within) { opacity: 0; pointer-events: none; }
.in-transition .current-chapter .chapter-content:not(:focus-within) { opacity: .18; }
.story:has(.stage-view[data-shot="flight"]) .chapter-dublin .chapter-content { opacity: 1; }
.chapter-dublin:has(.flight-copy:not([hidden])) .chapter-content { background: #101622f4; }
.chapter-opening .chapter-content { top: calc(var(--header) + 20svh); width: min(40vw, 575px); }
.focused .chapter-content { background: #101622; }
.chapter-hobbies .chapter-content { position: sticky; top: max(calc(var(--header) + 34px), 74svh); margin: 56svh auto 0; width: min(820px, 100%); padding: 15px 22px; }
.chapter-hobbies h2 { font-size: clamp(1.6rem, 2.7vw, 2.8rem); }
.chapter-hobbies .chapter-copy { max-width: 66ch; margin-top: 8px; }
.chapter-hobbies .chapter-actions { margin-top: 9px; }
.hobby-labels { display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; padding: 0; margin: 12px 0 0; text-align: center; gap: 9px; }
.hobby-labels li { background: var(--panel); padding: 7px 4px; color: var(--accent); font-weight: 650; }
.entering { animation: chapter-entrance .68s cubic-bezier(.18,.7,.25,1) var(--entrance-delay, 0ms) backwards; }
@keyframes chapter-entrance {
  from { opacity: .55; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
h1, h2 { margin: 0; font-weight: 680; letter-spacing: -.063em; line-height: 1; text-wrap: balance; }
h1 { font-size: clamp(3.45rem, 5.1vw, 6.6rem); }
h1 span { white-space: nowrap; }
h2 { font-size: clamp(2.5rem, 3.7vw, 4.85rem); }
.lead, .chapter-copy { margin-top: 18px; max-width: 48ch; font-size: clamp(1rem, 1.25vw, 1.15rem); }
.chapter-copy + .chapter-copy { margin-top: 10px; }
.chapter-note { margin-top: 10px; color: var(--muted); max-width: 44ch; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 11px; min-height: 46px; max-width: 100%; padding: 9px 13px; border: 0; color: var(--bg); background: var(--accent); font-size: .94rem; font-weight: 700; text-decoration: none; transition: background .2s ease, transform .2s ease; }
.button:hover { color: var(--bg); background: #ffe2a6; transform: translateY(-2px); }
.button:active { transform: translateY(1px); }
.chapter-opening .button, .chapter-actions { margin-top: 20px; }
.opening-portfolio { color: var(--muted); font-size: .94rem; }
.opening-portfolio a { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; color: var(--accent); font-weight: 650; }
.opening-portfolio a:hover { color: #ffe2a6; }
.chapter-actions { display: flex; flex-wrap: wrap; gap: 7px 15px; align-items: center; }
.secondary { color: var(--accent); display: inline-block; padding-block: 10px; }
.story-gallery { margin-top: 15px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 96px), 1fr)); gap: 10px; align-items: start; }
.story-media { min-width: 0; }
.photo-trigger { position: relative; display: block; border: 0; background: #252d40; width: 100%; padding: 0; cursor: zoom-in; }
.story-media img { width: 100%; height: clamp(105px, 16svh, 164px); object-fit: contain; }
.story-gallery:has(> :only-child) .photo-trigger { width: fit-content; }
.story-gallery:has(> :only-child) img { width: auto; max-width: 100%; }
.photo-trigger span { position: absolute; bottom: 5px; right: 5px; background: #111925; color: #fff8eb; padding: 1px 6px; }
.story-media figcaption { padding-top: 5px; color: var(--muted); font-size: .82rem; line-height: 1.2; }
#photo-viewer { width: min(95vw, 1100px); max-height: 96svh; border: 0; color: var(--ink); background: #101622; padding: 12px; }
#photo-viewer::backdrop { background: #06070de5; }
#photo-viewer figure img { width: 100%; height: auto; max-height: 78svh; object-fit: contain; }
#photo-viewer figure img { cursor: zoom-out; }
#photo-viewer figcaption { padding: 8px 4px 0; }
.photo-close { margin: 0 0 8px auto; display: block; border: 0; min-height: 44px; padding: 7px 11px; background: var(--accent); color: var(--bg); font-weight: 700; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 17px; margin-top: 14px; }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { color: var(--muted); font-size: .84rem; }
.stats dd { font-variant-numeric: tabular-nums; font-size: clamp(1.5rem, 2.5vw, 2.75rem); font-weight: 700; line-height: 1.04; color: var(--accent); }
.chapter-planet .stats { display: grid; grid-template-columns: .85fr 1.05fr 1fr; gap: 13px 5px; margin: 20px 0 18px; }
.chapter-planet .stats div { justify-content: end; min-width: 0; }
.chapter-planet .stats dd { font-size: clamp(1.4rem, 2.6vw, 2.75rem); white-space: nowrap; }
.chapter-planet .stats dt { min-height: 2.45em; line-height: 1.22; margin-top: 6px; }
.interaction { margin-top: 10px; padding: 11px 12px; color: var(--ink); background: var(--panel); }
.interaction p + p { margin-top: 5px; }
.interaction a, .voice-action { color: var(--accent); }
.demo-form { margin-top: 9px; display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.demo-field { display: grid; flex: 1 1 175px; gap: 3px; color: var(--muted); font-size: .87rem; min-width: 0; }
.demo-form select { width: 100%; min-height: 42px; padding: 4px 6px; color: var(--ink); background: var(--bg); border: 1px solid #657287; font: inherit; }
.demo-submit { min-height: 42px; padding: 5px 9px; border: 0; background: var(--accent); color: var(--bg); font-weight: 650; }
.demo-trace { list-style: none; display: grid; gap: 5px; padding: 0; margin: 10px 0 0; }
.demo-trace:empty { margin: 0; }
.demo-trace li { display: grid; grid-template-columns: minmax(75px, .28fr) 1fr; gap: 6px 10px; padding: 6px 8px; background: var(--bg); font-size: .88rem; animation: chapter-entrance .3s ease-out; }
.demo-trace strong { color: #afe7c0; }
.voice-action { background: transparent; min-height: 40px; border: 0; padding: 0; text-decoration: underline; }
.audio-status { margin-left: 8px; color: var(--muted); }
.monitor-controls { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.monitor-controls button { border: 0; background: var(--bg); color: var(--ink); min-height: 40px; padding: 6px 9px; font-size: .89rem; }
.monitor-controls button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.projects { display: grid; gap: 8px; margin-top: 17px; }
.projects a { display: block; padding: 8px 10px; background: var(--panel); text-decoration: none; }
.projects strong { display: block; color: var(--accent); }
.projects span { font-size: .92rem; }
.site-footer { position: relative; z-index: 2; background: var(--panel); padding: 25px 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.footer-inner img { width: 54px; height: 54px; object-fit: cover; }
.footer-inner p { flex: 1; min-width: 145px; font-weight: 700; }
.footer-inner p span { display: block; color: var(--muted); font-weight: 400; }
.contact-details { display: grid; gap: 7px; font-style: normal; min-width: 0; }
.contact-details a { width: fit-content; color: var(--accent); overflow-wrap: anywhere; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.celebration { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.celebration i { position: absolute; inset: 48% auto auto 68%; width: 8px; height: 12px; background: var(--confetti); animation: celebrate 1.25s ease-out forwards; }
@keyframes celebrate {
  from { transform: translate(0, 0); opacity: 1; }
  to { transform: translate(var(--flight-x), var(--flight-y)) rotate(var(--spin)); opacity: 0; }
}
@media (max-width: 1000px) {
  .chapter-content { width: min(40vw, 420px); }
  .chapter-opening .chapter-content { width: min(48vw, 470px); }
  h1 { font-size: clamp(2.65rem, 5.7vw, 3.45rem); }
}
@media (min-width: 821px) and (min-height: 521px), (min-width: 961px) {
  /* Force canvas composition with the page to avoid mirrored Windows overlay clipping. */
  .stage-canvas.is-ready { filter: brightness(1.001); }
}
@media (max-width: 820px), (max-height: 520px) and (max-width: 960px) {
  :root {
    --gutter: clamp(14px, 4.3vw, 30px);
    --header: calc(64px + env(safe-area-inset-top));
    --chapter-nav: 52px;
    --phone-stage: clamp(156px, 42svh, 390px);
    --story-inset: calc(var(--header) + var(--chapter-nav) + var(--phone-stage));
    scroll-padding-top: var(--story-inset);
  }
  .site-header { padding-top: env(safe-area-inset-top); }
  .header-inner { min-height: 64px; gap: 8px; }
  .identity { flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
  .wordmark { font-size: clamp(.8rem, 3.7vw, 1rem); line-height: 1.14; overflow-wrap: anywhere; }
  .availability, .site-header nav { font-size: .81rem; }
  .site-header nav { flex: none; gap: clamp(8px, 2.8vw, 18px); }
  .site-header nav a:first-child { display: none; }
  .site-header nav a { min-height: 44px; }
  .stage-control-track { height: var(--chapter-nav); margin-bottom: 0; background: var(--bg); }
  .stage-navigation { position: static; height: 100%; width: 100%; gap: 10px; padding: 4px var(--gutter); background: var(--bg); }
  .stage-navigation a { display: inline-flex; flex: none; align-items: center; gap: 4px; min-height: 44px; }
  .chapter-select { flex: 1; }
  #chapter-select { width: 100%; max-width: none; min-height: 44px; font-size: 1rem; }
  .stage-track { top: calc(var(--header) + var(--chapter-nav)); z-index: 2; height: var(--phone-stage); margin-bottom: 0; background: var(--bg); }
  .google-photo-cut img { object-position: center; }
  .stage-poster[src^="media/mobile-"], .stage-view[data-scene="opening"]:has(#initial-mobile-poster) .stage-poster { object-fit: cover; }
  .stage-controls { top: calc(var(--chapter-nav) + var(--phone-stage) - 48px); font-size: .82rem; padding: 4px 8px; }
  #reset-view { min-height: 40px; }
  .chapter { min-height: clamp(240px, 43svh, 410px); padding: 26px max(var(--gutter), env(safe-area-inset-right)) 40px max(var(--gutter), env(safe-area-inset-left)); scroll-margin-top: 0; }
  .chapter-dublin, .chapter-serving, .chapter-room { min-height: clamp(310px, 62svh, 580px); }
  .chapter-now { min-height: calc(100svh - var(--story-inset)); }
  .chapter-content, .chapter-opening .chapter-content, .chapter-hobbies .chapter-content {
    position: relative;
    top: auto;
    width: 100%;
    min-width: 0;
    max-width: 620px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
  }
  .chapter-dublin { padding-bottom: 22px; }
  .chapter-dublin .chapter-content { position: sticky; top: calc(var(--story-inset) + 14px); }
  .is-interactive .chapter:not(.current-chapter) .chapter-content:not(:focus-within),
  .in-transition .current-chapter .chapter-content:not(:focus-within) { opacity: 1; pointer-events: auto; }
  .chapter-dublin:has(.flight-copy:not([hidden])) .chapter-content { background: transparent; }
  h1 { font-size: clamp(2.38rem, 8.5vw, 4.4rem); }
  h2 { font-size: clamp(2.05rem, 7.8vw, 3.5rem); }
  .chapter-copy, .lead { margin-top: 12px; }
  .chapter-actions { margin-top: 14px; }
  .chapter-opening .button { margin-top: 10px; }
  .chapter-planet .stats { margin-block: 16px; }
  .story-media img { height: clamp(110px, 23svh, 204px); }
  .celebration i { left: 51%; top: 56%; }
  .contact-details, .footer-links { flex-basis: 100%; }
  .contact-details a, .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .contact-details a { display: block; padding-block: 10px; }
}
@media (max-height: 520px) and (max-width: 960px) and (orientation: landscape) {
  :root { --phone-stage: clamp(115px, 37svh, 195px); --header: calc(52px + env(safe-area-inset-top)); }
  .header-inner { min-height: 52px; }
  .stage-controls { top: calc(var(--chapter-nav) + var(--phone-stage) - 44px); }
  .contact-details { flex: 1 1 260px; }
  .footer-links { flex-basis: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
