/* ==========================================================================
   Constitutional Monarchy of Alura — public site styles
   Light + dark theme, fully responsive, no framework.
   ========================================================================== */

:root {
  --red: #8b1a1a;
  --red-deep: #6b1313;
  --red-soft: #a52121;
  --gold: #d4a017;
  --gold-soft: #e8c170;
  --gold-deep: #a87f12;

  --bg: #fafaf7;
  --bg-elev: #ffffff;
  --bg-muted: #f3eee5;
  --surface: #ffffff;
  --border: #e2dccd;
  --border-strong: #cfc6ad;

  --text: #1c1814;
  --text-muted: #5a544a;
  --text-soft: #7a7468;
  --text-on-red: #fff8e8;

  --accent: var(--red);
  --accent-2: var(--gold);

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(28, 24, 20, 0.06);
  --shadow:    0 4px 16px rgba(28, 24, 20, 0.08);
  --shadow-lg: 0 12px 36px rgba(28, 24, 20, 0.12);

  --container: 1180px;
  --gutter: clamp(16px, 4vw, 32px);

  --font-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f0a08;
  --bg-elev: #1a110d;
  --bg-muted: #221814;
  --surface: #1a110d;
  --border: #3a2a22;
  --border-strong: #574135;

  --text: #f3e9d6;
  --text-muted: #c0b39a;
  --text-soft: #978a73;

  --red: #c0383a;
  --red-deep: #8b1a1a;
  --red-soft: #d54e50;
  --gold: #e6b733;
  --gold-soft: #f0d28a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:    0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* Base reset */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration-color: rgba(139, 26, 26, 0.35); text-underline-offset: 3px; }
[data-theme="dark"] a { color: var(--gold); text-decoration-color: rgba(230, 183, 51, 0.35); }
a:hover { text-decoration-color: currentColor; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 700; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.4rem); }

p { margin: 0 0 1em; }
.lead { font-size: 1.2rem; color: var(--text-muted); max-width: 60ch; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--gold); color: #1c1814;
  padding: 10px 16px; border-radius: 0 0 8px 0; font-weight: 600; z-index: 1000;
}
.skip-link:focus { left: 0; outline: 3px solid var(--red); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--bg-elev) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; gap: 24px;
  padding-block: 14px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--text);
  font-family: var(--font-serif);
}
.brand-mark { flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-size: 1.35rem; font-weight: 700; }
.brand-sub  { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
              color: var(--text-soft); font-family: var(--font-sans); }

.primary-nav { margin-left: auto; }
.primary-nav ul {
  list-style: none; display: flex; align-items: center; gap: 4px;
  margin: 0; padding: 0;
}
.primary-nav a {
  display: inline-block; padding: 8px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500; font-size: .95rem;
  transition: background-color .15s ease, color .15s ease;
}
.primary-nav a:hover, .primary-nav a:focus-visible { background: var(--bg-muted); color: var(--accent); }
.primary-nav a.is-active { color: var(--accent); }
.primary-nav a.is-active::after {
  content: ""; display: block; height: 2px; margin-top: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--red), var(--gold));
}
.nav-cta {
  background: var(--red); color: #fff !important; padding: 8px 14px !important;
}
.nav-cta:hover { background: var(--red-deep); }
.nav-link-quiet { color: var(--text-muted) !important; }

/* Theme toggle */
.theme-toggle {
  background: transparent; border: 1px solid var(--border-strong); color: var(--text);
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { background: var(--bg-muted); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
[data-theme="light"] .icon-moon, html:not([data-theme="dark"]) .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* Mobile nav */
.nav-toggle {
  margin-left: auto;
  display: none; background: none; border: 1px solid var(--border-strong);
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-toggle-bar { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { transform: rotate(45deg) translate(2px,2px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(4) { transform: rotate(-45deg) translate(2px,-2px); }

@media (max-width: 880px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed; inset: 64px 0 auto 0;
    background: var(--bg-elev); border-bottom: 1px solid var(--border);
    padding: 12px var(--gutter); margin-left: 0;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
    box-shadow: var(--shadow);
  }
  .primary-nav.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .primary-nav li { border-bottom: 1px solid var(--border); }
  .primary-nav li:last-child { border-bottom: 0; }
  .primary-nav a { padding: 14px 8px; }
  .nav-cta { display: inline-block; margin: 8px 0; text-align: center; }
}

/* ==========================================================================
   Sections
   ========================================================================== */
section { padding: clamp(64px, 9vw, 120px) 0; scroll-margin-top: 96px; }
.section-eyebrow {
  display: inline-block; font-size: .8rem; letter-spacing: .18em;
  text-transform: uppercase; font-weight: 600; color: var(--gold-deep);
  margin-bottom: 14px;
}
[data-theme="dark"] .section-eyebrow { color: var(--gold); }
.section-head { max-width: 70ch; margin-bottom: 48px; }
.section-head p { color: var(--text-muted); }
.section-alt { background: var(--bg-muted); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; padding-top: clamp(80px, 12vw, 160px);
  padding-bottom: clamp(80px, 12vw, 160px);
  overflow: hidden;
  background:
    radial-gradient(60% 80% at 80% 30%, rgba(212, 160, 23, 0.18), transparent 70%),
    radial-gradient(80% 80% at 10% 90%, rgba(139, 26, 26, 0.20), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: url('/assets/img/flag.svg');
  background-position: 110% 50%; background-repeat: no-repeat;
  background-size: 60% auto; opacity: .12; pointer-events: none;
}
[data-theme="dark"] .hero::before { opacity: .18; }
.hero-inner { position: relative; max-width: 760px; }
.hero h1 { margin-bottom: 18px; }
.hero .tagline {
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem); color: var(--gold-deep);
  margin-bottom: 22px;
}
[data-theme="dark"] .hero .tagline { color: var(--gold); }
.hero p { font-size: clamp(1.05rem, 1.6vw, 1.18rem); color: var(--text-muted); max-width: 60ch; }

.cta-row { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: 10px; font-weight: 600; font-size: 1rem;
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-deep); box-shadow: 0 6px 18px rgba(139,26,26,.35); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-gold { background: var(--gold); color: #1c1814; }
.btn-gold:hover { background: var(--gold-deep); color: #fff; }

/* ==========================================================================
   Cards & grids
   ========================================================================== */
.grid { display: grid; gap: clamp(16px, 2vw, 24px); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--red), var(--gold));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; margin-bottom: 16px; font-size: 1.4rem;
}

/* About: colours block */
.colours {
  display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px;
}
.colour-chip {
  flex: 1 1 220px;
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.swatch { width: 44px; height: 44px; border-radius: 10px; border: 1px solid rgba(0,0,0,.1); flex: none; }
.colour-meta { font-size: .9rem; color: var(--text-muted); }
.colour-meta strong { display: block; color: var(--text); font-size: 1.05rem; }
.colour-meta code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* Government */
.gov-grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 920px) { .gov-grid { grid-template-columns: 1.1fr 1fr; } }

.senate-list {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px;
}
.senate-list li {
  background: var(--bg-muted); border-radius: 8px; padding: 10px 14px;
  font-weight: 500; font-size: .95rem;
}

.cabinet { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.cabinet li {
  display: flex; align-items: baseline; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.cabinet .role { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
                 color: var(--text-soft); flex: none; min-width: 180px; }
.cabinet .name { font-weight: 600; }
.cabinet .regnal { color: var(--text-muted); font-style: italic; margin-left: 8px; }
.cabinet .crown { background: linear-gradient(0deg, color-mix(in oklab, var(--gold) 18%, transparent), transparent), var(--surface); }

/* Parties */
.party-card { position: relative; padding-left: 44px; }
.party-card::before {
  content: ""; position: absolute; left: 16px; top: 28px; bottom: 28px;
  width: 6px; border-radius: 6px; background: var(--party-color, var(--red));
}
.party-acronym {
  display: inline-block; font-family: var(--font-sans); font-weight: 700;
  background: var(--party-color, var(--red)); color: #fff;
  font-size: .75rem; padding: 4px 8px; border-radius: 6px; letter-spacing: .04em;
  margin-left: 8px; vertical-align: 2px;
}

/* News */
.news-list { display: grid; gap: 20px; }
.news-card {
  display: grid; grid-template-columns: 120px 1fr; gap: 24px;
  align-items: start; padding: 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .15s ease, transform .15s ease;
}
.news-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.news-date {
  font-family: var(--font-serif); color: var(--text-muted);
  text-align: center; line-height: 1.1; padding: 8px 0;
  border-right: 1px solid var(--border);
}
.news-day { display: block; font-size: 2rem; font-weight: 700; color: var(--text); }
.news-month { display: block; text-transform: uppercase; letter-spacing: .14em; font-size: .7rem; }
.news-year { display: block; font-size: .8rem; }
.news-category {
  display: inline-block; font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 600;
  background: var(--bg-muted); color: var(--text-muted);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
}
.news-card h3 { margin-bottom: 8px; }
.news-card p { color: var(--text-muted); margin-bottom: 0; }

@media (max-width: 540px) {
  .news-card { grid-template-columns: 1fr; gap: 12px; }
  .news-date { text-align: left; border-right: none; border-bottom: 1px solid var(--border);
               padding: 0 0 10px; display: flex; align-items: baseline; gap: 8px; }
  .news-day { font-size: 1.4rem; }
}

/* Allies */
.allies-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ally-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; display: flex; flex-direction: column; gap: 14px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ally-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.ally-head { display: flex; align-items: center; gap: 14px; }
.ally-flag {
  width: 60px; height: 40px; border-radius: 4px; flex: none;
  border: 1px solid var(--border-strong); object-fit: cover; background: var(--bg-muted);
}
.ally-meta { display: flex; flex-direction: column; }
.ally-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.2rem; line-height: 1.15; }
.ally-designation {
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-deep); margin-top: 4px; font-weight: 600;
}
[data-theme="dark"] .ally-designation { color: var(--gold); }
.ally-desc { color: var(--text-muted); font-size: .95rem; margin: 0; }

/* Constitution */
.constitution {
  display: grid; gap: 24px; grid-template-columns: 1fr;
}
.constitution-preamble, .constitution-closing {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.15rem; line-height: 1.55; padding: 24px 28px;
  background: var(--bg-muted); border-left: 4px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0;
}
.article {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 28px;
}
.article-no {
  display: inline-block; font-family: var(--font-serif); font-weight: 700;
  font-size: .9rem; color: var(--gold-deep); letter-spacing: .14em;
  text-transform: uppercase; margin-bottom: 4px;
}
[data-theme="dark"] .article-no { color: var(--gold); }
.article h3 { margin-top: 0; margin-bottom: 16px; font-size: 1.4rem; }
.article ul, .article ol { padding-left: 22px; margin: 0 0 12px; }
.article li { margin-bottom: 6px; color: var(--text-muted); }
.article li::marker { color: var(--gold-deep); }
.article p { color: var(--text-muted); }

/* Join form */
.join-card {
  max-width: 640px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: clamp(24px, 4vw, 40px); box-shadow: var(--shadow);
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 600; font-size: .92rem; }
.field input, .field textarea, .field select {
  font: inherit; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}
.field textarea { min-height: 120px; resize: vertical; }
.field-help { font-size: .85rem; color: var(--text-soft); }
.honeypot { position: absolute; left: -9999px; top: -9999px; }

.form-message {
  margin-top: 16px; padding: 12px 16px; border-radius: 10px; display: none;
  font-weight: 500;
}
.form-message.is-success { display: block; background: color-mix(in oklab, #2e7d4f 18%, var(--surface)); color: #1f5734; border: 1px solid #2e7d4f; }
.form-message.is-error   { display: block; background: color-mix(in oklab, #b3261e 14%, var(--surface)); color: #8a1d18; border: 1px solid #b3261e; }
[data-theme="dark"] .form-message.is-success { color: #c5f0d8; }
[data-theme="dark"] .form-message.is-error   { color: #f6c9c5; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--red-deep); color: var(--text-on-red);
  padding: 56px 0 28px; margin-top: 80px;
  background-image:
    linear-gradient(180deg, var(--red), var(--red-deep)),
    url('/assets/img/flag.svg');
  background-size: cover, 320px;
  background-position: center, top right;
  background-repeat: no-repeat, no-repeat;
  background-blend-mode: multiply, normal;
}
.footer-inner { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .footer-inner {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}
.footer-brand { display: flex; align-items: center; gap: 16px; }
.footer-name { margin: 0; font-family: var(--font-serif); font-size: 1.25rem; font-weight: 700; color: #fff8e8; }
.footer-tagline { margin: 0; color: var(--gold-soft); font-size: .95rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-nav a { color: var(--gold-soft); text-decoration: none; font-size: .95rem; }
.footer-nav a:hover { color: #fff; }
.footer-copy {
  grid-column: 1 / -1; margin: 0; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.15); color: rgba(255, 248, 232, .7);
  font-size: .85rem; text-align: center;
}

/* ==========================================================================
   Auth pages (citizen + admin standalone)
   ========================================================================== */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 40px var(--gutter); }
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.75rem; margin-bottom: 8px; }
.auth-card .lead { font-size: 1rem; margin-bottom: 28px; }
.auth-card .btn { width: 100%; }
.auth-foot { margin-top: 20px; text-align: center; font-size: .9rem; color: var(--text-muted); }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: .95rem; }
.alert-error   { background: color-mix(in oklab, #b3261e 14%, var(--surface)); color: #8a1d18; border: 1px solid #b3261e; }
.alert-success { background: color-mix(in oklab, #2e7d4f 18%, var(--surface)); color: #1f5734; border: 1px solid #2e7d4f; }
.alert-info    { background: color-mix(in oklab, var(--gold) 18%, var(--surface)); color: var(--text); border: 1px solid var(--gold); }
[data-theme="dark"] .alert-error   { color: #f6c9c5; }
[data-theme="dark"] .alert-success { color: #c5f0d8; }

/* Member dashboard */
.dashboard { padding: 40px 0; }
.dashboard-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 880px) { .dashboard-grid { grid-template-columns: 1fr 2fr; } }
.profile-card { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.profile-card h2 { font-size: 1.4rem; margin: 0 0 16px; }
.profile-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.profile-row:last-child { border-bottom: 0; }
.profile-row .k { color: var(--text-soft); font-size: .9rem; }
.profile-row .v { font-weight: 500; }

/* Print */
@media print {
  .site-header, .site-footer, .nav-toggle, .theme-toggle, .skip-link, .cta-row { display: none !important; }
  body { background: #fff; color: #000; }
  section { padding: 24px 0; page-break-inside: avoid; }
}
