/* ═══════════════════════════════════════════
   Clan Chisolm — Single Page App
   ═══════════════════════════════════════════ */

:root {
  --stone-900: #1a1410;
  --stone-800: #2a211c;
  --stone-700: #3d322a;
  --cream: #f4e8d4;
  --gold: #c9a227;
  --gold-light: #e8c96a;
  --forest: #1e4d3a;
  --forest-bright: #2d6b4f;
  --crimson: #8b1e1e;
  --burgundy: #5c1a2a;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --header-h: 72px;
  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-ui: "Source Sans 3", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, #3d2a1a 0%, transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(92, 26, 42, 0.15), transparent 50%),
    radial-gradient(ellipse 80% 50% at 0% 80%, rgba(30, 77, 58, 0.12), transparent 50%),
    var(--stone-900);
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.55;
}

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

a {
  color: var(--gold-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #fff;
}

/* App shell */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.tartan-bar {
  height: 8px;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    90deg,
    #1a1a1a 0 12px,
    #8b1e1e 12px 18px,
    #1a1a1a 18px 30px,
    #2d5a3d 30px 36px,
    #1a1a1a 36px 48px,
    #c9a227 48px 52px,
    #1a1a1a 52px 64px,
    #5c1a2a 64px 72px
  );
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding: 0.65rem 4vw;
  background: rgba(26, 20, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 162, 39, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-light);
}

.crest-icon {
  font-size: 1.75rem;
  cursor: pointer;
  filter: drop-shadow(0 0 8px rgba(201, 162, 39, 0.4));
}

.eyebrow {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(244, 232, 212, 0.5);
}

.eyebrow.gold {
  color: var(--gold);
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.25rem;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
}

.app-nav a {
  color: rgba(244, 232, 212, 0.72);
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.app-nav a:hover {
  color: var(--gold-light);
  background: rgba(201, 162, 39, 0.08);
}

.app-nav a.is-active {
  color: var(--stone-900);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border-color: transparent;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--gold-light);
  border-radius: 1px;
}

/* Views */
.view-root {
  flex: 1;
  outline: none;
  padding: 1.5rem 4vw 2.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  animation: viewIn 0.28s ease;
}

.view-root.route-castle {
  max-width: none;
  padding: 0;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 2rem;
}

.section-head h2 {
  margin: 0.4rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  color: #fff;
}

.section-sub {
  margin: 0;
  font-size: 1.15rem;
  color: rgba(244, 232, 212, 0.75);
  font-style: italic;
}

.fine-print {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: rgba(244, 232, 212, 0.55);
}

/* Hero (home) */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2rem;
  align-items: center;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.hero-frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(201, 162, 39, 0.35);
}

.hero-portrait {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center 20%;
}

.hero-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem 1.15rem 0.9rem;
  background: linear-gradient(transparent, rgba(10, 8, 6, 0.92));
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

.hero-caption p {
  margin: 0;
}

.hero-caption .fine-print {
  margin-top: 0.25rem;
  font-size: 0.75rem;
}

.hero-copy h2 {
  margin: 0.35rem 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1.25;
  color: #fff;
}

.lede {
  margin: 0 0 1.25rem;
  font-size: 1.2rem;
  color: rgba(244, 232, 212, 0.9);
}

.lede.light {
  color: rgba(255, 255, 255, 0.92);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  text-align: center;
}

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold-light);
}

.stat-label {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: rgba(244, 232, 212, 0.65);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold) 0%, #a8841a 100%);
  color: var(--stone-900);
  box-shadow: 0 4px 20px rgba(201, 162, 39, 0.35);
}

.btn.primary:hover {
  color: var(--stone-900);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(201, 162, 39, 0.45);
  color: var(--gold-light);
  width: 100%;
}

.btn.ghost:hover {
  background: rgba(201, 162, 39, 0.1);
  color: #fff;
}

.btn.ghost-inline {
  background: transparent;
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: var(--gold-light);
}

.btn.ghost-inline:hover {
  background: rgba(201, 162, 39, 0.1);
  color: #fff;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Council */
.council-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.15rem;
}

.member-card {
  background: linear-gradient(165deg, var(--stone-800) 0%, var(--stone-900) 100%);
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s, transform 0.2s;
}

.member-card:hover {
  border-color: rgba(201, 162, 39, 0.5);
  transform: translateY(-3px);
}

.member-card.featured {
  border-color: rgba(201, 162, 39, 0.55);
}

.member-ribbon {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  text-align: center;
}

.member-ribbon.debbie {
  background: linear-gradient(90deg, var(--forest), var(--forest-bright));
  color: #e8f5ee;
}
.member-ribbon.gary {
  background: linear-gradient(90deg, #2a2a2a, #4a4a4a);
  color: #eee;
}
.member-ribbon.kenny {
  background: linear-gradient(90deg, var(--gold), #8a7020);
  color: var(--stone-900);
}
.member-ribbon.greg {
  background: linear-gradient(90deg, #1a2a3a, #2a4055);
  color: #d0e0f0;
}
.member-ribbon.linda {
  background: linear-gradient(90deg, var(--burgundy), #8b2a45);
  color: #f5e0e6;
}

.member-body {
  padding: 1.2rem 1.25rem 1.35rem;
}

.member-body h3,
.detail-body h2 {
  margin: 0;
  font-family: var(--font-display);
  color: #fff;
}

.member-body h3 {
  font-size: 1.25rem;
}

.detail-body h2 {
  font-size: 1.85rem;
}

.member-body .title,
.detail-body .title {
  margin: 0.15rem 0 0.35rem;
  font-style: italic;
  color: var(--gold-light);
  font-size: 1.05rem;
}

.member-body .role,
.detail-body .role {
  margin: 0 0 0.9rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: rgba(244, 232, 212, 0.55);
}

.belief {
  margin: 0 0 1rem;
  padding: 0.8rem 0.95rem;
  border-left: 3px solid var(--gold);
  background: rgba(201, 162, 39, 0.08);
  font-style: italic;
  font-size: 1.02rem;
  color: rgba(244, 232, 212, 0.95);
}

.traits {
  margin: 0 0 1.25rem;
}

.traits > div {
  margin-bottom: 0.75rem;
}

.traits dt {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.15rem;
}

.traits dd {
  margin: 0;
  font-size: 1.05rem;
  color: rgba(244, 232, 212, 0.85);
}

/* Member detail view */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
}

.member-detail {
  max-width: 640px;
  margin: 0 auto;
  background: linear-gradient(165deg, var(--stone-800) 0%, var(--stone-900) 100%);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.detail-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.voice-output {
  margin-top: 1.25rem;
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.12), rgba(0, 0, 0, 0.3));
  text-align: center;
  animation: viewIn 0.35s ease;
}

.view-council .voice-output {
  margin-top: 1.75rem;
}

.voice-from {
  margin: 0 0 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.voice-text {
  margin: 0;
  font-size: 1.25rem;
  font-style: italic;
  color: #fff;
}

/* Castle view */
.castle-panel {
  position: relative;
  min-height: calc(100vh - var(--header-h) - 80px);
  display: grid;
  align-items: end;
}

.castle-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 40%;
}

.castle-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 8, 6, 0.95) 0%,
    rgba(10, 8, 6, 0.5) 45%,
    rgba(10, 8, 6, 0.25) 100%
  );
}

.castle-overlay {
  position: relative;
  z-index: 1;
  padding: 3rem 5vw 2.5rem;
  max-width: 720px;
}

.castle-overlay h2 {
  margin: 0.35rem 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  color: #fff;
}

.castle-facts {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: rgba(244, 232, 212, 0.88);
}

.castle-facts li {
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.castle-facts strong {
  color: var(--gold-light);
}

.photo-credit {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: rgba(244, 232, 212, 0.45);
}

/* Physics */
.orbit-stage {
  position: relative;
  width: min(340px, 80vw);
  height: min(340px, 80vw);
  margin: 0 auto 2rem;
  border-radius: 50%;
  border: 1px dashed rgba(201, 162, 39, 0.3);
  background: radial-gradient(circle, rgba(201, 162, 39, 0.08) 0%, transparent 70%);
}

.orbit-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  color: var(--gold-light);
  width: 100px;
  line-height: 1.3;
}

.sun {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  animation: orbit-pulse 3s ease-in-out infinite;
}

.sun-debbie {
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--forest-bright);
  animation-delay: 0s;
}
.sun-gary {
  top: 35%;
  right: 5%;
  background: #555;
  animation-delay: 0.4s;
}
.sun-kenny {
  bottom: 12%;
  right: 18%;
  background: var(--gold);
  color: var(--stone-900);
  animation-delay: 0.8s;
}
.sun-greg {
  bottom: 12%;
  left: 18%;
  background: #2a4a6a;
  animation-delay: 1.2s;
}
.sun-linda {
  top: 35%;
  left: 5%;
  background: var(--burgundy);
  animation-delay: 1.6s;
}

@keyframes orbit-pulse {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(201, 162, 39, 0.4);
  }
  50% {
    box-shadow: 0 0 28px rgba(201, 162, 39, 0.7);
  }
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.rule-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(201, 162, 39, 0.2);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}

.rule-card h3 {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--gold-light);
}

.rule-card p {
  margin: 0;
  font-size: 1.02rem;
  color: rgba(244, 232, 212, 0.85);
}

.center-picker {
  text-align: center;
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 162, 39, 0.3);
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.08), transparent);
}

.center-picker h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.center-result {
  margin: 1.15rem 0 0;
  min-height: 1.5em;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--gold-light);
  font-weight: 600;
}

/* Decree */
.decree-form {
  max-width: 480px;
  margin: 0 auto 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.decree-form label,
.coo-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 232, 212, 0.65);
}

.decree-form input,
.decree-form select,
.coo-form input {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 39, 0.3);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1.15rem;
}

.decree-form input:focus,
.decree-form select:focus,
.coo-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}

.decree-form select option {
  background: var(--stone-800);
}

.decree-scroll {
  max-width: 560px;
  margin: 0 auto;
  animation: viewIn 0.4s ease;
}

.scroll-inner {
  background: linear-gradient(180deg, #f7ecd8 0%, #e8d4b0 100%);
  color: var(--stone-900);
  border-radius: 4px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid #c4a574;
  text-align: center;
}

.scroll-seal {
  margin: 0 0 0.65rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crimson);
}

.scroll-inner h3 {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--burgundy);
}

#decree-body {
  margin: 0 0 1.1rem;
  font-size: 1.15rem;
  line-height: 1.6;
}

.scroll-sign {
  margin: 0;
  font-style: italic;
  font-weight: 600;
  color: var(--stone-700);
}

/* Bartholomew */
.coo-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.75rem;
  align-items: start;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.75rem;
  border-radius: var(--radius);
  border: 1px solid rgba(201, 162, 39, 0.35);
  background:
    radial-gradient(circle at 10% 20%, rgba(201, 162, 39, 0.12), transparent 50%),
    var(--stone-800);
}

@media (max-width: 640px) {
  .coo-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .coo-form label {
    text-align: left;
  }
}

.coo-mascot {
  font-size: 5rem;
  line-height: 1;
  animation: coo-bob 2.5s ease-in-out infinite;
}

@keyframes coo-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-8px) rotate(3deg);
  }
}

.coo-panel h2 {
  margin: 0.3rem 0 0.7rem;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: #fff;
}

.coo-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}

.coo-answer {
  margin-top: 1.15rem;
  padding: 1.1rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(201, 162, 39, 0.3);
  animation: viewIn 0.35s ease;
  text-align: left;
}

.coo-q {
  margin: 0 0 0.45rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: rgba(244, 232, 212, 0.6);
}

.coo-a {
  margin: 0;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--gold-light);
  font-weight: 600;
}

/* Footer */
.app-footer {
  border-top: 1px solid rgba(201, 162, 39, 0.15);
  padding: 1.25rem 4vw 1.75rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
}

.footer-motto {
  margin: 0 0 0.35rem;
  font-style: italic;
  font-size: 1.05rem;
  color: rgba(244, 232, 212, 0.8);
}

.app-footer .fine-print {
  margin: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 0.85rem 1.4rem;
  border-radius: 999px;
  background: var(--stone-800);
  border: 1px solid var(--gold);
  color: var(--cream);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: viewIn 0.3s ease;
}

/* Mobile nav */
@media (max-width: 820px) {
  .nav-toggle {
    display: flex;
  }

  .app-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    background: rgba(26, 20, 16, 0.98);
    border-bottom: 1px solid rgba(201, 162, 39, 0.25);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  }

  .app-nav.is-open {
    display: flex;
  }

  .app-nav a {
    padding: 0.75rem 1rem;
    border-radius: 10px;
  }

  .app-header {
    position: sticky;
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .view-root,
  .sun,
  .coo-mascot {
    animation: none;
  }
}
