/* RotaCal: light, minimal, bento. System fonts only: zero requests, zero cost. */
:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #12151c;
  --mute: #5b667a;
  --line: #e4e8ef;
  --accent: #2f3bd4;

  --day-bg: #fff0cf;  --day-ink: #7a4e00;  --day-solid: #f2a93b;
  --night-bg: #e4e7ff; --night-ink: #2a33a6; --night-solid: #4350e0;
  --t-bg: #d7f4ee;    --t-ink: #0b6b5e;    --t-solid: #12a58f;
  --off-bg: #f0f2f6;  --off-ink: #5c6578;  --off-solid: #cfd5e0;

  --shadow-1: 0 1px 2px rgba(18, 21, 28, .04), 0 2px 6px rgba(18, 21, 28, .03);
  --shadow-2: 0 1px 2px rgba(18, 21, 28, .04), 0 6px 14px rgba(18, 21, 28, .04), 0 22px 44px rgba(18, 21, 28, .05);
  --r-lg: 28px;
  --r-md: 18px;
  --r-sm: 12px;
  --chip: #ffffff; --hover: #e9edf3; --prose: #2b3140; --brand-bg: #12151c;
  --btn-bg: #12151c; --btn-ink: #ffffff; --btn-hover: #262b38;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Night theme: follows the phone or computer setting; the header button overrides it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0e1117; --card: #171b23; --ink: #e8ebf2; --mute: #9aa4b6; --line: #2a303c; --accent: #9aa2ff;
  --day-bg: #3a2b0e;  --day-ink: #ffd27f;  --day-solid: #f2a93b;
  --night-bg: #252c63; --night-ink: #c3c9ff; --night-solid: #6f7bff;
  --t-bg: #0f3b34;    --t-ink: #86e3cf;    --t-solid: #2cc4a8;
  --off-bg: #1e232c;  --off-ink: #a6afbf;  --off-solid: #3b4252;
  --chip: #1d222c; --hover: #252b37; --prose: #c9cfdb; --brand-bg: #262c38;
  --btn-bg: #e8ebf2; --btn-ink: #0e1117; --btn-hover: #ffffff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1117; --card: #171b23; --ink: #e8ebf2; --mute: #9aa4b6; --line: #2a303c; --accent: #9aa2ff;
  --day-bg: #3a2b0e;  --day-ink: #ffd27f;  --day-solid: #f2a93b;
  --night-bg: #252c63; --night-ink: #c3c9ff; --night-solid: #6f7bff;
  --t-bg: #0f3b34;    --t-ink: #86e3cf;    --t-solid: #2cc4a8;
  --off-bg: #1e232c;  --off-ink: #a6afbf;  --off-solid: #3b4252;
  --chip: #1d222c; --hover: #252b37; --prose: #c9cfdb; --brand-bg: #262c38;
  --btn-bg: #e8ebf2; --btn-ink: #0e1117; --btn-hover: #ffffff;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .25), 0 10px 30px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--font); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; letter-spacing: -.022em; line-height: 1.12; font-weight: 650; }
h1 { font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem); letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .9em; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* page frame */
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0 8px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: -.02em; font-size: 1.1rem; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.brand i { width: 26px; height: 26px; border-radius: 9px; display: inline-grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 5px; background: var(--brand-bg); }
.brand i b { border-radius: 2px; background: #fff; opacity: .95; }
.brand i b:nth-child(2) { background: var(--day-solid); }
.brand i b:nth-child(3) { background: var(--night-solid); }
.brand i b:nth-child(5) { background: var(--t-solid); }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main a { color: var(--mute); text-decoration: none; padding: 8px 14px; border-radius: 999px; font-size: .92rem; font-weight: 500; transition: background .15s, color .15s; }
nav.main a:hover { background: var(--chip); color: var(--ink); }
nav.main a[aria-current="page"] { background: var(--chip); color: var(--ink); box-shadow: var(--shadow-1); }

.hero { padding: 28px 0 24px; max-width: 760px; }
.hero p { color: var(--mute); font-size: 1.1rem; margin: 14px 0 0; max-width: 56ch; }

/* bento */
.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; padding-bottom: 16px; }
.card { background: var(--card); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-2); min-width: 0; }
.card.sm { border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-1); }
.card > h2 { margin-bottom: 14px; }
.c-controls { grid-column: span 5; }
.c-cal { grid-column: span 7; grid-row: span 2; }
.c-ribbon { grid-column: span 5; }
.c-stat { grid-column: span 3; }
.c-cover { grid-column: span 8; }
.c-export { grid-column: span 4; }
.c-about { grid-column: span 7; }
.c-faq { grid-column: span 5; }
.c-wide { grid-column: span 12; }

/* controls */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .lbl { font-size: .86rem; font-weight: 600; color: var(--ink); }
.field small { color: var(--mute); font-size: .82rem; line-height: 1.4; }
select, input[type="date"], input[type="number"], input[type="text"] {
  font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid transparent;
  border-radius: var(--r-sm); padding: 11px 14px; width: 100%; min-height: 46px;
  transition: border-color .15s, background .15s;
}
select:hover, input:hover { border-color: var(--line); }
select:focus, input:focus { background: var(--card); border-color: var(--accent); outline: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
details { margin: 4px 0 0; }
summary { cursor: pointer; font-size: .9rem; color: var(--accent); font-weight: 500; padding: 6px 0; }

/* buttons */
.btn {
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; border: 0; border-radius: 999px;
  padding: 12px 20px; min-height: 46px; background: var(--btn-bg); color: var(--btn-ink);
  transition: transform .12s ease, box-shadow .15s ease, background .15s;
}
.btn:hover { background: var(--btn-hover); box-shadow: 0 6px 16px rgba(0, 0, 0, .18); }
.btn:active { transform: scale(.975); }
.btn.ghost { background: var(--bg); color: var(--ink); }
.btn.ghost:hover { background: var(--hover); box-shadow: none; }
.btn-stack { display: grid; gap: 10px; }
.note { color: var(--mute); font-size: .86rem; }
.toast { min-height: 1.4em; font-size: .86rem; color: var(--t-ink); font-weight: 600; }

/* shift chips (color + text, never color alone) */
.sh-D { --bg-s: var(--day-bg);  --ink-s: var(--day-ink);  --solid: var(--day-solid); }
.sh-N { --bg-s: var(--night-bg); --ink-s: var(--night-ink); --solid: var(--night-solid); }
.sh-T { --bg-s: var(--t-bg);    --ink-s: var(--t-ink);    --solid: var(--t-solid); }
.sh-O { --bg-s: var(--off-bg);  --ink-s: var(--off-ink);  --solid: var(--off-solid); }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-head h2 { font-size: 1.5rem; letter-spacing: -.03em; margin: 0; }
.cal-nav { display: flex; gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg); color: var(--ink); cursor: pointer; font-size: 1.15rem; display: grid; place-items: center; transition: background .15s, transform .12s; }
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.93); }
.today-btn { border-radius: 999px; width: auto; padding: 0 16px; font: inherit; font-weight: 600; font-size: .9rem; }
table.cal { width: 100%; border-collapse: separate; border-spacing: 5px; table-layout: fixed; }
.cal th { font-size: .78rem; font-weight: 600; color: var(--mute); padding: 4px 0 6px; text-align: center; }
.cal td { padding: 0; height: 74px; vertical-align: top; }
.cal td.blank { background: none; }
.cell {
  height: 100%; border-radius: 14px; background: var(--bg-s); color: var(--ink-s);
  padding: 7px 8px; display: flex; flex-direction: column; justify-content: space-between;
  border-left: 4px solid var(--solid);
}
.cell .d { font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cell .t { font-size: .74rem; font-weight: 650; letter-spacing: .01em; }
.cell .t .s { display: none; }
.cell.sh-O { border-left-color: transparent; background: var(--off-bg); }
.cell.today { box-shadow: 0 0 0 2.5px var(--ink); }
.cal-anim { animation: slide .18s ease-out; }
@keyframes slide { from { opacity: 0; transform: translateX(var(--dx, 8px)); } to { opacity: 1; transform: none; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 16px; font-size: .85rem; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 14px; height: 14px; border-radius: 5px; background: var(--solid); display: inline-block; }

/* ribbon: the whole cycle as one strip */
.ribbon { list-style: none; margin: 4px 0 14px; padding: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; }
.ribbon li { height: 44px; border-radius: 6px; background: var(--solid); position: relative; }
.ribbon li.sh-O { background: var(--off-bg); }
.ribbon li[aria-current="true"] { outline: 3px solid var(--ink); outline-offset: 2px; z-index: 1; }
.ribbon-now { font-size: 1.02rem; font-weight: 600; letter-spacing: -.01em; margin: 0 0 4px; }
.ribbon-sub { color: var(--mute); font-size: .88rem; margin: 0; }

/* stats */
.stat .v { font-size: 2rem; font-weight: 650; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: .95rem; font-weight: 500; color: var(--mute); letter-spacing: 0; margin-left: 4px; }
.stat .l { color: var(--mute); font-size: .88rem; margin-top: 4px; }

/* coverage */
.scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px 4px; }
table.cover { border-collapse: separate; border-spacing: 3px; min-width: 560px; width: 100%; font-size: .8rem; }
.cover th { font-weight: 500; color: var(--mute); padding: 2px 0; text-align: center; font-variant-numeric: tabular-nums; }
.cover th.row { text-align: left; color: var(--ink); font-weight: 600; white-space: nowrap; padding-right: 8px; }
.cover td { text-align: center; padding: 12px 0; border-radius: 8px; font-weight: 650; background: var(--bg-s); color: var(--ink-s); }
.cover tr.mine th.row { color: var(--accent); }
.cover tr.mine td { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* prose */
.prose p, .prose li { max-width: 62ch; color: var(--prose); }
.prose h3 { margin: 18px 0 6px; }
.faq details { border-top: 1px solid var(--line); padding: 12px 0; margin: 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { color: var(--ink); font-weight: 600; font-size: .98rem; list-style: none; display: flex; justify-content: space-between; gap: 16px; padding: 0; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--mute); font-weight: 400; font-size: 1.3rem; line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 10px 0 0; color: var(--prose); font-size: .95rem; }

table.cmp { width: 100%; border-collapse: collapse; font-size: .92rem; }
.cmp th, .cmp td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp th { font-weight: 600; color: var(--mute); font-size: .84rem; }
.cmp td:first-child, .cmp th:first-child { padding-left: 0; }
.cmp td .num { font-weight: 650; }

.ad { margin: 8px 0; min-height: 0; }
.ad:empty { display: none; }
/* Reserve space before AdSense fills the slot, so the page does not jump (CLS). */
.ad:not(:empty) { min-height: 250px; }
.ad:has(ins[data-ad-status="unfilled"]) { display: none; }
footer nav a { display: inline-block; padding: 4px 0; }
.aff { display: grid; gap: 10px; }
.aff a { display: block; padding: 14px 16px; border-radius: var(--r-sm); background: var(--bg); color: var(--ink); text-decoration: none; }
.aff a:hover { background: var(--hover); }
.aff a b { display: block; font-weight: 650; }
.aff a span { color: var(--mute); font-size: .88rem; }
.disclosure { color: var(--mute); font-size: .8rem; margin-top: 8px; }

footer { padding: 28px 0 56px; color: var(--mute); font-size: .88rem; }
footer .wrap { display: grid; gap: 10px; }
footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
footer a { color: var(--mute); }
.legal-page { max-width: 720px; margin: 24px auto 0; }
.legal-page h2 { margin: 26px 0 8px; font-size: 1.15rem; }

/* print: one clean calendar */
.print-year { display: none; }
@media print {
  :root:not(#print-light) {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #12151c;
  --mute: #5b667a;
  --line: #e4e8ef;
  --accent: #2f3bd4;

  --day-bg: #fff0cf;  --day-ink: #7a4e00;  --day-solid: #f2a93b;
  --night-bg: #e4e7ff; --night-ink: #2a33a6; --night-solid: #4350e0;
  --t-bg: #d7f4ee;    --t-ink: #0b6b5e;    --t-solid: #12a58f;
  --off-bg: #f0f2f6;  --off-ink: #5c6578;  --off-solid: #cfd5e0;

  --shadow-1: 0 1px 2px rgba(18, 21, 28, .04), 0 2px 6px rgba(18, 21, 28, .03);
  --shadow-2: 0 1px 2px rgba(18, 21, 28, .04), 0 6px 14px rgba(18, 21, 28, .04), 0 22px 44px rgba(18, 21, 28, .05);
  --r-lg: 28px;
  --r-md: 18px;
  --r-sm: 12px;
  --chip: #ffffff; --hover: #e9edf3; --prose: #2b3140; --brand-bg: #12151c;
  --btn-bg: #12151c; --btn-ink: #ffffff; --btn-hover: #262b38;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light; }
  body { background: #fff; }
  .top, .hero, .c-controls, .c-ribbon, .c-stat, .c-cover, .c-export, .c-about, .c-faq, .c-wide, .cal-nav, footer, .ad, .aff, .legend .hide-print { display: none !important; }
  .card { box-shadow: none; padding: 0; }
  .c-cal { grid-column: 1 / -1; }
  .cell { border: 1px solid #999; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-year .bento, body.printing-year .wrap > :not(.print-year) { display: none !important; }
  body.printing-year .print-year { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .print-year section { break-inside: avoid; }
  .print-year .py-title { grid-column: 1 / -1; font-size: 15pt; margin: 0 0 2px; }
  .print-year h3 { font-size: 11pt; margin: 0 0 4px; }
  .print-year table.cal { border-spacing: 2px; }
  .print-year .cal td { height: 34px; }
  .print-year .cell { padding: 2px 4px; border-radius: 5px; border-left-width: 3px; }
  .print-year .cell .d { font-size: 8pt; }
  .print-year .cell .t { font-size: 7pt; }
}

/* responsive */
@media (max-width: 1020px) {
  .c-controls, .c-cal, .c-ribbon, .c-cover, .c-export, .c-about, .c-faq { grid-column: 1 / -1; grid-row: auto; }
  .c-stat { grid-column: span 6; }
}
@media (max-width: 640px) {
  .card { padding: 18px; border-radius: 22px; }
  .row2 { grid-template-columns: 1fr; }
  .cal td { height: 58px; }
  .cell { padding: 5px 5px; border-left-width: 3px; }
  .cell .t .l { display: none; }
  .cell .t .s { display: inline; }
  table.cal { border-spacing: 3px; }
  .c-stat { grid-column: span 6; }
  .stat .v { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* theme switch */
.theme-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--chip); color: var(--ink); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-1); }
.theme-btn:hover { background: var(--hover); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
  :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
}
@media print { .theme-btn { display: none; } }
.top-right { display: contents; }
.top nav.main { margin-left: auto; }
@media (max-width: 640px) {
  .theme-btn { order: 2; margin-left: auto; }
  .top nav.main { order: 3; flex-basis: 100%; margin-left: -12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .top nav.main::-webkit-scrollbar { display: none; }
  .top nav.main a { padding: 8px 12px; white-space: nowrap; }
}

/* custom rotation builder */
#seq { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.seq-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font: inherit; font-size: .88rem; font-weight: 600; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 0; cursor: pointer; background: var(--bg-s, var(--bg)); color: var(--ink-s, var(--ink)); transition: transform .12s ease, filter .15s; }
.chip:hover { filter: brightness(.96); }
.chip:active { transform: scale(.97); }
.chip.ghost { background: transparent; color: var(--mute); box-shadow: inset 0 0 0 1.5px var(--line); }

/* footer list of every schedule page */
footer nav.all { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
