/* holcal — "Red Letter" design system. Values from docs/design-system/tokens.json.
   Rule: --red-letter is ONLY for day-off date numerals (holidays and breaks). */

:root {
  /* Colour */
  --surface-page: #f7f5f1;
  --surface-card: #ffffff;
  --surface-header: #1f2125;
  --on-header: #ffffff;
  --on-header-muted: #cfd1d6;
  --ink: #1d1f23;
  --ink-soft: #45484f;
  --ink-muted: #5a5d64;
  --action: #2f3238;
  --on-action: #ffffff;
  --neutral-soft: #ecebe8;
  --tag-bg: #f2efea;
  --line: #e2e0dc;
  --line-strong: #8a8d93;
  --line-past: #b9bbbf; /* dashed outline of past optional days (from the year-view mockup) */
  --red-letter: #bc3f1d;
  --red-letter-soft: #fcede6;
  --red-letter-deep: #9a3a22;
  --past: #636569;
  --past-soft: #eeece8;
  --brand-dot: #f08a6c;

  /* Type */
  --font-serif: "IBM Plex Serif", Georgia, serif;
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-2xl: 28px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-card: 0 1px 2px rgba(29, 31, 35, 0.04), 0 4px 14px rgba(29, 31, 35, 0.05);
  --shadow-panel: 0 1px 2px rgba(29, 31, 35, 0.04), 0 12px 32px rgba(29, 31, 35, 0.06);
  --shadow-next: inset 0 0 0 2px #2f3238, 0 8px 22px rgba(29, 31, 35, 0.14);
  --shadow-control: inset 0 0 0 1px #e2e0dc;

  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 22px;
}
a { color: var(--action); }
a:hover { color: var(--ink); }
:where(a, button, input, select, summary):focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
button, input, select { font: inherit; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.serif { font-family: var(--font-serif); font-weight: 600; }
.muted { color: var(--ink-muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: var(--space-6); }
@media (max-width: 480px) { .wrap { padding-inline: var(--space-4); } }

/* ---------- Header ---------- */
.site-header { background: var(--surface-header); }
.site-header .wrap {
  min-height: 64px; display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap; padding-block: 10px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--on-header); text-decoration: none;
  font-family: var(--font-serif); font-weight: 600; font-size: 22px; line-height: 28px;
}
.wordmark:hover { color: var(--on-header); }
.wordmark::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-dot); }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.nav-pill {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--radius-pill); color: var(--on-header-muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
}
.nav-pill:hover { color: var(--on-header); background: rgba(255, 255, 255, 0.06); }
.nav-pill[aria-current="page"] { color: var(--on-header); background: rgba(255, 255, 255, 0.1); }
.nav-pill.back { background: rgba(255, 255, 255, 0.08); }
.site-header :focus-visible { outline-color: var(--on-header); }

/* ---------- Layout pieces ---------- */
.panel {
  background: var(--surface-card); border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-panel); padding: var(--space-8);
}
.card {
  background: var(--surface-card); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card); padding: var(--space-5);
}
@media (max-width: 640px) { .panel { padding: var(--space-6) var(--space-5); } }

.page-main { padding-block: var(--space-8) 56px; }

.site-footer { padding-block: 0 var(--space-8); }
.site-footer p {
  margin: 0; padding: 18px 24px; border-radius: var(--radius-lg);
  background: var(--neutral-soft); color: var(--ink-soft); font-size: 13px; line-height: 18px;
}

.title-lg { font-family: var(--font-serif); font-weight: 600; font-size: 36px; line-height: 42px; }
.title-md { font-family: var(--font-serif); font-weight: 600; font-size: 22px; line-height: 28px; }
.lede { margin: 0; color: var(--ink-muted); font-size: 16px; line-height: 24px; }
@media (max-width: 480px) { .title-lg { font-size: 30px; line-height: 36px; } }

/* ---------- Date chips ---------- */
.chip {
  display: inline-block; font-family: var(--font-serif); font-weight: 600;
  font-size: 15px; line-height: 20px; padding: 4px 12px; border-radius: var(--radius-md);
  white-space: nowrap;
}
.chip.off { background: var(--red-letter-soft); color: var(--red-letter); }
.chip.opt { background: var(--surface-card); color: var(--action); padding: 3px 11px; border: 1px dashed var(--line-strong); }
.chip.past { background: var(--past-soft); color: var(--past); }
.chip.obs { background: var(--tag-bg); color: var(--ink-soft); }
.chip.past.opt { background: var(--surface-card); border-color: var(--line-past); color: var(--past); }
.chip.sm { font-size: 14px; padding: 3px 10px; border-radius: 10px; }

.stack {
  width: 48px; flex-shrink: 0; text-align: center; border-radius: var(--radius-md);
  background: var(--red-letter-soft); padding: 5px 0; line-height: 1.1;
}
.stack .m { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--red-letter-deep); text-transform: uppercase; }
.stack .d { display: block; font-family: var(--font-serif); font-weight: 600; font-size: 20px; color: var(--red-letter); }
.stack.sm { width: 46px; padding: 4px 0; }
.stack.sm .d { font-size: 18px; }
.stack.lg { width: 72px; border-radius: 16px; padding: 8px 0 10px; }
.stack.lg .m { font-size: 11px; }
.stack.lg .d { font-size: 30px; line-height: 36px; }
/* A date with only optional holidays is not a day off: no red. */
.stack.opt { background: var(--surface-card); border: 1px dashed var(--line-strong); }
.stack.opt .m, .stack.opt .d { color: var(--action); }

/* ---------- Tags ---------- */
.tag {
  display: inline-block; font-size: 12px; line-height: 16px; font-weight: 600;
  padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.tag.next { background: var(--action); color: var(--on-action); }
.tag.opt { background: var(--surface-card); color: var(--action); padding: 2px 9px; border: 1px dashed var(--line-strong); }
.tag.break { background: var(--tag-bg); color: var(--ink-soft); }
.tag.weekend { background: var(--tag-bg); color: var(--ink-muted); }
.tag.category { background: var(--neutral-soft); color: var(--action); padding: 4px 12px; }
.tag.place { background: var(--tag-bg); color: var(--ink-soft); padding: 4px 12px; }
.tag.sm { padding: 2px 8px; }
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border: 0; border-radius: var(--radius-pill);
  font-size: 14px; line-height: 20px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn.primary { background: var(--action); color: var(--on-action); font-weight: 600; }
.btn.primary:hover { background: var(--ink); color: var(--on-action); }
.btn.secondary { background: var(--surface-card); color: var(--ink); font-weight: 500; box-shadow: var(--shadow-control); }
.btn.secondary:hover { color: var(--ink); background: var(--surface-page); }
.btn svg { flex-shrink: 0; }

.seg {
  display: inline-flex; flex-wrap: wrap; padding: var(--space-1); border-radius: var(--radius-pill);
  background: var(--surface-card); box-shadow: var(--shadow-control);
}
.seg button {
  height: 36px; padding: 0 18px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-soft); font-size: 14px; font-weight: 500; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--action); color: var(--on-action); font-weight: 600; }
.seg.on-card { background: var(--surface-page); }
.seg.tight button { padding: 0 16px; }

/* Filter pills (home categories) */
.pill {
  height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-pill);
  background: var(--surface-card); color: var(--ink); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-control); cursor: pointer;
}
.pill[aria-pressed="true"] { background: var(--action); color: var(--on-action); font-weight: 600; box-shadow: none; }

/* ---------- Select ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .field-label {
  font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); padding-left: 4px;
}
.select { position: relative; display: inline-block; max-width: 100%; }
.select select {
  appearance: none; -webkit-appearance: none;
  height: 44px; padding: 0 44px 0 18px; max-width: 100%;
  border: 0; border-radius: var(--radius-pill); background: var(--surface-card); box-shadow: var(--shadow-control);
  font-size: 15px; color: var(--ink); cursor: pointer;
}
.select select::-ms-expand { display: none; }
.select.lg select { height: 46px; min-width: 240px; }
.select.wide select { min-width: 180px; }
.select.on-card select { background: var(--surface-page); }
.select svg {
  position: absolute; right: 18px; top: 50%; margin-top: -8px;
  pointer-events: none; color: var(--ink-muted);
}
@media (max-width: 480px) { .select.lg select, .select.wide select { min-width: 0; width: 100%; } .select { display: block; } }

/* Checkbox label */
.check {
  display: inline-flex; gap: 8px; align-items: center; min-height: 44px;
  font-size: 14px; color: var(--ink-soft); cursor: pointer;
}
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); cursor: pointer; }

/* ---------- Callout ---------- */
.callout {
  display: flex; gap: 10px; align-items: center; background: var(--neutral-soft); color: var(--action);
  border-radius: var(--radius-lg); padding: 12px 16px; font-size: 14px; line-height: 20px;
}
.callout svg { flex-shrink: 0; }
.callout[hidden] { display: none; }

/* ---------- Stat tiles ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3); margin-top: 26px;
}
.stat { background: var(--surface-page); border-radius: var(--radius-xl); padding: 16px 18px; }
.stat .k { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.stat .v { font-family: var(--font-serif); font-weight: 600; font-size: 22px; line-height: 28px; margin: 2px 0 4px; }
.stat .v.has-chip { margin-bottom: 8px; }
.stat .s { font-size: 13px; line-height: 18px; color: var(--ink-muted); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ---------- Holiday rows ---------- */
.rows { display: flex; flex-direction: column; gap: var(--space-2); }
.row {
  display: grid; grid-template-columns: 200px minmax(0, 1fr) 210px; align-items: center;
  gap: var(--space-3); padding: 12px 18px; border-radius: var(--radius-lg);
  background: var(--surface-card); box-shadow: var(--shadow-card);
}
.row .name { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; font-weight: 500; }
.row .day { font-size: 14px; color: var(--ink-muted); }
.row.past { background: rgba(255, 255, 255, 0.55); box-shadow: none; color: var(--past); }
.row.past .day { color: var(--past); }
.row.next { box-shadow: var(--shadow-next); }
@media (max-width: 640px) {
  .row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px 16px; }
  .row .chip { white-space: normal; }
}

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; font-size: 13px; color: var(--ink-muted); align-items: center; }
.legend > span { display: inline-flex; gap: 8px; align-items: center; }
.key {
  font-family: var(--font-serif); font-weight: 600; font-size: 15px; line-height: 20px;
  padding: 2px 8px; border-radius: var(--radius-sm);
}
.key.off { background: var(--red-letter-soft); color: var(--red-letter); }
.key.opt { background: var(--surface-card); border: 1px dashed var(--line-strong); color: var(--action); padding: 1px 7px; }
.key.past { background: var(--past-soft); color: var(--past); }
.key.cell { width: 26px; height: 24px; padding: 0; display: inline-grid; place-items: center; }
.key.today { box-shadow: inset 0 0 0 2px var(--action); color: var(--ink); font-family: var(--font-sans); }

/* ---------- Year view ---------- */
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.month { background: var(--surface-card); border-radius: var(--radius-xl); padding: var(--space-4); box-shadow: var(--shadow-card); }
.month.current { box-shadow: inset 0 0 0 2px #2f3238, 0 8px 22px rgba(29, 31, 35, 0.12); }
.month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.month-head h3 { font-family: var(--font-serif); font-weight: 600; font-size: 18px; line-height: 24px; }
.month-head span { font-size: 12px; color: var(--ink-muted); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.cal .dow { font-size: 11px; font-weight: 600; color: var(--ink-muted); padding-bottom: 4px; }
.cal .c { height: 30px; display: grid; place-items: center; border-radius: 9px; font-size: 13px; color: var(--ink); }
.cal .c.we { color: var(--ink-muted); }
.cal .c.off { background: var(--red-letter-soft); color: var(--red-letter); font-family: var(--font-serif); font-weight: 600; }
.cal .c.opt { border: 1px dashed var(--line-strong); color: var(--action); font-family: var(--font-serif); font-weight: 600; }
.cal .c.past-off { background: var(--past-soft); color: var(--past); font-family: var(--font-serif); font-weight: 600; }
.cal .c.past-opt { border: 1px dashed var(--line-past); color: var(--past); font-family: var(--font-serif); font-weight: 600; }
.cal .c.today { box-shadow: inset 0 0 0 2px var(--action); font-weight: 700; }
.month-items { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--neutral-soft); }
.month-items div { display: flex; gap: 8px; align-items: baseline; font-size: 13px; line-height: 18px; }
.month-items .past-name { color: var(--past); }
.mchip { font-family: var(--font-serif); font-weight: 600; font-size: 12px; padding: 1px 8px; border-radius: var(--radius-sm); white-space: nowrap; }
.mchip.off { background: var(--red-letter-soft); color: var(--red-letter); }
.mchip.opt { border: 1px dashed var(--line-strong); color: var(--action); padding: 0 7px; }
.mchip.past-off { background: var(--past-soft); color: var(--past); }
.mchip.past-opt { border: 1px dashed var(--line-past); color: var(--past); padding: 0 7px; }
@media (max-width: 600px) { .months { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Status messages ---------- */
.status { margin-block: var(--space-4); }

/* ---------- Print ---------- */
@media print {
  .site-header, .toolbar, .no-print, .site-footer { display: none !important; }
  body { background: #fff; }
  .panel, .card, .row, .month { box-shadow: none !important; }
  .row, .month { break-inside: avoid; border: 1px solid #ddd; }
}
