:root {
  color-scheme: light;
  --bg: hsl(188 38% 97%);
  --surface: #fff;
  --surface-2: hsl(188 54% 94%);
  --ink: hsl(220 22% 13%);
  --muted: hsl(214 12% 42%);
  --line: hsl(188 16% 84%);
  --brand: hsl(188 44% 33%);
  --brand-strong: hsl(188 48% 15%);
  --brand-soft: hsl(188 54% 91%);
  --accent: #d97745;
  --warning: #8a5b23;
  --positive: #176b4d;
  --focus: #2563eb;
  --shadow: 0 3px 14px rgb(22 49 54 / 0.09);
  --shadow-hover: 0 12px 30px rgb(22 49 54 / 0.16);
  --radius: 9px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-feature-settings: "palt";
  line-height: 1.45;
  transition: background 160ms ease, color 160ms ease;
}

a { color: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* dev/prod view toggle */
body[data-view="prod"] .dev-only { display: none !important; }

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}
.view-toggle:hover { border-color: var(--brand); color: var(--brand); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  color: var(--brand-strong);
  font-weight: 900;
  white-space: nowrap;
}

.brand strong { font-size: 0.95rem; }
.brand small { color: var(--muted); font-size: 0.61rem; font-weight: 800; letter-spacing: 0.08em; }

.issue {
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-label {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 3px 7px;
  white-space: nowrap;
}

.page-nav {
  display: flex;
  gap: 3px;
}

.page-nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  padding: 4px 7px;
  text-decoration: none;
  white-space: nowrap;
}

.page-nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.controlbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.shelf-promise {
  flex: 1;
  margin: 0;
  overflow: hidden;
  color: var(--brand-strong);
  font-size: 0.72rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-link:focus-visible,
.page-nav a:focus-visible,
.reader-actions a:focus-visible,
.reader-close:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

.review-link {
  border: 1px solid var(--brand);
  border-radius: 999px;
  color: var(--brand-strong);
  font-size: 0.64rem;
  font-weight: 900;
  padding: 4px 8px;
  text-decoration: none;
  white-space: nowrap;
}

.page-shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 8px 10px 64px;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.event-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.event-figure {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.visual-frame {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
}

.visual-frame img {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  object-fit: contain;
}

.visual-frame.visual-surface--contrast,
.reader-visual.visual-surface--contrast {
  background-color: hsl(188 48% 15%);
  background-image: linear-gradient(145deg, hsl(188 48% 15%), hsl(188 44% 33%));
}

.visual-surface--contrast img {
  background: transparent;
}

.visual-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: hsl(188 48% 15% / 0.84);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  backdrop-filter: blur(6px);
}

.event-compact {
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  padding: 7px 9px 8px;
}

.event-compact h2 {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 0.84rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compact-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.compact-venue {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--brand-strong);
  font-size: 0.75rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-access {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.2;
  padding: 3px 6px;
  white-space: nowrap;
}

.event-trigger {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}

.event-trigger:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent);
  outline-offset: -4px;
}

.event-reader {
  width: min(920px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(8 33 37 / 0.28);
}

.event-reader::backdrop {
  background: rgb(8 33 37 / 0.62);
  backdrop-filter: blur(3px);
}

.reader-close {
  position: sticky;
  z-index: 4;
  top: 8px;
  float: right;
  width: 44px;
  height: 44px;
  margin: 8px 8px -52px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--brand-strong);
  cursor: pointer;
  font: 900 1.45rem/1 var(--font);
  box-shadow: var(--shadow);
}

.reader-content {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  min-height: 0;
}

.reader-figure {
  margin: 0;
  padding: 16px;
  background: var(--surface-2);
}

.reader-visual {
  display: grid;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  place-items: center;
}

.reader-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reader-figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.not-found-shell {
  display: grid;
  min-height: calc(100vh - 46px);
  padding: 32px 16px;
  place-items: center;
}

.not-found-card {
  width: min(560px, 100%);
  padding: 40px 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.not-found-code {
  margin: 0;
  color: var(--brand);
  font-size: clamp(3.5rem, 16vw, 7rem);
  font-weight: 950;
  letter-spacing: -0.08em;
  line-height: 0.9;
}

.not-found-card h1 { margin: 20px 0 8px; color: var(--brand-strong); }
.not-found-card > p:not(.not-found-code) { margin: 0; color: var(--muted); }

.not-found-home {
  display: inline-flex;
  margin-top: 24px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.not-found-home:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.reader-copy { padding: 24px 24px 26px; }

.reader-eyebrow {
  margin: 0 48px 7px 0;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 900;
}

.reader-copy h2 {
  margin: 0 48px 10px 0;
  color: var(--brand-strong);
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.25;
}

.reader-primary {
  margin: 0 0 16px;
  font-size: 0.96rem;
  font-weight: 740;
  line-height: 1.55;
}

.reader-primary strong {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.06em;
}

.reader-facts { margin: 0; }

.reader-facts div {
  display: grid;
  grid-template-columns: 5.4rem minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.reader-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.reader-facts dd {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.48;
}

.reader-hooks { margin-top: 18px; }
.reader-hooks h3 { margin: 0 0 8px; font-size: 0.9rem; }
.reader-hooks ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.reader-hooks li { display: grid; grid-template-columns: 4.7rem minmax(0, 1fr) auto; gap: 7px; align-items: start; }
.reader-hooks strong { color: var(--brand-strong); font-size: 0.72rem; }
.reader-hooks span { font-size: 0.76rem; line-height: 1.45; }
.reader-hooks small { color: var(--muted); font-size: 0.63rem; }

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 20px;
}

.reader-actions a {
  border: 1px solid var(--brand);
  border-radius: 7px;
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 900;
  padding: 8px 10px;
  text-decoration: none;
}

.reader-official-link { background: var(--brand); color: #fff !important; }
.reader-route { margin: 12px 0 0; color: var(--warning); font-size: 0.67rem; }

body:has(.event-reader[open]) { overflow: hidden; }

@supports not selector(body:has(*)) {
  .event-reader[open] { overscroll-behavior: contain; }
}

.page-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.65rem;
  padding: 10px 2px;
}

@media (max-width: 1200px) {
  .event-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .event-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { min-height: 43px; padding: 5px 8px; }
  .brand small, .issue { display: none; }
  .local-label { display: none; }
  .page-nav a { font-size: 0.6rem; padding-inline: 5px; }
  .page-shell { padding: 7px 6px 48px; }
  .event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .event-compact { min-height: 74px; padding: 6px 7px 7px; }
  .event-compact h2 { font-size: 0.82rem; }
  .compact-meta { gap: 4px; }
  .compact-venue, .compact-access { font-size: 0.72rem; }
  .visual-badge { top: 6px; left: 6px; padding: 3px 6px; font-size: 0.7rem; }
  .compact-access { padding-inline: 5px; }
  .event-reader { width: calc(100% - 12px); max-height: calc(100dvh - 12px); }
  .reader-content { display: block; }
  .reader-figure { padding: 10px; }
  .reader-copy { padding: 16px 14px 20px; }
  .reader-eyebrow, .reader-copy h2 { margin-right: 42px; }
  .reader-facts div { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .reader-hooks li { grid-template-columns: 4.2rem minmax(0, 1fr); }
  .reader-hooks small { grid-column: 2; }
  .page-note { display: block; }
  .page-note span { display: block; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
