/* Modern atlas theme. Geometry continues to use the app's RTL-aware layout. */
:root {
  --panel: rgba(22, 27, 28, .95);
  --panel-border: rgba(211, 196, 161, .18);
  --text: #f4f0e7;
  --text-dim: #b4b8af;
  --accent: #dfc18b;
  --font-ui: "Segoe UI", Arial, sans-serif;
}
body { background: #151a1b; }
#osmap canvas { filter: saturate(.5); }
html[lang="he"] body, html[lang="lh"] body, html[lang="yi"] body { font-family: "Segoe UI", Arial, sans-serif; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { transition: background .18s, border-color .18s, color .18s; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
input:focus-visible, select:focus-visible { outline-offset: 2px; }
* { scrollbar-color: #686b61 transparent; scrollbar-width: thin; }
#hud { padding: 20px; padding-inline-end: 220px; }
#hud-left { gap: 14px; }
#brand { display: flex; align-items: center; gap: 10px; pointer-events: auto; color: var(--text); }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--accent); color: var(--accent); border-radius: 50%; font-size: 24px; }
#app-title { font-family: var(--font-he); font-size: 23px; letter-spacing: -.03em; }
#hud-left #lang-btn { height: 36px; border-radius: 8px; background: #242b2b; font-weight: 500; }
#lang-btn option { background: #202727; }
#hud::before { content: ""; position: fixed; inset: 0 0 auto; height: 82px; z-index: -1; background: #171e1e; border-bottom: 1px solid var(--panel-border); }
#year-box { min-width: 220px; background: transparent; border: 0; box-shadow: none; backdrop-filter: none; padding: 0 12px; }
#year-heb, #year-digits { font-size: 30px; text-shadow: none; font-weight: 500; }
#year-sub { font-size: 10px; margin-top: 3px; }
#era-name { color: var(--text); font-size: 12px; margin-top: 3px; }
#evt-panel, #year-rail, #detail, #entity-detail { box-shadow: 0 12px 36px #0003; }
#evt-panel { top: 100px; bottom: 48px; inset-inline-start: 18px; width: 326px; border-radius: 16px; padding: 16px; }
#searchbox { margin: 0 0 16px; }
#search-input { height: 46px; border-radius: 10px; background-color: #ffffff05; font-size: 13px; }
#search-results { background: #202727; }
#panel-tabs { padding: 4px; background: #0c111155; border: 1px solid var(--panel-border); border-radius: 10px; }
.ptab { min-height: 36px; font-size: 13px; }
.ptab.active { background: var(--accent); color: #202622; box-shadow: 0 2px 8px #0003; }
#triad-hint { font-size: 11px; line-height: 1.6; padding: 4px 2px 12px; }
#evt-panel-head { gap: 8px; margin: 4px 0 14px; }
#evt-panel h2 { font-size: 11px; letter-spacing: .06em; }
#chain-btn { padding: 7px 8px; font-size: 10px; }
.evt-card { padding: 10px 6px; border-radius: 10px; gap: 10px; background: transparent; border-bottom: 1px solid #ffffff0b; margin-bottom: 5px; }
.evt-card:hover, .person-row:hover { background: #ffffff08; }
.evt-card.selected { background: #dfc18b0b; border-color: #dfc18b66; }
.evt-thumb { width: 76px; height: 62px; border: 0; border-radius: 8px; }
.evt-card .dot { width: 5px; height: 5px; box-shadow: none; }
.evt-name { white-space: normal; line-height: 1.45; font-size: 14px; }
.evt-meta { font-size: 11px; line-height: 1.65; margin-top: 4px; }
.person-row { padding-block: 12px; }
#year-rail { top: 100px; bottom: 48px; inset-inline-end: 18px; border: 1px solid var(--panel-border); border-radius: 16px; background: var(--panel); }
#yr-head { top: 12px; gap: 8px; }
#yr-head button, #yr-input { height: 34px; border-radius: 8px; }
#yr-head #play-btn { color: #202622; background: var(--accent); border: 0; }
#yr-head #play-btn.active { background: #c9ac76; color: #141a18; }
#yr-track, #yr-eras { top: 104px; }
#yr-track { width: 8px; background: #dfc18b22; }
#yr-thumb { right: -8px; box-shadow: 0 0 0 5px #dfc18b18; }
#detail, #entity-detail { bottom: 48px; border-radius: 16px; background: #1b2222f5; }
#d-thumb { height: 200px; }
.image-download { display: inline-block; padding: 9px 13px; border: 1px solid #63756e; border-radius: 8px; color: #efcf92; font-size: 12px; text-decoration: none; }
.image-download[hidden] { display: none; }
.image-download:hover { background: #ffffff0d; }
#d-download { margin: 0 18px 12px; }
.person-photo { margin: 0 0 18px; text-align: center; }
.person-photo-image { display: block; width: 100%; height: 240px; object-fit: contain; border-radius: 10px; background: #101916; }
.person-photo figcaption { margin: 8px 0; color: #b8c5bd; font-size: 11px; }
#d-art-note { margin: -6px 18px 12px; color: var(--muted, #667571); font-size: 11px; }
#d-title { font-family: var(--font-he); font-size: 28px; line-height: 1.2; margin-block: 8px; }
#d-desc { font-size: 14px; line-height: 1.85; }
#d-close, #ed-close, #d-share { width: 36px; height: 36px; display: grid; place-items: center; background: #121a1aeb; color: var(--text); border: 1px solid var(--panel-border); border-radius: 50%; z-index: 3; }
#d-share { inset-inline-end: 52px; top: 8px; }
#detail:not(.open), #entity-detail:not(.open) { visibility: hidden; }
#controls { bottom: 48px; gap: 6px; }
#controls button { width: 40px; height: 40px; border-radius: 10px; background: #1b2222f5; }
#footer { background: #171e1e; border-top: 1px solid var(--panel-border); font-size: 10px; }
#intro { background: #101717e8; backdrop-filter: blur(14px); padding: 28px; overflow-y: auto; }
#intro.hidden { visibility: hidden; }
#intro-card { display: grid; grid-template-columns: 1fr 1.08fr; width: min(1060px, 100%); max-width: 1060px; margin: auto; padding: 0; overflow: hidden; text-align: start; background: #1b2322; border-radius: 22px; box-shadow: 0 40px 140px #0008; }
.intro-art { position: relative; min-height: 590px; background: linear-gradient(180deg, #0e1b1b05 45%, #0c191be6), url('../assets/thumbs/yam_suf.jpg?v=2026-09-09-realism1') center / cover; }
.art-coordinate, .art-caption { position: absolute; left: 28px; right: 28px; direction: ltr; color: #f4ecd9; letter-spacing: .13em; font: 10px/1.8 var(--font-ui); }
.art-coordinate { top: 28px; }
.art-caption { bottom: 28px; }
.intro-copy { padding: 54px 46px 36px; align-self: center; }
#intro-lang { color: var(--text-dim); background: #202727; border: 1px solid var(--panel-border); border-radius: 8px; padding: 7px 10px; font: 12px var(--font-ui); margin-bottom: 24px; }
.eyebrow { color: var(--accent); font-size: 10px; letter-spacing: .18em; margin-bottom: 22px; text-transform: uppercase; }
#intro-title { font-size: clamp(42px, 4.8vw, 64px); color: var(--text); font-weight: 400; line-height: 1.04; letter-spacing: -.035em; text-shadow: none; }
#intro-sub { color: var(--accent); font-size: 17px; line-height: 1.55; margin: 20px 0; }
#intro-card p { font-size: 13px; line-height: 1.8; }
#intro-p2 { font-size: 12px !important; }
.intro-stats { display: flex; justify-content: space-between; gap: 18px; padding: 20px 0; margin: 22px 0 24px; border-block: 1px solid var(--panel-border); }
.intro-stats span { color: var(--text-dim); font-size: 11px; }
.intro-stats b { display: block; font: 28px/1.3 Georgia, serif; color: var(--text); margin-bottom: 4px; }
#intro-actions { justify-content: flex-start; gap: 10px; }
#intro-begin, #intro-play { min-height: 46px; border-radius: 8px; padding: 12px 17px; font-size: 13px; }
#intro-begin { box-shadow: none; background: var(--accent); }
#intro-play { color: var(--text); border-color: var(--panel-border); background: #ffffff05; }
#intro-links { margin-top: 24px; font-size: 11px; }
@media (min-width: 901px) { #year-box { top: 10px; left: 54%; } }
@media (min-width: 901px) and (max-width: 1150px) { #evt-panel { width: 280px; } #app-title { font-size: 18px; } #hud-left { gap: 8px; } #year-box { left: 55%; } }
@media (max-width: 900px) {
  #hud { padding: 12px; gap: 12px; }
  #hud::before { height: 66px; }
  #brand { display: none; }
  #hud-left #searchbox { margin: 0; }
  #search-input { height: 40px; background-color: #202727; }
  #year-box { min-width: 190px; padding: 10px 16px; background: #172020ed; border: 1px solid var(--panel-border); border-radius: 12px; }
  #year-heb, #year-digits { font-size: 27px; }
  #evt-panel { top: 72px; bottom: calc(84px + env(safe-area-inset-bottom)); left: 10px; right: auto; inset-inline-start: auto; width: min(340px, calc(100vw - 20px)); z-index: 16; }
  #evt-panel:not(.open), #year-rail:not(.open) { visibility: hidden; }
  #year-rail { top: 72px; right: 10px; left: auto; inset-inline-end: auto; bottom: calc(84px + env(safe-area-inset-bottom)); }
  #detail, #entity-detail { bottom: calc(84px + env(safe-area-inset-bottom)); max-height: 55dvh; inset-inline: 10px; }
  #d-thumb { height: 150px; }
  #bottom-nav { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 58px; border: 1px solid var(--panel-border); border-radius: 16px; background: #172020f5; box-shadow: 0 8px 30px #0004; }
  #bottom-nav #bn-play { flex: .8; margin: 7px 0; background: var(--accent); color: #18211e; border-radius: 11px; }
  #mini-card { bottom: calc(80px + env(safe-area-inset-bottom)); background: #172020f5; border-radius: 14px; }
  #bn-menu-pop.open { bottom: calc(80px + env(safe-area-inset-bottom)); background: #202727; }
  #intro { padding: 16px; }
  #intro-card { grid-template-columns: 1fr; max-width: 560px; border-radius: 18px; }
  .intro-art { min-height: 180px; height: 23vh; background-position: center 55%; }
  .art-coordinate { top: 16px; }
  .art-caption { bottom: 14px; }
  .intro-copy { padding: 26px; }
  .eyebrow { margin-bottom: 12px; font-size: 9px; }
  #intro-title { font-size: 42px; }
  #intro-sub { margin: 12px 0; font-size: 15px; }
  #intro-p2 { display: none; }
  .intro-stats { margin: 16px 0; padding: 12px 0; }
  .intro-stats b { font-size: 24px; }
  #intro-actions > button { flex: 1; }
  #intro-links { margin-top: 18px; }
}
/* Compact header; the time rail occupies the full available screen height. */
@media (min-width: 901px) {
  #hud { height: 48px; padding: 6px 18px; padding-inline-end: 202px; align-items: center; }
  #hud::before { height: 48px; }
  #brand { gap: 8px; }
  .brand-mark { width: 28px; height: 28px; font-size: 19px; }
  #app-title { font-size: 19px; }
  #hud-left #lang-btn { height: 30px; }
  #year-box { top: 5px; min-width: 0; padding: 0; }
  #year-heb, #year-digits { font-size: 21px; }
  #year-sub { display: none; }
  #era-name { font-size: 10px; margin-top: 0; }
  #evt-panel { top: 60px; }
  #year-rail { top: 0; bottom: 26px; inset-inline-end: 0; border-radius: 0; }
  #yr-head { top: 8px; gap: 5px; }
  #yr-track, #yr-eras { top: 88px; }
}
@media (max-width: 900px) {
  #hud { padding: 6px 10px; gap: 0; }
  #hud::before { height: 52px; }
  #year-box { display: none; } /* Current year remains in the timeline and event card. */
  #year-heb, #year-digits { font-size: 20px; }
  #year-sub { display: none; }
  #era-name { font-size: 10px; margin-top: 0; }
  #year-rail { top: 0; right: 0; bottom: calc(78px + env(safe-area-inset-bottom)); border-radius: 0; }
  #yr-head { top: max(8px, env(safe-area-inset-top)); }
  #yr-track, #yr-eras { top: calc(96px + env(safe-area-inset-top)); }
  #evt-panel { top: 60px; }
}
#yr-close { display: none; }
@media (max-width: 900px) {
  #hud { height: 56px; padding: 8px 12px; background: #172020; }
  #hud::before { display: none; }
  #hud-left { min-width: 0; }
  #hud-left #lang-btn { flex: 0 0 88px; width: 88px; height: 40px; }
  #hud-left #searchbox { min-width: 0; }
  #search-input { width: 100%; font-size: 14px; }
  #evt-panel { top: 56px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 0; right: 0; width: auto; border-radius: 0; background: #1b2322; padding: 16px; }
  #year-rail { top: 0; bottom: calc(76px + env(safe-area-inset-bottom)); left: 0; right: 0; width: auto; background: #1b2322; z-index: 30; border: 0; box-shadow: none; }
  #yr-close { display: block; position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border: 1px solid var(--panel-border); border-radius: 10px; background: #27322f; color: var(--text); font-size: 26px; cursor: pointer; }
  #year-rail { touch-action: pan-y; }
  #yr-track { touch-action: none; }
  #yr-head { top: max(10px, env(safe-area-inset-top)); left: 16px; right: 68px; gap: 8px; }
  #yr-head button, #yr-input { height: 44px; font-size: 15px; }
  #yr-head #yr-minus, #yr-head #yr-plus { width: 44px; }
  #yr-track { top: calc(124px + env(safe-area-inset-top)); bottom: 24px; right: 48px; }
  #yr-eras { top: calc(118px + env(safe-area-inset-top)); bottom: 16px; left: 16px; right: 104px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; pointer-events: auto; touch-action: pan-y; overscroll-behavior: contain; padding: 0 3px; }
  #yr-eras .yr-span { display: none; }
  #yr-eras .yr-era { position: static; transform: none; flex: 0 0 auto; min-height: 44px; max-width: none; width: 100%; white-space: normal; overflow: visible; text-align: start; font-size: 13px; line-height: 1.4; padding: 10px 12px; border: 1px solid #ffffff12; border-radius: 8px; background: #ffffff04; }
  #yr-eras .yr-era::after { display: none; }
  #yr-eras .yr-era.cur { background: #dfc18b18; border-color: #dfc18b88; }
  #detail, #entity-detail { top: 56px; bottom: calc(76px + env(safe-area-inset-bottom)); left: 0; right: 0; width: auto; max-height: none; border-radius: 0; background: #1b2322; z-index: 22; }
  #d-thumb { height: min(30dvh, 240px); }
  #bottom-nav { left: 0; right: 0; bottom: 0; height: calc(76px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-radius: 0; background: #172020; z-index: 40; box-shadow: 0 -4px 20px #0003; }
  #mini-card { bottom: calc(88px + env(safe-area-inset-bottom)); }
  body:has(#evt-panel.open) #mini-card,
  body:has(#year-rail.open) #mini-card,
  body:has(#detail.open) #mini-card,
  body:has(#entity-detail.open) #mini-card { visibility: hidden; pointer-events: none; }
  body:has(#evt-panel.open) #detail,
  body:has(#evt-panel.open) #entity-detail,
  body:has(#year-rail.open) #detail,
  body:has(#year-rail.open) #entity-detail { visibility: hidden; pointer-events: none; }
  body:has(#year-rail.open) #hud { visibility: hidden; }
}
/* One year input, no header; playback and language live with map controls. */
#hud { display: none; }
#year-box, #yr-thumb-year { display: none; }
#controls #yr-transport { display: flex; gap: 6px; }
#controls { z-index: 30; }
#controls #play-btn { width: auto; min-width: 86px; padding: 0 12px; background: var(--accent); color: #172020; }
#controls #lang-btn { width: 108px; height: 40px; border: 1px solid var(--panel-border); border-radius: 10px; background: #1b2322; color: var(--text); }
#mobile-counter { display: none; }
@media (min-width: 901px) {
  #evt-panel { top: 10px; }
  #yr-head { top: 10px; }
  #yr-track, #yr-eras { top: 62px; }
}
@media (max-width: 900px) {
  #mobile-counter { display: block; position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 18; width: 176px; padding: 6px; border: 1px solid var(--panel-border); border-radius: 12px; background: #172020; box-shadow: 0 4px 16px #0003; }
  #mobile-counter:empty { display: none; }
  #mobile-counter #yr-jump { gap: 5px; }
  #mobile-counter #yr-input { height: 40px; font-size: 17px; color: var(--accent); }
  #mobile-counter button { width: 36px; height: 40px; flex: none; border: 1px solid var(--panel-border); border-radius: 8px; background: #27322f; color: var(--text); font-size: 18px; }
  #evt-panel, #detail, #entity-detail { top: 0; }
  #evt-panel #searchbox { margin-bottom: 12px; }
  #evt-panel #search-input { height: 44px; }
  #yr-track { top: calc(80px + env(safe-area-inset-top)); }
  #yr-eras { top: calc(74px + env(safe-area-inset-top)); }
  #bn-menu-pop #lang-btn { display: block; margin: 12px; padding: 10px; width: calc(100% - 24px); background: #27322f; color: var(--text); border: 1px solid var(--panel-border); border-radius: 8px; }
  body:has(#intro:not(.hidden)) #mobile-counter,
  body:has(#evt-panel.open) #mobile-counter,
  body:has(#detail.open) #mobile-counter,
  body:has(#entity-detail.open) #mobile-counter { visibility: hidden; }
}
/* The editable year is the visual anchor of the time controls. */
#yr-head #yr-input, #mobile-counter #yr-input {
  height: 50px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -.04em;
  color: #172020;
  background: #d9bd88;
  border: 1px solid #e5cc9d;
  border-radius: 10px;
  box-shadow: none;
  caret-color: #172020;
}
#yr-head #yr-input:focus, #mobile-counter #yr-input:focus {
  outline: 2px solid #ffe7b7;
  outline-offset: 3px;
}
@media (min-width: 901px) {
  #yr-track, #yr-eras { top: 90px; }
}
@media (max-width: 900px) {
  #mobile-counter { width: min(220px, calc(100vw - 24px)); padding: 6px; border-color: #dfc18b55; box-shadow: 0 4px 16px #0003; }
  #mobile-counter #yr-input { font-size: 30px; }
  #yr-track { top: calc(96px + env(safe-area-inset-top)); }
  #yr-eras { top: calc(90px + env(safe-area-inset-top)); }
}
#language-control { position: relative; display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border: 1px solid var(--panel-border); border-radius: 10px; background: #1b2322; color: var(--accent); }
#language-control svg { width: 23px; height: 23px; pointer-events: none; }
#language-control:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
#language-control:hover { background: #303d37; }
#language-control #lang-btn { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
@media (max-width: 900px) { #language-control { margin-inline: 4px; background: transparent; border-color: transparent; } }
@media (min-width: 901px) {
  #events-btn { display: none; }
}
#yr-head #yr-input { height: 34px; }
@media (max-width: 900px) {
  #yr-head #yr-input { height: 44px; }
  #mobile-counter #yr-input { height: 40px; }
}
@media (max-width: 900px) {
  #language-control { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 12px; left: auto; margin: 0; background: #172020; border: 1px solid var(--panel-border); box-shadow: 0 3px 12px #0003; }
  #language-control { z-index: 45; }
  #mobile-counter { left: 12px; transform: none; width: min(220px, calc(100vw - 80px)); }
  #yr-close { left: 12px; right: auto; }
  #yr-head { left: 68px; right: 68px; }
  #yr-head #yr-minus, #yr-head #yr-plus { width: 32px; }
  #bottom-nav #bn-play { position: absolute; left: 50%; top: -26px; transform: translateX(-50%); width: 60px; height: 60px; margin: 0; border-radius: 50%; border: 4px solid #172020; box-shadow: 0 4px 14px #0004; font-size: 22px; }
  #bottom-nav #bn-speed { position: absolute; left: 50%; top: 34px; transform: translateX(-50%); width: 60px; height: 38px; font-size: 13px; }
  #bottom-nav #bn-left, #bottom-nav #bn-menu, #bottom-nav #bn-right { position: absolute; top: 14px; width: 44px; height: 48px; }
  #bottom-nav #bn-left { left: 16px; }
  #bottom-nav #bn-menu { right: 72px; }
  #bottom-nav #bn-right { right: 16px; }
  #mini-card { bottom: calc(112px + env(safe-area-inset-bottom)); }
  #evt-panel, #year-rail, #detail, #entity-detail { bottom: calc(106px + env(safe-area-inset-bottom)); }
  body:has(#intro:not(.hidden)) #language-control { visibility: hidden; }
}
#mobile-header, #mobile-menu-backdrop { display: none; }
@media (max-width: 900px) {
  #mobile-header { display: grid; grid-template-columns: 44px minmax(0, 220px) 44px; align-items: center; justify-content: space-between; gap: 8px; position: fixed; top: 0; left: 0; right: 0; height: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; z-index: 50; background: #172020; border-bottom: 1px solid var(--panel-border); direction: ltr; }
  #mobile-header #bn-menu { grid-column: 1; grid-row: 1; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); cursor: pointer; }
  #mobile-header #bn-menu svg { width: 24px; height: 24px; }
  #mobile-header #mobile-counter { grid-column: 2; grid-row: 1; position: static; transform: none; width: 100%; padding: 0; border: 0; box-shadow: none; visibility: visible; }
  #mobile-header #language-control { grid-column: 3; grid-row: 1; position: relative; top: auto; right: auto; left: auto; box-shadow: none; border: 0; }
  #mobile-header #yr-input { height: 40px; font-size: 28px; }
  #mobile-header #mobile-counter button { width: 30px; }
  #evt-panel, #detail, #entity-detail, #year-rail { top: calc(64px + env(safe-area-inset-top)); }
  #year-rail #yr-close { top: 10px; left: 12px; }
  #year-rail #yr-track { top: 72px; }
  #year-rail #yr-eras { top: 66px; }
  #bn-menu-pop.open { top: calc(64px + env(safe-area-inset-top)); bottom: 0; left: 0; right: auto; width: min(290px, 85vw); min-width: 0; transform: none; border-radius: 0; padding: 18px 0; z-index: 48; background: #1b2322; overflow-y: auto; }
  #bn-menu-pop a { text-align: start; padding: 15px 20px; font-size: 16px; }
  body:has(#bn-menu-pop.open) #mobile-menu-backdrop { display: block; position: fixed; inset: 64px 0 0; z-index: 47; background: #0008; }
  body:has(#intro:not(.hidden)) #mobile-header { visibility: hidden; pointer-events: none; }
  body:has(#intro:not(.hidden)) #mobile-header * { visibility: hidden; }
}
@media (max-width: 900px) {
  #evt-panel, #year-rail { bottom: calc(76px + env(safe-area-inset-bottom)); }
  #bottom-nav { z-index: 40; overflow: visible; }
  #bottom-nav #bn-play { z-index: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
