/* Second Sleep — one stylesheet, all of it. */

@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/newsreader-latin-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin.woff2') format('woff2');
}

:root {
  --night:   #171C26;
  --surface: #1F2733;
  --paper:   #E4E1D8;
  --muted:   #949CA8;
  --clock:   #E0A458;
  --rule:    #2C3542;

  --font-head: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-body: 'IBM Plex Sans', Helvetica, Arial, sans-serif;
  --measure: 66ch;
}

[data-theme="day"] {
  --night:   #FBF9F4;
  --surface: #F2EEE5;
  --paper:   #23282F;
  --muted:   #5C646E;
  --clock:   #A96A16;
  --rule:    #E0DACE;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
}
[data-theme="day"] html { color-scheme: light; }

body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--clock); }
a:hover, a:focus { text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--clock);
  outline-offset: 2px;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 500;
  line-height: 1.2;
  margin: 0 0 0.6em;
}
h1 { font-size: 2.6rem; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.2em; }

.meta {
  font-size: 0.875rem;
  color: var(--muted);
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

.measure { max-width: var(--measure); }

/* header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--night);
  border-bottom: 1px solid var(--rule);
  transition: box-shadow 0.2s ease;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
.site-header .logo img,
.site-header .logo svg {
  height: 28px;
  width: auto;
  display: block;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--paper);
  font-size: 1.1rem;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--clock); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* home triage */

.triage {
  position: relative;
  padding: 56px 24px 40px;
  margin: 0 -24px;
  background-image: url('/assets/img/home-hero.webp');
  background-size: cover;
  background-position: center 35%;
}
.triage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--night);
  opacity: 0.87;
}
.triage > * {
  position: relative;
  z-index: 1;
}
.triage h1 {
  margin-bottom: 0.3em;
}
.triage .lede {
  color: var(--muted);
  font-size: 1.2rem;
  margin-bottom: 1.6em;
}
.triage-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.triage-list li {
  border-top: 1px solid var(--rule);
}
.triage-list li:last-child {
  border-bottom: 1px solid var(--rule);
}
.triage-list a {
  display: block;
  padding: 18px 4px;
  color: var(--paper);
  font-family: var(--font-head);
  font-size: 1.3rem;
  text-decoration: none;
}
.triage-list a::before {
  content: "\2192";
  color: var(--clock);
  margin-right: 14px;
}
.triage-list a:hover,
.triage-list a:focus-visible {
  color: var(--clock);
}

.latest {
  padding: 32px 0 48px;
  border-top: 1px solid var(--rule);
}
.latest h2 { font-size: 1.2rem; color: var(--muted); font-family: var(--font-body); font-weight: 600; text-transform: none; }
.article-row {
  display: block;
  padding: 14px 0;
  border-top: 1px solid var(--rule);
  color: var(--paper);
  text-decoration: none;
}
.article-row .title { font-family: var(--font-head); font-size: 1.15rem; display: block; }
.article-row .title:hover { color: var(--clock); }

/* article page */

.article {
  padding: 40px 0 60px;
}
.article h1 { margin-bottom: 0.5em; }
.article .byline {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.6em;
}
.answer-block {
  background: var(--surface);
  border-left: 2px solid var(--clock);
  padding: 20px 22px;
  margin: 0 0 2em;
  font-size: 1.05rem;
}
.hero-photo {
  margin: 0 0 0.5em;
}
.hero-photo img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}
.hero-photo figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4em;
}
@media (max-width: 480px) {
  .hero-photo img { height: 160px; }
}
.hero-photo figcaption a { color: var(--muted); }
.disclosure-note {
  font-size: 0.875rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 12px 0;
  margin: 1.6em 0;
}
.article figure { margin: 2em 0; }
.article figure svg { width: 100%; height: auto; }
.article figcaption {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.6em;
}
.source-list {
  font-size: 0.9rem;
  color: var(--muted);
}
.doctor-box {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 18px 20px;
  margin: 2em 0;
}
.siblings {
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  margin-top: 2.4em;
}
.siblings ul { padding-left: 1.2em; }

.author-footer {
  border-top: 1px solid var(--rule);
  margin-top: 3em;
  padding-top: 24px;
  font-size: 0.95rem;
  color: var(--muted);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.author-footer a { color: var(--clock); }
.author-footer img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.author-footer .author-text { flex: 1; min-width: 0; }

.author-photo {
  width: 180px;
  margin: 0 0 1.6em;
}
.author-photo img {
  width: 100%;
  height: auto;
  display: block;
}
.author-photo figcaption {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.4em;
}

.reviewed {
  font-size: 0.875rem;
  color: var(--muted);
}

/* footer */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 28px 0 48px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer a { color: var(--muted); margin-right: 16px; }
.site-footer a:hover { color: var(--clock); }

/* simple pages */

.page { padding: 48px 0 64px; }
.page h1 { margin-bottom: 0.7em; }

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  .triage { padding-top: 36px; }
}
