:root {
  --navy: #0b2943;
  --navy-2: #123e61;
  --red: #d62f3c;
  --cream: #f5f1e8;
  --paper: #fffdf8;
  --ink: #17202a;
  --muted: #66717c;
  --line: #d9d9d4;
  --gold: #b98942;
  --shadow: 0 18px 50px rgba(11, 41, 67, .11);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 20; padding: .75rem 1rem; background: white; color: var(--navy); border-radius: 8px; }
.skip-link:focus { top: 1rem; }

.hero {
  position: relative;
  min-height: 640px;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 82% 24%, rgba(255,255,255,.11) 0 1px, transparent 2px) 0 0 / 28px 28px,
    linear-gradient(135deg, #071f34 0%, var(--navy) 48%, #174a70 100%);
}
.hero::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -140px;
  bottom: -180px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 150px rgba(255,255,255,.018);
}
.topbar {
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1.35rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.16);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-family: Georgia, serif;
  font-size: 1.5rem;
  font-style: italic;
}
.brand strong { display: block; letter-spacing: .1em; font-size: .96rem; }
.brand small { display: block; color: rgba(255,255,255,.7); font-size: .72rem; }
.compact-link { color: rgba(255,255,255,.78); font-weight: 700; font-size: .86rem; text-decoration: none; }
.compact-link:hover, .compact-link:focus-visible { color: white; }

.hero-content {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 5.8rem 0 7.5rem;
}
.eyebrow { margin: 0 0 1rem; color: #f0ced0; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; }
.eyebrow.dark { color: var(--red); }
h1, h2, h3, p { text-wrap: pretty; }
h1 { max-width: 760px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 7vw, 6.6rem); line-height: .93; letter-spacing: -.055em; font-weight: 500; }
h1 em { color: #f0d8a9; font-weight: 400; }
.hero-copy { max-width: 650px; margin: 1.8rem 0 1.5rem; color: rgba(255,255,255,.78); font-size: clamp(1rem, 1.8vw, 1.23rem); }
.hero-meta { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 2.3rem; }
.hero-meta span { padding: .45rem .7rem; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: rgba(255,255,255,.86); font-size: .78rem; }
.primary-action, .secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  min-height: 50px;
  padding: .75rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-action:hover, .primary-action:focus-visible { background: #e5424e; transform: translateY(-1px); }
.hero-ribbon { position: absolute; right: -4%; top: 36%; width: 46%; height: 150px; transform: rotate(-12deg); opacity: .88; }
.hero-ribbon span { position: absolute; inset: 0; border-top: 12px solid var(--red); border-radius: 50%; }
.hero-ribbon span:last-child { top: 34px; border-top-color: rgba(255,255,255,.82); }

.planner, .notes { width: min(1180px, calc(100% - 2.5rem)); margin: 0 auto; }
.planner { padding: 5rem 0 4rem; }
.notes { padding: 4rem 0 5.5rem; border-top: 1px solid rgba(11,41,67,.16); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
h2 { margin: 0; color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.65rem); line-height: 1; letter-spacing: -.035em; font-weight: 500; }
.saved-toggle { min-height: 46px; padding: .65rem .9rem; border: 1px solid #bcc4c9; border-radius: 999px; background: transparent; color: var(--navy); font-weight: 800; cursor: pointer; white-space: nowrap; }
.saved-toggle span { color: var(--red); font-size: 1.12rem; }
.saved-toggle b { min-width: 22px; height: 22px; padding: 0 .35rem; display: inline-grid; place-items: center; border-radius: 999px; background: var(--navy); color: white; font-size: .72rem; }
.saved-toggle[aria-pressed="true"] { background: var(--navy); color: white; border-color: var(--navy); }
.saved-toggle[aria-pressed="true"] b { background: white; color: var(--navy); }

.controls { position: sticky; top: 0; z-index: 5; margin-inline: -1rem; padding: .85rem 1rem; background: rgba(245,241,232,.94); backdrop-filter: blur(12px); border-block: 1px solid rgba(11,41,67,.08); }
.day-tabs, .type-filters { display: flex; gap: .55rem; overflow-x: auto; scrollbar-width: none; }
.day-tabs::-webkit-scrollbar, .type-filters::-webkit-scrollbar { display: none; }
.type-filters { margin-top: .65rem; }
.day-tab, .filter-chip {
  flex: 0 0 auto;
  min-height: 44px;
  padding: .58rem .85rem;
  border: 1px solid #c8cbc7;
  border-radius: 999px;
  background: var(--paper);
  color: #44505a;
  font-weight: 750;
  cursor: pointer;
}
.day-tab span { color: var(--red); }
.day-tab.active, .filter-chip.active { background: var(--navy); color: white; border-color: var(--navy); }
.day-tab.active span { color: #ffb0b6; }
.filter-chip .dot { width: 7px; height: 7px; display: inline-block; margin-right: .35rem; border-radius: 50%; background: var(--chip-color, var(--red)); }
.result-line { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .84rem; }
.result-line p { margin: 0; }
.text-button { min-height: 44px; padding: .5rem; border: 0; background: transparent; color: var(--navy); text-decoration: underline; cursor: pointer; }

.day-group { margin-top: 2.4rem; }
.day-heading { display: flex; align-items: baseline; gap: .7rem; margin-bottom: 1rem; }
.day-heading time { color: var(--red); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 900; }
.day-heading h3 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.event-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.event-card {
  position: relative;
  display: grid;
  grid-template-columns: 108px 1fr;
  min-height: 165px;
  overflow: hidden;
  border: 1px solid rgba(11,41,67,.12);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 30px rgba(11,41,67,.04);
}
.event-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent, var(--red)); }
.event-time { padding: 1.15rem .8rem 1rem 1rem; border-right: 1px solid rgba(11,41,67,.09); }
.event-time strong { display: block; color: var(--navy); font-size: 1rem; line-height: 1.15; }
.event-time small { display: block; margin-top: .35rem; color: var(--muted); font-size: .72rem; }
.event-body { min-width: 0; padding: 1.05rem 3.3rem 1.05rem 1rem; }
.event-topline { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.category { color: var(--accent, var(--red)); text-transform: uppercase; letter-spacing: .11em; font-size: .66rem; font-weight: 900; }
.status { display: inline-flex; align-items: center; min-height: 22px; padding: .18rem .48rem; border-radius: 999px; font-size: .64rem; font-weight: 850; line-height: 1; }
.status.confirmed { color: #146140; background: #dff3e9; }
.status.provisional { color: #805315; background: #f7ead4; }
.status.open { color: #54606b; background: #e9ecee; }
.status.conflict { color: #9b2631; background: #f8dfe1; }
.event-body h4 { margin: .45rem 0 .35rem; color: var(--navy); font-family: Georgia, serif; font-size: 1.22rem; line-height: 1.13; font-weight: 600; }
.venue { display: flex; align-items: flex-start; gap: .38rem; margin: 0; color: #4c5964; font-size: .8rem; font-weight: 700; }
.venue::before { content: "●"; color: var(--accent, var(--red)); font-size: .52rem; line-height: 1.6; }
.note { margin: .55rem 0 0; color: var(--muted); font-size: .79rem; line-height: 1.4; }
.save-event { position: absolute; top: .72rem; right: .72rem; width: 44px; height: 44px; border: 1px solid #d0d4d6; border-radius: 50%; background: white; color: var(--red); font-size: 1.15rem; cursor: pointer; }
.save-event[aria-pressed="true"] { background: var(--red); color: white; border-color: var(--red); }
.empty-state { margin-top: 2rem; padding: 2rem; border: 1px dashed #aeb6ba; border-radius: var(--radius); text-align: center; }
.empty-state p { color: var(--muted); }
.secondary-action { background: var(--navy); }

.notes > div:first-child { max-width: 600px; }
.legend-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-top: 2rem; }
.legend-grid article { padding: 1.25rem; border: 1px solid rgba(11,41,67,.12); border-radius: 18px; background: rgba(255,253,248,.7); }
.legend-grid h3 { margin: .8rem 0 .3rem; color: var(--navy); font-size: .98rem; }
.legend-grid p { margin: 0; color: var(--muted); font-size: .8rem; }
.source-box { margin-top: 1rem; padding: 1.2rem 1.3rem; border-left: 4px solid var(--red); border-radius: 4px 16px 16px 4px; background: var(--paper); }
.source-box p { margin: 0; font-size: .9rem; }
.source-box details { margin-top: .8rem; }
.source-box summary { color: var(--navy); font-weight: 800; cursor: pointer; }
.source-box ul { margin: .7rem 0 0; padding-left: 1.2rem; }
.source-box li + li { margin-top: .35rem; }
.source-box a { color: var(--navy-2); }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem max(1.25rem, calc((100% - 1180px)/2)); color: rgba(255,255,255,.7); background: var(--navy); font-size: .78rem; }
footer p { margin: 0; }

:focus-visible { outline: 3px solid #f0b34e; outline-offset: 3px; }
@media (max-width: 860px) {
  .hero { min-height: 600px; }
  .hero-content { padding-top: 4.6rem; }
  .hero-ribbon { right: -22%; width: 74%; }
  .event-list { grid-template-columns: 1fr; }
  .legend-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .hero { min-height: 620px; }
  .topbar, .hero-content, .planner, .notes { width: min(100% - 1.35rem, 1180px); }
  .topbar { padding-block: 1rem; }
  .compact-link { display: none; }
  .hero-content { padding-top: 4.2rem; }
  h1 { font-size: clamp(3rem, 15vw, 4.8rem); }
  .hero-copy { margin-top: 1.35rem; }
  .hero-meta { gap: .4rem; }
  .hero-meta span { font-size: .7rem; }
  .hero-ribbon { top: 54%; right: -35%; width: 100%; }
  .planner { padding-top: 3.2rem; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { max-width: 210px; }
  .saved-toggle { margin-top: .2rem; padding-inline: .72rem; font-size: .78rem; }
  .controls { margin-inline: -.675rem; padding-inline: .675rem; }
  .result-line { font-size: .76rem; }
  .event-card { grid-template-columns: 96px 1fr; min-height: 0; border-radius: 17px; }
  .event-time { padding: 1rem .55rem .9rem .8rem; }
  .event-time strong { font-size: .9rem; }
  .event-body { padding: .95rem 2.9rem .95rem .8rem; }
  .event-body h4 { font-size: 1.08rem; }
  .note { font-size: .76rem; }
  .save-event { top: .55rem; right: .5rem; }
  .legend-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
