/* Sleepwrist site: the app's night theme (Theme.swift) on the web. Dark navy gradient, cards, violet CTA, rounded type. */
:root {
  --bg-top: #1A1F38;
  --bg-bottom: #0D0F1F;
  --card: #212642;
  --card-2: #262C4D;
  --border: rgba(255, 255, 255, .08);
  --ink: #FFFFFF;
  --ink-2: rgba(235, 235, 245, .78);
  --muted: rgba(235, 235, 245, .6);
  --violet: #7C4DDB;
  --violet-dark: #6A3CC8;
  --lilac: #B88CFF;
  --orange: #FF941A;
  --green: #30D158;
  --shadow: 0 16px 40px rgba(0, 0, 0, .35);
  --font: ui-rounded, "SF Pro Rounded", Nunito, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; background: var(--bg-bottom); }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 640px) var(--bg-bottom); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--lilac); }
a:hover { color: #D3B8FF; }
:focus-visible { outline: 3px solid var(--lilac); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: 780px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: 12px; background: var(--violet); color: #fff; font-weight: 800; text-decoration: none; }
.skip:focus { top: 12px; color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--violet); color: #fff; font: inherit; font-size: 16px; font-weight: 800; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--violet-dark); color: #fff; }
.btn--small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.btn--big { min-height: 56px; padding: 0 32px; font-size: 18px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(20, 23, 44, .86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border); }
.site-header__row { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { border-radius: 9px; }
.brand span { font-size: 21px; font-weight: 900; color: var(--ink); }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-header__row > .btn { margin-left: auto; }
.site-nav + .btn { margin-left: 0; }
.menu { position: relative; }
.menu__top { display: block; padding: 10px 12px; border-radius: 12px; color: var(--ink-2); font-weight: 800; font-size: 15px; text-decoration: none; }
.menu__top:hover, .menu__top[aria-current] { color: var(--lilac); }
.menu__panel { position: absolute; top: 100%; left: -8px; z-index: 30; display: none; min-width: 300px; padding: 10px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.menu:hover .menu__panel, .menu:focus-within .menu__panel { display: flex; flex-direction: column; }
.menu__panel a { padding: 8px 10px; border-radius: 10px; color: var(--ink); font-size: 15px; font-weight: 700; text-decoration: none; }
.menu__panel a:hover { background: var(--card-2); color: var(--lilac); }
.menu__panel .menu__all { margin-top: 4px; color: var(--lilac); font-weight: 900; }
.mobile-menu { display: none; position: relative; }
.mobile-menu summary { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; padding: 0 11px; border-radius: 12px; cursor: pointer; list-style: none; }
.mobile-menu summary::-webkit-details-marker { display: none; }
.mobile-menu summary span { display: block; height: 3px; border-radius: 2px; background: var(--ink); }
.mobile-menu nav { position: absolute; right: 0; top: 52px; display: flex; flex-direction: column; min-width: 220px; padding: 10px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.mobile-menu nav a { padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 800; text-decoration: none; }

/* Footer */
.site-footer { margin-top: 72px; padding: 48px 0 32px; background: #0A0C18; border-top: 1px solid var(--border); }
.site-footer__top { display: flex; justify-content: space-between; gap: 32px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.site-footer__brand { max-width: 380px; }
.site-footer__brand p { margin: 12px 0 16px; color: var(--ink-2); font-weight: 600; line-height: 1.5; }
.site-footer__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; padding-top: 32px; }
.site-footer__grid:empty { display: none; }
.site-footer nav { display: flex; flex-direction: column; gap: 9px; }
.site-footer nav strong, .site-footer nav strong a { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-decoration: none; }
.site-footer nav a { color: var(--ink-2); font-size: 14px; font-weight: 700; line-height: 1.35; text-decoration: none; }
.site-footer nav a:hover { color: var(--lilac); }
.site-footer__fine { margin-top: 32px; font-size: 13px; font-weight: 600; line-height: 1.5; color: var(--muted); }

/* Article */
.article, .hub { padding: 28px 0 8px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 800; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--lilac); }
.article h1, .hub h1 { margin: 18px 0 12px; font-size: 44px; line-height: 1.1; font-weight: 900; letter-spacing: -.02em; }
.dek { margin: 0 0 14px; font-size: 20px; line-height: 1.5; font-weight: 600; color: var(--ink-2); }
.byline-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 22px; }
.byline { margin: 0 0 18px; font-size: 14px; font-weight: 800; color: var(--muted); }
.byline-row .byline { margin: 0; }
.toc { margin: 0 0 28px; padding: 18px 22px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); }
.toc strong { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.toc ol { margin: 10px 0 0; padding-left: 20px; }
.toc li { margin: 6px 0; font-weight: 800; }
.toc a { text-decoration: none; }
.prose { font-size: 18px; line-height: 1.7; font-weight: 500; color: var(--ink-2); }
.prose h2 { margin: 44px 0 12px; font-size: 30px; line-height: 1.2; font-weight: 900; letter-spacing: -.01em; color: var(--ink); scroll-margin-top: 84px; }
.prose h3 { margin: 30px 0 8px; font-size: 22px; line-height: 1.3; font-weight: 800; color: var(--ink); scroll-margin-top: 84px; }
.prose h4 { margin: 24px 0 6px; font-size: 18px; font-weight: 800; color: var(--ink); }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 24px; }
.prose li { margin: 6px 0; }
.prose strong { font-weight: 800; color: var(--ink); }
.prose code { padding: 2px 6px; border-radius: 6px; background: var(--card); font-size: .9em; }
.callout { margin: 24px 0; padding: 18px 22px; border-radius: 20px; background: rgba(184, 140, 255, .12); border: 1px solid rgba(184, 140, 255, .3); }
.callout p:last-child { margin-bottom: 0; }
.table-wrap { margin: 20px 0 24px; overflow-x: auto; border-radius: 18px; border: 1px solid var(--border); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--card-2); font-weight: 800; color: var(--ink); }
tr:last-child td { border-bottom: 0; }
.medical-note { margin-top: 28px; padding: 14px 18px; border-radius: 16px; background: var(--card); font-size: 15px; line-height: 1.55; color: var(--muted); }
.article--legal .prose h2 { font-size: 24px; margin-top: 36px; }

.hero-img { width: 100%; height: auto; margin: 0 0 28px; border-radius: 24px; box-shadow: var(--shadow); aspect-ratio: 1200 / 630; object-fit: cover; }
.share-bar { display: flex; gap: 8px; }
.share-btn { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--violet); color: #fff; font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.share-btn:hover { background: var(--violet-dark); }
.share-btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--border); }
.share-btn--ghost:hover { background: var(--card); }
.keep-exploring { margin: 28px 0; padding: 18px 22px; border-radius: 20px; background: var(--card); border: 1px solid var(--border); }
.keep-exploring strong { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.keep-exploring ul { margin: 8px 0 0; padding-left: 20px; }
.keep-exploring li { margin: 6px 0; font-size: 17px; font-weight: 800; }
.sources { font-size: 15px; }
.sources li { margin: 6px 0; }
.hook { margin: 36px 0; padding: 26px 26px 22px; border-radius: 26px; background: linear-gradient(135deg, rgba(124, 77, 219, .45), rgba(124, 77, 219, .15)); border: 1px solid rgba(184, 140, 255, .35); color: #fff; }
.hook__label { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--lilac); }
.hook p { margin: 8px 0 16px; font-size: 24px; line-height: 1.35; font-weight: 900; color: #fff; }
.hook .share-btn { background: #fff; color: #141733; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 26px 0; }
.shots img { width: 100%; height: auto; border-radius: 22px; box-shadow: var(--shadow); }
.shots figcaption { grid-column: 1 / -1; font-size: 14px; font-weight: 700; color: var(--muted); }
.hub-group { margin-top: 36px; }
.hub-group h2 { margin: 0 0 8px; font-size: 26px; font-weight: 900; }
.hub-item { padding: 18px 0; border-bottom: 1px solid var(--border); }
.hub-item h3 { margin: 0 0 6px; font-size: 21px; line-height: 1.3; font-weight: 800; }
.hub-item h3 a { color: var(--ink); text-decoration: none; }
.hub-item h3 a:hover { color: var(--lilac); }
.hub-item p { margin: 0; font-size: 16px; line-height: 1.55; font-weight: 600; color: var(--ink-2); }

/* CTAs */
.cta-inline { display: flex; align-items: center; gap: 16px; margin: 28px 0; padding: 18px 20px; border-radius: 24px; background: var(--card); border: 1px solid rgba(184, 140, 255, .25); }
.cta-inline img { flex: none; }
.cta-inline div { display: flex; flex-direction: column; gap: 4px; flex: 1; font-size: 15px; line-height: 1.45; }
.cta-inline strong { font-size: 17px; font-weight: 900; color: var(--ink); }
.cta-inline span { color: var(--ink-2); font-weight: 600; }
.cta-end { display: flex; align-items: center; gap: 28px; margin: 48px 0 8px; padding: 32px; border-radius: 30px; background: linear-gradient(135deg, rgba(124, 77, 219, .55), rgba(124, 77, 219, .18)); border: 1px solid rgba(184, 140, 255, .35); }
.cta-end img { flex: none; }
.cta-end h2 { margin: 0 0 10px; font-size: 30px; line-height: 1.15; font-weight: 900; }
.cta-end p { margin: 0 0 18px; font-size: 17px; line-height: 1.5; font-weight: 600; color: var(--ink-2); }

/* Hubs and related cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 24px; }
.card-link { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 22px; background: var(--card); border: 1px solid var(--border); color: var(--ink); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.card-link:hover { transform: translateY(-2px); border-color: rgba(184, 140, 255, .4); color: var(--ink); }
.card-link__kicker { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; color: var(--lilac); }
.card-link strong { font-size: 19px; line-height: 1.3; font-weight: 800; }
.card-link span:last-child { color: var(--ink-2); font-size: 15px; line-height: 1.45; font-weight: 600; }
.related { margin-top: 56px; }
.related h2 { font-size: 26px; font-weight: 900; }

@media (max-width: 900px) {
  .site-nav { display: none; }
  .site-nav + .btn { margin-left: auto; }
  .mobile-menu { display: block; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__top { flex-direction: column; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .site-header__row { gap: 12px; }
  .brand span { font-size: 19px; }
  .site-header .btn--small { min-height: 38px; padding: 0 16px; font-size: 14px; }
  .article h1, .hub h1 { font-size: 32px; }
  .dek { font-size: 18px; }
  .prose { font-size: 17px; }
  .prose h2 { font-size: 25px; }
  .cta-inline { flex-wrap: wrap; }
  .cta-inline .btn { width: 100%; }
  .cta-end { flex-direction: column; text-align: center; padding: 26px 20px; }
  .site-footer__grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card-link { transition: none; }
}
