/* Havetime — "Daylight" for the web.
   Mirrors the app's design system (App/Design/Theme.swift):
   black and white only, hierarchy from opacity, serif for headlines and big numbers,
   sans for everything you read, hairlines instead of cards, lots of room. */

@font-face {
  /* A free serif close to Apple's New York, used where New York isn't available (Chrome, Windows, Android). */
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/newsreader-latin.woff2") format("woff2");
}

:root {
  --bg: #F6F6F3;
  --ink: #141414;
  --soft: rgba(20, 20, 20, 0.56);   /* secondary text */
  --faint: rgba(20, 20, 20, 0.34);  /* tertiary text */
  --line: rgba(20, 20, 20, 0.12);   /* hairlines */
  --wash: rgba(20, 20, 20, 0.045);  /* the faintest tint */

  /* New York on Apple devices (Safari), Newsreader everywhere else. */
  --serif: ui-serif, "New York", "Newsreader", Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --margin: clamp(24px, 5vw, 56px);
  --wide: 1120px;
  --narrow: 660px;
  --corner: 16px;
  --section: clamp(112px, 15vw, 200px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0F0E;
    --ink: #ECEBE5;
    --soft: rgba(236, 235, 229, 0.56);
    --faint: rgba(236, 235, 229, 0.34);
    --line: rgba(236, 235, 229, 0.16);
    --wash: rgba(236, 235, 229, 0.07);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--faint); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }
::selection { background: var(--ink); color: var(--bg); }

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 400; margin: 0; }
h1 { font-size: clamp(44px, 7.2vw, 92px); line-height: 1.02; letter-spacing: -0.028em; }
h2 { font-size: clamp(32px, 4.2vw, 52px); line-height: 1.08; letter-spacing: -0.022em; }
h3 { font-size: 24px; line-height: 1.25; letter-spacing: -0.005em; }
h1, h2 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
.line-break { display: inline-block; }

.wrap { width: 100%; max-width: calc(var(--wide) + 2 * var(--margin)); margin: 0 auto; padding: 0 var(--margin); }
.wrap.narrow { max-width: calc(var(--narrow) + 2 * var(--margin)); }

.label { font: 500 11px/1.4 var(--sans); color: var(--soft); letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 22px; }
.soft { color: var(--soft); }
.faint { color: var(--faint); }
.lead { font-size: clamp(18px, 1.5vw, 19px); line-height: 1.6; color: var(--soft); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--bg); padding: 8px 12px; z-index: 10; }

/* ---------- Header and footer ---------- */

.site-header { padding: 26px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: baseline; gap: 0.48em; font: 400 21px/1 var(--serif); letter-spacing: -0.01em; text-decoration: none; }
/* As tall as the capital H and standing on the baseline, so the mark lines up with the wordmark.
   New York and Newsreader both have a cap height of about 0.71em. */
.brand-mark { width: 0.71em; height: 0.71em; fill: currentColor; flex: none; }
.site-nav { display: flex; gap: clamp(18px, 3vw, 36px); font-size: 14px; }
.site-nav a { color: var(--soft); text-decoration: none; transition: color 0.3s; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 420px) { .site-nav .optional { display: none; } }

.site-footer { padding: 40px 0 56px; border-top: 1px solid var(--line); font-size: 14px; color: var(--soft); }
.site-footer.flush { border-top: 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer .brand { color: var(--ink); }
.site-footer .brand { font-size: 20px; }

/* ---------- Buttons ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 26px;
  border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font: 500 15px/1 var(--sans); letter-spacing: 0.005em; text-decoration: none;
  transition: opacity 0.3s;
}
.button:hover { opacity: 0.82; }
/* Until the app is live: a quiet hairline pill, not a button you'd try to press. */
.button.soon { background: transparent; color: var(--soft); box-shadow: inset 0 0 0 1px var(--line); cursor: default; }
.button.soon:hover { opacity: 1; }

.tag {
  display: inline-block; vertical-align: 0.2em; margin-left: 8px;
  padding: 3px 8px 4px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line);
  font: 500 11px/1 var(--sans); color: var(--soft); letter-spacing: 0.06em; text-transform: uppercase;
}

/* ---------- The sun ----------
   Always a round sun, in light and dark, like the breathing in the app. */

.orb { color: var(--ink); }
.orb .sun { fill: currentColor; }

/* ---------- Hero: the horizon with a rising sun ---------- */

.hero { padding: clamp(88px, 14vw, 176px) 0 0; text-align: center; }
.hero h1 { max-width: 11ch; margin: 0 auto; }
.hero .lead { max-width: 27em; margin: 32px auto 0; }
.hero .cta { margin-top: 44px; }

.horizon { position: relative; margin-top: clamp(80px, 11vw, 144px); --orb: clamp(72px, 8vw, 104px); }
.horizon .sky { position: relative; height: clamp(120px, 14vw, 180px); overflow: hidden; }
.horizon .orb {
  position: absolute; left: 50%; bottom: clamp(20px, 2.4vw, 30px);
  width: var(--orb); height: var(--orb);
  transform: translate(-50%, calc(100% + 40px));
  animation: rise 3.6s var(--ease) 0.5s forwards;
}
.horizon .line { height: 1px; background: var(--ink); opacity: 0.85; transform-origin: 50% 50%; animation: draw 1.8s var(--ease) both; }

@keyframes rise { to { transform: translate(-50%, 0); } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Hero calculator ----------
   A ruler of hours that slides under a fixed sun, like the iOS timer: ticks up to your hours in ink,
   the rest faint, fading out at both ends. The sun sits on the horizon, under the chosen tick. */

.calc { margin-top: clamp(96px, 12vw, 160px); text-align: center; }
.calc-big { margin: 0; display: flex; flex-direction: column; align-items: center; }
.calc-big [data-out="days"] { font: 400 clamp(72px, 11vw, 140px)/0.95 var(--serif); letter-spacing: -0.035em; font-variant-numeric: lining-nums tabular-nums; }
.calc-big .unit { margin-top: 14px; font: 400 clamp(20px, 2vw, 24px)/1.3 var(--serif); color: var(--soft); letter-spacing: -0.005em; }

.dial { position: relative; margin-top: clamp(34px, 4.4vw, 50px); --gap: clamp(18px, 1.9vw, 24px); --tick: 28px; --sun: 12px; }
.ruler {
  position: relative; max-width: 600px; margin: 0 auto;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; cursor: grab; outline: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
}
.ruler::-webkit-scrollbar { display: none; }
.ruler.dragging { cursor: grabbing; scroll-snap-type: none; }
.ruler .track { display: inline-flex; align-items: flex-end; padding: 0 calc(50% - var(--gap) / 2); height: calc(var(--tick) + 26px); }
.ruler .t {
  flex: none; position: relative; width: var(--gap); height: var(--tick);
  scroll-snap-align: center; display: flex; justify-content: center;
}
.ruler .t::before {
  content: ""; width: 2px; height: 100%; border-radius: 1px;
  background: var(--ink); opacity: 0.16; transition: opacity 0.25s;
}
.ruler .t.on::before { opacity: 1; }
.ruler .t span {
  position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  font: 500 12px/1 var(--sans); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; color: var(--ink); opacity: 0.28; transition: opacity 0.25s;
}
.ruler .t.on span { opacity: 1; }
.ruler:focus-visible { -webkit-mask-image: none; mask-image: none; box-shadow: 0 0 0 1px var(--line); border-radius: 12px; }

.dial .line { height: 1px; background: linear-gradient(90deg, transparent, var(--ink) 18%, var(--ink) 82%, transparent); opacity: 0.85; margin-top: 14px; transform-origin: 50% 50%; animation: draw 1.8s var(--ease) both; }
.dial .pointer { width: var(--sun); height: var(--sun); margin: calc(var(--sun) / -2) auto 0; border-radius: 50%; background: var(--ink); }
.ruler-read { margin: 16px 0 0; font-size: 14px; color: var(--soft); font-variant-numeric: tabular-nums; }

.calc-life { margin: clamp(40px, 5vw, 56px) auto 0; font-size: clamp(17px, 1.6vw, 19px); color: var(--soft); }
.calc-life strong { color: var(--ink); font-weight: 500; white-space: nowrap; }
.calc-life .nowrap { white-space: nowrap; }
.calc-life { text-wrap: balance; }
.calc-back { margin: 10px auto 0; font-size: 13px; color: var(--faint); }
.age {
  width: 2.2ch; padding: 0 0 1px; margin: 0; border: 0; border-bottom: 1px solid var(--faint); border-radius: 0;
  background: transparent; color: var(--ink); font: inherit; font-weight: 500; text-align: center; -moz-appearance: textfield; appearance: textfield;
}
.age::-webkit-inner-spin-button, .age::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.age:focus { outline: none; border-bottom-color: var(--ink); }

/* ---------- Sections: whitespace, not dividers ---------- */

.section { padding: var(--section) 0; }
.head { max-width: 720px; }
h2 + .lead { margin-top: 24px; }

.split { display: grid; gap: clamp(64px, 8vw, 128px); align-items: center; }
.split .text { max-width: 480px; }
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split.reverse .text { justify-self: end; width: 100%; }
}

/* Breathe, Wait, Write */
.rituals { margin: 44px 0 0; display: grid; gap: 18px; }
.rituals > div { display: grid; grid-template-columns: 6.2em 1fr; align-items: baseline; gap: 16px; }
.rituals dt { font: 400 26px/1.2 var(--serif); letter-spacing: -0.01em; }
.rituals dd { margin: 0; color: var(--soft); }

/* Plain definition list */
.list { margin: 40px 0 0; display: grid; gap: 26px; }
.list dt { font-weight: 500; margin-bottom: 4px; }
.list dd { margin: 0; color: var(--soft); }

/* Gentle / Firm / Locked */
.three { display: grid; gap: 36px; margin: clamp(56px, 7vw, 88px) 0 0; }
.three dt { font: 400 clamp(30px, 3.2vw, 40px)/1.1 var(--serif); letter-spacing: -0.015em; margin-bottom: 14px; }
.three dd { margin: 0; color: var(--soft); max-width: 18em; }
@media (min-width: 760px) { .three { grid-template-columns: repeat(3, 1fr); gap: 48px; } }
.aside { margin-top: clamp(48px, 6vw, 72px); color: var(--soft); font-size: 15px; max-width: 40em; }
.aside a { color: var(--ink); white-space: nowrap; }

/* ---------- Phones: real screenshots, framed by a hairline ---------- */

.phones { display: flex; justify-content: center; gap: clamp(14px, 2.4vw, 28px); }
.phone { flex: 0 1 270px; margin: 0; }
.phone img {
  width: 100%; height: auto;
  border-radius: 13.5% / 6.2%;
  box-shadow: 0 0 0 1px var(--line), 0 30px 60px -30px rgba(0, 0, 0, 0.18);
  background: var(--bg);
}
.phones.pair .phone:nth-child(2) { margin-top: clamp(40px, 7vw, 88px); }
@media (max-width: 560px) { .phones.pair .phone { flex-basis: 50%; } }
#features .phone { flex-basis: 300px; }

/* ---------- Privacy ---------- */

.promise { text-align: center; }
.promise .label { margin-left: auto; margin-right: auto; }
.promise h2 { max-width: 12ch; margin: 0 auto; }
.promise .lead { margin: 28px auto 0; max-width: 26em; }
.promise .more { margin-top: 32px; font-size: 15px; }

/* ---------- Havetime Plus ---------- */

.plans { display: grid; gap: 48px; margin-top: clamp(56px, 7vw, 88px); }
.plans h3 { font-size: 26px; margin-bottom: 22px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.plans .price { font: 400 17px/1 var(--sans); color: var(--soft); }
.plans ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plans li { padding: 13px 0; border-bottom: 1px solid var(--line); }
.plans > div:first-child li { color: var(--soft); }
@media (min-width: 760px) { .plans { grid-template-columns: 1fr 1fr; gap: clamp(48px, 7vw, 104px); } }
.fineprint { margin-top: 36px; font-size: 13px; color: var(--faint); max-width: 46em; }

/* ---------- Closing: the sun setting ---------- */

.closing { padding: var(--section) 0 0; text-align: center; }
.closing h2 { max-width: 12ch; margin: 0 auto; }
.closing .cta { margin-top: 40px; }
.closing .horizon .sky { height: calc(var(--orb) * 1.3); }
.closing .horizon .orb { bottom: 0; transform: translate(-50%, 50%); animation: none; }
/* Where the browser supports it, the sun sets as you reach the end of the page. */
@supports (animation-timeline: view()) {
  .closing .horizon .orb { animation: set linear both; animation-timeline: view(); animation-range: cover 5% cover 45%; }
}
@keyframes set {
  from { transform: translate(-50%, -18%); }
  to   { transform: translate(-50%, 50%); }
}

/* ---------- Text pages (privacy, support, terms) ---------- */

.page { padding: clamp(48px, 8vw, 96px) 0 var(--section); }
.page h1 { font-size: clamp(42px, 6vw, 60px); line-height: 1.06; letter-spacing: -0.018em; }
.page .date { color: var(--soft); font-size: 15px; margin: 14px 0 0; }
.page .intro { font: 400 clamp(21px, 2.2vw, 24px)/1.42 var(--serif); margin: 36px 0 0; }
.page .mini-horizon { margin-top: 40px; }
.page .mini-horizon .sky { position: relative; height: 44px; overflow: hidden; }
.page .mini-horizon .orb { position: absolute; left: 0; bottom: -17px; width: 34px; height: 34px; }
.page .mini-horizon .line { height: 1px; background: var(--ink); }
.page section { border-top: 1px solid var(--line); margin-top: 44px; padding-top: 30px; }
.page .mini-horizon + section { border-top: 0; margin-top: 8px; }
.page h2 { font-size: clamp(24px, 2.4vw, 28px); line-height: 1.25; letter-spacing: -0.008em; margin: 0 0 14px; }
.page ul { margin: 0 0 14px; padding-left: 20px; }
.page li { margin: 0 0 8px; }
.page li::marker { color: var(--faint); }
.page em { font-style: normal; font-weight: 500; }

.contact { margin-top: 26px; }
.contact .email { font: 400 clamp(26px, 3.4vw, 36px)/1.2 var(--serif); letter-spacing: -0.01em; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: border-color 0.3s; overflow-wrap: anywhere; }
.contact .email:hover { border-color: var(--ink); }
.contact p { margin-top: 16px; color: var(--soft); }

.faq { margin: 0; }
.faq > div { border-top: 1px solid var(--line); padding: 28px 0 26px; }
.faq dt { font: 400 clamp(21px, 2.2vw, 24px)/1.3 var(--serif); margin-bottom: 12px; letter-spacing: -0.005em; }
.faq dd { margin: 0; }
.faq dd p, .faq dd li { color: var(--soft); }
.faq dd strong { color: var(--ink); font-weight: 500; }
.faq ol { margin: 0 0 14px; padding-left: 22px; }
.faq ol li { margin-bottom: 6px; }
.path { color: var(--ink); font-weight: 500; }

/* ---------- Motion: slow and soft, and never for people who'd rather not ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .horizon .orb { animation: none; transform: translate(-50%, 0); }
  .horizon .line, .dial .line { animation: none; transform: none; }
  .ruler .t::before, .ruler .t span { transition: none; }
  .closing .horizon .orb { animation: none; transform: translate(-50%, 50%); }
}
