/* The sleep log (/homework/sleep-log/) and the sleep efficiency calculator
   (/sleep-efficiency-calculator/). Site tokens from src/styles/tokens.css,
   so dark mode follows the rest of the site. The band colours for the three
   answers match the Sleep Window flow chart: green 90%+, amber 85 to 89%,
   coral under 85%. */
.st { font-family: var(--font-display); color: var(--ink); -webkit-font-smoothing: antialiased; }
.st *, .st *::before, .st *::after { box-sizing: border-box; }
.st .wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.st .narrow { max-width: 760px; }

.st-hero { background: var(--grad-navy); color: #F0E4D7; padding: calc(var(--bar-h, 66px) + var(--pad-top, 16px) + 28px) 0 40px; }
.st-hero .eyebrow { font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--coral-soft); margin: 14px 0 10px; }
.st-hero h1 { font-family: var(--font-display); font-size: clamp(36px, 6.4vw, 58px); line-height: 1.04; color: #fff; margin: 0 0 14px; letter-spacing: -.01em; }
.st-hero h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 500; color: #EFA48C; }
.st-hero .lede { font-family: var(--font-serif); font-size: clamp(20px, 2.4vw, 23px); line-height: 1.5; color: #dfe7f0; max-width: 760px; margin: 0 0 16px; }
.st-hero .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.st-hero .chips span { font-size: 14px; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28); color: #fff; }
.st-hero .crumbs a, .st-hero .crumbs { color: #cfdbe8; }

.st-band { padding: 46px 0; }
.st-band.cream { background: var(--cream); }
.st-band.white { background: var(--paper); }
.st h2 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 36px); color: var(--heading); margin: 0 0 10px; line-height: 1.12; }
.st h3 { font-family: var(--font-display); font-size: 21px; color: var(--heading); margin: 0 0 8px; }
.st p { font-family: var(--font-serif); font-size: 20px; line-height: 1.55; margin: 0 0 12px; }
.st .sub { color: var(--muted); }
.st a:not(.st-btn) { color: var(--coral-text); font-weight: 600; text-underline-offset: 3px; }

.st-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 22px 20px; box-shadow: var(--shadow-1, 0 18px 40px -30px rgba(21,39,64,.45)); }
.st-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.st-label { font-size: 12.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--coral-text); margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.st-label:first-child { margin-top: 0; }

/* Form rows */
.st-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.st-row:last-child { border-bottom: 0; }
.st-row .n { width: 26px; height: 26px; border-radius: 50%; background: #d06a51; color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.st-row label { font-size: 17px; color: var(--heading); line-height: 1.25; }
.st-row label small { display: block; font-size: 14px; font-style: italic; color: var(--coral-text); margin-top: 2px; }
.st input[type=time], .st input[type=number], .st input[type=date], .st input[type=text], .st textarea {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 44px;
}
.st textarea { min-height: 70px; resize: vertical; }
.st input:focus-visible, .st textarea:focus-visible, .st button:focus-visible, .st a:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.st .unit { position: relative; }
.st .unit input { padding-right: 46px; }
.st .unit::after { content: attr(data-unit); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--muted); pointer-events: none; }
.st .wide { grid-template-columns: 30px minmax(0, 1fr); }
.st .wide > :last-child { grid-column: 2; }
.st .q5 { display: flex; gap: 6px; }
.st .q5 label { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 10px; padding: 9px 0; cursor: pointer; font-size: 17px; background: var(--paper); }
.st .q5 input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.st .q5 input:checked + span { color: #fff; }
.st .q5 label:has(input:checked) { background: var(--navy); border-color: var(--navy); color: #fff; }
.st .q5 label:has(input:focus-visible) { outline: 3px solid var(--coral); outline-offset: 2px; }

.st-live { margin-top: 16px; border-radius: 12px; background: var(--cream); padding: 12px 14px; font-size: 17px; color: var(--heading); min-height: 48px; }
.st-live.err { background: transparent; border: 2px solid #d06a51; color: var(--coral-text); }
.st-live b { font-size: 19px; }

.st-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--font-display); font-size: 16px; border-radius: 999px; padding: 12px 22px; min-height: 44px; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.st-btn.primary { background: var(--grad-coral); color: #fff; }
.st-btn.line { background: var(--surface); color: var(--heading); border-color: var(--line); }
.st-btn.ghost { background: transparent; color: var(--muted); }
.st-btn:hover { filter: brightness(1.04); transform: translateY(-1px); }

/* Tips */
.st-tips { list-style: none; margin: 0; padding: 0; }
.st-tips li { position: relative; padding-left: 20px; font-family: var(--font-serif); font-size: 19px; line-height: 1.45; margin-bottom: 11px; color: var(--ink); }
.st-tips li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: #d06a51; }
.st-tips b { color: var(--heading); font-family: var(--font-display); font-weight: 600; }

/* Week summary */
.st-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.st-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.st-stat .k { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.st-stat .v { font-size: 26px; color: var(--heading); margin-top: 4px; }
.st-stat.big .v { font-size: 34px; }
.st-next { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.st-next .band { color: #fff; font-size: 13.5px; letter-spacing: .16em; text-transform: uppercase; padding: 9px 16px; background: var(--navy); }
.st-next.well .band { background: #2c7a6e; } .st-next.hold .band { background: #b07a22; } .st-next.later .band, .st-next.floor .band { background: #d06a51; }
.st-next .body { padding: 14px 16px 6px; }
.st-next .t { font-size: 25px; color: var(--heading); margin-bottom: 4px; }
.st-seven { margin-top: 10px; background: rgba(44,122,110,.1); border-radius: 10px; padding: 10px 12px; font-family: var(--font-serif); font-size: 18px; line-height: 1.45; }
.st-seven b { color: #1f6b60; font-family: var(--font-display); }
:root[data-theme="dark"] .st-seven b { color: #7fd3c4; }
.st-window { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.st-window label { font-size: 15px; color: var(--muted); display: block; margin-bottom: 4px; }
.st-window .out { font-size: 22px; color: var(--heading); padding-bottom: 8px; }

/* Nights table */
.st-tablewrap { overflow-x: auto; margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.st table { width: 100%; border-collapse: collapse; font-size: 16px; min-width: 640px; }
.st th { text-align: left; font-weight: normal; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.st td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.st tr:last-child td { border-bottom: 0; }
.st td .pill { display: inline-block; min-width: 52px; text-align: center; border-radius: 999px; padding: 3px 10px; color: #fff; font-size: 15px; }
.pill.well { background: #2c7a6e; } .pill.hold { background: #b07a22; } .pill.later { background: #d06a51; }
.st td button { font: inherit; font-size: 14px; background: none; border: 0; color: var(--coral-text); cursor: pointer; padding: 6px 4px; min-height: 36px; }
.st .empty { font-family: var(--font-serif); font-size: 19px; color: var(--muted); padding: 18px; }

/* Calculator meter */
.st-meter { position: relative; height: 18px; border-radius: 999px; margin: 18px 0 34px; background: linear-gradient(90deg, #d06a51 0 85%, #b07a22 85% 93%, #2c7a6e 93% 100%); }
.st-meter .tick { position: absolute; top: 24px; font-size: 13px; color: var(--muted); transform: translateX(-50%); }
.st-meter .dot { position: absolute; top: -7px; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 4px solid var(--navy); transform: translateX(-50%); transition: left .25s ease; }
:root[data-theme="dark"] .st-meter .dot { border-color: #fff; }
.st-se { font-size: clamp(54px, 10vw, 84px); line-height: 1; color: var(--heading); }
.st-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.st-pair .hm { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.st-field-l { font-size: 17px; color: var(--heading); margin-bottom: 6px; display: block; }

.st-figure { margin: 18px 0 0; }
.st-figure img { width: 100%; height: auto; border-radius: 14px; display: block; box-shadow: var(--shadow-2, 0 26px 52px -28px rgba(21,39,64,.5)); }
.st-figure figcaption { font-family: var(--font-serif); font-size: 17px; color: var(--muted); margin-top: 10px; }

.st-alert { border: 2px solid #d06a51; border-radius: 16px; padding: 18px 20px; background: var(--surface); }
.st-alert h3 { color: var(--coral-text); }
.st-alert p { font-size: 18.5px; margin-bottom: 8px; }
.st-alert b { font-family: var(--font-display); color: var(--heading); }
.st-learn { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; background: var(--grad-navy); color: #F0E4D7; border-radius: 18px; padding: 24px 26px; }
.st-learn h3 { color: #fff; font-size: 24px; }
.st-learn p { color: #dbe4f0; font-size: 19px; margin: 0; }
.st-fine { font-family: var(--font-serif); font-size: 16.5px; color: var(--muted); line-height: 1.5; margin-top: 18px; }
.st-fine b { color: var(--heading); font-family: var(--font-display); font-weight: normal; }
.st .note-save { font-size: 15px; color: var(--muted); margin-top: 10px; font-family: var(--font-serif); }

@media (max-width: 860px) {
  .st-grid { grid-template-columns: 1fr; }
  .st-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-learn { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .st .wrap { padding: 0 16px; }
  .st-row { grid-template-columns: 26px minmax(0, 1fr); }
  .st-row > :last-child { grid-column: 2; }
  .st-window { grid-template-columns: 1fr 1fr; }
  .st-window .out { grid-column: 1 / -1; }
  .st-pair { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .st-btn:hover { transform: none; } .st-meter .dot { transition: none; } }

@media print {
  .op-header, .op-menu, .op-search-drop, .op-scrim, footer.foot, .crisis-strip, .back-to-top, .skip-link, .st-noprint { display: none !important; }
  .st-hero { background: none; color: #000; padding: 0 0 10px; }
  .st-hero h1, .st-hero .lede { color: #1A2F4F; }
  .st-band { padding: 10px 0; background: none !important; }
  .st-card, .st-stat, .st-next, .st-tablewrap { box-shadow: none; }
  .st table { min-width: 0; font-size: 12px; }
  .st td, .st th { padding: 5px 6px; }
  .st td .pill { color: #000; background: none !important; border: 1px solid #999; }
}
