/* Base reset (same rules the page was previewed with) */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}
img{max-width:100%}
[hidden]:not([hidden=until-found i]){display:none!important}

/* Page styles */
  /* Layout: two columns: text, status and countdown on the
     left, a code-editor window on the right that types out the site while the percentage climbs.
     The theme picker floats at the bottom centre and slides away while scrolling down. The footer
     has a faded-looking but working link on the right. Four colour themes recolour everything through
     the --cN-rgb tokens. */
  :root {
    --bg: #150d19;
    --fg: #fdf3ea;
    --muted: #b7a6b3;
    --line: #34253a;
    --c1-rgb: 255, 94, 91;
    --c2-rgb: 255, 182, 39;
    --c3-rgb: 255, 61, 129;
    --c4-rgb: 46, 196, 182;
    --coral: rgb(var(--c1-rgb));
    --amber: rgb(var(--c2-rgb));
    --pink: rgb(var(--c3-rgb));
    --teal: rgb(var(--c4-rgb));
    --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --wrap-max: 1040px;
    color-scheme: dark;
  }

  * { box-sizing: border-box; }
  html, body { min-height: 100%; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    padding-block: 32px 40px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    transition: background .4s ease;
  }
  .wrap { max-width: var(--wrap-max); margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }

  /* The first screen is filled by the hero, so the footer sits below the fold and the page can scroll */
  main {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 48px;
    align-items: center; align-content: center;
    min-height: calc(100vh - 32px);
    min-height: calc(100svh - 32px);
  }
  .copy { display: flex; flex-direction: column; gap: 32px; min-width: 0; }

  .eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--teal); }

  .status { display: flex; align-items: center; gap: 12px; font-size: 0.95rem; color: var(--muted); }
  .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(var(--c4-rgb), .6); animation: ping 1.8s infinite; flex: none; }
  @keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(var(--c4-rgb), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--c4-rgb), 0); } }

  .launch-note { margin: 0 0 12px; font-size: 0.85rem; color: var(--muted); }
  .countdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-width: 460px; }
  .unit { border-top: 3px solid var(--coral); padding-top: 10px; }
  .unit:nth-child(2) { border-color: var(--amber); }
  .unit:nth-child(3) { border-color: var(--pink); }
  .unit:nth-child(4) { border-color: var(--teal); }
  .unit b { display: block; font-family: var(--font-display); font-weight: 500; font-size: clamp(1.6rem, 5vw, 2.3rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
  .unit span { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

  /* Code window */
  .stage { width: 100%; max-width: 480px; justify-self: center; min-width: 0; }
  .editor {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px -24px rgba(var(--c1-rgb), 0.4);
  }
  .titlebar { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
  .lights { display: flex; gap: 7px; }
  .lights i { width: 10px; height: 10px; border-radius: 50%; display: block; }
  .lights i:nth-child(1) { background: var(--coral); }
  .lights i:nth-child(2) { background: var(--amber); }
  .lights i:nth-child(3) { background: var(--teal); }
  .tab { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
  .code { padding: 14px 0; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.75; overflow-x: auto; }
  .ln { display: flex; min-width: max-content; }
  .ln.active { background: rgba(var(--c2-rgb), 0.08); }
  .num { width: 42px; padding-right: 14px; text-align: right; color: var(--muted); opacity: 0.55; flex: none; user-select: none; }
  .txt { white-space: pre; min-height: 1.75em; padding-right: 16px; }
  .cm { color: var(--teal); font-style: italic; }
  .kw { color: var(--coral); }
  .st { color: var(--amber); }
  .fn { color: var(--pink); }
  .id { color: var(--fg); }
  .pn { color: var(--muted); }
  .cur::after { content: ""; display: inline-block; width: 0.55em; height: 1.15em; margin-left: 1px; vertical-align: text-bottom; background: var(--amber); animation: blink 1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }

  .statusbar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px 14px; border-top: 1px solid var(--line); }
  #stLabel { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
  #pct { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 6vw, 2.4rem); line-height: 1; font-variant-numeric: tabular-nums; }
  .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
  #bar { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--coral), var(--amber), var(--pink)); }


  footer {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px;
    font-size: 0.82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px;
    margin-top: clamp(0px, 8vh, 96px);
  }
  /* Looks switched off, but it is a working link */
  .next {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 56px; min-height: 36px;
    font: 500 0.85rem/1 var(--font-body);
    color: var(--muted);
    text-decoration: none;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    opacity: 0.5;
  }
  .next:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }

  /* Theme picker, floating at the bottom */
  .dock {
    position: fixed; inset: 0;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    pointer-events: none;
    z-index: 20;
  }
  .dock-in { position: relative; max-width: var(--wrap-max); height: 100%; margin: 0 auto; }
  /* The picker rides the right edge. --p is scroll progress (0 = top, 1 = bottom) and
     --end is where it comes to rest at the bottom. Both are set by the script. */
  .picker {
    position: absolute; right: 0;
    top: calc((1 - var(--p, 0)) * (16px + env(safe-area-inset-top, 0px)) + var(--p, 0) * var(--end, 400px));
    pointer-events: auto;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    transition: top .3s cubic-bezier(.2, .8, .2, 1);
  }
  .picker-label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
  .swatches { --sw: 22px; --sg: 10px; position: relative; display: flex; gap: var(--sg); }
  .swatch {
    width: var(--sw); height: var(--sw); padding: 0; border: 0; border-radius: 50%; cursor: pointer;
    transition: transform .18s cubic-bezier(.3, 1.6, .5, 1);
    animation: swIn .5s cubic-bezier(.3, 1.5, .5, 1) backwards;
    animation-delay: calc(0.55s + var(--i, 0) * 0.07s);
  }
  @media (hover: hover) { .swatch:hover { transform: scale(1.18); } }
  .swatch:active { transform: scale(0.9); }
  .swatch:focus-visible { outline: 2px solid var(--fg); outline-offset: 5px; }
  /* Selection ring that slides between swatches */
  .ring {
    position: absolute; left: -4px; top: -4px; width: calc(var(--sw) + 8px); height: calc(var(--sw) + 8px);
    border: 2px solid var(--fg); border-radius: 50%; pointer-events: none;
    transform: translateX(calc(var(--sel, 0) * (var(--sw) + var(--sg))));
    transition: transform .4s cubic-bezier(.3, 1.4, .5, 1);
  }
  .picker { animation: dockIn .6s cubic-bezier(.2, .8, .2, 1) .3s backwards; }
  @keyframes dockIn { from { opacity: 0; transform: translateY(22px) scale(.96); } }
  @keyframes swIn { from { opacity: 0; transform: scale(0); } }

  /* Circular colour reveal when the theme changes (browsers with view transitions) */
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
  ::view-transition-old(root) { z-index: 1; }
  ::view-transition-new(root) { z-index: 2; }

  /* Large screens: a little more room and larger code */
  @media (min-width: 1280px) {
    :root { --wrap-max: 1180px; }
    main { gap: 72px; }
    .stage { max-width: 540px; }
    .code { font-size: 0.92rem; }
    .eyebrow { font-size: 0.85rem; }
    .status { font-size: 1.02rem; }
    .countdown { max-width: 520px; }
  }
  /* Tablets and below: stack the text above the code window */
  @media (max-width: 900px) {
    main { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .stage { max-width: 560px; justify-self: start; }
  }
  /* Phones */
  @media (max-width: 560px) {
    body { padding-block: 20px 32px; }
    .wrap { gap: 40px; }
    main { gap: 32px; }
    .copy { gap: 24px; }
    .code { font-size: 0.76rem; }
    .num { width: 36px; padding-right: 10px; }
    .countdown { gap: 10px; }
    .unit span { font-size: 0.66rem; letter-spacing: 0.06em; }
  }
  /* Very small phones */
  @media (max-width: 340px) {
    .countdown { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; }
    .picker-label { display: none; }
  }
  /* Touch screens: bigger colour swatches */
  @media (pointer: coarse) {
    .swatches { --sw: 28px; --sg: 12px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .dot, .cur::after, .picker, .swatch { animation: none; }
    .picker, body, .swatch, .ring { transition: none; }
  }
