/* Boat-V English guide (/en/). Dark only, same palette as the Japanese app (tailwind.config.ts).
   Text colors stay at gray-400 (#9ca3af) or brighter: scripts/test-en-pages.mjs checks this.
   The figure rules (.en-fig svg ...) are appended by scripts/build-en-pages.mjs from en-src/figs/*.svg. */
:root {
  color-scheme: dark;
  --en-bg: #0f1419;
  --en-card: #1f2937;
  --en-line: #374151;
  --en-fg: #f3f4f6;
  --en-text: #e5e7eb;
  --en-muted: #9ca3af;
  --en-link: #22d3ee;
  --en-paper: #fbbf24;
  --en-btn: #1e5fd0;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--en-bg); color: var(--en-text); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.en-wrap {
  max-width: 32rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

a { color: var(--en-link); text-underline-offset: 2px; }
a:hover { color: var(--en-fg); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--en-link); outline-offset: 2px; }

.en-header { border-bottom: 1px solid var(--en-line); padding-block: 12px; }
.en-header .en-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.en-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--en-fg); text-decoration: none; }
.en-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.en-nav a { color: var(--en-text); }

main { padding-block: 16px 40px; }
h1 { font-size: 1.6rem; line-height: 1.3; color: var(--en-fg); margin: 16px 0 12px; text-wrap: balance; }
h2 { font-size: 1.2rem; line-height: 1.35; color: var(--en-fg); margin: 32px 0 8px; text-wrap: balance; }
h3 { font-size: 1rem; color: var(--en-fg); margin: 20px 0 4px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 1.3em; }
li + li { margin-top: 4px; }
strong { color: var(--en-fg); }
.en-lead { font-size: 1.05rem; color: var(--en-fg); }
.en-note { color: var(--en-muted); font-size: 14px; }

/* Safety notice: always the first element in <main> */
.en-safety { background: var(--en-card); border: 1px solid var(--en-line); border-left: 4px solid var(--en-paper); border-radius: 6px; padding: 12px 14px; margin-bottom: 8px; }
.en-safety p { margin: 0 0 6px; color: var(--en-fg); }
.en-safety p:last-child { margin-bottom: 0; }

.en-updates { list-style: none; padding: 0; margin: 0 0 12px; }
.en-updates li { padding: 8px 0; border-top: 1px solid var(--en-line); }
.en-updates time { color: var(--en-muted); font-size: 14px; margin-right: 4px; }

.en-cards { display: grid; gap: 12px; margin: 12px 0; }
.en-card { display: block; background: var(--en-card); border: 1px solid var(--en-line); border-radius: 8px; padding: 12px 14px; color: var(--en-text); text-decoration: none; }
.en-card strong { display: block; font-size: 1.05rem; }
.en-card:hover { border-color: var(--en-link); }

/* Racecourse cards (/en/venues/): one block per racecourse, no table, so nothing scrolls sideways */
.en-venue { background: var(--en-card); border: 1px solid var(--en-line); border-radius: 8px; padding: 4px 14px 10px; margin: 12px 0; }
.en-venue h2 { margin: 10px 0 6px; font-size: 1.1rem; }
.en-venue dl { margin: 0; }
.en-venue dt { color: var(--en-muted); font-size: 13px; margin-top: 8px; }
.en-venue dd { margin: 0; }

/* Figures: the figure scrolls inside itself on narrow screens; the page never scrolls sideways. */
.en-fig { margin: 16px 0; overflow-x: auto; background: var(--en-bg); border: 1px solid var(--en-line); border-radius: 8px; padding: 8px; }
.en-fig svg { display: block; width: 100%; min-width: 440px; height: auto; }
.en-fig figcaption { color: var(--en-muted); font-size: 13px; padding: 6px 4px 0; }
@media (max-width: 480px) {
  .en-fig figcaption::after { content: " Swipe sideways to see the whole figure."; }
}

/* Photos of the mark cards (/en/marksheet/): the photo fits the frame width and never scrolls sideways; a click or tap opens the full-size file. */
.en-photo { margin: 16px 0; background: var(--en-bg); border: 1px solid var(--en-line); border-radius: 8px; padding: 8px; }
.en-photo a { display: block; }
.en-photo img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.en-photo figcaption { color: var(--en-muted); font-size: 13px; padding: 6px 4px 0; }
.en-photo figcaption::after { content: "Click or tap the photo to open it full size."; display: block; }
.en-example { background: var(--en-card); border: 1px solid var(--en-line); border-radius: 8px; margin: 10px 0; padding: 0 12px 4px; }
.en-example summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--en-fg); }
.en-example[open] > summary { border-bottom: 1px solid var(--en-line); margin-bottom: 8px; }

.en-footer { border-top: 1px solid var(--en-line); padding-block: 16px 24px; font-size: 14px; color: var(--en-muted); }
.en-footer p { margin: 0 0 8px; }
.en-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; }
.en-footer a { color: var(--en-text); }

#en-consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--en-card); border-top: 1px solid var(--en-line); padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); font-size: 14px; color: var(--en-text); }
#en-consent p { max-width: 32rem; margin: 0 auto 8px; }
.en-consent-buttons { max-width: 32rem; margin: 0 auto; display: flex; gap: 8px; }
/* the fixed banner must not hide the footer links while it is open */
body:has(#en-consent) { padding-bottom: 12rem; }
.en-btn { font: inherit; font-weight: 600; border-radius: 6px; padding: 8px 16px; cursor: pointer; }
.en-btn-yes, .en-btn-no { background: var(--en-btn); color: #ffffff; border: 1px solid var(--en-btn); }

/* Tokens for the inline figures (the figure files carry their own light/dark tokens; the build strips them) */
.en-fig svg {
  --bg: #0f1419; --fg: #f3f4f6; --muted: #9ca3af; --panel: #1f2937; --rail: #9ca3af;
  --accent: #22d3ee; --accent-bg: #12384a; --warm: #f87171; --warn: #fbbf24;
  --stop: #1f2937; --stop-line: #6b7280;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

/* figures (generated by scripts/build-en-pages.mjs) */
.en-fig svg text { fill: var(--fg); font-family: var(--font-body); }
.en-fig svg .sub { fill: var(--muted); }
.en-fig svg .b { font-weight: 700; }
.en-fig svg .acc { fill: var(--accent); font-weight: 700; }
.en-fig svg .warnt { fill: var(--warn); font-weight: 700; }
.en-fig svg .node { fill: var(--panel); stroke: var(--rail); stroke-width: 1.5; }
.en-fig svg .node-hi { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 2; }
.en-fig svg .edge { stroke-width: 2.5; fill: none; }
.en-fig svg .e-a { stroke: var(--accent); }
.en-fig svg .h-a { fill: var(--accent); }
.en-fig svg .e-r { stroke: var(--rail); }
.en-fig svg .h-r { fill: var(--rail); }
.en-fig svg .e-w { stroke: var(--warm); }
.en-fig svg .h-w { fill: var(--warm); }
.en-fig svg .e-m { stroke: var(--muted); stroke-dasharray: 6 5; }
.en-fig svg .h-m { fill: var(--muted); }
.en-fig svg .panel { fill: var(--panel); stroke: var(--rail); stroke-width: 1.2; }
.en-fig svg .ring { stroke: var(--fg); stroke-width: 1.5; }
.en-fig svg .num { font-weight: 700; font-size: 15px; }
.en-fig svg .rail-line { stroke: var(--rail); stroke-width: 6; stroke-dasharray: 2 8; stroke-linecap: butt; fill: none; }
.en-fig svg .stn { fill: var(--panel); stroke: var(--rail); stroke-width: 2; }
.en-fig svg .stop { fill: var(--stop); stroke: var(--stop-line); stroke-width: 1.5; }
.en-fig svg .stop-hi { fill: var(--accent); stroke: var(--accent); stroke-width: 1.5; }
.en-fig svg .stop-hi-num { fill: var(--bg); }
.en-fig svg .halo { fill: none; stroke: var(--accent); stroke-width: 2; }
.en-fig svg .call { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 1.5; }
.en-fig svg .stop-alt { fill: var(--accent-bg); stroke: var(--accent); stroke-width: 2; }
.en-fig svg .stop-alt-num { fill: var(--accent); }
.en-fig svg .call2 { fill: var(--panel); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.en-fig svg .lead-line { stroke: var(--accent); stroke-width: 1.5; fill: none; }
.en-fig svg .walk { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; fill: none; }
.en-fig svg .dot { fill: var(--muted); }
.en-fig svg .accent-text { fill: var(--accent); font-weight: 700; }
