:root {
  color-scheme: light;
  --night: #25334b;
  --mist: #edf0fa;
  --paper: #fbfaf7;
  --muted: #4c5868;
  --line: #cbd0dd;
  --soft: #f0e8dd;
  --serif: Georgia, "Songti SC", "Songti TC", "Noto Serif CJK SC", serif;
  --sans: system-ui, "PingFang SC", "PingFang TC", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 1.5rem; }
body { margin: 0; color: var(--night); background: var(--paper); font: 1rem/1.65 var(--sans); }
a { color: inherit; text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 3px solid #6446a6; outline-offset: 4px; }
.sleep-wrap { width: min(1180px, calc(100% - 3rem)); margin-inline: auto; }
.sleep-skip { position: absolute; z-index: 2; top: 0; left: 1rem; padding: .5rem 1rem; background: white; transform: translateY(-120%); }
.sleep-skip:focus { transform: translateY(0); }
.sleep-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 24px; padding-block: 22px 16px; border-bottom: 1px solid var(--line); }
.sleep-brand { font: 700 1.75rem var(--serif); text-decoration: none; }
.sleep-nav, .sleep-languages { display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: .85rem; }
.sleep-nav a, .sleep-languages a { text-decoration: none; padding-block: 5px; }
.sleep-languages { margin-left: auto; }
.sleep-languages a[aria-current], .sleep-nav a:hover, .sleep-languages a:hover { text-decoration: underline; }
.sleep-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .92fr); align-items: stretch; margin-top: 26px; background: var(--mist); }
.sleep-intro { padding: clamp(24px, 5vw, 72px); align-self: center; }
.sleep-kicker { margin: 0 0 .8rem; font-size: .93rem; font-weight: 650; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; }
h1 { margin: 0; font-size: clamp(2.45rem, 5vw, 4.85rem); text-wrap: balance; }
.sleep-lead { max-width: 40ch; color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.18rem); margin-block: 1.15rem 1.55rem; }
.sleep-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; font-size: .92rem; }
.sleep-button, [data-sleep-print] { display: inline-block; color: white; background: var(--night); border: 1px solid var(--night); padding: .55rem .85rem; border-radius: 3px; font: 600 .94rem/1.5 var(--sans); text-decoration: none; cursor: pointer; }
[data-sleep-print][hidden] { display: none; }
.sleep-button:hover, [data-sleep-print]:hover { background: #3e5272; }
.sleep-photo { margin: 0; min-height: 300px; position: relative; }
.sleep-photo img { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: 58% 50%; }
.sleep-body { padding-block: 3.1rem 2rem; }
.sleep-body h2, .sheet-header h2 { margin: 0 0 .6rem; font-size: clamp(1.65rem, 3vw, 2.3rem); }
.sleep-steps { list-style: none; margin: 1.45rem 0 2.5rem; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.7rem; }
.sleep-steps li { border-top: 1px solid var(--line); padding-top: .8rem; }
.sleep-body h3 { margin: 0 0 .45rem; font-size: 1.28rem; }
.sleep-body p { margin: 0; color: var(--muted); max-width: 58ch; }
.sleep-diary-callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; background: var(--soft); padding: clamp(18px, 4vw, 48px); }
.sleep-next { display: grid; grid-template-columns: 1fr 1fr; gap: 1.7rem; margin-top: 2.5rem; }
.sleep-next section { border-top: 1px solid var(--line); padding-top: 1rem; }
.sleep-next h2 { font-size: 1.6rem; }
.sleep-next a { display: inline-block; margin-top: .65rem; font-weight: 650; }
.sleep-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; margin-block: 1rem 5rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
.sleep-footer p { margin: 0; }
.sleep-footer a { margin-left: .5em; }
.sleep-diary-page .sleep-wrap { max-width: 960px; }
.sleep-print-back { margin-block: 1.5rem; }
.sleep-worksheet { background: white; padding: 1.5rem; margin-bottom: 2rem; }
.sheet-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.sheet-header p { margin: 0 0 .35rem; }
.sheet-days { border-top: 1px solid var(--line); }
.sheet-day { display: grid; grid-template-columns: 1.3em repeat(6, minmax(0, 1fr)); align-items: start; gap: .55rem; padding-block: .55rem; border-bottom: 1px solid var(--line); }
.sheet-day span { font-size: .8rem; }
.sheet-day i { display: block; min-height: 1.7rem; border-bottom: 1px dotted #757575; }
@media (max-width: 740px) {
  .sleep-wrap { width: calc(100% - 2rem); }
  .sleep-header { padding-block: 12px 8px; }
  .sleep-nav { margin-left: auto; }
  .sleep-languages { margin-left: 0; width: 100%; gap: 3px 12px; }
  .sleep-hero { grid-template-columns: 1fr; margin-top: 14px; }
  .sleep-photo { min-height: 0; aspect-ratio: 2/1; }
  .sleep-body { padding-top: 2.1rem; }
  .sleep-steps, .sleep-next { grid-template-columns: 1fr; gap: .85rem; }
  .sleep-worksheet { padding: .75rem; }
  .sheet-day { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-day strong { grid-column: 1 / -1; }
}
@page { margin: 13mm; }
@media print {
  body { background: white; color: #111; }
  .sleep-print-back, [data-sleep-print] { display: none; }
  .sleep-wrap { width: 100%; }
  .sleep-worksheet { margin: 0; padding: 0; }
  .sheet-header { display: block; }
  .sheet-day { grid-template-columns: 1.3em repeat(6, minmax(0, 1fr)); break-inside: avoid; min-height: 19mm; }
  .sheet-day strong { grid-column: auto; }
}
