/* calyard.com coming-soon page.
   Tokens mirror the app palette (docs/design/design-direction.md §3.1, src/theme/colors.ts):
   dark is the default, the light column applies through prefers-color-scheme.
   One accent (mint); Swim's lane color appears on its glyph only. Motion uses the
   brand curve cubic-bezier(0.2, 0, 0, 1) and stops entirely under reduced motion. */

:root {
  color-scheme: dark light;
  --bg: #0B0C0F;
  --surface: #16181D;
  --raised: #1E2128;
  --border: #272B33;
  --text: #F5F6F8;
  --text-2: #9BA1AE;
  --mint: #2EE6A8;
  --mint-ink: #2EE6A8;
  --lane: #47C9FF;
  --lane-ink: #47C9FF;
  --track: #1E2128;
  --tick: rgba(155, 161, 174, 0.30);
  --tick-major: rgba(155, 161, 174, 0.58);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --gutter: clamp(20px, 4vw, 48px);
  --max: 1280px;
  --font: Heebo, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #F7F8FA;
    --surface: #FFFFFF;
    --raised: #F0F1F4;
    --border: #E3E7EA;
    --text: #11131A;
    --text-2: #5B616E;
    --mint: #16B378;
    --mint-ink: #0B7F55;
    --lane: #0A9BD6;
    --lane-ink: #06759F;
    --track: #E6E9ED;
    --tick: rgba(91, 97, 110, 0.35);
    --tick-major: rgba(91, 97, 110, 0.62);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, figure, ul { margin: 0; padding: 0; }
ul { list-style: none; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--mint-ink); /* ink: >= 3:1 on both backgrounds */
  outline-offset: 3px;
  border-radius: 6px;
}

::selection { background: var(--mint); color: #0B0C0F; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--mint);
  color: #0B0C0F;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* micro: the app's uppercase eyebrow. Hebrew has no case and must not be tracked. */
.micro {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}
:lang(he) .micro { font-size: 13px; letter-spacing: 0; text-transform: none; }

/* ------------------------------------------------------------------ header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 80px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.brand svg { flex: none; display: block; }

.lang {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 13px;
}
.lang a {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 36px;
  padding-inline: 10px;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: color 180ms var(--ease), background-color 180ms var(--ease);
}
.lang a:lang(he) { letter-spacing: 0; font-size: 14px; }
.lang a:hover { color: var(--text); }
.lang a[aria-current="page"] { background: var(--raised); color: var(--text); }

/* ------------------------------------------------------------------ ruler (the "yard lines") */

.ruler {
  height: 14px;
  background:
    linear-gradient(var(--mint), var(--mint)) left top / 2px 14px no-repeat,
    repeating-linear-gradient(to right, var(--tick-major) 0 1px, transparent 1px 40px) left top / 100% 9px no-repeat,
    repeating-linear-gradient(to right, var(--tick) 0 1px, transparent 1px 8px) left top / 100% 5px no-repeat;
}
[dir="rtl"] .ruler {
  background:
    linear-gradient(var(--mint), var(--mint)) right top / 2px 14px no-repeat,
    repeating-linear-gradient(to left, var(--tick-major) 0 1px, transparent 1px 40px) right top / 100% 9px no-repeat,
    repeating-linear-gradient(to left, var(--tick) 0 1px, transparent 1px 8px) right top / 100% 5px no-repeat;
}

/* Over the module row the majors fall on the column edges (0, 25, 50, 75, 100%). */
.ruler--quarters {
  background:
    linear-gradient(var(--mint), var(--mint)) left top / 2px 14px no-repeat,
    linear-gradient(var(--tick-major), var(--tick-major)) right top / 1px 10px no-repeat,
    repeating-linear-gradient(to right, var(--tick-major) 0 1px, transparent 1px 25%) left top / 100% 10px no-repeat,
    repeating-linear-gradient(to right, var(--tick) 0 1px, transparent 1px 8px) left top / 100% 5px no-repeat;
}
[dir="rtl"] .ruler--quarters {
  background:
    linear-gradient(var(--mint), var(--mint)) right top / 2px 14px no-repeat,
    linear-gradient(var(--tick-major), var(--tick-major)) left top / 1px 10px no-repeat,
    repeating-linear-gradient(to left, var(--tick-major) 0 1px, transparent 1px 25%) right top / 100% 10px no-repeat,
    repeating-linear-gradient(to left, var(--tick) 0 1px, transparent 1px 8px) right top / 100% 5px no-repeat;
}

/* ------------------------------------------------------------------ hero */

main { flex: 1 0 auto; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  grid-template-areas:
    "intro watch"
    "avail watch";
  column-gap: clamp(32px, 6vw, 112px);
  padding-block: clamp(40px, 6.5vw, 96px) clamp(56px, 7vw, 112px);
}

.intro { grid-area: intro; align-self: end; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(18px, 2.2vw, 28px);
}

/* Status light: the 16x2 tick from the app's tab bar, breathing slowly. */
.live-tick {
  flex: none;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--mint);
}

.display {
  font-size: clamp(3.4rem, 1.4rem + 7.2vw, 9rem);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.048em;
  font-feature-settings: "tnum" 0;
  /* optical nudge: the heavy start stem of the M sits on the gutter */
  margin-inline-start: -0.05em;
}
.display > span { display: block; }
.display .dot { color: var(--mint); }
:lang(he) .display { letter-spacing: 0; line-height: 0.98; margin-inline-start: 0; }

.lede {
  margin-top: clamp(22px, 2.6vw, 34px);
  max-width: 27ch;
  font-size: clamp(1.15rem, 0.95rem + 0.75vw, 1.55rem);
  line-height: 1.38;
  color: var(--text-2);
  text-wrap: pretty;
}
:lang(he) .lede { max-width: 30ch; }

/* availability readout */
.avail {
  grid-area: avail;
  align-self: start;
  margin-top: clamp(36px, 4vw, 56px);
  max-width: 540px;
}
.avail h2 { margin-bottom: 12px; }
.avail .row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 24px;
  row-gap: 2px;
  padding-block: 15px;
  border-top: 1px solid var(--border);
}
.avail .row:last-child { border-bottom: 1px solid var(--border); }
.avail dt { font-size: 16px; font-weight: 600; color: var(--text); }
.avail dd {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--text-2);
}
.avail .row--soon dd { color: var(--text); font-weight: 500; }
.status-tick {
  width: 12px;
  height: 2px;
  border-radius: 1px;
  background: var(--tick-major);
}
.row--soon .status-tick { background: var(--mint); }

/* ------------------------------------------------------------------ stopwatch */

.watch {
  grid-area: watch;
  align-self: center;
  justify-self: center;
  width: min(100%, 540px);
}
.face {
  position: relative;
  aspect-ratio: 1;
  container-type: inline-size;
}
.dial { display: block; width: 100%; height: 100%; overflow: visible; }
.dial .track { fill: none; stroke: var(--track); stroke-width: 16; }
.dial .arc {
  fill: none;
  stroke: var(--mint);
  stroke-width: 16;
  stroke-linecap: round;
}
.dial .tk { stroke: var(--tick); stroke-width: 1.5; stroke-linecap: round; transition: stroke 400ms var(--ease); }
.dial .mj { stroke: var(--tick-major); stroke-width: 2.2; }
.dial .z, .dial .tk.on { stroke: var(--mint); transition-duration: 0ms; }
.dial .z { stroke-width: 2.6; }
.dial .nums text {
  fill: var(--text-2);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  text-anchor: middle;
  dominant-baseline: central;
  font-feature-settings: "tnum" 1;
}

.readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.watch-label { font-size: max(10px, 2.3cqi); line-height: 1.3; max-width: 52cqi; }
:lang(he) .watch-label { font-size: max(11px, 2.7cqi); }
.time {
  display: flex;
  align-items: baseline;
  margin-top: 1.6cqi;
  font-size: 16.5cqi;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--text);
}
.tenths {
  margin-inline-start: 0.04em;
  font-size: 0.42em;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-2);
}
.zero-tick {
  width: 3.4cqi;
  min-width: 14px;
  height: 2px;
  margin-top: 3.4cqi;
  border-radius: 1px;
  background: var(--mint);
}

/* ------------------------------------------------------------------ modules */

.modules { padding-bottom: clamp(56px, 7vw, 104px); }
.modules > h2 { margin-bottom: 14px; }

.mods {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mod {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "glyph idx"
    "title title"
    "body body"
    "units units";
  align-content: start;
  padding: 26px clamp(18px, 2vw, 28px) 4px;
  border-inline-start: 1px solid var(--border);
  --acc: var(--mint);
  --acc-ink: var(--mint-ink);
}
.mod:first-child { border-inline-start: 0; padding-inline-start: 0; }
.mod:last-child { padding-inline-end: 0; }
.mod--swim { --acc: var(--lane); --acc-ink: var(--lane-ink); }

/* hover/focus: the column's stretch of ruler fills in its identity color (a ruler bar). */
.mod::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 2px;
  border-radius: 1px;
  background: var(--acc);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 400ms var(--ease);
}
[dir="rtl"] .mod::before { transform-origin: right; }
.mod:hover::before { transform: scaleX(1); }

.glyph {
  grid-area: glyph;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--acc);
}
.mod--coach .glyph { color: var(--text-2); }
.glyph .g-acc { stroke: var(--mint); }
.glyph .g-dot { fill: var(--mint); }
.glyph svg { display: block; }

.idx {
  grid-area: idx;
  align-self: start;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.mod h3 {
  grid-area: title;
  margin-top: 22px;
  font-size: 20px;
  line-height: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
:lang(he) .mod h3 { letter-spacing: 0; }
.mod-body {
  grid-area: body;
  margin-top: 6px;
  font-size: 15px;
  line-height: 22px;
  color: var(--text-2);
  max-width: 34ch;
  text-wrap: pretty;
}
.units {
  grid-area: units;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 0.08em;
}
:lang(he) .units { font-size: 13px; }
.unit-tick {
  flex: none;
  width: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--acc);
}

/* ------------------------------------------------------------------ footer */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 22px 28px;
  font-size: 14px;
  color: var(--text-2);
  /* a hairline across the content width only, not the gutters */
  background: linear-gradient(var(--border), var(--border)) var(--gutter) 0 / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}

/* ------------------------------------------------------------------ 404 */

.nf-main { padding-block: clamp(56px, 10vw, 140px); }
.nf-title { margin-bottom: 8px; }
.nf .lede { max-width: none; }
.nf .lede a { color: var(--mint-ink); text-underline-offset: 3px; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .mods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mod { padding-bottom: 26px; }
  .mod:nth-child(odd) { border-inline-start: 0; padding-inline-start: 0; }
  .mod:nth-child(even) { padding-inline-end: 0; }
  .mod:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .ruler--quarters {
    background:
      linear-gradient(var(--mint), var(--mint)) left top / 2px 14px no-repeat,
      linear-gradient(var(--tick-major), var(--tick-major)) right top / 1px 10px no-repeat,
      repeating-linear-gradient(to right, var(--tick-major) 0 1px, transparent 1px 50%) left top / 100% 10px no-repeat,
      repeating-linear-gradient(to right, var(--tick) 0 1px, transparent 1px 8px) left top / 100% 5px no-repeat;
  }
  [dir="rtl"] .ruler--quarters {
    background:
      linear-gradient(var(--mint), var(--mint)) right top / 2px 14px no-repeat,
      linear-gradient(var(--tick-major), var(--tick-major)) left top / 1px 10px no-repeat,
      repeating-linear-gradient(to left, var(--tick-major) 0 1px, transparent 1px 50%) right top / 100% 10px no-repeat,
      repeating-linear-gradient(to left, var(--tick) 0 1px, transparent 1px 8px) right top / 100% 5px no-repeat;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "watch" "avail";
    padding-top: clamp(28px, 7vw, 56px);
  }
  .watch { width: min(100%, 460px); margin-top: clamp(36px, 8vw, 56px); }
  .avail { max-width: none; }
}

@media (max-width: 620px) {
  .top { min-height: 68px; }
  .brand { font-size: 20px; }
  .mods { grid-template-columns: minmax(0, 1fr); }
  .mod,
  .mod:nth-child(odd),
  .mod:nth-child(even) {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    grid-template-areas:
      "glyph title idx"
      "glyph body body"
      "glyph units units";
    column-gap: 16px;
    padding: 20px 0;
    border-inline-start: 0;
  }
  .mod + .mod { border-top: 1px solid var(--border); }
  .mod h3 { margin-top: 0; font-size: 18px; line-height: 24px; }
  .mod-body { max-width: none; }
  .units { margin-top: 10px; }
  .glyph { align-self: start; }
  .idx { align-self: center; }
  .avail .row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .ruler--quarters,
  [dir="rtl"] .ruler--quarters { background-size: 2px 14px, 0 0, 0 0, 100% 5px; }
}

/* ------------------------------------------------------------------ motion */

@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 360deg; }

@media (prefers-reduced-motion: no-preference) {
  .live-tick { animation: breathe 2400ms var(--ease) infinite; }
  @keyframes breathe { 50% { opacity: 0.25; } }

  .rise { animation: rise 760ms var(--ease) both; animation-delay: 60ms; }
  .d1 { animation-delay: 120ms; }
  .d2 { animation-delay: 190ms; }
  .d3 { animation-delay: 280ms; }
  .d4 { animation-delay: 380ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } }

  .ruler--draw { animation: draw 1100ms var(--ease) both; }
  @keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
  [dir="rtl"] .ruler--draw { animation-name: draw-rtl; }
  @keyframes draw-rtl { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }

  /* the bezel powers on clockwise from 12, like a hand sweeping round */
  /* starts 3deg before 12 and ends 3deg past it, so at rest the mask covers the whole
     dial with no hairline seam at 12 o'clock */
  .dial {
    -webkit-mask-image: conic-gradient(from -3deg, #000 calc(var(--sweep) + 3deg), transparent 0);
    mask-image: conic-gradient(from -3deg, #000 calc(var(--sweep) + 3deg), transparent 0);
    animation: sweep 1000ms var(--ease) 100ms both;
  }
  @keyframes sweep { from { --sweep: 0deg; } to { --sweep: 360deg; } }

  .mod { animation: rise 760ms var(--ease) both; }
  .mod:nth-child(1) { animation-delay: 420ms; }
  .mod:nth-child(2) { animation-delay: 470ms; }
  .mod:nth-child(3) { animation-delay: 520ms; }
  .mod:nth-child(4) { animation-delay: 570ms; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}
