/* Cronos landing. The look is the desktop app's: the first-run story
   (apps/desktop/frontend/src/onboarding/first-run.css) on the Studio Crystal
   dark material (apps/desktop/frontend/src/theme/crystal.css). Keep the tokens
   below in step with those files. Always dark, like the story it comes from. */
@property --sweep { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  color-scheme: dark;
  --bg: #141720;
  --panel: #202530;
  --text: #edf0f8;
  --muted: #b2bdd0;
  --border: #3b4354;
  --accent: #b6a5ff;
  --on-accent: #231744;
  --error: #ff9baa;
  --success: #abe6cf;
  --cal-bg: #151b2b;
  --cal-gridline: #303a52;

  --glass-fill: #252b3bd9;
  --glass-edge: #ffffff29;
  --glass-glint: #ffffff24;
  --glass-shade: #00000030;
  --glass-control: #ffffff0d;
  --glass-selected: #ffffff18;
  --glass-blur: 24px;
  --glass-canvas: radial-gradient(ellipse at 8% 0%, #404c6e65, transparent 48%), radial-gradient(ellipse at 100% 85%, #463e6650, transparent 55%), #141720;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scrollbar-color: var(--border) transparent; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--glass-canvas) fixed;
  color: var(--text);
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, p, ol, figure, blockquote { margin: 0; padding: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ── Light behind the glass: slow drifting glows give the material something to bend. */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(90px); will-change: transform; }
.aurora i:nth-child(1) { width: 52vmax; height: 52vmax; left: -14vmax; top: -18vmax; background: #404c6e; opacity: .5; animation: drift-a 46s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 46vmax; height: 46vmax; right: -16vmax; bottom: -20vmax; background: #463e66; opacity: .55; animation: drift-b 58s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 30vmax; height: 30vmax; left: 38%; top: 30%; background: var(--accent); opacity: .09; animation: drift-c 38s ease-in-out infinite alternate; }
@keyframes drift-a { to { transform: translate3d(16vmax, 12vmax, 0) scale(1.15); } }
@keyframes drift-b { to { transform: translate3d(-18vmax, -10vmax, 0) scale(1.1); } }
@keyframes drift-c { to { transform: translate3d(-14vmax, 10vmax, 0) scale(1.35); } }

/* ── Studio Crystal material (crystal.css recipe). */
.glass, .pill {
  background: linear-gradient(135deg, var(--glass-glint), transparent 58%), var(--glass-fill);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--glass-glint), 0 6px 22px var(--glass-shade);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(135%);
  backdrop-filter: blur(var(--glass-blur)) saturate(135%);
}
.pill { display: inline-flex; gap: 3px; padding: 4px; border-radius: 999px; }
.pill > * {
  border: 1px solid transparent; border-radius: 999px; background: transparent;
  padding: 5px 13px; font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--muted);
  transition: background .2s, color .2s;
}
.pill > button:hover { background: var(--glass-control); color: var(--text); }
.pill > :is(.active, [aria-pressed="true"]) {
  color: var(--text); background: var(--glass-selected); border-color: var(--glass-edge);
  box-shadow: 0 2px 6px var(--glass-shade), inset 0 1px var(--glass-glint);
}


/* ── Stage: the name and the one field fill the first screen. */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 72px var(--gutter);
  text-align: center;
}
.scene { width: 100%; }

/* ── The story from the app's welcome: days against decades, then the two gods.
   It plays as it scrolls into view; without the script it is simply all there. */
.myth { display: grid; justify-items: center; gap: clamp(56px, 9vw, 112px); padding: clamp(40px, 8vw, 96px) var(--gutter); text-align: center; }
.scene-charts { position: relative; width: min(640px, 100%); height: 235px; }
.chart { position: absolute; top: 0; left: 50%; width: 240px; }
.chart-days { transform: translateX(calc(-50% - clamp(85px, 23vw, 180px))); }
.chart-decades { transform: translateX(calc(-50% + clamp(85px, 23vw, 180px))); }
.bars { height: 180px; display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.bars span { width: 3px; border-radius: 3px; background: currentColor; transition: height .18s ease-out; }
.bars span:nth-child(2) { transition-delay: .24s; }
.bars span:nth-child(3) { transition-delay: .48s; }
.bars span:nth-child(4) { transition-delay: .72s; }
.bars span:nth-child(5) { transition-delay: .96s; }
.bars span:nth-child(6) { transition-delay: 1.2s; }
.bars span:nth-child(7) { transition-delay: 1.44s; }
.chart-days span:nth-child(1) { height: 46px; }
.chart-days span:nth-child(2) { height: 98px; }
.chart-days span:nth-child(3) { height: 30px; }
.chart-days span:nth-child(4) { height: 72px; }
.chart-days span:nth-child(5) { height: 38px; }
.chart-days span:nth-child(6) { height: 108px; }
.chart-days span:nth-child(7) { height: 54px; }
.chart-decades span:nth-child(1) { height: 3.2px; }
.chart-decades span:nth-child(2) { height: 9.5px; }
.chart-decades span:nth-child(3) { height: 27px; }
.chart-decades span:nth-child(4) { height: 41px; }
.chart-decades span:nth-child(5) { height: 86px; }
.chart-decades span:nth-child(6) { height: 119px; }
.chart-decades span:nth-child(7) { height: 170px; }
.chart-label { margin-top: 24px; font: 600 17px var(--font-mono); letter-spacing: .16em; transition: opacity .6s; }
.myth.armed .chart:not(.grown) .bars span { height: 1px; }
.myth.armed .chart:not(.grown) .chart-label { opacity: 0; }

.scene-story { width: min(1100px, 100%); display: grid; gap: clamp(28px, 5vw, 56px); }
.story-block { transition: opacity 1.1s var(--ease-out), filter 1.1s var(--ease-out), transform 1.1s var(--ease-out); }
.story-block:last-child { margin-top: clamp(28px, 6vw, 72px); }
.myth.armed .story-block:not(.shown) { opacity: 0; filter: blur(12px); transform: translateY(14px); }
.scene-story h2 { margin-bottom: 12px; font-size: clamp(30px, 4.4vw, 56px); line-height: 1.1; font-weight: 500; letter-spacing: -.035em; text-wrap: balance; }
.story-wide h2 { margin: 0 auto; max-width: 900px; font-size: clamp(24px, 3.4vw, 42px); }
.scene-story p { margin: 4px 0; font-size: clamp(16px, 1.6vw, 21px); color: var(--muted); }

/* ── Act three, and the page itself: the name, the promise, the one field. */
.scene-brand { display: grid; justify-items: center; }
.lockup { display: flex; align-items: center; justify-content: center; gap: .14em; font-size: clamp(56px, 9vw, 144px); }
.lockup h1 { font-size: 1em; line-height: 1.05; font-weight: 600; letter-spacing: -.055em; }
.mark { width: .98em; height: .98em; flex: none; overflow: visible; transition: filter 1.2s var(--ease-out); }
.mark g { opacity: 0; transform: scale(.55); transform-origin: 12px 21px; transition: opacity .32s ease-out, transform .6s var(--ease-out); }
.mark[data-stage="leaf"] .m-leaf, .mark[data-stage="sprout"] .m-sprout,
.mark[data-stage="stem"] .m-stem, .mark[data-stage="tree"] .m-tree { opacity: 1; transform: none; }
.mark.bloom { filter: drop-shadow(0 6px 26px #8cdb8b80); animation: bloom 1.4s var(--ease-out); }
@keyframes bloom { 0% { transform: scale(1); } 35% { transform: scale(1.12) rotate(-2deg); } 100% { transform: scale(1); } }

.soon { margin-top: clamp(10px, 1.6vw, 22px); font-size: clamp(18px, 2.1vw, 28px); font-weight: 500; letter-spacing: .02em; color: var(--muted); }

.signup {
  position: relative; isolation: isolate;
  width: min(520px, 100%); margin-top: clamp(32px, 5vw, 56px); padding: 22px;
  border-radius: 18px; text-align: left;
}
/* The light that runs once around the panel's edge when it arrives. */
.signup::after {
  content: ''; position: absolute; inset: -1px; z-index: 1; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0;
  background: conic-gradient(from var(--sweep), transparent 0 68%, #ffffffd0 86%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.signup > label { display: block; font-size: 15px; line-height: 1.45; color: var(--text); text-wrap: pretty; }
.signup > label strong { display: block; font-weight: 600; }
.signup > label span { display: block; margin-top: 4px; color: var(--muted); }
.signup-row { display: flex; gap: 8px; margin-top: 14px; }
.signup input[type="email"] {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text);
  caret-color: var(--accent); appearance: none; -webkit-appearance: none;
  transition: border-color .2s;
}
.signup input[type="email"]::placeholder { color: var(--muted); opacity: .8; }
.signup input[type="email"]:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--text)); }
.signup input[type="email"]:focus-visible { border-color: var(--accent); }
.signup input[aria-invalid="true"] { border-color: var(--error); }
.signup button {
  flex: none; height: 46px; padding: 0 20px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; white-space: nowrap;
  box-shadow: inset 0 1px 0 #ffffff55, 0 4px 14px #00000040;
  transition: filter .2s, transform .2s var(--ease-out);
}
.signup button:hover { filter: brightness(1.08); }
.signup button:active { transform: scale(.98); }
.signup button:disabled { cursor: progress; filter: saturate(.5) brightness(.85); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.signup-status { font-size: 14px; color: var(--error); }
.signup-status:not(:empty) { margin-top: 10px; }
.signup.done :is(label, .signup-row) { display: none; }
.signup.done .signup-status { margin: 0; font-size: 17px; line-height: 1.45; color: var(--success); text-align: center; animation: rise .9s var(--ease-out) both; }

.quote { width: min(560px, 100%); min-height: 5.2em; margin-top: clamp(28px, 4vw, 44px); transition: opacity .8s ease, filter .8s ease; }
.quote.swapping { opacity: 0; filter: blur(8px); }
.quote blockquote p { font-size: clamp(15px, 1.4vw, 18px); line-height: 1.5; color: var(--muted); text-wrap: balance; }
.quote figcaption { margin-top: 6px; font-size: 13px; color: var(--muted); opacity: .7; }
.quote figcaption:empty { display: none; }

/* Arrival of the brand after the story (or on a return visit). */
html[data-act="brand"] .lockup h1 { animation: name-in 1.6s var(--ease-out) .35s both; }
html[data-act="brand"] .soon { animation: rise 1.1s var(--ease-out) 1.15s both; }
html[data-act="brand"] .signup { animation: rise 1.2s var(--ease-out) 1.55s both; }
html[data-act="brand"] .signup::after { animation: sweep 2.6s cubic-bezier(.4, 0, .2, 1) 2.1s both; }
html[data-act="brand"] .quote { animation: reveal 1.4s ease 2.5s both; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; filter: blur(12px); transform: translateY(16px); } to { opacity: 1; filter: none; transform: none; } }
@keyframes name-in { from { opacity: 0; filter: blur(18px); letter-spacing: .12em; } to { opacity: 1; filter: none; letter-spacing: -.055em; } }
@keyframes sweep { 0% { --sweep: 0deg; opacity: 0; } 12%, 80% { opacity: 1; } 100% { --sweep: 360deg; opacity: 0; } }

/* ── The app, drawn with its own material: glass for navigation, a quiet sheet for the day. */
.preview { padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(64px, 10vw, 120px); display: grid; justify-items: center; text-align: center; }
.preview h2 { font-size: clamp(30px, 4.6vw, 60px); line-height: 1.08; font-weight: 600; letter-spacing: -.04em; text-wrap: balance; }
.preview-body { max-width: 62ch; margin-top: 18px; font-size: clamp(16px, 1.5vw, 19px); color: var(--muted); text-wrap: pretty; }

.window {
  width: min(940px, 100%); margin-top: clamp(32px, 5vw, 56px); padding: 8px;
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 8px; text-align: left;
  border: 1px solid var(--glass-edge); border-radius: 26px;
  background: #1a1e2a99; box-shadow: inset 0 1px 0 var(--glass-glint), 0 30px 80px #00000066;
}
.win-side { border-radius: 20px; padding: 18px 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.win-brand { display: flex; align-items: center; gap: 8px; padding: 0 6px 14px; font-size: 21px; font-weight: 650; letter-spacing: -.04em; }
.win-brand svg { width: 22px; height: 22px; }
.win-item { padding: 9px 12px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--muted); }
.win-item.active { color: var(--text); font-weight: 600; background: var(--glass-selected); border-color: var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-glint), 0 2px 5px var(--glass-shade); }
.win-main { min-width: 0; padding: 6px 6px 6px 2px; }
.win-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.win-total { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.win-total b { color: var(--text); font-weight: 600; }

.sheet {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr);
  padding: 12px 12px 12px 6px; border: 1px solid color-mix(in srgb, var(--border) 75%, transparent); border-radius: 18px;
  background: var(--cal-bg); box-shadow: inset 0 1px 0 var(--glass-glint);
  --hour: 44px;
}
.hours { list-style: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; padding-right: 8px; }
.hours li { height: var(--hour); line-height: 1; transform: translateY(-.45em); }
.blocks { position: relative; height: calc(var(--hour) * 8); background: repeating-linear-gradient(to bottom, var(--cal-gridline) 0 1px, transparent 1px var(--hour)); }
.block {
  --c: var(--accent);
  position: absolute; left: 6px; right: 0; overflow: hidden; padding: 3px 10px;
  border-radius: 5px; font-size: 12px; font-weight: 500; line-height: 1.35; white-space: nowrap; color: var(--text);
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 35%, var(--panel)), color-mix(in srgb, var(--c) 19%, var(--panel)));
  box-shadow: inset 2px 0 0 var(--c), inset 0 1px 0 color-mix(in srgb, var(--c) 40%, var(--glass-glint)), inset 0 -1px 0 #00000015;
}
.block.focus { --c: #b6a5ff; }
.block.make { --c: #80cfb5; }
.block.meeting { --c: #a98be0; }
.block.neutral { --c: #8795b0; }
.block.drift { --c: #f09bb3; }
.block.idle { background: none; box-shadow: none; border: 1px dashed var(--cal-gridline); color: var(--muted); }
.b1 { top: 1px; height: calc(var(--hour) * 1.5 - 2px); }
.b2 { top: calc(var(--hour) * 1.5 + 1px); height: calc(var(--hour) * .5 - 2px); }
.b3 { top: calc(var(--hour) * 2 + 1px); height: calc(var(--hour) * 1.25 - 2px); }
.b4 { top: calc(var(--hour) * 3.25 + 1px); height: calc(var(--hour) * 1 - 2px); }
.b5 { top: calc(var(--hour) * 4.25 + 1px); height: calc(var(--hour) * 2.25 - 2px); }
.b6 { top: calc(var(--hour) * 6.5 + 1px); height: calc(var(--hour) * .5 - 2px); }
.b7 { top: calc(var(--hour) * 7 + 1px); height: calc(var(--hour) * 1 - 2px); }
.now { position: absolute; left: 0; right: 0; top: 100%; height: 2px; margin-top: -1px; border-radius: 2px; background: var(--accent); opacity: 0; }

/* The day fills in as it scrolls into view: each interval is drawn by the passing hour. */
.window.armed .block { clip-path: inset(0 0 100% 0); }
.window.armed.in-view .block { animation: fill linear both; }
.window.armed.in-view .b1 { animation-duration: .66s; animation-delay: .3s; }
.window.armed.in-view .b2 { animation-duration: .22s; animation-delay: .96s; }
.window.armed.in-view .b3 { animation-duration: .55s; animation-delay: 1.18s; }
.window.armed.in-view .b4 { animation-duration: .44s; animation-delay: 1.73s; }
.window.armed.in-view .b5 { animation-duration: .99s; animation-delay: 2.17s; }
.window.armed.in-view .b6 { animation-duration: .22s; animation-delay: 3.16s; }
.window.armed.in-view .b7 { animation-duration: .44s; animation-delay: 3.38s; }
.window.armed.in-view .now { animation: now 3.52s linear .3s both; }
@keyframes fill { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes now { 0% { top: 0; opacity: 1; } 96% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

/* Week and month: the same material at coarser grain. Built by main.js from sample data. */
.view[hidden] { display: none; }
.week { margin-bottom: 18px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.day-col { position: relative; height: calc(var(--hour) * 8); background: repeating-linear-gradient(to bottom, var(--cal-gridline) 0 1px, transparent 1px var(--hour)); }
.day-name { position: absolute; left: 0; right: 0; bottom: -18px; z-index: 1; font-size: 11px; font-weight: 500; text-align: center; color: var(--muted); }
.day-col.today .day-name { color: var(--text); font-weight: 600; }
.week .block { left: 1px; right: 1px; padding: 0; }
.sheet.month { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: 1fr; gap: 5px; min-height: calc(var(--hour) * 8 + 24px); padding: 12px; }
.month-head { font-size: 11px; font-weight: 500; text-align: center; color: var(--muted); padding-bottom: 2px; }
.cell {
  --load: 0;
  display: flex; align-items: flex-start; justify-content: flex-end; padding: 5px 7px; border-radius: 6px;
  font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text);
  background: color-mix(in srgb, var(--accent) calc(var(--load) * 1%), var(--panel));
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) calc(var(--load) * .5%), var(--glass-glint));
}
.cell.blank { visibility: hidden; }
.cell.ahead { background: none; box-shadow: none; border: 1px dashed var(--cal-gridline); color: var(--muted); }
.cell.today { outline: 2px solid var(--accent); outline-offset: -2px; font-weight: 600; }
/* Switching period redraws the sheet. */
.window .view.replay .block { animation: fill .5s var(--ease-out) both; animation-delay: var(--d, 0s); }
.window .view.replay .cell { animation: cell-in .5s var(--ease-out) both; animation-delay: var(--d, 0s); }
.window .view.replay .now { animation: none; }
@keyframes cell-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }

/* The last word is the same single field. */
.closing { display: grid; justify-items: center; padding: 0 var(--gutter) clamp(64px, 10vw, 120px); text-align: center; }
.closing h2 { font-size: clamp(26px, 3.6vw, 46px); line-height: 1.1; font-weight: 600; letter-spacing: -.04em; text-wrap: balance; }
html .closing .signup { margin-top: clamp(24px, 3vw, 36px); animation: none; }
html .closing .signup::after { animation: none; }

.foot { padding: 0 var(--gutter) max(32px, env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: var(--muted); }
.foot-dim { opacity: .7; }

@media (max-width: 680px) {
  .window { grid-template-columns: minmax(0, 1fr); border-radius: 22px; }
  .win-side, .win-total { display: none; }
  .win-main { padding: 4px; }
}
@media (max-width: 500px) {
  .chart { width: 150px; }
  .bars { gap: 10px; }
  .signup { padding: 18px; }
  .signup-row { flex-direction: column; }
  .signup input[type="email"] { flex: none; width: 100%; }
  .signup button { width: 100%; }
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root { --glass-fill: var(--panel); --glass-glint: transparent; --glass-edge: var(--border); --glass-blur: 0px; --glass-control: var(--panel); --glass-selected: var(--bg); }
  body { background: var(--bg); }
  .aurora { display: none; }
  .glass, .pill { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--panel); }
  .block { background: var(--panel); border: 1px solid var(--c); box-shadow: inset 3px 0 var(--c); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
