@layer reset, base, layout, components, motion;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; }
  img { max-width: 100%; height: auto; display: block; }
  a { font: inherit; color: inherit; text-decoration: none; }
  ul { margin: 0; padding: 0; list-style: none; }
  h1, p { margin: 0; }
}

@layer base {
  :root {
    --void: #0c0b0a;
    --print: #f3eee6;
    --ink: #f4f0e8;
    --muted: color-mix(in oklab, var(--ink) 58%, var(--void));
    --safelight: #e08a3c;
    --safelight-ink: #1a1008;
    --line: color-mix(in oklab, var(--ink) 12%, var(--void));
    --font-display: "Unbounded", "Arial Black", sans-serif;
    --font-text: "Onest", "Segoe UI", sans-serif;
    --fs-xs: clamp(0.72rem, 0.7rem + 0.2vw, 0.8rem);
    --fs-sm: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
    --fs-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.05rem);
    --fs-md: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
    --fs-hero: clamp(1.85rem, 1.05rem + 3.2vw, 3.4rem);
    --pad: clamp(1rem, 2.6vw, 2.2rem);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dur: 180ms;
  }

  html {
    background: var(--void);
    color: var(--ink);
  }
  html, body {
    width: 100%;
    min-height: 100%;
  }
  body {
    font-family: var(--font-text);
    font-size: var(--fs-base);
    line-height: 1.42;
    min-height: 100dvh;
    background: var(--void);
  }
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
  }
  h1 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.05em;
    line-height: 0.9;
    font-size: var(--fs-hero);
  }
  :focus-visible {
    outline: 2px solid var(--safelight);
    outline-offset: 3px;
  }
  .skip { position: absolute; left: -999px; top: 0; }
  .skip:focus {
    left: var(--pad);
    top: 0.5rem;
    z-index: 40;
    background: var(--print);
    color: var(--safelight-ink);
    padding: 0.5rem 0.75rem;
  }
}

@layer layout {
  .stage {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto auto;
    justify-content: start;
    align-items: center;
    gap: clamp(1.1rem, 3vw, 2.4rem);
    min-height: 100dvh;
    min-height: 100svh;
    padding: var(--pad);
    overflow: hidden;
  }
  .stage::before {
    content: "";
    position: absolute;
    width: min(42vw, 28rem);
    height: min(42vw, 28rem);
    left: -8%;
    top: -12%;
    background: radial-gradient(circle, color-mix(in oklab, var(--safelight) 22%, transparent), transparent 70%);
    pointer-events: none;
    z-index: 0;
  }
  .col, .device { position: relative; z-index: 1; }
  .col {
    display: grid;
    gap: 0.7rem;
    max-width: 26.5rem;
    align-content: center;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--fs-sm);
    letter-spacing: -0.04em;
  }
  .brand img { width: 28px; height: 28px; }
  .kicker {
    font-size: var(--fs-xs);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--safelight);
    font-weight: 600;
  }
  .lede {
    font-size: var(--fs-md);
    color: var(--muted);
    max-width: 38ch;
    line-height: 1.35;
  }
  .spec {
    display: grid;
    gap: 0.42rem;
    margin: 0.15rem 0 0;
    padding: 0;
  }
  .spec > div {
    display: grid;
    grid-template-columns: 4.6rem minmax(0, 1fr);
    gap: 0.65rem;
    align-items: baseline;
  }
  .spec dt {
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    letter-spacing: -0.03em;
    font-weight: 700;
  }
  .spec dd {
    margin: 0;
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.3;
  }

  @media (max-width: 800px) {
    html, body { overflow: auto; }
    .stage {
      grid-template-columns: 1fr;
      justify-items: center;
      min-height: auto;
      overflow: visible;
      padding-bottom: 2rem;
    }
    .col { width: 100%; max-width: none; }
  }
}

@layer components {
  .cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    min-width: 9.5rem;
    margin-top: 0.35rem;
    padding: 0.8rem 1.55rem;
    background: var(--safelight);
    color: var(--safelight-ink);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.04em;
    border: 0;
    width: fit-content;
    touch-action: manipulation;
  }
  .cta:hover { filter: brightness(1.07); }
  .cta.is-busy { opacity: 0.65; }

  .device {
    position: relative;
    width: min(250px, 72vw);
    aspect-ratio: 9 / 19.5;
    height: auto;
    border-radius: 2rem;
    background: #221f1a;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, 0.08),
      0 28px 50px rgba(0, 0, 0, 0.55);
    padding: 0.45rem;
    z-index: 2;
  }
  .device__chrome {
    position: absolute;
    top: 0.7rem;
    left: 50%;
    width: 5.2rem;
    height: 0.28rem;
    transform: translateX(-50%);
    background: #0a0908;
    border-radius: 99px;
    z-index: 2;
  }
  .device__screen {
    height: 100%;
    border-radius: 1.55rem;
    overflow: hidden;
    background: #0a0908;
  }
  .app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100%;
    background: #11100e;
    color: var(--print);
  }
  .app__bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.05rem 0.7rem 0.4rem;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .app__bar span {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    text-transform: none;
    font-size: 0.72rem;
  }
  .app__bar em { font-style: normal; color: var(--safelight); }
  .app__work {
    display: grid;
    grid-template-columns: 2.15rem 1fr;
    min-height: 0;
    gap: 0.15rem;
    padding: 0 0.2rem 0 0.15rem;
  }
  .app__rail {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.15rem 0 0.35rem;
    font-size: 0.42rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    writing-mode: horizontal-tb;
    color: color-mix(in oklab, var(--print) 42%, transparent);
  }
  .app__rail em {
    font-style: normal;
    padding: 0.22rem 0;
    border-left: 1px solid transparent;
  }
  .app__rail .is-on {
    color: var(--print);
    border-left-color: var(--safelight);
  }
  .app__body {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    min-height: 0;
    min-width: 0;
  }
  .hist {
    display: block;
    width: 100%;
    height: 1.05rem;
    fill: color-mix(in oklab, var(--safelight) 55%, var(--print));
    opacity: 0.55;
  }
  .app__stage {
    position: relative;
    margin: 0.15rem 0.2rem 0.25rem 0;
    border-radius: 0.28rem;
    overflow: hidden;
    min-height: 0;
  }
  .app__stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
    background: #0a0908;
  }
  .mask {
    position: absolute;
    inset: 18% 22% auto auto;
    width: 38%;
    aspect-ratio: 1;
    border: 1px solid rgba(224, 138, 60, 0.85);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(12, 11, 10, 0.35);
    pointer-events: none;
  }
  .crop {
    position: absolute;
    inset: 10% 8%;
    pointer-events: none;
  }
  .crop--thin .crop__frame {
    box-shadow: none;
    border-color: rgba(243, 238, 230, 0.55);
  }
  .crop__frame {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(243, 238, 230, 0.92);
    box-shadow: 0 0 0 999px rgba(8, 7, 6, 0.42);
  }
  .h {
    position: absolute;
    width: 9px;
    height: 9px;
    background: var(--print);
    box-shadow: 0 0 0 1px rgba(12, 11, 10, 0.45);
  }
  .h--tl { top: -4px; left: -4px; }
  .h--t { top: -4px; left: 50%; margin-left: -4px; }
  .h--tr { top: -4px; right: -4px; }
  .h--l { top: 50%; left: -4px; margin-top: -4px; }
  .h--r { top: 50%; right: -4px; margin-top: -4px; }
  .h--bl { bottom: -4px; left: -4px; }
  .h--b { bottom: -4px; left: 50%; margin-left: -4px; }
  .h--br { bottom: -4px; right: -4px; }

  .app__tone {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.18rem 0.4rem;
    align-items: center;
    padding: 0.2rem 0.35rem 0.1rem 0;
    font-size: 0.48rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: color-mix(in oklab, var(--print) 70%, transparent);
  }
  .grade {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.2rem;
    padding: 0.15rem 0.2rem 0.1rem 0;
    text-align: center;
    font-size: 0.42rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: color-mix(in oklab, var(--print) 62%, transparent);
  }
  .grade span {
    display: grid;
    justify-items: center;
    gap: 0.18rem;
  }
  .wheel {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    background: conic-gradient(from 210deg, #c45a4a, #d4a24a, #5aaa6a, #4a7ec4, #8a5ac4, #c45a4a);
    box-shadow: inset 0 0 0 0.42rem #141210;
  }
  .wheel--s { filter: hue-rotate(-12deg) saturate(0.9); }
  .wheel--m { filter: hue-rotate(8deg); }
  .wheel--h { filter: hue-rotate(28deg) saturate(1.1); }
  .rail {
    display: block;
    height: 2px;
    background: color-mix(in oklab, var(--print) 18%, transparent);
  }
  .rail b {
    display: block;
    height: 100%;
    background: var(--safelight);
  }
  .app__tools {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 0.35rem 0.2rem 0.7rem;
    font-size: 0.48rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    color: color-mix(in oklab, var(--print) 55%, transparent);
  }
  .app__tools em { font-style: normal; padding: 0.35rem 0; }
  .app__tools .is-on { color: var(--print); }

  .dl-body {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--pad);
  }
  .dl-card {
    display: grid;
    gap: 0.85rem;
    max-width: 26rem;
  }
  .dl-card h1 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.15rem);
    letter-spacing: -0.05em;
    line-height: 0.95;
  }
  .dl-card p { color: var(--muted); }
  .back { color: var(--muted); font-size: var(--fs-sm); }
}

@layer motion {
  .col, .device { animation: rise 0.7s var(--ease) both; }
  .device { animation-delay: 80ms; }
  .cta { transition: filter var(--dur) var(--ease), opacity var(--dur) var(--ease); }

  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}
