/* lt3.me. One typeface, chosen to stay readable half-asleep; the only colour that means anything is the night itself,
   in the app's own colours: amber is the phone in bed, indigo is asleep, coral is awake. */

@font-face {
  font-family: "Atkinson Next";
  src: url("/assets/fonts/atkinson-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #070917;
  --dusk: #15133b;
  --moon: #e7e6fb;
  --haze: #aeadd2;
  --dim: #7d7ca6;
  --link: #b4b6ff;
  --phone: #ffba5c;
  --sleep: #5e63ed;
  --awake: #ff856e;
  --rule: rgba(231, 230, 251, 0.12);
  --gutter: 1.25rem;
}

* { box-sizing: border-box; }

html {
  background: var(--night);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--night) 0%, #0b0b22 45%, var(--dusk) 100%);
  color: var(--moon);
  font: 400 1.125rem/1.6 "Atkinson Next", system-ui, -apple-system, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--moon); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: 70rem; margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: 40rem; }
.t { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--moon); color: var(--night); padding: 0.5rem 0.75rem; }
.skip:focus { left: var(--gutter); }

/* header and footer */

.site-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding-top: 1.5rem; padding-bottom: 1.5rem;
}
.wordmark {
  color: var(--moon); text-decoration: none;
  font-weight: 700; font-size: 1.375rem; letter-spacing: -0.02em;
}
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.site-nav a { color: var(--haze); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--moon); }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--dim); }

.site-foot {
  margin-top: 7rem; padding: 2rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--haze); font-size: 0.95rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem;
}
.site-foot p { margin: 0; max-width: 28rem; }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-foot a { color: var(--haze); }
.site-foot a:hover { color: var(--moon); }

/* type */

.display {
  font-weight: 300;
  font-size: clamp(2.6rem, 7vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 3.5rem 0 1.5rem;
  max-width: 14ch;
}
.lead { font-size: 1.3rem; line-height: 1.5; color: var(--moon); margin: 0 0 1rem; max-width: 36rem; }
h2 {
  font-weight: 500; font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
}
h3 { font-weight: 600; font-size: 1.125rem; margin: 2rem 0 0.5rem; }
p { margin: 0 0 1rem; }
.quiet { color: var(--haze); }
.small { font-size: 0.95rem; }

main > section { margin-top: 7rem; }
main > section.first { margin-top: 0; }

/* the night: the one picture on the site */

.night { margin: 3.5rem 0 0; }
.night-figure { position: relative; }
.marks { position: relative; height: 3.4rem; }
.mark {
  position: absolute; left: var(--x);
  white-space: nowrap; font-size: 0.95rem; line-height: 1.2; color: var(--haze);
  padding: 0 0 0 0.55rem;
  border-left: 1px solid rgba(231, 230, 251, 0.4);
  animation: mark-in 0.5s ease var(--d, 0s) backwards;
}
.mark b { display: block; color: var(--moon); font-weight: 600; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.marks.above .mark { bottom: 0; padding-bottom: 0.6rem; }
.marks.below .mark { top: 0; padding-top: 0.6rem; }
.mark.end {
  left: auto; right: calc(100% - var(--x));
  border-left: 0; border-right: 1px solid rgba(231, 230, 251, 0.4);
  padding: 0 0.55rem 0 0; text-align: right;
}
.marks.below .mark.end { padding-top: 0.6rem; }

.track {
  position: relative; height: 3.5rem;
  border-radius: 0.8rem; overflow: hidden;
  background: rgba(231, 230, 251, 0.05);
}
.track-fill { position: absolute; inset: 0; animation: draw 1.8s cubic-bezier(0.5, 0, 0.25, 1) 0.1s backwards; }
.seg { position: absolute; top: 0; bottom: 0; left: var(--x); width: var(--w); }
.seg.phone { background: var(--phone); }
.seg.sleep { background: linear-gradient(180deg, #6a6ff4, var(--sleep)); }
.seg.awake { background: var(--awake); }
/* an hour line every tenth of the bar (23:00 to 09:00) */
.track::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), rgba(7, 9, 23, 0.4) calc(10% - 1px), rgba(7, 9, 23, 0.4) 10%);
}
.night figcaption { margin-top: 1.25rem; color: var(--haze); font-size: 0.95rem; max-width: 40rem; }

@keyframes draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes mark-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .track-fill, .mark { animation: none; }
}

/* the app on the home page */

.app { display: flex; gap: 1.5rem; align-items: flex-start; }
.app-icon { width: 88px; height: 88px; border-radius: 20px; flex: none; box-shadow: 0 0 0 1px rgba(231, 230, 251, 0.1); }
.app h2 { margin-bottom: 0.5rem; }

.app-hero { display: flex; gap: 1.5rem; align-items: center; margin-top: 3rem; }
.app-hero .app-icon { width: 112px; height: 112px; border-radius: 25px; }
.app-hero .display { margin: 0; }
.status { color: var(--haze); font-size: 0.95rem; }

/* term and description lists: principles, features, the legend */

.list { margin: 0; }
.list > div { padding: 1.25rem 0; border-top: 1px solid var(--rule); display: grid; gap: 0.35rem; }
.list > div:last-child { border-bottom: 1px solid var(--rule); }
.list dt { font-weight: 600; }
.list dd { margin: 0; color: var(--haze); max-width: 40rem; }

.key dt { display: flex; align-items: center; gap: 0.75rem; }
.key dt::before { content: ""; width: 1.75rem; height: 0.6rem; border-radius: 0.2rem; flex: none; background: var(--c, transparent); box-shadow: inset 0 0 0 1px var(--rule); }
.key .k-phone { --c: var(--phone); }
.key .k-sleep { --c: var(--sleep); }
.key .k-awake { --c: var(--awake); }
.key .k-woke dt::before { background: none; border-left: 2px solid var(--moon); width: 1.75rem; border-radius: 0; box-shadow: none; }

/* questions */

.faq details { border-top: 1px solid var(--rule); }
.faq details:last-of-type { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer; list-style: none; padding: 1.1rem 2rem 1.1rem 0; position: relative; font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 0.25rem; top: 1.45rem; width: 0.55rem; height: 0.55rem;
  border-right: 2px solid var(--haze); border-bottom: 2px solid var(--haze);
  transform: rotate(45deg); transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(225deg); top: 1.7rem; }
.faq details > div { padding: 0 0 1.25rem; color: var(--haze); max-width: 40rem; }
.faq details > div p:last-child { margin-bottom: 0; }

/* long text: privacy, terms */

.prose { max-width: 40rem; }
.prose h2 { font-size: 1.35rem; font-weight: 600; margin: 2.75rem 0 0.75rem; }
.prose ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.6rem; }
.prose li::marker { color: var(--dim); }
.updated { color: var(--haze); font-size: 0.95rem; }

@media (min-width: 760px) {
  :root { --gutter: 2.5rem; }
  .list > div { grid-template-columns: 16rem 1fr; gap: 2rem; }
  .track { height: 4.25rem; }
  .marks { height: 3.6rem; }
}

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .site-head { flex-direction: column; gap: 0.5rem; }
  .lead { font-size: 1.175rem; }
  .mark { font-size: 0.85rem; }
  .mark b { font-size: 1rem; }
  .track { height: 2.75rem; border-radius: 0.6rem; }
  .app-icon { width: 64px; height: 64px; border-radius: 15px; }
  .app-hero { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .app-hero .app-icon { width: 88px; height: 88px; border-radius: 20px; }
  main > section { margin-top: 5rem; }
}
