/* Clearbox site v2. Tokens from brand/identity/IDENTITY.md: radius 24px, no shadows or gradients. */
@font-face { font-family: 'Fredoka'; src: url('assets/fonts/fredoka.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('assets/fonts/figtree.woff2') format('woff2'); font-weight: 400 700; font-display: swap; }

:root {
  --blue: #37597A; --snow: #FFFFFF; --muzzle: #F7A85A; --ember: #D8672F;
  --midnight: #14213D; --frost: #D9E1EC; --ink: #0F1830; --wrong: #C62F2F;
  --display: 'Fredoka', system-ui, sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
  --radius: 24px;
  --gutter: clamp(20px, 4vw, 56px);
  --bar: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body { font-family: var(--body); font-size: 18px; line-height: 1.5; color: var(--ink); background: var(--blue); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.015em; line-height: 1.04; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 3px; border-radius: 6px; }

.button {
  display: inline-block; padding: 14px 26px; border-radius: 999px; background: var(--muzzle); color: var(--ink);
  font-weight: 600; text-decoration: none; transition: transform .15s ease;
}
.button:hover { transform: rotate(-2deg) scale(1.04); }

/* Top bar */
.top {
  position: fixed; inset: 12px var(--gutter) auto; z-index: 20; height: var(--bar); pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.top > * { pointer-events: auto; }
.top-mark { font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: -0.02em; text-decoration: none; line-height: 1; background: var(--snow); color: var(--blue); padding: 9px 16px 10px; border-radius: 999px; }
.top nav { display: flex; gap: 6px; }
.top nav a { background: var(--snow); padding: 7px 14px; border-radius: 999px; font-size: 15px; font-weight: 600; text-decoration: none; transition: transform .15s ease; }
.top nav a:hover { transform: rotate(-3deg); }
.top-cta { background: var(--snow); color: var(--ink); padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; text-decoration: none; }

/* Hero */
.hero { position: relative; height: 100vh; height: 100svh; min-height: 620px; overflow: hidden; background: var(--blue); color: var(--snow); }
.giant {
  position: absolute; left: 0; right: 0; top: calc(var(--bar) + 26px); text-align: center;
  font-size: min(calc((100vw - 2 * var(--gutter)) / 3.75), 46vh); line-height: .86; letter-spacing: -0.02em;
}
.scene {
  --size: min(44vmin, 390px);
  position: absolute; left: 50%; top: 56%; width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  perspective: 1100px; z-index: 2; cursor: grab; touch-action: pan-y;
  animation: drop .95s cubic-bezier(.3, 1.5, .5, 1) both;
}
@keyframes drop { from { transform: translateY(-115vh) rotate(-8deg); } to { transform: none; } }
.scene.dragging { cursor: grabbing; }
.cube { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(-14deg) rotateY(-28deg); }
.face {
  position: absolute; inset: 0; border-radius: var(--radius);
  background: rgba(217, 225, 236, .09); border: 4px solid rgba(217, 225, 236, .9);
}
.front { transform: translateZ(calc(var(--size) / 2)); }
.back { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
.right { transform: rotateY(90deg) translateZ(calc(var(--size) / 2)); }
.left { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }
.top-face { transform: rotateX(90deg) translateZ(calc(var(--size) / 2)); }
.bottom { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }
.cube-bear { position: absolute; inset: 6%; display: block; }
.cube-bear img { width: 100%; pointer-events: none; }

.hero-foot {
  position: absolute; left: var(--gutter); right: var(--gutter); bottom: 104px; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; pointer-events: none;
}
.hero-foot > * { pointer-events: auto; }
.hero-words { max-width: 300px; }
.tagline { font-family: var(--display); font-weight: 600; font-size: clamp(28px, 2.8vw, 40px); line-height: 1.08; }
.lede { margin-top: 8px; color: var(--frost); }
.hero-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px 20px; }
.plain { font-weight: 600; text-underline-offset: 4px; }
.plain:hover { color: var(--muzzle); }

.badge { position: absolute; right: clamp(16px, 13vw, 220px); top: 50%; width: clamp(104px, 11vw, 160px); z-index: 3; transform: rotate(-8deg); }
.badge-disc { fill: var(--ember); }
.badge-dot { fill: var(--muzzle); }
.badge text { font-family: var(--display); font-weight: 600; font-size: 21px; letter-spacing: .02em; fill: var(--ink); }
.badge-spin { transform-origin: 100px 100px; animation: spin 16s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tapes */
.tapes { position: relative; z-index: 6; height: 0; }
.tape { position: absolute; left: -4vw; width: 108vw; overflow: hidden; padding: 12px 0; }
.tape-a { top: -66px; background: var(--midnight); color: var(--snow); transform: rotate(-2.4deg); z-index: 2; }
.tape-b { top: -34px; background: var(--muzzle); color: var(--ink); transform: rotate(1.8deg); }
.tape-run { display: inline-flex; align-items: center; gap: 22px; white-space: nowrap; will-change: transform; }
.tape-run span { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 3vw, 38px); line-height: 1.1; }
.tape-run img { width: 38px; height: 38px; border-radius: 50%; }

/* A day inside your phone. Default: stacked, each hour its own block. Script upgrades it to a pinned story. */
.day { position: relative; background: var(--frost); }
.day-head { padding: 96px var(--gutter) 0; }
.day h2 { font-size: clamp(24px, 2.6vw, 34px); }
.pills { display: flex; gap: 8px; margin-top: 12px; }
.pills[hidden] { display: none; }
.pills button {
  font: 600 15px var(--body); color: inherit; background: none; border: 2px solid currentColor; border-radius: 999px;
  padding: 4px 13px; cursor: pointer;
}
.pills button.on { background: var(--ink); border-color: var(--ink); color: var(--snow); }

.hour {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 64px); align-items: center;
  padding: 48px var(--gutter);
}
.hour[data-bg="frost"] { background: var(--frost); color: var(--ink); }
.hour[data-bg="muzzle"] { background: var(--muzzle); color: var(--ink); }
.hour[data-bg="blue"] { background: var(--blue); color: var(--snow); }
.hour[data-bg="midnight"] { background: var(--midnight); color: var(--snow); }
.time { font-family: var(--display); font-weight: 600; font-size: clamp(88px, 15vw, 230px); line-height: 1.04; letter-spacing: -0.03em; }
.hour h3 { font-size: clamp(30px, 3.3vw, 46px); margin-top: 12px; max-width: 15em; }
.hour-copy > p:not(.time) { margin-top: 12px; max-width: 30em; font-size: clamp(17px, 1.4vw, 19px); }
.source a { font-weight: 600; text-underline-offset: 3px; }

.hour-show { position: relative; display: flex; justify-content: center; }
.phone {
  --open: 1;
  position: relative; width: min(100%, 300px); height: min(68vh, 560px); min-height: 420px; flex: none;
  border-radius: 40px; background: var(--snow); padding: 10px; transform: rotate(3deg);
}

.inside, .lid { position: absolute; inset: 10px; border-radius: 30px; }
.inside {
  background: var(--frost); color: var(--ink); padding: 26px 20px; display: flex; flex-direction: column; justify-content: center; gap: 12px;
}
.lid {
  background: var(--ink); color: var(--snow); display: flex; align-items: center; padding: 26px;
  font-family: var(--display); font-weight: 600; font-size: 32px; line-height: 1.1;
  --hole: calc(var(--open) * 400px);
  -webkit-mask: radial-gradient(circle at 50% 50%, transparent var(--hole), #000 calc(var(--hole) + 1px));
  mask: radial-gradient(circle at 50% 50%, transparent var(--hole), #000 calc(var(--hole) + 1px));
}
.lid { border: 0; width: auto; text-align: left; cursor: pointer; }
.lid span { opacity: calc(1 - var(--open) * 5); }
.phone.opened .lid { visibility: hidden; }
.tile { background: var(--snow); border-radius: 18px; padding: 12px 16px; font-family: var(--display); font-weight: 600; font-size: 21px; line-height: 1.15; }
.tile small { display: block; font-family: var(--body); font-size: 14px; font-weight: 500; }
.tile-dim { opacity: .72; }
.tile-bright { background: var(--muzzle); }
.inside-battery { align-items: center; text-align: center; }
.inside-battery p { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1.15; }
.battery { position: relative; width: 120px; height: 220px; border-radius: 24px; background: var(--snow); padding: 10px; display: flex; align-items: flex-end; }
.battery::before { content: ''; position: absolute; left: 36px; right: 36px; top: -12px; height: 16px; border-radius: 8px 8px 0 0; background: var(--snow); }
.battery-fill { --charge: 1; display: block; width: 100%; height: calc(18% + var(--charge) * 74%); border-radius: 16px; background: var(--muzzle); }
.emails { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.emails li { height: 14px; border-radius: 7px; background: var(--blue); }
.emails li:nth-child(2), .emails li:nth-child(3) { opacity: .6; }
.bubble { background: var(--blue); color: var(--snow); padding: 12px 16px; border-radius: 18px; font-weight: 600; }
.stamp {
  align-self: center; margin-top: 8px; padding: 6px 16px; border-radius: 12px; transform: rotate(-6deg);
  background: var(--wrong); color: var(--snow); font-family: var(--display); font-weight: 600; font-size: 24px;
}
.reaction { position: absolute; right: max(-6%, -44px); bottom: -5%; width: clamp(150px, 15vw, 220px); z-index: 2; }
.reaction img { width: 100%; }

/* Pinned story, switched on by script when motion is allowed */
.day.pinned { height: 210vh; background: none; }
.pinned .day-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--frost); color: var(--ink); transition: background-color .45s ease, color .45s ease; }
.day-stage { background: var(--frost); color: var(--ink); }
.day-stage[data-bg="muzzle"] { background: var(--muzzle); }
.day-stage[data-bg="blue"] { background: var(--blue); color: var(--snow); }
.day-stage[data-bg="midnight"] { background: var(--midnight); color: var(--snow); }
.day-stage[data-bg="blue"] .pills button.on, .day-stage[data-bg="midnight"] .pills button.on { background: var(--snow); border-color: var(--snow); color: var(--ink); }
.pinned .hour .phone { height: min(calc(100vh - 176px), 560px); min-height: 0; }
.pinned .time { font-size: min(13vw, 21vh); }
.pinned .hour-copy > p:not(.time) { margin-top: 8px; }
.pinned .day-head { position: absolute; z-index: 3; left: 0; top: 0; padding-top: 88px; }
.pinned .hour {
  position: absolute; inset: 0; padding: 150px var(--gutter) 32px; background: none; color: inherit;
  opacity: 0; visibility: hidden; transform: translateY(26px); transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .3s;
}
.pinned .hour.on { opacity: 1; visibility: visible; transform: none; transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1), visibility 0s; }

/* Fact of the day extras */
.day-head { display: grid; grid-template-columns: auto auto; justify-content: start; align-items: center; gap: 6px 16px; }
.day-head .pills { grid-column: 1 / -1; margin-top: 4px; flex-wrap: wrap; }
.streak { font-weight: 600; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; }
.streak[hidden] { display: none; }
.streak i { width: 13px; height: 13px; border-radius: 4px; background: currentColor; opacity: .25; }
.streak i.lit { opacity: 1; background: var(--ember); }
.fact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 16px; }
.share { font: 600 16px var(--body); color: var(--snow); background: var(--ink); border: 0; border-radius: 999px; padding: 10px 18px; cursor: pointer; transition: transform .15s ease; }
.share:hover { transform: rotate(-2deg) scale(1.04); }
.next { font-weight: 600; font-size: 15px; }
.day-stage[data-bg="blue"] .share, .day-stage[data-bg="midnight"] .share { background: var(--snow); color: var(--ink); }

/* Latest */
.latest { background: var(--frost); padding: clamp(72px, 9vw, 130px) 0; overflow: hidden; }
.latest-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(32px, 7vw, 100px); align-items: center; }
.poster { position: relative; display: block; border-radius: var(--radius); overflow: hidden; transform: rotate(-3deg); transition: transform .2s ease; }
.poster:hover { transform: rotate(0); }
.play { position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; background: var(--muzzle); }
.play::after { content: ''; position: absolute; left: 33px; top: 26px; border-left: 26px solid var(--ink); border-top: 16px solid transparent; border-bottom: 16px solid transparent; }
.latest-words > * + * { margin-top: 16px; }
.latest-label { font-weight: 600; color: var(--blue); font-size: 24px; font-family: var(--display); }
.latest h2 { font-size: clamp(44px, 7vw, 100px); color: var(--blue); }
.latest-words p { max-width: 30em; }

/* Free */
.free { background: var(--muzzle); padding: clamp(72px, 9vw, 120px) 0 clamp(48px, 6vw, 72px); }
.free h2 { font-size: clamp(56px, 12.4vw, 186px); line-height: .92; letter-spacing: -0.025em; color: var(--midnight); }
.free-row { margin-top: 28px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 24px; align-items: end; }
.free p + p { margin-top: 14px; }
.free p { max-width: 32em; font-size: clamp(18px, 1.6vw, 21px); }

/* Footer */
.foot { background: var(--midnight); color: var(--snow); padding-top: 44px; overflow: hidden; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; font-weight: 600; }
.foot ul a { text-underline-offset: 4px; }
.foot ul a:hover { color: var(--muzzle); }
.foot-giant { margin-top: 24px; font-family: var(--display); font-weight: 600; text-align: center; font-size: calc((100vw - 2 * var(--gutter)) / 3.75); line-height: .9; letter-spacing: -0.02em; color: var(--blue); }
.fine { padding: 10px var(--gutter) 20px; font-size: 15px; color: var(--frost); text-align: center; }

/* 404 */
.lost { min-height: 100vh; min-height: 100svh; background: var(--blue); color: var(--snow); display: grid; place-content: center; justify-items: start; gap: 18px; padding: var(--gutter); }
.lost h1 { font-size: clamp(48px, 8vw, 96px); }

@media (max-width: 900px) {
  .top nav { display: none; }
  .hero { min-height: 640px; }
  .giant { top: calc(var(--bar) + 18px); }
  .scene { --size: min(58vw, 34vh); top: 48%; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 12px; bottom: 84px; }
  .hero-words, .hero-links { max-width: none; justify-content: flex-start; }
  .hero-links { gap: 8px 14px; }
  .hero-links .button { padding: 11px 18px; font-size: 16px; }
  .hero-links .plain { font-size: 16px; }
  .badge { right: 10px; top: calc(92px + 25vw); width: 112px; }
  .hour { grid-template-columns: minmax(0, 1fr); }
  .time { font-size: clamp(76px, 24vw, 150px); }
  .latest-grid { grid-template-columns: minmax(0, 1fr); }
  .poster { max-width: 290px; }
  .free-row { grid-template-columns: minmax(0, 1fr); }
  .free-row img { width: 200px; }
  .phone { height: 440px; min-height: 0; width: min(100%, 250px); }
  .hour-show { justify-content: flex-start; }
  .hour { padding-bottom: 72px; }
  .day-head { padding-top: 84px; }
  .reaction { width: 130px; right: 0; }
}

@media (max-width: 900px) and (max-height: 740px) {
  .scene { --size: min(44vw, 24vh); top: 39%; }
  .hero-foot { gap: 8px; bottom: 76px; }
  .tagline { font-size: 26px; }
  .lede { font-size: 16px; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .badge-spin { animation: none; }
  .button, .poster, .top nav a { transition: none; }
}
