:root {
  --paper: #f7f4ee;
  --paper-2: #efe9df;
  --ink: #20241f;
  --muted: #667063;
  --line: #d8d0c4;
  --green: #2f6f5e;
  --green-dark: #214f43;
  --clay: #9b5f38;
  --gold: #c79a45;
  --focus: #765300;
  --white: #fffdfa;
  --family: #a34f32;
  --holiday: #7a2f3a;
  --quiet: #2f6f5e;
  --unknown: #5f665f;
  --shadow: 0 18px 50px rgba(34, 40, 33, .12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 0%, rgba(199, 154, 69, .13), transparent 26rem),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button, a { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 8px max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(216, 208, 196, .86);
  background: rgba(247, 244, 238, .94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 8px; }

.brand-mark,
.capture-brand-mark {
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--green-dark);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 50%;
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-weight: 700;
}

.brand-mark { width: 38px; height: 38px; }

.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { font-size: 15px; letter-spacing: .12em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .18em; }

.calendar-header-links { display: flex; align-items: center; gap: 7px; }
.calendar-header-links a {
  padding: 7px 10px;
  border: 1px solid var(--green-dark);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--white);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.calendar-header-links a:last-child { color: #fff; background: var(--green-dark); }
.calendar-header-links a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

html, body, main { max-width: 100%; }
main { overflow-x: clip; }

.hero,
.plain-answers,
.calendar-section {
  width: min(1180px, calc(100% - 36px));
  margin-inline: auto;
}

.hero {
  display: grid;
  justify-items: center;
  padding: 30px 0 18px;
  text-align: center;
}

.hero-boundary {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 7px 0 0;
  color: var(--green-dark);
  font-size: 13px;
}

.hero-boundary a {
  color: var(--green-dark);
  font-weight: 900;
  text-underline-offset: 3px;
}

.hero-boundary a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .18em;
}

h1, h2, h3 { font-family: "Noto Serif TC", "Songti TC", serif; }

h1 {
  margin: 0;
  font-size: 46px;
  line-height: 1.12;
  letter-spacing: -.035em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.journey-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(760px, 100%);
  margin-top: 18px;
}

.journey-split a {
  display: grid;
  gap: 2px;
  padding: 11px 14px;
  border: 1px solid var(--green);
  border-radius: 14px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}

.journey-split a:first-child { background: var(--white); color: var(--ink); }
.journey-split a:last-child { background: var(--green-dark); color: #fff; }
.journey-split strong { font-size: 14px; }
.journey-split span { color: var(--muted); font-size: 11px; }
.journey-split a:last-child span { color: rgba(255,255,255,.78); }
.journey-split a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.page-boundary {
  display: grid;
  gap: 4px;
  width: min(760px, 100%);
  margin-top: 12px;
  padding: 9px 11px;
  border-left: 4px solid var(--gold);
  border-radius: 0 12px 12px 0;
  background: var(--paper-2);
  text-align: left;
}
.page-boundary p { margin: 0; font-size: 12px; line-height: 1.35; }
.page-boundary strong { color: var(--green-dark); }

.month-jumps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 11px;
}

.month-jumps a,
.month-jumps span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--white);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.month-jumps a[aria-current="page"] { color: #fff; background: var(--green); }
.month-jumps a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.legend { display: flex; flex-wrap: wrap; gap: 7px; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--white);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.legend-item.family { color: var(--family); }
.legend-item.holiday { color: var(--holiday); }
.legend-item.quiet { color: var(--quiet); }
.legend-item.unknown { color: var(--unknown); border-style: dashed; }
.legend-item i { width: 1em; font-style: normal; text-align: center; }

.plain-answers {
  margin-bottom: 70px;
  padding: 25px clamp(20px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--green-dark);
  color: #fff;
  box-shadow: var(--shadow);
}

.plain-answers .eyebrow { color: #dfbd78; }
.plain-answers h2 { margin: 0 0 14px; font-size: 34px; }
.plain-answers > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plain-answers p:not(.eyebrow) { margin: 0; padding: 12px; border: 1px solid rgba(255,255,255,.2); border-radius: 14px; background: rgba(255,255,255,.06); }
.plain-answers span { margin-right: 8px; color: #dfbd78; }

.calendar-section { padding: 0 0 36px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.source-loading-state,
.source-failure-state {
  display: none;
  width: min(620px, 100%);
  margin: 18px auto 60px;
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.source-loading-state { border-top-color: var(--green); }
.source-loading-state .state-kicker { color: var(--green-dark); }
.source-failure-state .state-kicker { color: var(--clay); }
.source-loading-state .state-kicker,
.source-failure-state .state-kicker { font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.source-loading-state h2,
.source-failure-state h2 { margin: 5px 0 14px; font-size: 30px; line-height: 1.25; }
.source-loading-state p,
.source-failure-state p { margin: 7px 0; }
.source-failure-state p strong { color: var(--green-dark); }
.source-failure-state a { display: inline-block; margin-top: 14px; padding: 11px 16px; border-radius: 12px; color: #fff; background: var(--green-dark); font-weight: 900; text-decoration: none; }
.source-failure-state a:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.source-loading-state small,
.source-failure-state small { display: block; margin-top: 14px; color: var(--muted); font-size: 11px; }

body.fail-closed-mode .month-jumps,
body.fail-closed-mode .month-grid,
body.fail-closed-mode .placeholder-explainer,
body.fail-closed-mode .plain-answers { display: none; }
body[data-fd-calendar-state="loading"] .source-loading-state { display: block; }
body[data-fd-calendar-state="failed"] .source-failure-state { display: block; }

.month-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }

.month-card {
  scroll-margin-top: 76px;
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.capture-brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 13px 16px;
  color: #fff;
  background: var(--green-dark);
  border-radius: 23px 23px 0 0;
}

.capture-brand-mark { width: 34px; height: 34px; background: rgba(255,255,255,.12); }
.capture-brand > span:not(.capture-brand-mark) { display: grid; line-height: 1.1; }
.capture-brand strong { font-size: 13px; letter-spacing: .1em; }
.capture-brand small { margin-top: 3px; color: rgba(255,255,255,.72); font-size: 9px; letter-spacing: .08em; }
.capture-brand em { padding: 4px 7px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; font-size: 9px; font-style: normal; font-weight: 900; }

.month-card-header { padding: 12px 16px 6px; }
.month-card-header p { margin: 0; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.month-card-header h3 { margin: 1px 0 0; font-size: 31px; line-height: 1.1; }
.month-card-header span { color: var(--muted); font-size: 11px; }

.month-date-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 14px 8px;
}

.month-date-summary h4 {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--green-dark);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: .08em;
}

.month-date-summary-item {
  min-width: 0;
  margin: 0;
  padding: 7px 8px;
  border: 1px solid currentColor;
  border-radius: 10px;
  background: var(--white);
}

.month-date-summary-item strong,
.month-date-summary-item span {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.month-date-summary-item strong { margin-bottom: 2px; }
.month-date-summary-item i { width: 1em; margin-right: 4px; font-style: normal; }
.month-date-summary-item.family { color: var(--family); }
.month-date-summary-item.holiday { color: var(--holiday); }
.month-date-summary-item.quiet { color: var(--quiet); }

.first-screen-contract {
  display: grid;
  gap: 7px;
  margin: 0 14px 9px;
}

.first-screen-boundary {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border-left: 4px solid var(--gold);
  background: var(--paper-2);
}

.first-screen-boundary p {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.first-screen-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.first-screen-actions a {
  display: grid;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--green-dark);
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--white);
  text-align: left;
  text-decoration: none;
}

.first-screen-actions a:first-child { color: #fff; background: var(--green-dark); }
.first-screen-actions strong { font-size: 13px; line-height: 1.35; }
.first-screen-actions span { font-size: 11px; line-height: 1.35; }
.first-screen-actions a:first-child span { color: rgba(255,255,255,.82); }
.first-screen-actions a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.legend-month {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 0 14px 8px;
}
.legend-month .legend-item { justify-content: center; padding: 4px 6px; font-size: 12px; line-height: 1.35; }

.calendar {
  width: calc(100% - 28px);
  margin: 0 14px;
  table-layout: fixed;
  border-spacing: 0;
  border-collapse: separate;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.calendar thead { color: #fff; background: var(--green-dark); }
.calendar th { padding: 5px 0; text-align: center; font-size: 12px; font-weight: 900; line-height: 1.35; }

.day {
  position: relative;
  min-width: 0;
  height: 56px;
  padding: 3px 2px;
  vertical-align: top;
  border-right: 1px solid #e5dfd6;
  border-bottom: 1px solid #e5dfd6;
  background: #fff;
}

.calendar tr .day:last-child { border-right: 0; }
.calendar tbody tr:last-child .day { border-bottom: 0; }
.day b { display: block; color: var(--muted); font-size: 14px; line-height: 1.35; }
.day span { display: block; margin-top: 0; font-size: 11px; font-weight: 900; line-height: 1.35; }
.day small { display: block; margin-top: 0; font-size: 11px; font-weight: 800; line-height: 1.35; }
.day.empty { background: #f6f3ed; }
.day.family-day { color: #7d2f19; background: #f8e3da; box-shadow: inset 0 3px 0 var(--family); }
.day.family-holiday { color: #611d28; background: #f2dce0; box-shadow: inset 0 3px 0 var(--holiday); }
.day.general-quiet { color: #1d5847; background: #dfeee8; box-shadow: inset 0 3px 0 var(--quiet); }
.day.unknown { color: #454b45; background: repeating-linear-gradient(135deg, #eef0ed, #eef0ed 5px, #e2e5e1 5px, #e2e5e1 10px); box-shadow: inset 0 3px 0 var(--unknown); }
.day.is-past { filter: grayscale(.9) saturate(.35); opacity: 1; }

.type-clarifiers { display: grid; gap: 2px; padding: 8px 14px; }
.type-clarifiers p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.type-clarifiers strong { margin-right: 5px; color: var(--ink); }

.capture-boundary {
  display: grid;
  gap: 7px;
  margin: 0 10px 9px;
  padding: 8px 10px;
  border-top: 3px solid var(--gold);
  background: var(--paper-2);
}
.capture-boundary p { margin: 0; font-size: 12px; line-height: 1.35; }
.capture-boundary strong { color: var(--green-dark); }

.month-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: 0 10px 7px;
}
.month-actions a {
  display: grid;
  gap: 0;
  min-width: 0;
  padding: 4px 7px;
  border: 1px solid var(--green-dark);
  border-radius: 9px;
  color: var(--green-dark);
  background: var(--white);
  text-decoration: none;
}
.month-actions a:first-child { color: #fff; background: var(--green-dark); }
.month-actions strong { font-size: 13px; line-height: 1.35; }
.month-actions span { font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.month-actions a:first-child span { color: rgba(255,255,255,.82); }
.month-actions a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.month-card > footer { display: grid; gap: 1px; min-width: 0; padding: 7px 12px; border-radius: 0 0 23px 23px; color: #fff; background: var(--green-dark); text-align: center; }
.month-card > footer strong { min-width: 0; font-size: 12px; line-height: 1.35; letter-spacing: .01em; overflow-wrap: anywhere; word-break: break-word; }
.month-card > footer span { min-width: 0; color: rgba(255,255,255,.82); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; word-break: break-word; }

.placeholder-explainer { margin: 14px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

body.capture-mode {
  width: 390px;
  min-width: 390px;
  margin: 0;
  background: var(--paper);
}
body.capture-mode .site-header,
body.capture-mode main > .hero,
body.capture-mode .plain-answers,
body.capture-mode .page-footer,
body.capture-mode .placeholder-explainer { display: none; }
body.capture-mode .first-screen-contract { display: none; }
body.capture-mode .calendar-section { width: 390px; margin: 0; padding: 0; }
body.capture-mode .month-grid { display: block; }
body.capture-mode .month-card { display: none; width: 390px; border-radius: 0; box-shadow: none; }
body.capture-mode .month-card.capture-target { display: block; }
body.capture-mode .capture-brand { padding: 6px 12px; }
body.capture-mode .capture-brand,
body.capture-mode .month-card > footer { border-radius: 0; }
body.capture-mode .month-card-header { padding: 5px 14px 3px; }
body.capture-mode .month-date-summary {
  grid-template-columns: 62px minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 4px;
  margin: 0 10px 5px;
}
body.capture-mode .month-date-summary h4 {
  grid-column: auto;
  align-self: center;
}
body.capture-mode .month-date-summary-item { padding: 4px 6px; }
body.capture-mode .legend-month { gap: 4px; padding: 0 10px 5px; }
body.capture-mode .day { height: 50px; }
body.capture-mode .type-clarifiers { padding: 6px 14px; }
body.capture-mode .capture-boundary { gap: 5px; margin-bottom: 6px; padding: 6px 10px; }
body.capture-mode .month-actions { margin-bottom: 5px; }
body.capture-mode .month-card > footer { padding: 5px 12px; }

.page-footer {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 22px 18px 30px;
  color: #dbe5df;
  background: #172f28;
  text-align: center;
}
.page-footer strong { font-size: 12px; letter-spacing: .14em; }
.page-footer span { font-size: 10px; }

@media (max-width: 760px) {
  .site-header { min-height: 56px; padding-inline: 14px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy small { display: none; }
  .calendar-header-links a:first-child { display: none; }
  .hero, .plain-answers, .calendar-section { width: min(100% - 24px, 560px); }
  .hero { padding-top: 20px; padding-bottom: 13px; }
  h1 { font-size: 31px; }
  .subtitle { margin-top: 6px; font-size: 15px; }
  .hero-boundary { margin-top: 4px; font-size: 12px; }
  .journey-split { margin-top: 13px; gap: 7px; }
  .journey-split a { padding: 8px 9px; }
  .journey-split strong { font-size: 13px; }
  .journey-split span { font-size: 11px; }
  .month-jumps { margin-top: 8px; }
  .plain-answers { padding: 22px 18px; }
  .plain-answers h2 { font-size: 26px; }
  .plain-answers > div { grid-template-columns: 1fr; }
  .plain-answers p:not(.eyebrow) { font-size: 13px; }
  .calendar-section { padding-top: 0; }
  .source-loading-state,
  .source-failure-state { margin-top: 10px; padding: 22px 18px; }
  .source-loading-state h2,
  .source-failure-state h2 { font-size: 27px; }
  .month-grid { grid-template-columns: 1fr; }
  .month-card { border-radius: 19px; }
  .month-card-header { padding-inline: 14px; }
  .month-date-summary { margin-inline: 10px; }
  .first-screen-contract { margin-inline: 10px; }
  .legend-month { padding-inline: 14px; }
  .calendar { width: calc(100% - 20px); margin-inline: 10px; }
  .day { height: 56px; padding-inline: 2px; }
  .capture-boundary { margin-inline: 10px; }
}

@media (max-width: 374px) {
  .hero, .plain-answers, .calendar-section { width: calc(100% - 18px); }
  .candidate-flag { font-size: 10px; }
  .journey-split { gap: 5px; }
  .journey-split a { padding-inline: 7px; }
  .legend-item { padding-inline: 7px; }
  .capture-brand { padding-inline: 12px; }
  .legend-month { gap: 5px; }
  .legend-month .legend-item { font-size: 12px; }
  .day { height: 56px; }
}

@media (max-width: 260px) {
  .site-header { position: static; }
  .calendar-header-links { display: none; }
  .hero, .plain-answers, .calendar-section { width: calc(100% - 12px); }
  .hero { padding-top: 12px; }
  h1 { font-size: 27px; }
  .journey-split,
  .first-screen-actions,
  .month-date-summary,
  .legend-month,
  .month-actions { grid-template-columns: minmax(0, 1fr); }
  .month-date-summary h4 { grid-column: auto; }
  .calendar { width: calc(100% - 8px); margin-inline: 4px; }
  .calendar th { font-size: 11px; }
  .day { height: auto; min-height: 56px; padding-inline: 1px; }
  .day b { font-size: 14px; }
  .day span { font-size: 11px; overflow-wrap: anywhere; word-break: break-all; }
  .capture-brand,
  .month-card-header,
  .type-clarifiers { padding-inline: 8px; }
  .capture-brand { grid-template-columns: auto minmax(0, 1fr); }
  .capture-brand em { display: none; }
  .capture-boundary,
  .month-actions { margin-inline: 4px; }
  .month-card > footer { padding-inline: 6px; }
}

@media (forced-colors: active) {
  .day,
  .legend-item,
  .month-date-summary-item,
  .journey-split a,
  .month-actions a,
  .month-jumps a { border-color: CanvasText; }
}

@media (forced-colors: active) and (max-width: 430px) {
  html,
  body,
  main {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .hero,
  .plain-answers,
  .calendar-section {
    min-width: 0;
    max-width: calc(100% - 24px);
  }

  .month-grid {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .month-card,
  .month-date-summary,
  .month-date-summary-item,
  .first-screen-contract,
  .first-screen-boundary,
  .first-screen-actions,
  .legend-month,
  .calendar,
  .capture-boundary,
  .month-actions {
    min-width: 0;
    max-width: 100%;
  }

  .first-screen-boundary p,
  .month-date-summary-item strong,
  .month-date-summary-item span,
  .first-screen-actions strong,
  .first-screen-actions span,
  .month-actions strong,
  .month-actions span,
  .subtitle {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media print {
  .site-header { position: static; }
  .month-card { break-inside: avoid; box-shadow: none; }
}
