/*
 * The guide pages (/night-definition, /uk-night, /night-currency; round 9,
 * WS-P). Copied from accuracy.html's own styles, so the four pages read as one
 * set; accuracy.html keeps its inline copy. Website only: not in the app, not
 * precached.
 */

:root {
  --ink: #e8eaf0;
  --ink-soft: rgba(232, 234, 240, 0.78);
  --ink-faint: rgba(232, 234, 240, 0.52);
  --accent: #FF9500;
  --card: rgba(16, 21, 31, 0.82);
  --hair: rgba(255, 255, 255, 0.10);
  --hair-bright: rgba(255, 255, 255, 0.18);
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(32px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
           max(56px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #0a0f1a 0%, #16222e 38%, #24505b 78%, #33707c 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.65;
  font-feature-settings: 'kern' 1, 'liga' 1;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* The same faint starfield the app uses, so the two feel like one product. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.16), transparent),
    radial-gradient(1px 1px at 60px 70px, rgba(255, 255, 255, 0.10), transparent),
    radial-gradient(2px 2px at 150px 120px, rgba(255, 255, 255, 0.14), transparent);
  background-size: 300px 300px;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 22px;
  margin-bottom: 34px;
  border-bottom: 1px solid var(--hair);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #fff;
  text-decoration: none;
}

.brand .glyph {
  font-size: 17px;
  line-height: 1;
}

.back {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: none;
  padding: 7px 13px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  white-space: nowrap;
  transition: color 160ms ease, border-color 160ms ease;
}

.back:hover {
  color: var(--ink);
  border-color: var(--hair-bright);
}

/* ---------- title ---------- */

.eyebrow {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

h1 {
  font-size: clamp(32px, 8vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: #fff;
  margin-bottom: 14px;
}

.lede {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 54ch;
  margin-bottom: 18px;
}

.meta {
  display: inline-block;
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: 5px 11px;
  border: 1px solid var(--hair);
  border-radius: 6px;
  margin-bottom: 40px;
}

/* ---------- summary ---------- */

.summary {
  position: relative;
  padding: 24px 26px 24px 30px;
  margin-bottom: 40px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 149, 0, 0.10), rgba(255, 149, 0, 0.04));
  border: 1px solid rgba(255, 149, 0, 0.28);
  overflow: hidden;
}

.summary::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), rgba(255, 149, 0, 0.25));
}

.summary h2 {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.summary p {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.88);
}

.summary p + p {
  margin-top: 10px;
}

/* ---------- sections ---------- */

section.doc {
  padding: 26px 0 6px;
  border-top: 1px solid var(--hair);
}

section.doc:first-of-type {
  border-top: none;
  padding-top: 0;
}

section.doc > h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.015em;
  color: #fff;
  margin-bottom: 16px;
}

section.doc > h2 .num {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  opacity: 0.85;
}

h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: #fff;
  margin: 22px 0 6px;
}

/* Only an h3 that opens a section loses its top margin. Was
   :first-of-type, which also caught the first h3 in a section that starts
   with prose - section 04 - and jammed it against the paragraph above. */
section.doc h2 + h3 {
  margin-top: 0;
}

p {
  color: var(--ink-soft);
  margin-bottom: 12px;
  max-width: 62ch;
}

p:last-child,
ul:last-child {
  margin-bottom: 0;
}

ul {
  list-style: none;
  margin-bottom: 12px;
  max-width: 62ch;
}

li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 11px;
  color: var(--ink-soft);
}

li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 11px;
  width: 8px;
  height: 1.5px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0.75;
}

li:last-child {
  margin-bottom: 0;
}

strong {
  color: #fff;
  font-weight: 650;
}

a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 149, 0, 0.35);
  transition: border-color 160ms ease;
}

a:hover {
  border-bottom-color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

code {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--hair);
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: #fff;
}

/* ---------- contact ---------- */

.contact {
  margin-top: 34px;
  padding: 22px 24px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--hair);
}

.contact h2 {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.contact a {
  font-size: 16px;
}

/* ---------- footer ---------- */

footer {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--hair);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-faint);
}

/* No date line under the title here, so the lede carries the gap before the summary. */
.lede:last-child {
  margin-bottom: 40px;
}

/* ---------- tables (accuracy page) ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
}

caption {
  caption-side: top;
  text-align: left;
  padding: 12px 14px 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

th,
td {
  padding: 8px 14px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--hair);
}

thead th {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* The guides' cells are words as well as times, so unlike /accuracy they wrap;
   tabular digits still line the times up. */
td,
tbody th {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

tbody th {
  font-weight: 600;
}

/* A phone keeps every column on screen: tighter cells, a size smaller. */
@media (max-width: 480px) {
  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 7px 6px;
  }
}

.note {
  font-size: 13.5px;
  color: var(--ink-soft);
}

/* ---------- guide pages ---------- */

/* The way back into the calculator, under each guide. */
.cta {
  display: inline-block;
  margin-top: 6px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1206;
  font-weight: 700;
  text-decoration: none;
  border-bottom: none;
}

.cta:hover {
  color: #1a1206;
  filter: brightness(1.08);
}

blockquote {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 0 8px 8px 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}

/* A guide is something people print or save as PDF. Make that legible. */
@media print {
  body {
    background: #fff;
    color: #000;
    padding: 0;
    font-size: 11pt;
  }
  body::before,
  .back,
  .masthead { display: none; }
  .wrap { max-width: none; }
  h1, h2, h3, strong { color: #000; }
  p, li, .lede { color: #222; }
  .summary {
    border: 1px solid #999;
    background: none;
  }
  .summary::before { display: none; }
  .contact { border: 1px solid #999; background: none; }
  .table-wrap { border: 1px solid #999; background: none; overflow: visible; }
  td, th, caption { color: #000; }
  a { color: #000; border-bottom: 1px solid #999; }
  a[href^="http"]::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #555; }
  section.doc { break-inside: avoid; }
}
