/* Nijo Castle Today — shared styles
   Same layout and type as osakacastletoday.com. Palette taken from Nijo Castle:
   white plaster, black lacquer, the gold fittings of Kara-mon Gate, and the
   deep red used on the map page.
   Class names here avoid the ones used inside /map/ (.pin .stop .list .key .chip
   .bar .sel .note .mapwrap .route .zoom .jump .facts .src .hint). */

:root {
  --plaster: #f7f5f0;
  --paper: #ffffff;
  --ink: #1f1c18;
  --granite: #615a50;
  --rule: #e0dbd0;
  --lacquer: #8e2a20;
  --lacquer-soft: #f6e9e5;
  --gold: #a7822f;
  --quiet: #2f6b3c;
  --moderate: #7a8a3a;
  --busy: #a7822f;
  --very-busy: #9b3a2c;
  --open: #2f6b3c;
  --closed: #9b3a2c;

  --serif: "Shippori Mincho B1", "Hiragino Mincho ProN", Georgia, serif;
  --sans: "Zen Kaku Gothic New", "Hiragino Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 40rem;
  --wide: 60rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--plaster);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--lacquer); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.prose { max-width: var(--measure); }

/* Header */
.site-header { background: var(--ink); color: var(--plaster); padding-top: env(safe-area-inset-top, 0px); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.25rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--plaster); text-decoration: none; }
.brand img { width: 38px; height: 38px; flex: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.2; }
.brand:hover { color: #fff; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-size: 0.95rem; }
.site-nav a { color: #d8d1c4; text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #fff; text-decoration: underline; }

/* Typography */
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(1.9rem, 5vw, 2.8rem); }
h2 { font-family: var(--serif); font-weight: 700; font-size: 1.55rem; margin-top: 3rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin-top: 1.75rem; margin-bottom: 0.4rem; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.2rem; max-width: var(--measure); }
.muted { color: var(--granite); font-size: 0.95rem; }
ul.plain { padding-left: 1.2rem; max-width: var(--measure); }
ul.plain li { margin: 0.3rem 0; }
.jp { font-weight: 400; }

main { padding-bottom: 4rem; }
.page-head { padding: 2.5rem 0 0.5rem; }
.crumbs { font-size: 0.88rem; color: var(--granite); margin: 0 0 0.75rem; }
.crumbs a { color: var(--granite); }

/* Board (the hero on the home page) */
.board { padding: 2.25rem 0 2rem; border-bottom: 1px solid var(--rule); }

/* Today's status card */
.status {
  background: var(--paper); border-radius: 18px; padding: 1.1rem 1.2rem; margin: 1.5rem 0 0; max-width: 40rem;
  box-shadow: 0 0 0 1px rgba(31, 28, 24, 0.06), 0 16px 32px -24px rgba(31, 28, 24, 0.45);
}
.status-date { margin: 0 0 0.4rem; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--granite); }
.status ul { list-style: none; margin: 0; padding: 0; }
.status li { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; align-items: baseline; padding: 0.7rem 0; border-top: 1px solid var(--rule); }
.status li:first-child { border-top: 0; }
.status .what { font-weight: 700; }
.status .state { font-family: var(--serif); font-weight: 800; font-size: 1.35rem; line-height: 1.1; text-align: right; color: var(--state-color, var(--ink)); }
.status .detail { grid-column: 1 / -1; color: var(--granite); font-size: 0.92rem; }
.status .is-open { --state-color: var(--open); }
.status .is-closed { --state-color: var(--closed); }
.status-foot { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--granite); }

/* Crowd score ring (same as osakacastletoday.com) */
.level {
  display: inline-block; font-family: var(--serif); font-weight: 800;
  font-size: clamp(2.2rem, 8vw, 3.4rem); line-height: 1; color: var(--level-color, var(--ink));
}
.level-row { display: flex; align-items: center; gap: 1.1rem; margin-top: 1rem; }
.level-note { margin-top: 0.6rem; color: var(--granite); }
.ring { position: relative; flex: none; width: clamp(4.6rem, 16vw, 6.2rem); aspect-ratio: 1; color: var(--level-color, var(--ink)); }
.ring[hidden] { display: none; }
.ring svg { display: block; width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 8; }
.ring-track { stroke: var(--rule); }
.ring-value { stroke: currentColor; stroke-linecap: round; stroke-dasharray: 270.2; stroke-dashoffset: 270.2; transition: stroke-dashoffset 0.6s ease; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-weight: 800; font-size: clamp(1.6rem, 5.5vw, 2.2rem); line-height: 1; }
@media (prefers-reduced-motion: reduce) { .ring-value { transition: none; } }
.stamp { margin-top: 1rem; font-size: 0.9rem; color: var(--granite); max-width: var(--measure); }

/* Hourly bars */
.hours-strip { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 0.5rem; max-width: var(--wide); }
.hour { flex: 0 0 3.6rem; display: flex; flex-direction: column; align-items: center; font-size: 0.85rem; }
.hour .bar-box { height: 5rem; width: 100%; display: flex; align-items: flex-end; }
.hour .bar-fill { width: 100%; background: var(--level-color, var(--granite)); border-radius: 2px 2px 0 0; }
.hour .t { margin-top: 0.3rem; color: var(--granite); }

/* Weather */
.weather { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.5rem; max-width: var(--measure); }
.weather .now { font-family: var(--serif); font-weight: 800; font-size: 2.4rem; line-height: 1; }
.weather .cond { font-weight: 700; }
.weather ul { list-style: none; margin: 0.75rem 0 0; padding: 0; width: 100%; }
.weather li { display: grid; grid-template-columns: 7rem 1fr auto; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.weather li .r { color: var(--granite); }

/* Tables */
.table-scroll { overflow-x: auto; max-width: var(--wide); }
table { border-collapse: collapse; width: 100%; min-width: 32rem; font-size: 0.98rem; }
table.narrow { min-width: 0; max-width: var(--measure); }
th, td { text-align: left; vertical-align: top; padding: 0.7rem 0.75rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
th { font-weight: 700; border-bottom: 2px solid var(--ink); }
td.num, th.num { white-space: nowrap; }
caption { text-align: left; color: var(--granite); font-size: 0.9rem; padding-bottom: 0.5rem; }

/* Callout */
.callout { max-width: var(--measure); border-left: 4px solid var(--lacquer); padding: 0.25rem 0 0.25rem 1rem; margin: 1.5rem 0; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout-gold { border-left-color: var(--gold); }
.keyfacts { background: var(--paper); border-radius: 14px; padding: 0.9rem 1.1rem; max-width: var(--measure); margin: 1.25rem 0; box-shadow: 0 0 0 1px var(--rule); }
.keyfacts ul { margin: 0; padding-left: 1.2rem; }
.keyfacts li { margin: 0.25rem 0; }

/* Buttons */
.btn { display: inline-block; background: var(--lacquer); color: #fff; text-decoration: none; font-weight: 700; padding: 0.75rem 1.1rem; border-radius: 4px; }
.btn:hover { background: var(--ink); color: #fff; }
.btn-line { background: transparent; color: var(--lacquer); border: 2px solid var(--lacquer); }
.btn-line:hover { background: var(--lacquer); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0 0.75rem; }
.btn-note { font-size: 0.9rem; color: var(--granite); max-width: var(--measure); }
.aff { font-size: 0.85rem; color: var(--granite); max-width: var(--measure); }

/* Map on the home page */
.map-panel {
  background: var(--paper); border-radius: 28px; padding: 1rem; margin: 1rem 0 2rem;
  box-shadow: 0 0 0 1px rgba(31, 28, 24, 0.05), 0 24px 48px -28px rgba(31, 28, 24, 0.35);
}
.map-figure { margin: 0; border-radius: 20px; overflow: hidden; background: #efe9db; }
.map-figure img { width: 100%; }
.spots { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.spot { background: var(--paper); border-radius: 18px; padding: 0.85rem 1rem; box-shadow: 0 0 0 1px rgba(31, 28, 24, 0.08); }
.spot-name { font-weight: 700; display: flex; align-items: center; gap: 0.6rem; }
.spot-no { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; color: #fff; font-size: 0.85rem; flex: none; }
.spot-no.gate { background: #4d453b; }
.spot-no.facility { background: #2f5f8f; }
.spot-no.palace { background: #a3271c; }
.spot-name .jp { color: var(--granite); font-size: 0.9rem; }
.spot p { margin: 0.4rem 0 0 2.3rem; font-size: 0.95rem; color: var(--granite); }
@media (min-width: 56rem) { .spots { grid-template-columns: repeat(3, 1fr); } }
.map-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.9rem 1.5rem; margin-top: 1.1rem; padding: 0 0.4rem 0.3rem; }
.map-foot strong { font-family: var(--serif); font-size: 1.25rem; }
.map-foot p { margin: 0.15rem 0 0; color: var(--granite); max-width: 34rem; }
.map-foot .btn { border-radius: 999px; padding: 0.9rem 1.6rem; background: var(--ink); }
.map-foot .btn:hover { background: var(--lacquer); }

/* Page cards */
.cards { display: grid; gap: 0.8rem; margin: 0.6rem 0 1rem; }
@media (min-width: 40rem) { .cards { grid-template-columns: 1fr 1fr; } }
.card { display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: 14px; background: #fff; color: var(--ink); text-decoration: none; }
.card strong { font-family: var(--serif); font-size: 1.15rem; color: var(--lacquer); }
.card span:last-child { font-size: 0.95rem; }
.card:hover { border-color: var(--lacquer); color: var(--ink); }
.card-tag { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--granite); }

/* Closed-day calendar */
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; list-style: none; margin: 0.5rem 0 1rem; padding: 0; font-size: 0.9rem; }
.cal-legend i { display: inline-block; width: 0.9rem; height: 0.9rem; border-radius: 3px; margin-right: 0.4rem; vertical-align: -2px; }
.cal-months { display: grid; gap: 1.5rem; }
@media (min-width: 48rem) { .cal-months { grid-template-columns: 1fr 1fr; } }
.cal h3 { margin-top: 0; font-family: var(--serif); }
.cal table { min-width: 0; table-layout: fixed; font-size: 0.9rem; }
.cal th { text-align: center; padding: 0.3rem 0; font-size: 0.78rem; color: var(--granite); border-bottom: 1px solid var(--ink); }
.cal td { text-align: center; padding: 0.25rem 0.1rem; border-bottom: 0; height: 3.1rem; vertical-align: top; }
.cal .d { display: block; font-weight: 700; }
.cal .today .d { text-decoration: underline; text-decoration-thickness: 2px; }
.cal .marks { display: flex; justify-content: center; gap: 2px; margin-top: 0.2rem; }
.cal .marks i { width: 0.55rem; height: 0.55rem; border-radius: 2px; }
.c-castle { background: var(--closed); }
.c-nino { background: var(--gold); }
.c-hon { background: #2f5f8f; }
.cal .hol .d { color: var(--lacquer); }

/* FAQ */
.faq details { border-bottom: 1px solid var(--rule); max-width: var(--measure); }
.faq summary { cursor: pointer; padding: 0.85rem 0; list-style-position: outside; }
.faq summary h3 { display: inline; margin: 0; font-size: 1.05rem; }
.faq details p { margin: 0 0 1rem; }
.checked { margin-top: 1rem; font-size: 0.9rem; color: var(--granite); }

/* Update log */
.log { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.log li { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.log time { font-weight: 700; display: block; }

/* Sources line at the end of each page */
.sources { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 0.9rem; color: var(--granite); max-width: var(--measure); }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 3rem; font-size: 0.92rem; color: var(--granite); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-bottom: 1rem; }
.site-footer a { color: var(--granite); }
.site-footer p { max-width: var(--measure); }

@media (prefers-reduced-motion: no-preference) { .hour .bar-fill { transition: height 0.4s ease-out; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
