/* Night Screen website. Colors mirror NightScreenTheme.swift. */
:root {
  color-scheme: dark;
  --bg: #090a0b;
  --surface: #131213;
  --elevated: #1c1817;
  --text: #f5e8d6;
  --secondary: #aa9e91;
  --amber: #f29e57;
  --red: #d2473a;
  --line: rgba(255, 255, 255, 0.08);
  --radius: 24px;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }

a { color: var(--amber); text-underline-offset: 3px; }
a:hover { color: #ffb878; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.5rem, 6vw, 4.25rem); }
h2 { font-size: clamp(2rem, 4.2vw, 3rem); }
h3 { font-size: 1.5rem; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--secondary); }
.small { font-size: 0.875rem; line-height: 1.5; }

.eyebrow {
  font: 600 0.75rem/1.4 var(--rounded);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(9, 10, 11, 0.82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 600 1.05rem var(--rounded); }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand:hover { color: var(--text); }
.nav { display: flex; gap: 24px; font-size: 0.95rem; }
.nav a { color: var(--secondary); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 720px) { .nav .wide { display: none; } }

/* Sections */
section { padding: 96px 0; }
section + section { border-top: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 48px; }
.section-head p:not(.eyebrow) { margin-top: 18px; color: var(--secondary); font-size: 1.1rem; }
@media (max-width: 720px) { section { padding: 72px 0; } }

/* Hero */
.hero { padding: 72px 0 96px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 70%; height: 120%;
  background: radial-gradient(closest-side, rgba(242, 158, 87, 0.13), transparent 70%);
  pointer-events: none;
}
.hero .wrap { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 56px; align-items: center; position: relative; }
.hero .lede { margin-top: 22px; font-size: 1.2rem; color: var(--secondary); max-width: 34ch; }
.hero .accent { color: var(--amber); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 36px; }
.cta .note { color: var(--secondary); font-size: 0.9rem; line-height: 1.45; }
.badge img { height: 54px; width: auto; }
.qr-mini { display: flex; align-items: center; gap: 14px; margin-top: 32px; padding: 12px 18px 12px 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); width: fit-content; }
.qr-mini img { width: 84px; height: 84px; border-radius: 8px; }
.qr-mini p { font-size: 0.9rem; color: var(--secondary); line-height: 1.4; }
.qr-mini strong { color: var(--text); font-weight: 600; display: block; }
@media (max-width: 860px) {
  .hero { padding-top: 48px; }
  .hero .wrap { grid-template-columns: 1fr; gap: 48px; }
  .hero .phone { max-width: 300px; margin: 0 auto; }
}
/* QR codes are for desktop visitors; on a phone you tap the badge instead. */
@media (max-width: 860px), (hover: none) { .qr-mini { display: none; } }

/* Phone frame */
.phone {
  border-radius: 46px; padding: 10px;
  background: linear-gradient(160deg, #2a2523, #141213);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 40px 80px -30px rgba(0, 0, 0, 0.9), 0 0 120px -40px rgba(242, 158, 87, 0.25);
}
.phone img { border-radius: 37px; width: 100%; }

/* Modes */
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.mode { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.mode .phone { max-width: 260px; margin: 18px auto 0; }
.mode.red .eyebrow { color: #ef6b5d; }
.mode p:not(.eyebrow) { color: var(--secondary); }
.footnote { margin-top: 22px; color: var(--secondary); font-size: 0.875rem; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } .mode { padding: 26px 22px; } }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--amber); color: var(--bg); font: 700 1rem var(--rounded); margin-bottom: 18px;
}
.steps h3 { font-size: 1.3rem; margin-bottom: 10px; }
.steps p { color: var(--secondary); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding: 0; list-style: none; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 7px 15px; font-size: 0.9rem; color: var(--secondary); background: var(--surface); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* Light & sleep */
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; display: flex; flex-direction: column; gap: 12px; }
.fact .figure { font: 400 2.6rem/1 var(--serif); color: var(--amber); }
.fact p { color: var(--secondary); }
.fact p strong { color: var(--text); font-weight: 600; }
.source { font-size: 0.8rem; color: var(--secondary); margin-top: auto; padding-top: 6px; }
.source a { color: var(--secondary); }
.source a:hover { color: var(--text); }
.spectrum { margin-top: 24px; display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 24px; align-items: stretch; }
.spectrum .fact { justify-content: center; }
.bar {
  height: 18px; border-radius: 999px; margin: 6px 0 4px;
  background: linear-gradient(90deg, #6b3fd1 0%, #2f6fe4 14%, #1fb3d6 26%, #3fbf6a 40%, #d9d43a 56%, #f29e57 70%, #e3502f 84%, #a5170f 100%);
}
.bar-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--secondary); }
.honest { background: var(--elevated); border: 1px solid rgba(242, 158, 87, 0.25); border-radius: var(--radius); padding: 30px; }
.honest h3 { font-size: 1.35rem; margin-bottom: 12px; }
.honest p { color: var(--secondary); }
.honest p + p { margin-top: 10px; }
.tips { margin-top: 48px; }
.tips h3 { margin-bottom: 18px; }
.tips ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 32px; padding: 0; margin: 0; list-style: none; }
.tips li { padding-left: 26px; position: relative; color: var(--secondary); }
.tips li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); opacity: 0.8; }
@media (max-width: 760px) {
  .facts, .spectrum, .tips ul { grid-template-columns: 1fr; }
  .fact, .honest { padding: 26px 22px; }
}

/* Privacy summary */
.privacy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; list-style: none; padding: 0; margin: 0; }
.privacy-grid li { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.privacy-grid strong { display: block; font: 400 1.2rem/1.25 var(--serif); margin-bottom: 8px; }
.privacy-grid span { color: var(--secondary); font-size: 0.95rem; }
.more { display: inline-block; margin-top: 28px; font-weight: 500; }
@media (max-width: 900px) { .privacy-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .privacy-grid { grid-template-columns: 1fr; } }

/* Pricing */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 780px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; position: relative; }
.plan.best { border-color: rgba(242, 158, 87, 0.55); background: linear-gradient(180deg, rgba(242, 158, 87, 0.08), var(--surface) 60%); }
.plan .tag { position: absolute; top: -12px; right: 22px; background: var(--amber); color: var(--bg); font: 700 0.72rem var(--rounded); letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 11px; border-radius: 999px; }
.plan h3 { font: 600 1rem var(--rounded); color: var(--secondary); text-transform: uppercase; letter-spacing: 0.1em; }
.price { font: 400 2.8rem/1 var(--serif); margin: 14px 0 6px; }
.price span { font: 400 1rem var(--sans); color: var(--secondary); }
.plan ul { margin: 22px 0 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.plan li { padding-left: 24px; position: relative; color: var(--secondary); font-size: 0.95rem; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--amber); font-weight: 700; }
.terms { margin-top: 24px; max-width: 780px; color: var(--secondary); font-size: 0.85rem; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; gap: 28px; } }

/* Download */
.downloads { max-width: 560px; }
.store { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; display: flex; gap: 26px; align-items: center; }
.store .qr { width: 132px; height: 132px; flex: none; border-radius: 12px; }
.store h3 { font-size: 1.35rem; margin-bottom: 6px; }
.store p { color: var(--secondary); font-size: 0.95rem; }
.store .badge { display: inline-block; margin-top: 16px; }
.store .badge img { height: 46px; }
@media (max-width: 860px), (hover: none) {
  .store .qr { display: none; }
}

/* FAQ */
.faq { max-width: 780px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none; padding: 22px 40px 22px 0; position: relative;
  font: 400 1.25rem/1.35 var(--serif);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 18px; font: 300 1.6rem var(--sans); color: var(--amber); }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--secondary); padding: 0 0 22px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 56px; color: var(--secondary); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px 48px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.site-footer nav a { color: var(--secondary); text-decoration: none; }
.site-footer nav a:hover { color: var(--text); }
.legal { flex-basis: 100%; font-size: 0.78rem; opacity: 0.75; }

/* Document pages (privacy, support) */
.doc { padding: 64px 0 96px; }
.doc .wrap { max-width: 760px; }
.doc h1 { font-size: clamp(2.3rem, 5vw, 3.25rem); }
.doc .meta { color: var(--secondary); margin-top: 14px; }
.doc h2 { font-size: 1.7rem; margin: 48px 0 14px; }
.doc h3 { font-size: 1.25rem; margin: 28px 0 10px; }
.doc p, .doc li { color: #d9cdbd; }
.doc p + p { margin-top: 14px; }
.doc ol, .doc ul { padding-left: 1.3em; margin: 12px 0 0; display: grid; gap: 8px; }
.doc .card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; margin-top: 32px; }
.doc .card p { color: var(--secondary); }
.doc .card .email { font: 400 1.35rem var(--serif); display: inline-block; margin: 8px 0 10px; word-break: break-all; }
.doc .path { font-family: var(--rounded); color: var(--text); white-space: nowrap; }
@media (max-width: 520px) { .doc .path { white-space: normal; } }
.doc .intro { margin-top: 32px; }
