/* Bedtime Lens legal pages — palette mirrors AppDesign.swift.
   No webfonts on purpose: these pages must not make third-party requests. */

:root {
  --bg: #fbf3e6;
  --bg-grad: linear-gradient(180deg, #fef6ea 0%, #f8ecdb 100%);
  --card: #fffbf3;
  --edge: #ecdcc4;
  --ink: #3b3357;
  --ink-soft: #6f678c;
  /* --ink-faint and --accent are darkened versions of the app's #a59fbb and
     gold: on a cream card the app values land near 2.5:1 and 3.1:1, short of
     the 4.5:1 these documents need to stay readable. The brand gold survives
     as --accent-soft on rules, borders and the moon. */
  --ink-faint: #857da1;
  --head: #3d3068;
  --accent: #9d5f18;
  --accent-soft: #f3ba5c;
  --quote: #fdf1dc;
  --shadow: 0 1px 2px rgba(34, 27, 70, .05), 0 12px 36px rgba(34, 27, 70, .07);
  --serif: ui-serif, "New York", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1640;
    --bg-grad: linear-gradient(180deg, #1c1640 0%, #2a2350 100%);
    --card: #251e4a;
    --edge: #3d3068;
    --ink: #ece5f6;
    --ink-soft: #b6acd0;
    --ink-faint: #8e85ab;
    --head: #f4ecff;
    --accent: #f3ba5c;
    --accent-soft: #e2982f;
    --quote: #2f2758;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .28);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

/* ---------- header ---------- */

.site {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 0 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--head);
  text-decoration: none;
}

.brand .mark { width: 30px; height: 30px; color: var(--accent-soft); flex: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; letter-spacing: .01em; }
.brand i { font-style: normal; font-size: .72rem; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-faint); }

.site-nav { display: flex; flex-wrap: wrap; gap: .35rem; }

.site-nav a {
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .85rem;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover { background: rgba(120, 100, 160, .12); color: var(--ink); }
.site-nav a.current { background: var(--card); color: var(--head); box-shadow: inset 0 0 0 1px var(--edge); }

/* ---------- article ---------- */

main { max-width: 52rem; margin: 0 auto; }

article {
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 5vw, 3.25rem);
}

.doc-head { border-bottom: 1px solid var(--edge); padding-bottom: 1.5rem; margin-bottom: .5rem; }

.eyebrow {
  margin: 0 0 .5rem;
  font-size: .72rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

h1 {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 6vw, 2.7rem);
  line-height: 1.15;
  font-weight: 600;
  color: var(--head);
  margin: 0 0 .6rem;
}

.updated { margin: 0; color: var(--ink-soft); font-size: .93rem; }

h2 {
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 600;
  color: var(--head);
  line-height: 1.3;
  margin: 2.4rem 0 .7rem;
  scroll-margin-top: 1.5rem;
}

h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--head);
  margin: 1.7rem 0 .5rem;
  scroll-margin-top: 1.5rem;
}

p { margin: 0 0 1rem; }

ul, ol { margin: 0 0 1.15rem; padding-left: 1.35rem; }
li { margin-bottom: .45rem; }
li::marker { color: var(--ink-faint); }

strong { color: var(--head); font-weight: 700; }

hr { border: 0; border-top: 1px solid var(--edge); margin: 2rem 0; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--quote);
  padding: .1em .35em;
  border-radius: 5px;
}

blockquote {
  margin: 1.4rem 0;
  padding: .9rem 1.15rem;
  background: var(--quote);
  border-left: 3px solid var(--accent-soft);
  border-radius: 0 12px 12px 0;
}

blockquote p { margin: 0; }

/* ---------- contents ---------- */

.toc {
  margin: 1.75rem 0 2.25rem;
  padding: 1.1rem 1.35rem .6rem;
  background: var(--quote);
  border-radius: 14px;
}

.toc h2 {
  font-family: var(--sans);
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 .6rem;
}

.toc ol {
  columns: 2;
  column-gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 0 0 .5rem;
  font-size: .91rem;
}

.toc li { margin-bottom: .3rem; break-inside: avoid; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 34rem) { .toc ol { columns: 1; } }

/* ---------- tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.4rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

table { border-collapse: collapse; width: 100%; font-size: .93rem; }

th, td {
  padding: .65rem .9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--edge);
}

th {
  background: var(--quote);
  color: var(--head);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }

/* ---------- index ---------- */

.cards { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: .9rem; }

.cards a {
  display: block;
  padding: 1.15rem 1.35rem;
  background: var(--quote);
  border: 1px solid transparent;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}

.cards a:hover { border-color: var(--accent-soft); transform: translateY(-1px); }
.cards h2 { font-size: 1.2rem; margin: 0 0 .3rem; }
.cards p { margin: 0 0 .5rem; color: var(--ink-soft); font-size: .95rem; }
.cards .go { font-size: .85rem; color: var(--accent); font-weight: 600; }

.contact { margin-top: 2rem; color: var(--ink-soft); font-size: .95rem; }

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

.site-footer {
  max-width: 52rem;
  margin: 2rem auto 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: .88rem;
}

.site-footer p { margin: .3rem 0; }
/* Kept at --ink-soft, not --ink-faint: it is the one piece of small text whose
   content appears nowhere else, so it has to clear 4.5:1 on its own. */
.site-footer .fine { font-size: .8rem; }

/* ---------- print ---------- */

@media print {
  body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
  .site-nav, .toc, .site-footer { display: none; }
  article { box-shadow: none; border: 0; border-radius: 0; padding: 0; background: #fff; }
  h2, h3 { break-after: avoid; }
  .table-scroll, blockquote, li { break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
}
