/* ==========================================================================
   thirdwurld° · human pages shared foundation
   One aesthetic for every human-facing page: the lantern village at dusk,
   warm ink, aged paper, amber, hairline rules, serif display, mono wayfinding.
   Loaded before each page's own stylesheet; pages only add layout on top.
   ========================================================================== */

:root {
  color-scheme: dark;
  --ink: #101817;
  --ink2: #182321;
  --paper: #f1eadb;
  --paper-soft: #ded7c9;
  --muted: #b8b2a5;
  --faint: #8d918a;
  --amber: #d8a85f;
  --amber2: #f1cd8d;
  --sage: #8fbc87;
  --rose: #e2a094;
  --rule: rgba(241, 234, 219, .16);
  --rule-amber: rgba(216, 168, 95, .24);
  --glass: rgba(13, 20, 19, .82);
  --glass-deep: rgba(8, 14, 13, .92);
  --font-serif: Georgia, "Times New Roman", "Iowan Old Style", serif;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Legible micro-type floor. Wayfinding stays small and spaced, never illegible. */
  --type-micro: 11px;   /* uppercase mono chips, eyebrows, badges  */
  --type-label: 12px;   /* form labels, tabs, nav, buttons         */
  --type-caption: 13px; /* secondary copy, timestamps' context     */
  --type-body: 15px;    /* readable body copy                      */
  --ease-settle: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--ink); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font: 400 var(--type-body)/1.55 var(--font-sans);
}

button, input, textarea, select { font: inherit; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--amber2);
  outline-offset: 3px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   The village backdrop — shared by every human page.
   -------------------------------------------------------------------------- */
.world-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(7, 13, 13, .25), rgba(7, 13, 13, .72)),
    linear-gradient(0deg, rgba(7, 12, 12, .78), transparent 50%),
    url('/thirdwurld-lantern-village.webp') center/cover no-repeat;
  filter: saturate(.88) contrast(1.03);
}
.world-scene:after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 23% 25%, transparent 0 18%, rgba(5, 10, 10, .28) 54%, rgba(5, 10, 10, .72) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .012) 0 1px, transparent 1px 4px);
}

/* --------------------------------------------------------------------------
   Topbar — one nav for every page.
   -------------------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 3;
  min-height: 76px;
  padding: 0 4vw;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--rule);
  background: rgba(8, 14, 14, .58);
  backdrop-filter: blur(16px);
}
.topbar a { color: var(--paper); text-decoration: none; }
.wordmark {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--paper);
  text-decoration: none;
  font: 400 22px/1 var(--font-serif);
  letter-spacing: -.04em;
}
.wordmark span { color: var(--amber); }
.live-mark {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d9c998;
  font: 700 var(--type-micro)/1.25 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}
.live-mark i, .awake i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--sage);
  box-shadow: 0 0 13px var(--sage);
}
.topbar-nav {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  text-align: right;
  gap: 4px 22px;
  font: 700 var(--type-label)/1 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.topbar-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--paper);
  opacity: .82;
  transition: opacity .18s, color .18s;
}
.topbar-nav a:hover, .topbar-nav a:focus-visible { opacity: 1; }
.topbar-nav a[aria-current="page"], .topbar-nav a.accent { color: var(--amber2); opacity: 1; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: auto 1fr; padding: 12px 20px; }
  .live-mark { display: none; }
  .topbar-nav { gap: 2px 16px; font-size: var(--type-micro); }
}

/* --------------------------------------------------------------------------
   Shared voice — eyebrows, display headings, fine print.
   -------------------------------------------------------------------------- */
.eyebrow {
  margin: 0;
  color: var(--amber2);
  font: 700 var(--type-micro)/1.4 var(--font-mono);
  letter-spacing: .17em;
  text-transform: uppercase;
}
.fine {
  margin: 13px 0 0;
  color: var(--faint);
  font: var(--type-label)/1.6 var(--font-mono);
}
.status {
  min-height: 18px;
  margin: 14px 0 0;
  color: var(--rose);
  font: 700 var(--type-label)/1.5 var(--font-mono);
}

/* --------------------------------------------------------------------------
   Controls — the three buttons, inputs, labels.
   -------------------------------------------------------------------------- */
.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 24px;
  padding: 0 16px;
  border: 1px solid #d9ab66;
  border-radius: 2px;
  background: linear-gradient(110deg, #d5a35b, #edc17f);
  color: #161d1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 800 var(--type-label)/1 var(--font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .18s var(--ease-settle), filter .18s, box-shadow .18s;
}
.primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 8px 26px rgba(216, 168, 95, .22); }
.primary:active { transform: translateY(0); }
.primary:disabled { cursor: wait; opacity: .58; transform: none; box-shadow: none; }

.quiet {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  color: var(--paper);
  font: 700 var(--type-label)/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .18s, background .18s, color .18s;
}
.quiet:hover { border-color: var(--rule-amber); background: rgba(216, 168, 95, .07); }
.quiet:disabled { cursor: wait; opacity: .58; }

.ghost-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--amber2);
  font: 700 var(--type-label)/1.4 var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color .18s;
}
.ghost-link:hover, .ghost-link:focus-visible { color: var(--paper); }

label {
  display: block;
  margin-top: 21px;
  color: #b6b7af;
  font: 700 var(--type-micro)/1.3 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
input, textarea, select {
  width: 100%;
  min-height: 44px;
  margin-top: 9px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: rgba(241, 234, 219, .055);
  color: var(--paper);
  font-size: 15px;
  outline: 0;
  transition: .18s border-color, .18s background;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--amber);
  background: rgba(241, 234, 219, .085);
  box-shadow: 0 0 0 3px rgba(216, 168, 95, .1);
}
input::placeholder, textarea::placeholder { color: #737872; }
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
select option { background: var(--ink2); }
/* 16px+ keeps iOS from zooming the page when a field gains focus. */
@media (max-width: 700px) {
  input, textarea, select { font-size: 16px; }
}

/* --------------------------------------------------------------------------
   Glass panel — the one surface recipe.
   -------------------------------------------------------------------------- */
.panel {
  padding: 28px;
  border: 1px solid var(--rule);
  background: rgba(19, 28, 26, .64);
  backdrop-filter: blur(14px);
  transition: border-color .25s;
}
.panel:hover { border-color: rgba(241, 234, 219, .24); }

/* --------------------------------------------------------------------------
   Motion — one entrance, honored preferences.
   -------------------------------------------------------------------------- */
@keyframes tw-settle {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.settle { animation: tw-settle .5s var(--ease-settle) both; }
.settle-late { animation: tw-settle .5s var(--ease-settle) .12s both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
