/* Life Through the Ages: a Qu game. Navy night map, cream text, yellow beacons, Fraunces. */
:root {
  --bg: var(--color-off-white, #F8F9F0);
  --ink: var(--color-navy, #1E3A5F);
  --yellow: var(--color-yellow, #FDE358);
  --night: #0E1C33;
  --sea: #15284A;
  --land: #4F719C;
  --font: "Fraunces", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--night); color: var(--bg); font-family: var(--font); font-weight: 500; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
#app { position: fixed; inset: var(--bar-h, 64px) 0 0 0; }
.loadfail { padding: 40px 20px; text-align: center; }

.stage { position: absolute; inset: 0; display: grid; background: var(--night);
  grid-template-columns: auto 1fr; grid-template-rows: 1fr auto 78px;
  grid-template-areas: "map map" "chips chips" "ctl slider"; }
.hud { grid-area: map; justify-self: start; align-self: start; z-index: 2; }
.era { grid-area: map; align-self: center; justify-self: stretch; z-index: 2; }
.mapwrap { grid-area: map; position: relative; min-height: 0; background: var(--night); overflow: hidden; }
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sea { fill: var(--sea); }
.grat { fill: none; stroke: #fff; stroke-opacity: .05; }
.people { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; }
.blk { fill: var(--land); stroke: var(--land); stroke-width: .7; stroke-linejoin: round; }
.land-n { fill: var(--bg); font-family: var(--font); font-size: 20px; font-weight: 700; letter-spacing: .32em; text-anchor: middle; text-transform: uppercase; paint-order: stroke; stroke: rgba(14, 28, 51, .55); stroke-width: 3px; pointer-events: none; }

/* beacons: civilizations beat like hearts */
.ring { fill: none; stroke: var(--yellow); stroke-width: 1.3; vector-effect: non-scaling-stroke; pointer-events: none; }
.core { fill: var(--yellow); stroke: var(--bg); stroke-width: .7; pointer-events: none; }
.bc { pointer-events: none; }
.hit { fill: transparent; cursor: pointer; outline: none; }
.hit:focus-visible { stroke: var(--bg); stroke-width: 1.6; stroke-dasharray: 3 3; }
.site { cursor: pointer; outline: none; }
.sdot { fill: var(--bg); stroke: var(--night); stroke-width: 1; }
.sring { fill: none; stroke: var(--bg); stroke-width: 1.3; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; animation: sp 2.4s ease-out infinite; }
@keyframes sp { 0% { transform: scale(.7); opacity: .95; } 100% { transform: scale(2.1); opacity: 0; } }
.site:focus-visible .sdot { stroke: var(--yellow); stroke-width: 2; }

/* the big names across the middle */
.era { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 6%; opacity: .16; transition: opacity 1.2s; }
.era-n { font-size: clamp(2.4rem, 11vw, 7.5rem); font-weight: 800; line-height: 1; letter-spacing: -.01em; text-wrap: balance; }
.era-rev { margin-top: .5rem; font-size: clamp(1rem, 2.8vw, 1.7rem); font-weight: 600; }
.era.rev .era-n { color: var(--yellow); }
.era.flash { animation: flash 3.6s ease forwards; }
@keyframes flash { 0% { opacity: 0; transform: scale(.96); } 12% { opacity: 1; transform: none; } 62% { opacity: 1; } 100% { opacity: .16; } }
.era.flash .era-n { text-shadow: 0 2px 24px rgba(14, 28, 51, .8); }

.hud { margin: 10px 14px 0 14px; pointer-events: none; text-shadow: 0 1px 8px rgba(14, 28, 51, .9); }
.hud-row { display: flex; align-items: flex-start; gap: 28px; flex-wrap: wrap; }
.tickets { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; pointer-events: auto; }
.tk { display: flex; flex-direction: column; gap: 1px; padding: 4px 11px 5px; border: 1px solid rgba(248, 249, 240, .28); border-radius: 12px; background: rgba(14, 28, 51, .55); max-width: 270px; text-shadow: none; }
.tk[hidden] { display: none; }
.tk-l { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; opacity: .65; }
.tk b { font-size: .98rem; font-weight: 700; line-height: 1.2; }
.tk-people b { color: #FFD79A; }
.tk-dino b { color: #BFE7C8; }
.tk-hom b { color: #8FE3D6; }
.site.hominin .sdot { fill: #8FE3D6; }
.site.hominin .sring { stroke: #8FE3D6; }
.tk-n { font-size: .72rem; opacity: .6; line-height: 1.25; }
.hud-t { font-size: clamp(1.3rem, 4.4vw, 2rem); font-weight: 700; line-height: 1.1; }
.hud-s { font-size: .95rem; opacity: .85; }
.legend { position: absolute; left: 14px; bottom: 8px; right: 14px; font-size: .78rem; opacity: .72; pointer-events: none; text-shadow: 0 1px 6px rgba(14, 28, 51, .95); }
.zoomout { position: absolute; right: 12px; top: 10px; background: var(--yellow); color: var(--ink); border: 1.5px solid var(--bg); border-radius: 999px; padding: .35rem .9rem; font-weight: 700; cursor: pointer; z-index: 5; }
.zoomout[hidden] { display: none; }

.chips { grid-area: chips; display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; min-height: 46px; align-items: center; background: rgba(255, 255, 255, .04); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; background: transparent; border: 1.5px solid var(--bg); color: var(--bg); border-radius: 999px; padding: .3rem .8rem; font-size: .92rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.civ { border-color: var(--yellow); color: var(--yellow); }
.chip:hover { background: rgba(255, 255, 255, .12); }
.chip-none { opacity: .65; font-size: .92rem; }

.ctl { grid-area: ctl; display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.cb { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--bg); background: transparent; color: var(--bg); font-size: 1.35rem; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; }
.cb.play { background: var(--yellow); color: var(--ink); border-color: var(--yellow); font-size: 1rem; }
.cb:hover { background: rgba(255, 255, 255, .14); }
.cb.play:hover { background: #ffe97a; }

/* the slider: horizontal on a wide screen, vertical on a phone */
.slider { grid-area: slider; position: relative; padding: 0 22px; outline: none; touch-action: none; cursor: pointer; }
.slider:focus-visible .thumb { box-shadow: 0 0 0 4px rgba(253, 227, 88, .5); }
.track { position: absolute; left: 22px; right: 22px; top: 22px; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .2); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); border-radius: 8px; background: var(--yellow); }
.thumb { position: absolute; top: 50%; left: var(--p, 0%); width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--bg); }
.ticks { position: absolute; left: 22px; right: 22px; top: 38px; height: 22px; font-size: .72rem; opacity: .75; }
.ticks span { position: absolute; left: var(--p); transform: translateX(-50%); white-space: nowrap; }
.ticks span:first-child { transform: none; }
.ticks span:last-child { transform: translateX(-100%); }

@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr 76px; grid-template-rows: auto auto auto 1fr auto;
    grid-template-areas: "hud slider" "map slider" "era slider" "chips slider" "ctl slider"; }
  .hud { grid-area: hud; margin: 8px 8px 4px 14px; }
  .hud-row { gap: 12px; }
  .tickets { gap: 8px; margin-top: 2px; }
  .tk { padding: 3px 9px 4px; max-width: 160px; }
  .tk-n { display: none; }
  .tk b { font-size: .85rem; }
  .mapwrap { aspect-ratio: 960 / 500; width: 100%; }
  .era { grid-area: era; align-self: start; padding: 12px 14px 4px; opacity: .95; }
  .era-n { font-size: clamp(1.9rem, 10.5vw, 3rem); }
  .era-rev { font-size: 1.05rem; opacity: .9; }
  .era.flash { animation: none; }
  .chips { flex-wrap: wrap; overflow-x: visible; overflow-y: auto; align-content: flex-start; padding: 10px 14px; gap: 8px; }
  .slider { padding: 14px 0; }
  .track { left: 14px; right: auto; top: 14px; bottom: 14px; width: 8px; height: auto; }
  .fill { width: auto; height: var(--p, 0%); right: 0; bottom: auto; }
  .thumb { top: var(--p, 0%); left: 50%; margin: -13px 0 0 -13px; }
  .ticks { left: 30px; right: 0; top: 14px; bottom: 14px; height: auto; font-size: .68rem; }
  .ticks span { left: 0; top: var(--p); transform: translateY(-50%) !important; }
  .ticks span:first-child { transform: translateY(0) !important; }
  .ticks span:last-child { transform: translateY(-100%) !important; }
  .ctl { padding: 4px 12px 10px; }
  .legend { display: none; }
}

/* card: a sheet that leaves the zoomed map visible */
.card-wrap { position: fixed; inset: var(--bar-h, 64px) 0 0 0; pointer-events: none; z-index: 20; display: flex; align-items: flex-end; justify-content: flex-start; }
.card-wrap[hidden] { display: none; }
.card { pointer-events: auto; position: relative; background: var(--bg); color: var(--ink); width: min(420px, 100%); max-height: 62%; overflow-y: auto; margin: 0 0 14px 14px; padding: 16px 18px 14px; border: 1.5px solid var(--ink); border-radius: 16px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .6); }
.card h2 { margin: 2px 28px 2px 0; font-size: 1.6rem; line-height: 1.1; font-weight: 700; }
.c-when { font-size: .85rem; color: rgba(30, 58, 95, .7); font-weight: 600; }
.c-place { color: rgba(30, 58, 95, .7); margin-bottom: 6px; }
.c-status { margin: 2px 0 6px; font-size: .85rem; font-style: italic; color: rgba(30, 58, 95, .75); }
.c-pop { margin: 6px 0 4px; padding: 7px 10px; border-radius: 10px; background: rgba(253, 227, 88, .45); font-size: .95rem; line-height: 1.3; }
.c-pop span { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(30, 58, 95, .7); }
.card ul { margin: 6px 0; padding-left: 1.1rem; }
.card li { margin: 5px 0; }
.c-src { font-size: .8rem; color: rgba(30, 58, 95, .72); margin: 8px 0 0; }
.c-src a { color: var(--ink); }
.c-src summary { cursor: pointer; } .c-src p { margin: 6px 0 0; line-height: 1.55; }
.close { position: absolute; right: 8px; top: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--yellow); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; }
@media (max-width: 760px) { .card-wrap { right: 76px; } .card { margin: 0 0 8px 8px; max-height: 56%; } }

.intro-wrap { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--night); text-align: center; padding: 20px; transition: opacity .5s; }
.intro-wrap.gone { opacity: 0; pointer-events: none; }
.intro { max-width: 34rem; display: flex; flex-direction: column; align-items: center; gap: 1.6rem; }
.intro h1 { font-size: clamp(2.8rem, 10vw, 5rem); margin: 0; line-height: 1.02; letter-spacing: -.01em; text-wrap: balance; font-weight: 400; }
.intro h1 b { font-weight: 700; }
.intro p { margin: 0; max-width: 24rem; font-size: clamp(1.1rem, 3.6vw, 1.4rem); line-height: 1.4; opacity: .85; text-wrap: balance; }
.pill { display: inline-block; margin-top: .6rem; background: var(--yellow); color: var(--ink); border: 0; border-radius: 999px; padding: .95rem 2.6rem; font-weight: 700; font-size: 1.3rem; cursor: pointer; box-shadow: 0 10px 28px -10px rgba(253, 227, 88, .55); }
.pill:active { transform: translateY(1px); }

html.portal-in::after { content: ""; position: fixed; inset: 0; z-index: 500; pointer-events: none; background: #1E3A5F; clip-path: circle(150vmax at var(--px) var(--py)); animation: portal-out .9s cubic-bezier(.7, 0, .3, 1) .12s forwards; }
@keyframes portal-out { to { clip-path: circle(0 at var(--px) var(--py)); } }
@media (prefers-reduced-motion: reduce) { html.portal-in::after { display: none; } .sring { animation: none; } #zoomg { transition: none; } .era.flash { animation: none; opacity: 1; } }
