/* Sleep & Alarm — github.com/veraetogrex-portfolio · zero dependencies */
:root {
  /* Nocturne surfaces + one accent: a muted dawn amber */
  --page: #07080c; --panel: #0e1016; --raise: #151823; --raise-2: #1c2030;
  --text: #f2f3f7; --text-2: #b4b7c6; --text-3: #9093a6;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --accent: #e3a066; --accent-ink: #1a1208; --accent-soft: rgba(227, 160, 102, .14);
  --night-a: #0b0e1a; --night-b: #0e1016; --arc: #39405a;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display: var(--font);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: grid; place-items: center; overflow: hidden; background: var(--page); color: var(--text); font: 16px/1.4 var(--font); }
p, h1, h2, ol { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

/* ── desktop screen: the night dial on the left, the week on the right ── */
.sa { position: relative; width: 1360px; height: 800px; border-radius: 36px; overflow: hidden; user-select: none; color: var(--text); background: var(--panel);
  box-shadow: 0 0 0 1px var(--line) inset, 0 80px 140px -50px rgba(0, 0, 0, .8); }
@media (max-width: 1400px) { .sa { zoom: .8; } }
@media (max-width: 1100px) { .sa { zoom: .6; } }
@media (max-width: 820px)  { .sa { zoom: .4; } }

/* sky panel */
.sa-sky { position: absolute; left: 0; top: 0; width: 880px; height: 800px; overflow: hidden; background: linear-gradient(180deg, var(--night-a), var(--night-b)); }
.sa-star { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #e9ecf7; opacity: var(--o); transition: opacity 1.1s ease; }
/* dawn: warm light that spreads from the wake-up side of the dial over the whole sky */
.sa-dawn { position: absolute; left: 0; top: 0; width: 1800px; height: 1800px; margin: -900px 0 0 -900px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(240, 176, 120, .55), rgba(214, 132, 96, .28) 32%, rgba(120, 80, 90, .12) 58%, transparent 80%); }
.sa-head { position: absolute; left: 48px; top: 40px; display: flex; align-items: center; gap: 14px; font: 700 28px var(--font); }
.sa-head svg { width: 26px; height: 26px; stroke: var(--text-2); }

.sa-dial { position: absolute; left: 120px; top: 140px; width: 640px; height: 640px; overflow: visible; }
.sa-dial .track { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 40; stroke-linecap: round; }
.sa-dial .arc { fill: none; stroke: var(--arc); stroke-width: 40; stroke-linecap: round; transition: stroke .6s; }
.sa-dial .arc-warm { fill: none; stroke: url(#sa-warm); stroke-width: 40; stroke-linecap: round; opacity: 0; }
.sa-dial .tick { stroke: rgba(255, 255, 255, .22); stroke-width: 3; stroke-linecap: round; }
.sa-dial .lbl { fill: var(--text-3); font: 600 22px var(--font); text-anchor: middle; dominant-baseline: central; }

.sa-center { position: absolute; left: 120px; top: 140px; width: 640px; height: 640px; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.sa-dur { font: 800 92px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.sa-dur small { font-size: 46px; font-weight: 700; color: var(--text-2); margin: 0 10px 0 4px; }
.sa-dur small:last-child { margin-right: 0; }
.sa-times { margin-top: 14px; font: 600 24px var(--font); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sa-times b { color: var(--text); }

/* handles: real HTML elements on top of the ring, so they can take focus */
.sa-h { position: absolute; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%; display: grid; place-items: center; z-index: 3; }
.sa-h svg { width: 34px; height: 34px; }
.sa-bed { background: var(--raise-2); box-shadow: 0 0 0 2px var(--line-2) inset; }
.sa-bed svg { fill: #c9cbd6; }
.sa-wake { background: #f2f3f7; cursor: grab; touch-action: none; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .7); transition: background .5s, transform .2s; }
.sa-wake svg { stroke: #2a2f44; fill: none; stroke-width: 2.2; stroke-linecap: round; transition: stroke .5s; }
.sa-wake.is-drag { transform: scale(1.12); cursor: grabbing; }
.sa.is-on .sa-wake { background: var(--accent); }
.sa.is-on .sa-wake svg { stroke: var(--accent-ink); }

/* right column */
.sa-side { position: absolute; left: 880px; top: 0; width: 480px; height: 800px; padding: 44px 40px 40px; background: var(--raise); box-shadow: 1px 0 0 var(--line) inset; display: flex; flex-direction: column; }
.sa-side h1 { font: 700 32px/1.1 var(--font); letter-spacing: -.01em; }
.sa-side > p { margin-top: 8px; font: 600 20px var(--font); color: var(--text-2); }
.sa-week { list-style: none; padding: 0; margin-top: 26px; }
.sa-week li { display: flex; align-items: center; justify-content: space-between; height: 46px; border-bottom: 1px solid var(--line); font: 600 22px var(--font); font-variant-numeric: tabular-nums; }
.sa-week li span { color: var(--text-2); width: 64px; }
.sa-week li b { font-weight: 600; }
.sa-week li b i { font-style: normal; color: var(--text-3); margin: 0 8px; }
.sa-week li.is-off b { color: var(--text-3); }
.sa-week li .w { display: inline-block; transition: color .3s; }
.sa-week li .w.is-tick { color: var(--accent); }

.sa-last { margin-top: 26px; }
.sa-last > span { font: 600 20px var(--font); color: var(--text-2); }
.sa-bars { display: flex; align-items: flex-end; gap: 10px; height: 64px; margin-top: 12px; position: relative; }
.sa-bars i { flex: 1; border-radius: 6px 6px 3px 3px; background: #2b3042; }
.sa-bars::after { content: ""; position: absolute; left: 0; right: 0; bottom: 56px; border-top: 2px dashed rgba(227, 160, 102, .5); }
.sa-goal { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 20px; border-radius: 16px; background: var(--raise-2); font: 600 22px var(--font); transition: background .4s, box-shadow .4s; }
.sa-goal em { font-style: normal; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sa-goal.is-met { background: var(--accent-soft); box-shadow: 0 0 0 1.5px rgba(227, 160, 102, .55) inset; }
.sa-goal.is-met em { color: var(--accent); }

.sa-alarm { margin-top: auto; display: flex; align-items: center; gap: 18px; height: 96px; padding: 0 22px; border-radius: 20px; background: var(--raise-2); }
.sa-alarm > svg { width: 30px; height: 30px; stroke: var(--text-2); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sa-alarm div { flex: 1; }
.sa-alarm b { display: block; font: 700 24px var(--font); }
.sa-alarm span { font: 600 20px var(--font); color: var(--text-2); font-variant-numeric: tabular-nums; }
.sa-toggle { position: relative; width: 76px; height: 44px; border-radius: 22px; background: #2b3042; transition: background .3s; flex: none; }
.sa-toggle i { position: absolute; left: 4px; top: 4px; width: 36px; height: 36px; border-radius: 50%; background: #f2f3f7; transition: transform .45s cubic-bezier(.34, 1.4, .64, 1); }
.sa-toggle[aria-checked="true"] { background: var(--accent); }
.sa-toggle[aria-checked="true"] i { transform: translateX(32px); background: #fff7ef; }

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