/* ==========================================================================
   THE RUSTED DAWN — Tribe of the Wasteland
   Design system: scorched soot browns, oxide rust, bone, a trace of patina.
   Display: Allerta Stencil  ·  Body: IBM Plex Sans
   Utility: IBM Plex Mono    ·  Field notes: Special Elite
   ========================================================================== */

:root {
  --soot:   #16100b;   /* deepest background — burnt brown-black, never pure black */
  --char:   #241a12;   /* raised panels */
  --char-2: #2f2218;   /* card surfaces */
  --rust:   #8c2f0d;   /* oxide red — borders, stamps */
  --ember:  #c9531a;   /* hot accent */
  --dawn:   #e8762c;   /* the rising sun — links, highlights */
  --gold:   #e9a23b;   /* sun core */
  --bone:   #e8dfcb;   /* primary text */
  --ash:    #a4977f;   /* secondary text */
  --patina: #6e8f7c;   /* oxidized copper — used sparingly (status, hover) */
  --line:   rgba(140, 47, 13, 0.45);

  --font-display: 'Allerta Stencil', 'Arial Black', sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --font-type: 'Special Elite', 'Courier New', monospace;

  --max: 1100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--soot);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* film grain over everything — the desert gets into the lens */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 999;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }

a { color: var(--dawn); text-decoration: none; }
a:hover { color: var(--gold); }
a:focus-visible, button:focus-visible {
  outline: 2px dashed var(--dawn);
  outline-offset: 3px;
}

::selection { background: var(--rust); color: var(--bone); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- type scale ---------- */

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.05; text-transform: uppercase; }

h1 { font-size: clamp(2.8rem, 9vw, 6.5rem); letter-spacing: 0.02em; }
h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); color: var(--bone); }
h3 { font-size: 1.15rem; letter-spacing: 0.08em; color: var(--dawn); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ember);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.eyebrow::before {
  content: '';
  width: 34px; height: 1px;
  background: var(--rust);
}

.lead { font-size: 1.2rem; color: var(--ash); max-width: 62ch; }

/* ---------- header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(22, 16, 11, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.wordmark:hover { color: var(--bone); }
.wordmark .mark { width: 26px; height: 26px; flex: none; border-radius: 50%; object-fit: cover; }
.wordmark em { font-style: normal; color: var(--dawn); }

.nav {
  display: flex;
  gap: 6px;
}
.nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ash);
  padding: 8px 14px;
  border: 1px solid transparent;
}
.nav a:hover { color: var(--bone); border-color: var(--line); }
.nav a[aria-current="page"] {
  color: var(--dawn);
  border-color: var(--rust);
  background: rgba(140, 47, 13, 0.12);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rust);
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  padding: 8px 12px;
  cursor: pointer;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: var(--char);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 20px;
    display: none;
  }
  .nav.open { display: flex; }
}

/* ---------- hero (home) ---------- */

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  /* generated sky: ember glow on the horizon, near-black above to seat the sigil art */
  background:
    radial-gradient(ellipse 85% 45% at 50% 100%, rgba(140, 47, 13, 0.45), transparent 70%),
    linear-gradient(180deg, #060404 0%, #0b0705 55%, #1a110b 100%);
}

.hero-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* pulsing ember halo behind the sigil */
.hero-sky::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(115vmin, 980px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(233, 162, 59, 0.20), rgba(201, 83, 26, 0.10) 45%, transparent 68%);
  animation: pulse 7s ease-in-out infinite;
}

/* the tribe sigil, feathered into the dark sky */
.hero-sigil {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(80vmin, 660px);
  transform: translate(-50%, -50%);
  -webkit-mask-image: radial-gradient(circle closest-side, #000 72%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 72%, transparent 100%);
  filter: drop-shadow(0 0 70px rgba(201, 83, 26, 0.3));
  animation: sigil-rise 3.5s ease-out both;
}

.hero-scrapline {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 90px 0 110px;
  width: 100%;
}

.hero h1 {
  color: var(--bone);
  text-shadow: 0 4px 30px rgba(0,0,0,0.6);
}
.hero h1 .burn { color: var(--dawn); }

.hero .tagline {
  font-family: var(--font-type);
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  color: var(--ash);
  margin-top: 18px;
  max-width: 54ch;
}

.hero-actions { margin-top: 36px; display: flex; gap: 16px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 14px 26px;
  border: 1px solid var(--rust);
  color: var(--bone);
  background: rgba(140, 47, 13, 0.18);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  display: inline-block;
}
.btn:hover { background: rgba(201, 83, 26, 0.32); color: var(--bone); transform: translateY(-2px); }
.btn.ghost { border-color: rgba(232, 223, 203, 0.25); background: transparent; }
.btn.ghost:hover { border-color: var(--bone); }

/* sunrise animation */
@keyframes sigil-rise {
  from { transform: translate(-50%, -44%); opacity: 0.4; }
  to   { transform: translate(-50%, -50%); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-sigil, .hero-sky::before { animation: none; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---------- page banner (interior pages) ---------- */

.banner {
  position: relative;
  padding: 84px 0 56px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse 90% 120% at 50% 130%, rgba(201, 83, 26, 0.22), transparent 60%),
    var(--soot);
}
.banner h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
.banner .lead { margin-top: 14px; }

/* ---------- sections ---------- */

section.block { padding: 88px 0; }
section.block + section.block { border-top: 1px solid rgba(140, 47, 13, 0.25); }
section.alt { background: var(--char); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 860px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- creed / codes ---------- */

.creed-list { list-style: none; counter-reset: creed; margin-top: 8px; }
.creed-list li {
  counter-increment: creed;
  padding: 22px 0 22px 70px;
  position: relative;
  border-bottom: 1px dashed rgba(164, 151, 127, 0.25);
}
.creed-list li::before {
  content: counter(creed, decimal-leading-zero);
  position: absolute;
  left: 0; top: 18px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--rust);
}
.creed-list strong { display: block; font-family: var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.85rem; color: var(--dawn); margin-bottom: 4px; }
.creed-list span { color: var(--ash); font-size: 0.98rem; }

/* ---------- stat stamps ---------- */

.stamps { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 40px; }
.stamp {
  border: 2px solid var(--rust);
  padding: 14px 22px;
  transform: rotate(-1.2deg);
  background: rgba(140, 47, 13, 0.08);
}
.stamp:nth-child(2n) { transform: rotate(0.8deg); }
.stamp .num { font-family: var(--font-display); font-size: 1.7rem; color: var(--dawn); display: block; line-height: 1; }
.stamp .lbl { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ash); }

/* ---------- lore: recovered pages ---------- */

.logbook { max-width: 760px; }

.log-entry {
  background: var(--char-2);
  border: 1px solid rgba(164, 151, 127, 0.18);
  border-left: 4px solid var(--rust);
  padding: 36px 40px;
  margin-bottom: 42px;
  position: relative;
  box-shadow: 0 14px 40px rgba(0,0,0,0.35);
}
.log-entry::before {
  content: attr(data-stamp);
  position: absolute;
  top: -14px; right: 22px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--soot);
  background: var(--ember);
  padding: 5px 12px;
}
.log-entry h3 { margin-bottom: 6px; }
.log-entry .log-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--ash);
  text-transform: uppercase;
  margin-bottom: 18px;
}
.log-entry p { font-family: var(--font-type); color: var(--bone); font-size: 1.02rem; line-height: 1.85; }
.log-entry p + p { margin-top: 16px; }

blockquote.war-cry {
  border: none;
  margin: 70px auto;
  max-width: 700px;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  text-transform: uppercase;
  color: var(--dawn);
  line-height: 1.35;
}
blockquote.war-cry footer {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--ash);
}

/* ---------- members: salvage manifest ---------- */

.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 26px; margin-top: 44px; }

.tag-card {
  background: var(--char-2);
  border: 1px solid rgba(164, 151, 127, 0.2);
  padding: 26px 26px 22px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}
.tag-card:hover { transform: translateY(-4px); border-color: var(--rust); }

/* rivet corners */
.tag-card::before, .tag-card::after,
.tag-card .rivet-a, .tag-card .rivet-b {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c8b89a, #5a4a36 70%);
}
.tag-card::before { top: 8px; left: 8px; }
.tag-card::after  { top: 8px; right: 8px; }
.tag-card .rivet-a { bottom: 8px; left: 8px; }
.tag-card .rivet-b { bottom: 8px; right: 8px; }

.tag-card .callsign {
  font-family: var(--font-display);
  font-size: 1.5rem;
  text-transform: uppercase;
  color: var(--bone);
  line-height: 1.1;
}
.tag-card .role {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--dawn);
  margin: 8px 0 16px;
}
.tag-card .bio { color: var(--ash); font-size: 0.94rem; line-height: 1.65; }

.tag-card .meta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed rgba(164, 151, 127, 0.25);
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ash);
}
.tag-card .meta .ok { color: var(--patina); }

/* vacant slots on the roster */
.tag-card.empty {
  border-style: dashed;
  border-color: rgba(140, 47, 13, 0.5);
  background: rgba(47, 34, 24, 0.45);
}
.tag-card.empty .callsign { color: var(--ash); }
.tag-card.empty::before, .tag-card.empty::after,
.tag-card.empty .rivet-a, .tag-card.empty .rivet-b { opacity: 0.35; }

/* ---------- gallery: year tabs ---------- */

.year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.year-tabs [role="tab"] {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 12px 20px;
  border: 2px solid rgba(140, 47, 13, 0.5);
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  transform: rotate(-0.6deg);
}
.year-tabs [role="tab"]:nth-child(2n) { transform: rotate(0.5deg); }
.year-tabs [role="tab"]:hover { color: var(--bone); border-color: var(--rust); }
.year-tabs [role="tab"][aria-selected="true"] {
  color: var(--dawn);
  border-color: var(--rust);
  background: rgba(140, 47, 13, 0.14);
}

/* ---------- gallery: lightbox ---------- */

.photo .frame a.zoom { display: block; width: 100%; height: 100%; cursor: zoom-in; }

dialog.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(94vw, 1200px);
  overflow: visible;
  /* the global `* { margin: 0 }` reset kills the UA's centering margin — restore it */
  margin: auto;
}
dialog.lightbox::backdrop {
  background: rgba(13, 9, 5, 0.93);
}

.lb-frame {
  background: #d9d2bf;
  padding: 14px 14px 52px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7);
  position: relative;
}
.lb-img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  margin: 0 auto;
  object-fit: contain;
}
.lb-caption {
  position: absolute;
  bottom: 14px; left: 18px; right: 18px;
  font-family: var(--font-type);
  font-size: 0.95rem;
  color: #4a3c2c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-btn {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone);
  background: rgba(22, 16, 11, 0.85);
  border: 1px solid var(--rust);
  padding: 10px 16px;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(140, 47, 13, 0.5); }
.lb-close { top: 18px; right: 18px; }
.lb-prev, .lb-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.6rem;
  line-height: 1;
  padding: 12px 18px;
}
.lb-prev { left: 14px; }
.lb-next { right: 14px; }

@media (max-width: 600px) {
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
  .lb-img { max-height: 70vh; }
}

/* ---------- gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 30px;
  margin-top: 44px;
}

.photo {
  background: #d9d2bf;
  padding: 12px 12px 46px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.45);
  transform: rotate(-1.4deg);
  position: relative;
  transition: transform 0.25s;
}
.photo:nth-child(2n) { transform: rotate(1.1deg); }
.photo:nth-child(3n) { transform: rotate(-0.6deg); }
.photo:hover { transform: rotate(0deg) scale(1.03); z-index: 2; }

/* strip of gaffer tape */
.photo::before {
  content: '';
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 90px; height: 24px;
  background: rgba(110, 143, 124, 0.55);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25);
}

.photo .frame {
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(ellipse at 50% 110%, rgba(201, 83, 26, 0.5), transparent 65%),
    linear-gradient(180deg, #2c2117, #161009);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.photo .frame img { width: 100%; height: 100%; object-fit: cover; }
.photo .frame .pending {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ash);
  border: 1px dashed var(--rust);
  padding: 10px 14px;
  text-align: center;
  line-height: 2;
}

.photo .caption {
  position: absolute;
  bottom: 12px; left: 14px; right: 14px;
  font-family: var(--font-type);
  font-size: 0.85rem;
  color: #4a3c2c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- callout / join ---------- */

.callout {
  border: 2px solid var(--rust);
  background:
    radial-gradient(ellipse 80% 140% at 50% 160%, rgba(201, 83, 26, 0.18), transparent 60%),
    var(--char);
  padding: 56px 48px;
  text-align: center;
}
.callout h2 { margin-bottom: 14px; }
.callout p { color: var(--ash); max-width: 56ch; margin: 0 auto 28px; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 44px 0 56px;
  background: var(--char);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}
.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ash);
}
.site-footer .sigil { width: 34px; height: 34px; opacity: 0.8; border-radius: 50%; object-fit: cover; }

/* the tribe sigil, featured large (about page) */
.tribe-sigil {
  margin-top: 32px;
  max-width: 320px;
  border: 1px solid rgba(164, 151, 127, 0.25);
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}

/* member badge art on roster cards */
.tag-card .badge {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rust);
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

/* tribe color swatches (field manual) */
.swatches { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.swatch {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ash);
}
.swatch::before {
  content: '';
  width: 30px; height: 30px;
  border: 1px solid rgba(164, 151, 127, 0.4);
  background: var(--sw, #000);
  transform: rotate(-2deg);
}

/* inline photo in a manual/lore section */
.field-photo {
  background: #d9d2bf;
  padding: 10px 10px 14px;
  box-shadow: 0 16px 36px rgba(0,0,0,0.45);
  transform: rotate(1.2deg);
  max-width: 340px;
}
.field-photo img { width: 100%; }
.field-photo figcaption {
  font-family: var(--font-type);
  font-size: 0.85rem;
  color: #4a3c2c;
  padding-top: 8px;
}

@media (max-width: 600px) {
  .log-entry { padding: 28px 22px; }
  .callout { padding: 40px 22px; }
}
