:root {
  --paper: #f4f0e7;
  --surface: #fffefa;
  --ink: #282722;
  --muted: #716b61;
  --line: #d8d1c3;
  --soft-line: #ebe6dd;
  --terracotta: #bd6844;
  --shadow: 0 24px 70px rgb(68 57 41 / 8%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, "Noto Sans TC", "PingFang TC", sans-serif; }
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid rgb(39 102 177 / 35%); outline-offset: 3px; }

.site-header { position: sticky; top: 0; z-index: 20; display: flex; min-height: 78px; align-items: center; justify-content: space-between; padding: 0 5vw; border-bottom: 1px solid var(--line); background: rgb(244 240 231 / 94%); backdrop-filter: blur(12px); }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-family: Georgia, "Noto Serif TC", serif; font-size: 23px; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Noto Serif TC", serif; letter-spacing: .14em; }
.brand small { margin-top: 3px; font-size: 8px; letter-spacing: .19em; opacity: .64; }
nav { display: flex; gap: 34px; }
nav a { color: inherit; font-size: 14px; text-decoration: none; }

.intro { display: grid; max-width: 1500px; margin: 0 auto; padding: clamp(48px, 7vw, 100px) 7vw clamp(42px, 6vw, 84px); grid-template-columns: 1.5fr .72fr; gap: 10vw; align-items: end; }
.eyebrow { margin: 0 0 16px; color: var(--terracotta); font-size: 12px; font-weight: 700; letter-spacing: .16em; }
.intro h1 { margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(38px, 4.4vw, 70px); font-weight: 400; line-height: 1.28; letter-spacing: .03em; }
.intro-copy { color: var(--muted); font-size: 15px; line-height: 2; }
.intro-copy p { margin: 0; }
.intro-copy .notice { margin-top: 16px; font-size: 12px; }

.calendar-section { padding: 56px 7vw 90px; border-top: 1px solid var(--line); background: #fbfaf6; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Noto Serif TC", serif; font-size: clamp(36px, 4vw, 56px); font-weight: 400; letter-spacing: .06em; }
.view-switcher { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: #f0ece3; }
.view-switcher button { min-width: 60px; padding: 8px 14px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
.view-switcher button.is-active { color: white; background: var(--ink); }
.calendar-controls { display: flex; gap: 20px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.space-filters { display: flex; gap: 9px; overflow-x: auto; padding: 3px 0; }
.space-filter { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer; font-size: 13px; }
.space-filter-dot { width: 8px; height: 8px; border-radius: 50%; }
.space-filter.is-active { border-color: #a99f8e; background: #e8e1d4; }
.refresh-button { display: flex; flex: 0 0 auto; gap: 7px; align-items: center; padding: 9px 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); cursor: pointer; font-size: 13px; }
.refresh-button.is-loading span { animation: rotate 800ms linear infinite; }
.status-message { display: none; margin-bottom: 16px; padding: 12px 14px; border: 1px solid #e4c59d; background: #fff5e8; color: #77522c; font-size: 13px; line-height: 1.6; }
.status-message.is-visible { display: block; }
.status-message.is-error { border-color: #dcafa7; background: #fff0ee; color: #873c31; }
.calendar-shell { overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
.calendar-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 82px; padding: 14px 18px; border-bottom: 1px solid var(--soft-line); }
.calendar-today { justify-self: start; padding: 10px 16px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); cursor: pointer; }
.calendar-date-navigation { display: flex; align-items: center; justify-content: center; gap: 18px; }
.calendar-date-navigation h3 { min-width: 180px; margin: 0; text-align: center; white-space: nowrap; font-family: Georgia, "Noto Serif TC", serif; font-size: 23px; font-weight: 400; }
.calendar-date-navigation button { display: grid; width: 44px; height: 44px; flex: 0 0 44px; place-items: center; padding: 0; border: 0; border-radius: 3px; color: white; background: var(--ink); cursor: pointer; font-family: Arial, sans-serif; font-size: 35px; font-weight: 300; line-height: 1; }
#calendar { min-height: 680px; padding: 18px; }

.fc { --fc-border-color: var(--soft-line); --fc-button-bg-color: var(--ink); --fc-button-border-color: var(--ink); --fc-button-hover-bg-color: #48463f; --fc-button-hover-border-color: #48463f; --fc-button-active-bg-color: var(--terracotta); --fc-button-active-border-color: var(--terracotta); --fc-today-bg-color: rgb(189 104 68 / 8%); font-size: 13px; }
.fc .fc-toolbar-title { font-family: Georgia, "Noto Serif TC", serif; font-size: 23px; font-weight: 400; }
.fc .fc-button { border-radius: 3px; box-shadow: none !important; font-size: 13px; }
.fc .fc-toolbar-chunk:has(.fc-toolbar-title) { display: flex !important; flex-flow: row nowrap !important; align-items: center !important; justify-content: center !important; gap: 16px; }
.fc .fc-toolbar-chunk:has(.fc-toolbar-title) > * { flex: 0 0 auto !important; margin: 0 !important; }
.fc .fc-toolbar-chunk:has(.fc-toolbar-title) .fc-toolbar-title { display: block; margin: 0 !important; white-space: nowrap; }
.fc .fc-toolbar-chunk:has(.fc-toolbar-title) .fc-button-group { display: inline-flex !important; width: auto !important; }
.fc .fc-toolbar-chunk:has(.fc-toolbar-title) .fc-button { display: inline-flex !important; align-items: center; justify-content: center; flex: 0 0 auto !important; margin: 0 !important; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--ink); text-decoration: none; }
.fc .fc-col-header-cell-cushion { padding: 10px 4px; font-size: 12px; font-weight: 500; }
.fc .fc-daygrid-day-number { padding: 8px; }
.fc .fc-daygrid-day-frame { min-height: 112px; }
.fc .fc-event { border: 0; border-left: 3px solid currentcolor; border-radius: 0; cursor: pointer; }
.fc .fc-list-event:hover td { background: #f5f1e8; }

.calendar-footer { display: flex; gap: 20px; justify-content: space-between; color: #777166; font-size: 11px; }
.calendar-footer p { margin: 12px 0 0; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #d39849; }
.event-dialog { width: min(560px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 4px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 100px rgb(0 0 0 / 25%); }
.event-dialog::backdrop { background: rgb(22 21 18 / 55%); backdrop-filter: blur(3px); }
.event-dialog article { position: relative; padding: 40px; }
.dialog-close { position: absolute; top: 15px; right: 17px; width: 36px; height: 36px; border: 0; background: transparent; cursor: pointer; font-size: 28px; }
.dialog-space { margin: 0 0 10px; color: var(--terracotta); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.event-dialog h2 { margin: 0; padding-right: 30px; font-family: Georgia, "Noto Serif TC", serif; font-size: 30px; font-weight: 400; line-height: 1.4; }
.event-details { display: grid; margin: 28px 0; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--line); }
.event-details div { padding: 15px 8px 15px 0; border-bottom: 1px solid var(--line); }
.event-details dt { margin-bottom: 6px; color: var(--muted); font-size: 11px; }
.event-details dd { margin: 0; font-size: 14px; }
.dialog-description { color: var(--muted); font-size: 14px; line-height: 1.8; }
.dialog-actions { display: flex; gap: 10px; margin-top: 28px; }
.primary-button, .secondary-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 3px; cursor: pointer; font-size: 14px; text-decoration: none; }
.primary-button { border: 1px solid var(--ink); color: white; background: var(--ink); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: transparent; }
.noscript-message { padding: 16px; text-align: center; }

@keyframes rotate { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .site-header { min-height: 68px; padding: 0 20px; }
  .brand-mark { width: 36px; height: 36px; font-size: 19px; }
  .brand strong { font-size: 14px; }
  nav { display: none; }
  .intro { display: block; padding: 42px 20px; }
  .intro h1 { font-size: clamp(31px, 9vw, 42px); }
  .intro-copy { margin-top: 26px; }
  .calendar-section { padding: 38px 20px 70px; }
  .section-heading { align-items: center; }
  .section-heading h2 { font-size: 34px; }
  .view-switcher { display: none; }
  .calendar-controls { display: block; }
  .refresh-button { margin-top: 12px; }
  .calendar-shell { border-right: 0; border-left: 0; box-shadow: none; }
  .calendar-navigation { grid-template-columns: auto 1fr; gap: 10px; padding: 12px 0; }
  .calendar-navigation-spacer { display: none; }
  .calendar-today { padding: 8px 10px; font-size: 13px; }
  .calendar-date-navigation { justify-self: end; gap: 7px; }
  .calendar-date-navigation h3 { min-width: 0; font-size: clamp(14px, 4.4vw, 19px); }
  .calendar-date-navigation button { width: 36px; height: 36px; flex-basis: 36px; font-size: 28px; }
  #calendar { min-height: 500px; padding: 10px 0; }
  .fc .fc-toolbar-title { font-size: clamp(15px, 4.7vw, 20px); }
  .fc .fc-button { padding: 7px 9px; }
  .fc .fc-toolbar-chunk:has(.fc-toolbar-title) { gap: 8px; }
  .calendar-footer { display: block; line-height: 1.6; }
  .event-dialog article { padding: 34px 22px 26px; }
  .event-dialog h2 { font-size: 25px; }
  .event-details { grid-template-columns: 1fr; }
  .dialog-actions { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
