/* The interface's whole job is to get out of the way of the sky. Everything is
   low-contrast, thin, and mostly transparent until you reach for it. */

:root {
  --ink: #e7ecf6;
  --dim: #8c9ab4;
  --faint: #5d6b86;
  --line: rgba(150, 175, 215, 0.16);
  --panel: rgba(9, 12, 19, 0.82);
  --accent: #a8c6ee;
  /* Same three faces as avyeni.com, so the two sites read as one hand.
     Display and Text are separate cuts of the same serif: Display has the
     thin strokes that make a heading elegant and a paragraph unreadable, so
     the myths get Text and the titles get Display. */
  --serif: "DM Serif Display", "Iowan Old Style", Palatino, Georgia, serif;
  --serif-text: "DM Serif Text", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #05070c;
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#sky {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  touch-action: none;
  cursor: grab;
}
#sky.dragging { cursor: grabbing; }

/* ---- opening veil ---- */

#veil {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 40%, #0b1020 0%, #04060b 70%);
  padding: 6vh 6vw;
  transition: opacity .9s ease;
}
#veil.gone { opacity: 0; pointer-events: none; }
.veil-inner { max-width: 34rem; text-align: left; }
#veil h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  letter-spacing: -0.02em;
  margin: 0 0 .6rem;
}
.lede {
  font-family: var(--serif-text);
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--accent);
  margin: 0 0 1.1rem;
  line-height: 1.45;
}
.fine {
  font-size: .875rem; line-height: 1.6; color: var(--dim);
  margin: 0 0 1.2rem; max-width: 46ch;
}
.dim { color: #6f7d96; }
#veil-status { font-family: var(--mono); font-size: .78rem; color: #5f6f8c; margin-bottom: 1rem; }
#veil-go {
  font-family: var(--serif); font-size: 1.05rem;
  background: none; color: var(--ink);
  border: 1px solid var(--line); border-radius: 2px;
  padding: .6rem 1.6rem; cursor: pointer;
  transition: background .25s, border-color .25s;
}
#veil-go:hover { background: rgba(140,175,230,.10); border-color: rgba(150,180,230,.4); }

/* ---- hud ---- */

#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: .85rem 1rem; padding-top: max(.85rem, env(safe-area-inset-top));
  pointer-events: none;
  font-size: .8rem;
}
#hud > * { pointer-events: auto; display: flex; gap: .8rem; align-items: center; }
.place { color: var(--dim); font-family: var(--mono); font-size: .74rem; letter-spacing: .02em; }
.clock { color: var(--dim); font-family: var(--mono); font-size: .74rem; }

.glyph {
  background: none; border: 1px solid transparent; color: var(--dim);
  font-size: .95rem; cursor: pointer; padding: .2rem .45rem; border-radius: 2px;
  font-family: var(--mono);
}
.glyph:hover { color: var(--ink); border-color: var(--line); }

/* ---- time ---- */

#timebar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 20;
  width: min(30rem, 92vw);
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 3px;
  backdrop-filter: blur(14px);
  padding: .6rem .8rem;
}
.tb-row { display: flex; align-items: center; gap: .7rem; }
#scrub { flex: 1; }
.tb-rate {
  font-family: var(--mono); font-size: .7rem; color: var(--dim);
  min-width: 8.5rem; text-align: right;
}
.tb-scale { display: flex; gap: .3rem; margin-top: .5rem; justify-content: center; }
.tb-scale button {
  background: none; border: 1px solid transparent; color: #6f7d96;
  font-size: .68rem; font-family: var(--mono); padding: .15rem .5rem;
  border-radius: 2px; cursor: pointer;
}
.tb-scale button.on { color: var(--accent); border-color: var(--line); }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  background: transparent; height: 20px;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 1px; background: var(--line);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); margin-top: -5px; cursor: pointer;
}
input[type=range]::-moz-range-track { height: 1px; background: var(--line); }
input[type=range]::-moz-range-thumb {
  width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--accent); cursor: pointer;
}

/* ---- panels ---- */

#panel, #settings {
  position: fixed; z-index: 30;
  top: 0; right: 0; height: 100%;
  width: min(23rem, 100vw);
  background: var(--panel);
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  padding: 1.4rem 1.4rem 4rem;
  overflow-y: auto;
  font-size: .85rem;
  line-height: 1.6;
}
#panel h2, #settings h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1.5rem;
  margin: 0 0 .1rem; letter-spacing: -0.01em;
}
#panel .gloss {
  font-family: var(--serif-text); font-style: italic; color: var(--accent);
  margin: 0 0 1.1rem; font-size: .95rem;
}
#panel .close, #settings .close {
  position: absolute; top: .9rem; right: 1rem;
  background: none; border: 0; color: var(--dim); font-size: 1.1rem; cursor: pointer;
}
.kv { display: grid; grid-template-columns: 8.5rem 1fr; gap: .1rem .8rem; margin: .9rem 0; }
.kv dt { color: #6f7d96; font-size: .74rem; font-family: var(--mono); }
.kv dd { margin: 0; font-family: var(--mono); font-size: .74rem; }
.myth {
  font-family: var(--serif-text); font-size: .95rem; line-height: 1.65;
  color: #c3cee2; border-left: 1px solid var(--line); padding-left: .9rem; margin: 1.1rem 0;
}
.morph { font-family: var(--mono); font-size: .72rem; color: var(--dim); }
.morph b { color: var(--accent); font-weight: 400; }
h3.sec {
  font-family: var(--mono); font-size: .68rem; font-weight: 400;
  text-transform: uppercase; letter-spacing: .12em; color: #5f6f8c;
  margin: 1.6rem 0 .5rem; border-top: 1px solid var(--line); padding-top: .8rem;
}

.field { display: block; margin: 1.2rem 0; }
.field > span { display: block; font-size: .74rem; color: #6f7d96; margin-bottom: .4rem; font-family: var(--mono); }
.field em { color: var(--accent); font-style: normal; }
.row { display: flex; gap: .5rem; align-items: center; }
input[type=number], select, button.plain {
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  color: var(--ink); border-radius: 2px; padding: .4rem .5rem;
  font-family: var(--mono); font-size: .76rem; width: 100%;
}
#settings button, #panel button {
  background: rgba(255,255,255,.03); border: 1px solid var(--line);
  color: var(--ink); border-radius: 2px; padding: .4rem .7rem;
  font-family: var(--mono); font-size: .72rem; cursor: pointer; white-space: nowrap;
}
#settings button:hover { border-color: rgba(150,180,230,.4); }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: 1.2rem 0; }
.toggles label { font-size: .76rem; color: var(--dim); display: flex; gap: .4rem; align-items: center; cursor: pointer; }
.links { display: flex; gap: 1rem; margin-top: 1.6rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.links a { color: var(--accent); text-decoration: none; font-size: .78rem; border-bottom: 1px solid transparent; }
.links a:hover { border-bottom-color: var(--accent); }
#stats { margin-top: 1.2rem; font-family: var(--mono); font-size: .66rem; line-height: 1.7; }

@media (max-width: 700px) {
  #panel, #settings, #atlas, #about {
    width: 100vw; border-left: 0; border-top: 1px solid var(--line);
    top: auto; bottom: 0; height: 72vh; border-radius: 6px 6px 0 0;
  }
  /* The time bar and a sheet cannot both own the bottom of the screen. */
  body.sheet-open #timebar { opacity: 0; pointer-events: none; }
  #timebar { width: min(30rem, 96vw); transition: opacity .2s; }
  #hud { padding: .7rem .7rem; }
  .hud-right { gap: .55rem; }
  .clock .date { display: none; }
  .place { font-size: .68rem; }
  .daynote { display: none; }
}

/* ---- atlas / about ---- */

#atlas, #about {
  position: fixed; z-index: 30; top: 0; right: 0; height: 100%;
  width: min(26rem, 100vw);
  background: var(--panel); backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  padding: 1.4rem 1.4rem 4rem; overflow-y: auto;
  font-size: .85rem; line-height: 1.62;
}
#atlas h2, #about h2 {
  font-family: var(--serif); font-weight: 400; font-size: 1.5rem;
  margin: 0 0 .1rem; letter-spacing: -.01em;
}
#atlas .gloss, #about .gloss {
  font-family: var(--serif-text); font-style: italic; color: var(--accent);
  margin: 0 0 1.2rem; font-size: .95rem;
}
#atlas .close, #about .close {
  position: absolute; top: .9rem; right: 1rem;
  background: none; border: 0; color: var(--dim); font-size: 1.2rem; cursor: pointer;
}
#about p { color: #b8c4da; margin: 0 0 1rem; }
#about strong { color: var(--ink); font-weight: 500; }
#about em { color: var(--accent); font-style: normal; }
.counts { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .72rem; margin: .4rem 0 1rem; }
.counts th { text-align: right; color: #5f6f8c; font-weight: 400; padding: .18rem .4rem; }
.counts th:first-child { text-align: left; }
.counts td { padding: .18rem .4rem; text-align: right; color: var(--dim); }
.counts td:first-child { text-align: left; color: #7b89a3; }
.counts td:nth-child(2) { color: var(--accent); }
.doers { margin: 0 0 1rem; padding-left: 1.1rem; color: #b8c4da; }
.doers li { margin-bottom: .6rem; }

#atlas-q {
  width: 100%; background: rgba(255,255,255,.04); border: 1px solid var(--line);
  color: var(--ink); border-radius: 2px; padding: .5rem .6rem;
  font-family: var(--mono); font-size: .78rem; margin-bottom: .9rem;
}
#atlas-q::placeholder { color: #55637d; }
.hit {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid rgba(150,175,215,.08);
  padding: .5rem .2rem; color: var(--ink); font: inherit;
}
.hit:hover { background: rgba(140,175,230,.07); }
.hit .n { font-family: var(--serif-text); font-size: .96rem; }
.hit .m { color: var(--dim); font-family: var(--mono); font-size: .68rem; float: right; }
.hit .g { display: block; color: #7b89a3; font-size: .74rem; font-style: italic; }
.atlas-group {
  font-family: var(--mono); font-size: .66rem; text-transform: uppercase;
  letter-spacing: .12em; color: #55637d; margin: 1.2rem 0 .3rem;
}
.daynote { color: #c8a06a; font-family: var(--mono); font-size: .68rem; }

/* ---- privacy, poster, ads ---- */

#privacy {
  position: fixed; z-index: 30; top: 0; right: 0; height: 100%;
  width: min(26rem, 100vw);
  background: var(--panel); backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  padding: 1.4rem 1.4rem 4rem; overflow-y: auto;
  font-size: .85rem; line-height: 1.62;
}
#privacy h2 { font-family: var(--serif); font-weight: 400; font-size: 1.5rem; margin: 0 0 .1rem; }
#privacy .gloss { font-family: var(--serif-text); font-style: italic; color: var(--accent); margin: 0 0 1.2rem; font-size: .95rem; }
#privacy .close { position: absolute; top: .9rem; right: 1rem; background: none; border: 0; color: var(--dim); font-size: 1.2rem; cursor: pointer; }
#privacy p { color: #b8c4da; margin: 0 0 1rem; }

button.wide { width: 100%; text-align: center; padding: .55rem !important; }
#btn-poster[data-busy] { color: var(--accent); }

/* An ad, if there is one, lives inside a reading panel and never over the sky. */
.ad-slot {
  margin: 1.6rem 0 .4rem; padding-top: 1rem;
  border-top: 1px solid var(--line);
  min-height: 0;
}
.ad-slot:empty { display: none; }
.ad-slot .ad-label {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .14em;
  text-transform: uppercase; color: #4d5a72; margin-bottom: .5rem;
}

#ad-consent {
  position: fixed; z-index: 60; left: 1rem; bottom: 1rem;
  width: min(24rem, calc(100vw - 2rem));
  background: var(--panel); backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 3px; padding: 1rem;
  font-size: .8rem; color: var(--dim);
}
#ad-consent p { margin: 0 0 .7rem; line-height: 1.5; }
#ad-consent button {
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  color: var(--ink); border-radius: 2px; padding: .35rem .7rem;
  font-family: var(--mono); font-size: .72rem; cursor: pointer;
}
#ad-consent button:hover { border-color: rgba(150,180,230,.45); }
.clock .solar { color: #6f7d96; }
@media (max-width: 700px) { .clock .solar { display: none; } }

/* The mark, quiet enough not to compete with the sky. */
.wordmark {
  font-family: var(--sans);
  font-size: .66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .26em;
  margin-right: -.26em;
  color: var(--dim);
  text-decoration: none;
  transition: color .2s ease;
}
.wordmark:hover { color: var(--ink); }
/* The negative margin that makes the mark optically flush also pulls the next
   item too close, so the divider carries the gap instead. */
.wordmark + .place::before {
  content: "";
  display: inline-block;
  width: 1px; height: .8em;
  margin-right: .8rem;
  background: var(--line);
  vertical-align: -0.08em;
}
@media (max-width: 700px) { .wordmark { display: none; } }
