/* STANDBY — Forma. Colours and type are tokens; change them here. */
@font-face { font-family: 'Geist'; src: url('fonts/geist-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('fonts/geist-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('fonts/geist-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Big Shoulders'; src: url('fonts/big-shoulders-display-latin-900-normal.woff2') format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin-400-italic.woff2') format('woff2'); font-style: italic; font-display: swap; }

:root {
  --ink: #f6f3ec; --ink2: rgba(246,243,236,.66); --glass: rgba(10,10,12,.46); --line: rgba(246,243,236,.16);
  --acc: #ff6a2a; --night: #ff3b2f; --ease: cubic-bezier(.2,.8,.2,1);
  --mono: 'Geist Mono', ui-monospace, monospace; --sans: 'Geist', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
body { font: 400 15px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 99px; }

/* the live scene: frames cross-fade on top of each other */
.bg { position: fixed; inset: 0; background: #000; transition: filter 1.2s var(--ease); }
.bg iframe, .bg img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; opacity: 0; transition: opacity 1.1s var(--ease); pointer-events: none; }
.bg .on { opacity: 1; }
.shade { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.28), transparent 30%, transparent 62%, rgba(0,0,0,.35)); transition: background 1.2s; }

/* the clock face */
.face { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; padding: max(15vh, env(safe-area-inset-top)) 6vw 0; text-align: center; pointer-events: none; transform: translate(var(--sx, 0px), var(--sy, 0px)); transition: transform 2s var(--ease); text-shadow: 0 2px 30px rgba(0,0,0,.22); }
.date { margin: 0; font: 600 clamp(15px, 2.4vh, 22px)/1 var(--sans); letter-spacing: .01em; opacity: .92; }
.time { margin: .06em 0 0; display: flex; align-items: baseline; font: 600 clamp(96px, 23vw, 210px)/.9 var(--sans); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.time i { font-style: normal; margin: 0 .01em; animation: tick 2s steps(1) infinite; }
.time small { font: 500 .16em var(--mono); letter-spacing: .08em; margin-left: .5em; opacity: .7; align-self: flex-start; margin-top: .9em; }
.meta { margin: 14px 0 0; display: flex; gap: 8px; align-items: center; font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink2); }
.meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 12px var(--acc); }
@keyframes tick { 50% { opacity: .55; } }
.meta { transition: opacity .4s; }
body.show-ui .meta { opacity: 0; }

/* clock styles */
body[data-style="poster"] .time { font: 900 clamp(130px, 34vw, 330px)/.8 'Big Shoulders', Impact, sans-serif; letter-spacing: -.01em; }
body[data-style="poster"] .date { font: 500 12px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
body[data-style="serif"] .time { font: italic 400 clamp(120px, 30vw, 290px)/.85 'Instrument Serif', Georgia, serif; letter-spacing: -.035em; }
body[data-style="serif"] .time i { animation: none; opacity: .7; }
body[data-style="mono"] .time { font: 500 clamp(76px, 17vw, 168px)/1 var(--mono); letter-spacing: -.06em; }
body[data-style="mono"] .date { font: 500 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }

/* landscape: a nightstand clock, big and low, like a phone on its side */
@media (orientation: landscape) {
  .face { justify-content: flex-end; align-items: flex-start; text-align: left; padding: 0 max(6vw, env(safe-area-inset-left)) max(9vh, env(safe-area-inset-bottom)); }
  .time { font-size: clamp(110px, 31vh, 300px); }
  body[data-style="poster"] .time { font-size: clamp(150px, 48vh, 440px); }
  body[data-style="serif"] .time { font-size: clamp(130px, 40vh, 380px); }
  body[data-style="mono"] .time { font-size: clamp(90px, 25vh, 240px); }
  .shade { background: linear-gradient(90deg, rgba(0,0,0,.4), transparent 55%), linear-gradient(0deg, rgba(0,0,0,.35), transparent 45%); }
}

/* night mode: the scene drops to a dim red, the clock turns red, nothing bright is left */
body.night .bg { filter: grayscale(1) brightness(.26) sepia(1) saturate(6) hue-rotate(-38deg); }
body.night .shade { background: rgba(0,0,0,.35); }
body.night .face { color: var(--night); text-shadow: none; opacity: .82; }
body.night .meta { color: rgba(255,59,47,.6); }
body.night .meta .dot { background: var(--night); box-shadow: none; }
body.night .ui, body.night .hint { filter: grayscale(1) sepia(1) saturate(5) hue-rotate(-38deg) brightness(.8); }

/* controls: hidden until you tap, gone again after a few seconds */
.ui { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s var(--ease); }
body.show-ui .ui { opacity: 1; }
body.show-ui .ui .bar { pointer-events: auto; }
.bar { position: absolute; left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 8px; }
.bar--top { top: max(14px, env(safe-area-inset-top)); justify-content: space-between; }
.bar--bottom { bottom: max(14px, env(safe-area-inset-bottom)); justify-content: center; }
.mark { display: inline-flex; align-items: center; gap: 8px; font: 500 11px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; padding: 10px 14px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }
.mark svg { width: 16px; height: 16px; color: var(--acc); }
.tools { display: flex; gap: 6px; padding: 5px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }
.tool { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: 99px; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink2); transition: background .25s, color .25s; }
.tool svg { width: 17px; height: 17px; flex: none; }
.tool:hover { color: var(--ink); background: rgba(255,255,255,.08); }
.tool[aria-pressed="true"] { color: #000; background: var(--ink); }
.tool--acc { color: #000; background: var(--acc); }
.scenes { gap: 6px; padding: 5px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); left: 50%; right: auto; translate: -50% 0; max-width: calc(100vw - 28px); overflow-x: auto; scrollbar-width: none; }
.scenes::-webkit-scrollbar { display: none; }
.scenes { touch-action: pan-x; }
.scene { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 6px; border-radius: 99px; font: 500 11px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink2); }
.scene b { width: 26px; height: 26px; border-radius: 50%; background: var(--sw) center / cover; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.scene[aria-pressed="true"] { background: var(--ink); color: #000; }

.toast { position: fixed; left: 50%; top: 50%; translate: -50% -50%; margin: 0; padding: 12px 18px; border-radius: 99px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); font: 500 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; opacity: 0; transition: opacity .4s; pointer-events: none; }
.toast.on { opacity: 1; }
.hint { position: fixed; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); margin: 0; text-align: center; font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--ink2); transition: opacity 1s; }
body.show-ui .hint, body.seen .hint { opacity: 0; }

@media (max-width: 560px) { .tool span { display: none; } .tool--acc span { display: inline; } .mark { padding: 10px 12px; } }
@media (prefers-reduced-motion: reduce) { .time i { animation: none; } .face { transition: none; } }
