/* Daybar, the room: "The edge of the screen". The page is a white desktop with one bar on its edge.
   Red means now, blue and violet are calendars. Everything else is ink on white. One family, Instrument Sans, whose width axis gives the clock its narrow numerals. */

@font-face {
  font-family: 'Instrument Sans';
  src: url('/assets/worlds/fonts/instrument-sans-latin-wdth-wght.woff2') format('woff2');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --screen: #fafaf8;
  --ink: #18191d;
  --ink-2: #5c5f67;
  --hair: rgb(24 25 29 / 0.12);
  --glass: rgb(232 233 237 / 0.82);
  --red: #ff3b30;
  --blue: #3b8bea;
  --violet: #9a6cf0;
  --gut-l: clamp(20px, 6.2vw, 96px);
  --gut-r: clamp(44px, 10vw, 168px);
  --band: clamp(170px, 20vw, 300px);
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  /* the bar's own unit and height; world.js keeps them in step with the canvas */
  --db-u: 1;
  --db-h: 450px;
  --dock-r: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--screen); }
body {
  margin: 0;
  background: var(--screen);
  color: var(--ink);
  font-family: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 1.55;
  font-weight: 400;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: rgb(59 139 234 / 0.24); }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { font-weight: 540; letter-spacing: -0.03em; text-wrap: balance; }
h2 { font-size: clamp(1.7rem, 2.5vw, 2.3rem); font-stretch: 90%; line-height: 1.08; letter-spacing: -0.025em; max-width: 15em; }
h3 { font-size: 1.2rem; line-height: 1.25; letter-spacing: -0.012em; font-weight: 560; }
p { text-wrap: pretty; }
.db-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- The stage: the hero, and the close-up of the bar behind it ---------- */
.db-stage { position: relative; }
.db-pin { position: relative; min-height: 100svh; display: flex; flex-direction: column; isolation: isolate; }
.db-zoom { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; }
.db-js .db-zoom { display: block; }
.db-stage.is-pinned { height: calc(100svh + var(--travel, 75vh)); }
.db-stage.is-pinned .db-pin { position: sticky; top: 0; height: 100svh; min-height: 0; overflow: clip; }
.db-stage.is-docked .db-zoom { visibility: hidden; }

.db-top {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 12px var(--gut-l) 0;
  font-size: 15.5px; font-weight: 520;
}
.db-top .world-exit { justify-self: start; }
.db-top .world-lang { justify-self: end; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-right: calc(var(--band) * 0.9 - var(--gut-l) + 20px); }
.db-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; letter-spacing: -0.015em; }
.db-mark { width: 30px; height: 18px; flex: none; }
.db-mark__bar { fill: #e3e4e8; }
.db-mark__dot { fill: var(--red); }

.db-hero {
  position: relative; z-index: 1; flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: clamp(36px, 7vh, 88px) calc(var(--band) * 1.5 + 30px) clamp(40px, 7vh, 80px) var(--gut-l);
}
.db-hero h1 { font-size: clamp(3rem, 7.1vw, 7.6rem); font-stretch: 84%; font-weight: 540; line-height: 0.95; letter-spacing: -0.038em; max-width: 9em; }
html[lang='fr'] .db-hero h1 { font-size: clamp(2.8rem, 6.4vw, 6.9rem); max-width: 10em; }
.db-hero__row { display: grid; grid-template-columns: minmax(0, 27em) minmax(0, 1fr); gap: 24px clamp(24px, 4vw, 64px); align-items: end; margin-top: clamp(26px, 4.4vh, 52px); }
.db-lede { font-size: clamp(1.08rem, 1.3vw, 1.28rem); line-height: 1.5; color: #2b2d33; max-width: 27em; }

.db-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 26px; margin-top: clamp(22px, 3.4vh, 34px); }
.db-btn {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 24px 0 18px; border-radius: 999px;
  background: var(--ink); color: #fff; text-decoration: none;
  font-size: 17px; font-weight: 560; letter-spacing: -0.01em; white-space: nowrap;
  transition: transform 160ms var(--ease), background-color 160ms ease;
}
/* the button carries the bar's own mark: now, and the line that runs into your day */
.db-btn__mark { width: 30px; height: 12px; flex: none; fill: var(--red); overflow: visible; }
.db-btn__mark rect { transform-origin: 8px 6px; transform: scaleX(0.55); transition: transform 260ms var(--ease); }
.db-btn:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .db-btn:hover { background: #000; }
  .db-btn:hover .db-btn__mark rect { transform: none; }
}
.db-link {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 17px; font-weight: 540; letter-spacing: -0.01em;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px; text-decoration-color: rgb(24 25 29 / 0.3);
  transition: text-decoration-color 160ms ease;
}
@media (hover: hover) and (pointer: fine) { .db-link:hover { text-decoration-color: currentColor; } }

/* The clock beside the dot. world.js fills it and lines the dot up with the time. */
.db-read { justify-self: end; text-align: right; padding-bottom: 2px; }
.db-read__time { font-size: clamp(3.2rem, 6.1vw, 6.6rem); font-stretch: 75%; font-weight: 520; line-height: 0.86; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-read__cur { margin-top: 14px; font-size: 17px; font-weight: 560; letter-spacing: -0.01em; }
.db-read__next { margin-top: 2px; font-size: 17px; color: var(--ink-2); }
.db-read__cap { margin: 14px 0 0 auto; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); max-width: 19em; }
.db-read__time, .db-read__cur, .db-read__next { font-variant-numeric: tabular-nums; }

/* Without JavaScript the close-up is drawn once, with no clock. */
.db-still { position: absolute; z-index: 0; top: 0; bottom: 0; right: calc(var(--band) * -0.1); width: var(--band); background: var(--glass); box-shadow: -40px 0 60px -30px rgb(0 0 0 / 0.18); clip-path: inset(0 0 0 -100vw); }
.db-still__ev { position: absolute; left: 26.2%; width: 47.6%; border-radius: 999px; background: var(--blue); opacity: 0.8; }
.db-still__ev--past { opacity: 0.4; }
.db-still__ev--v { background: var(--violet); }
/* the line runs from just outside the bar to the events' right edge, with the dot on its left end (app proportions) */
.db-still__now { position: absolute; top: 56%; left: -11.9%; width: 85.7%; height: calc(var(--band) * 0.143); margin-top: calc(var(--band) * -0.0715); background: var(--red); }
.db-still__now::before { content: ''; position: absolute; top: 50%; left: calc(var(--band) * -0.476); width: calc(var(--band) * 0.571); height: calc(var(--band) * 0.571); margin-top: calc(var(--band) * -0.2855); border-radius: 50%; background: var(--red); }

/* Arrival: the white of the hole is already the page. The words settle, the bar is simply there. */
@keyframes db-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes db-fade { from { opacity: 0; } }
html.is-arriving body { animation: none; }
html.is-arriving .db-hero h1 { animation: db-rise 900ms var(--ease) 80ms both; }
html.is-arriving .db-hero__row { animation: db-rise 900ms var(--ease) 200ms both; }
html.is-arriving .db-top { animation: db-fade 600ms ease 300ms both; }
html.is-arriving .db-zoom { animation: db-fade 500ms ease 40ms both; }

/* ---------- Below the hero: two beats, a few questions, the way to daybar.io ---------- */
main { position: relative; padding-bottom: clamp(90px, 16vh, 170px); }
main > section { padding: clamp(84px, 14vh, 160px) var(--gut-r) 0 var(--gut-l); }
main > section.db-beats { padding-top: clamp(30px, 7vh, 90px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(32px, 6vw, 110px); max-width: 1320px; }
.db-beat { padding-top: 26px; border-top: 1px solid var(--hair); }
.db-beat h2 { margin-top: 22px; }
.db-beat p { margin-top: 12px; max-width: 27em; color: #3a3d44; font-size: clamp(1.05rem, 1.2vw, 1.15rem); }
.db-beats__try { grid-column: 1 / -1; margin-top: clamp(36px, 6vh, 60px); font-size: 15px; color: var(--ink-2); }

/* The glyphs are the bar's own parts, at the bar's own size. */
.db-glyph { position: relative; display: block; width: 40px; height: 30px; }
.db-glyph i { position: absolute; }
.db-glyph::before { content: ''; position: absolute; left: 20px; top: 0; width: 18px; height: 30px; border-radius: 9px 9px 0 0; background: var(--glass); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.04); }
.db-glyph--block i { left: 24px; top: 6px; width: 10px; height: 22px; border-radius: 5px; background: var(--blue); opacity: 0.8; }
.db-glyph--now i { left: 2px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); }
.db-glyph--now i::after { content: ''; position: absolute; left: 10px; top: 4.5px; width: 22px; height: 3px; border-radius: 0 2px 2px 0; background: inherit; }

/* FAQ */
.db-faq__list { margin-top: clamp(24px, 4vh, 40px); max-width: 44em; }
.db-faq details { border-top: 1px solid var(--hair); }
.db-faq details:last-child { border-bottom: 1px solid var(--hair); }
.db-faq summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 60px; padding: 12px 0; }
.db-faq summary::-webkit-details-marker { display: none; }
.db-faq summary h3 { font-size: 1.1rem; font-weight: 540; letter-spacing: -0.012em; }
/* the marker is the bar's capsule, lying down; it stands up when the answer opens */
.db-faq summary::after { content: ''; flex: none; width: 18px; height: 6px; border-radius: 3px; background: var(--blue); opacity: 0.8; transition: transform 220ms var(--ease); }
.db-faq details[open] summary::after { transform: rotate(90deg); }
.db-faq details p { padding: 0 0 22px; max-width: 38em; color: #2f3238; }
@supports (interpolate-size: allow-keywords) {
  .db-faq { interpolate-size: allow-keywords; }
  .db-faq details::details-content { height: 0; overflow: clip; transition: height 240ms var(--ease), content-visibility 240ms allow-discrete; }
  .db-faq details[open]::details-content { height: auto; }
}

/* The way to daybar.io */
.db-end .db-btn { margin-top: clamp(22px, 3.4vh, 32px); }

.world-colophon { color: var(--ink-2); padding: 22px var(--gut-r) 30px var(--gut-l); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 28px; font-size: 14.5px; border-top: 1px solid var(--hair); }
.world-colophon p { margin: 0; align-self: center; }
.world-colophon nav { display: flex; flex-wrap: wrap; gap: 0 22px; }
.world-colophon nav a { min-height: 44px; display: inline-flex; align-items: center; }
.world-colophon a { text-underline-offset: 3px; text-decoration-color: rgb(24 25 29 / 0.3); }

/* ---------- The bar on the edge of the page ---------- */
.db-dock {
  position: fixed; z-index: 30; right: var(--dock-r); top: 50%;
  width: calc(21px * var(--db-u)); height: var(--db-h); margin-top: calc(var(--db-h) / -2);
  visibility: hidden; opacity: 0;
}
.db-dock[hidden] { display: none; }
.db-dock.is-on { visibility: visible; opacity: 1; }
.db-dock.is-soft { transition: opacity 260ms ease, visibility 0s linear 260ms; }
.db-dock.is-soft.is-on { transition: opacity 260ms ease, visibility 0s; }
.db-dock__bar {
  appearance: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer;
  position: absolute; inset: 0; display: block;
  border-radius: calc(10px * var(--db-u));
  background: var(--glass);
  box-shadow: -3px 0 9px -3px rgb(0 0 0 / 0.16), 0 1px 1px rgb(0 0 0 / 0.08), 0 2px 3px rgb(0 0 0 / 0.1), 0 3px 6px rgb(0 0 0 / 0.08);
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
.db-dock__track { position: absolute; left: 0; right: 0; top: calc(7.5px * var(--db-u)); bottom: calc(7.5px * var(--db-u)); }
.db-dock__ev {
  position: absolute; left: calc(5.5px * var(--db-u)); width: calc(10px * var(--db-u));
  top: calc(var(--a, 0) * 100%); height: max(calc(8px * var(--db-u)), calc(var(--b, 0) * 100%));
  border-radius: calc(5px * var(--db-u)); background: var(--c, var(--blue)); opacity: 0.8;
}
.db-dock__ev.is-past, .db-day__ev.is-past { opacity: 0.4; }
.db-cal--blue { --c: var(--blue); }
.db-cal--violet { --c: var(--violet); }
.db-dock__now { --ind: var(--red); position: absolute; left: calc(-12.5px * var(--db-u)); top: calc(7.5px * var(--db-u) + var(--f, 0.5) * (var(--db-h) - 15px * var(--db-u))); width: 0; height: 0; transition: none; }
.db-dock__now b { position: absolute; left: 0; top: calc(-6px * var(--db-u)); width: calc(12px * var(--db-u)); height: calc(12px * var(--db-u)); border-radius: 50%; background: var(--ind); transition: background-color 200ms ease; }
.db-dock__now b::after { content: ''; position: absolute; left: calc(10px * var(--db-u)); top: calc(4.5px * var(--db-u)); width: calc(18px * var(--db-u)); height: calc(3px * var(--db-u)); background: inherit; }
.db-dock__bar:focus-visible { outline-offset: 4px; border-radius: calc(10px * var(--db-u)); }

/* the wave the app sends out from the bar when it starts, so you know where it is */
.db-dock__glow { position: absolute; inset: -10px; border-radius: 20px; opacity: 0; pointer-events: none; box-shadow: 0 0 28px 12px rgb(59 139 234 / 0.34), inset 0 0 16px 4px rgb(59 139 234 / 0.22); }
@keyframes db-glow { 0% { opacity: 0; transform: scale(1); } 24% { opacity: 0.85; } 100% { opacity: 0; transform: scale(3.2, 1.22); } }
.db-dock.is-glow .db-dock__glow { animation: db-glow 1500ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }

/* The open bar: titles and times, at their place in the day */
.db-day {
  position: absolute; right: 0; top: 0; height: 100%; width: calc(203px * var(--db-u));
  border-radius: calc(10px * var(--db-u)); background: rgb(246 246 248 / 0.97);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 10px 30px -8px rgb(0 0 0 / 0.28);
  opacity: 0; visibility: hidden; transform: scale(0.94, 0.985); transform-origin: 100% 50%;
  transition: opacity 150ms ease, transform 240ms var(--ease), visibility 0s linear 240ms;
}
.db-dock.is-open .db-day { opacity: 1; visibility: visible; transform: none; transition: opacity 150ms ease, transform 280ms var(--ease), visibility 0s; }
.db-dock.is-open .db-dock__now { opacity: 0; }
.db-day__list { position: absolute; left: calc(1.5px * var(--db-u)); right: calc(1.5px * var(--db-u)); top: calc(7.5px * var(--db-u)); bottom: calc(7.5px * var(--db-u)); }
.db-day__ev {
  position: absolute; left: 0; right: 0; top: calc(var(--a, 0) * 100%); height: max(calc(8px * var(--db-u)), calc(var(--b, 0) * 100%));
  display: flex; align-items: center; gap: 6px; padding: 0 8px; overflow: hidden;
  border-radius: 6px; background: color-mix(in srgb, var(--c) 80%, transparent); color: #111;
  font-size: calc(11.5px * var(--db-u) + 0.5px); line-height: 1.15; font-weight: 560; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3);
}
.db-day__ev.is-past { opacity: 1; background: color-mix(in srgb, var(--c) 40%, transparent); }
.db-day__title { overflow: hidden; text-overflow: ellipsis; }
.db-day__time { flex: none; font-weight: 450; color: rgb(17 17 17 / 0.62); font-variant-numeric: tabular-nums; font-size: 0.92em; }
.db-day__now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); top: calc(7.5px * var(--db-u) + var(--f, 0.5) * (var(--db-h) - 15px * var(--db-u))); margin-top: -1px; }
.db-day__now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.db-day__cap { position: absolute; right: 0; top: calc(100% + 8px); padding: 4px 9px; border-radius: 7px; background: rgb(24 25 29 / 0.82); color: #fff; font-size: 12px; line-height: 1.3; white-space: nowrap; }

/* ---------- Narrow screens ---------- */
/* between a phone and a wide screen the clock gets its own row, under the words, still beside the dot */
@media (min-width: 861px) and (max-width: 1180px) {
  .db-hero { padding-top: 22px; padding-bottom: 22px; }
  .db-hero__row { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 24px; }
  .db-hero h1 { font-size: clamp(3rem, 6.6vw, 5.6rem); }
  .db-read__cap { margin-top: 8px; }
  .db-read__time { font-size: clamp(3.2rem, 6vw, 4.6rem); }
}
@media (max-width: 860px) {
  :root { --band: clamp(56px, 17vw, 84px); --dock-r: 8px; }
  body { font-size: 17px; }
  :root { --gut-r: 52px; }
  .db-hero { justify-content: flex-start; padding: clamp(18px, 3.4vh, 48px) calc(var(--band) * 0.9 + 14px) 20px var(--gut-l); }
  .db-hero__row { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 18px; }
  .db-lede { font-size: 16px; line-height: 1.46; }
  .db-cta { margin-top: 18px; }
  .db-read { margin-right: calc(var(--band) * 0.62); }
  .db-still__now { top: 82%; }
  .db-read__time { font-size: clamp(2.6rem, 12vw, 3.7rem); }
  .db-read__cur { margin-top: 8px; }
  .db-read__cur, .db-read__next { font-size: 14.5px; text-wrap: balance; }
  .db-read__cap { margin-top: 8px; font-size: 12px; }
  .db-top .world-lang { margin-right: 0; }
  .db-top { padding-right: calc(var(--band) * 0.9 + 6px); }
  .db-brand { font-size: 16px; }
  main > section.db-beats { grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .db-beats__try { margin-top: 0; }
  .world-colophon { flex-direction: column; }
}
@media (max-width: 480px) {
  .db-cta { gap: 6px 22px; }
  .db-btn { font-size: 16px; padding: 0 20px 0 16px; }
  .db-hero h1 { font-size: clamp(2.5rem, 11.6vw, 3.2rem); }
  html[lang='fr'] .db-hero h1 { font-size: clamp(2.3rem, 10.4vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  html.is-arriving .db-hero h1, html.is-arriving .db-hero__row { animation: db-fade 240ms ease both; }
  html.is-arriving .db-top, html.is-arriving .db-zoom { animation: none; }
  .db-btn, .db-btn__mark rect, .db-faq summary::after, .db-day, .db-dock.is-open .db-day { transition: none; }
  .db-faq details::details-content { transition: none; }
}
