/* SpiralCon theme D: Obsidian layout, Ember palette (issue #48).
   Design canvas: "SpiralCon Theme Options", board D.
   Semantic HTML is styled by default; a few classes cover layout pieces. */

@font-face {
  font-family: "Cinzel";
  src: url("../fonts/cinzel-latin-wght.e7ed1ab78a17.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-wght.938c6e8019b6.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Surfaces */
  --night: #161417;
  --header: #1a171b;
  --card: #1f1c20;
  --raised: #2a262c;
  /* Lines */
  --line: #34303a;
  --line-strong: #3a3540;
  --line-input: #4a4550;
  /* Text */
  --bone: #f1ebe1;
  --bone-soft: #c9c1bc;
  --smoke: #a9a1a6;
  /* Accents */
  --crimson: #c7362f;
  --crimson-hover: #a92c26;
  --ember: #f07a6f;
  --ember-hover: #f7a39b;
  --ok: #6fcf97;
  --stripe: #2e2a31;
  --shadow: 0 12px 32px rgb(0 0 0 / 45%);
  /* The logo artwork sits on solid black; "lighten" lets a dark page show through. */
  --logo-blend: lighten;
  --logo-bg: transparent;

  --font-display: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 8px;
  --radius-card: 12px;
  --gutter: clamp(16px, 4vw, 48px);
  --content: 1120px;
}

/* Light theme "Parchment" (#95). Chosen in the avatar menu; "auto" follows
   the device. Both blocks must stay identical. */
:root[data-theme="light"] {
  color-scheme: light;
  --night: #f4efe6;
  --header: #ece5d8;
  --card: #fffaf2;
  --raised: #efe7da;
  --line: #ddd3c4;
  --line-strong: #d2c6b4;
  --line-input: #bfb2a0;
  --bone: #1d1a1e;
  --bone-soft: #4a4349;
  --smoke: #6b6268;
  --crimson: #b12d27;
  --crimson-hover: #962520;
  --ember: #a3291f;
  --ember-hover: #7f1f18;
  --ok: #2f7d4f;
  --stripe: #e6dccd;
  --shadow: 0 12px 32px rgb(60 40 20 / 18%);
  /* On parchment the black-backed logo sits on its own dark tile. */
  --logo-blend: normal;
  --logo-bg: #000;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --night: #f4efe6;
    --header: #ece5d8;
    --card: #fffaf2;
    --raised: #efe7da;
    --line: #ddd3c4;
    --line-strong: #d2c6b4;
    --line-input: #bfb2a0;
    --bone: #1d1a1e;
    --bone-soft: #4a4349;
    --smoke: #6b6268;
    --crimson: #b12d27;
    --crimson-hover: #962520;
    --ember: #a3291f;
    --ember-hover: #7f1f18;
    --ok: #2f7d4f;
    --stripe: #e6dccd;
    --shadow: 0 12px 32px rgb(60 40 20 / 18%);
    --logo-blend: normal;
    --logo-bg: #000;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

/* ---------- Type ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; }
h2 { font-size: clamp(1.4rem, 3vw, 1.75rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }
small { font-size: 0.875rem; color: var(--smoke); }
strong { font-weight: 700; }

a { color: var(--ember); text-underline-offset: 3px; }
a:hover { color: var(--ember-hover); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.eyebrow {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--smoke);
  margin-bottom: 0.5rem;
}
.eyebrow.accent { color: var(--ember); }
.lede { font-size: 1.15rem; color: var(--bone-soft); max-width: 36rem; }
.muted { color: var(--smoke); }

hgroup { margin-bottom: 1.5rem; }
hgroup > p { color: var(--bone-soft); margin: 0; }

/* ---------- Layout ---------- */

.site-header {
  background: var(--header);
  border-bottom: 1px solid var(--line);
}
.site-header .inner,
main,
.site-footer .inner {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.site-header .inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--bone);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
}
.brand:hover { color: var(--bone); }
.brand img { width: 44px; height: 44px; border-radius: 50%; }

/* Desktop: brand | links | avatar. Phones: brand and avatar on top, links below. */
.site-nav { margin-left: auto; }
@media (max-width: 720px) {
  .site-nav { order: 3; width: 100%; margin-left: 0; }
}
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 500;
}
.site-nav a { color: var(--bone); text-decoration: none; padding: 6px 0; display: inline-block; }
.site-nav a:hover { color: var(--ember); }
.site-nav a[aria-current="page"] { color: var(--ember); }
.site-nav a.quiet { color: var(--smoke); }

main { flex: 1 0 auto; padding-top: 40px; padding-bottom: 56px; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--smoke);
  font-size: 0.875rem;
}
.site-footer .inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Hero: logo beside the title, stacks on phones */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 56px;
  margin-bottom: 40px;
}
.hero img { width: min(340px, 100%); height: auto; flex: 0 0 auto; }
.hero > div { flex: 1 1 320px; min-width: 0; }

/* Compass-star divider */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px 0;
  color: var(--crimson);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 28px;
  margin-bottom: 24px;
}
.card-grid > article { margin-bottom: 0; }
article > :last-child { margin-bottom: 0; }

/* ---------- Forms & buttons ---------- */

button,
.button,
input[type="submit"] {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  padding: 13px 24px;
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--crimson);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
button:hover,
.button:hover,
input[type="submit"]:hover { background: var(--crimson-hover); color: #fff; }
.button.secondary,
button.secondary {
  background: transparent;
  border-color: var(--line-input);
  color: var(--bone);
  font-weight: 600;
}
.button.secondary:hover,
button.secondary:hover { background: var(--raised); color: var(--bone); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

form { max-width: 40rem; }
form p { margin-bottom: 1.1em; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
select,
textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--bone);
  background: var(--raised);
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 44px;
  margin-bottom: 4px;
}
input::placeholder,
textarea::placeholder { color: var(--smoke); }
input[type="checkbox"],
input[type="radio"] { width: 20px; height: 20px; accent-color: var(--crimson); }
input[type="file"] { padding: 8px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  margin: 0 0 24px;
}
legend {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0 8px;
}

.errorlist { list-style: none; margin: 4px 0 8px; padding: 0; color: var(--ember); font-size: 0.9rem; }
.helptext, form small { display: block; color: var(--smoke); font-size: 0.875rem; }

/* ---------- Messages ---------- */

.messages { list-style: none; margin: 0 0 24px; padding: 0; }
.messages li {
  background: var(--raised);
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}
mark { background: none; color: var(--ember); font-weight: 600; }

/* ---------- Tables, lists, details ---------- */

.table-wrap { overflow-x: auto; margin-bottom: 24px; border: 1px solid var(--line); border-radius: var(--radius-card); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 12px 18px; text-align: left; vertical-align: top; }
thead th { background: var(--raised); font-weight: 600; }
tbody tr { border-top: 1px solid var(--line); }
td strong { color: var(--ember); }

details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 8px; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0; }
dt { color: var(--smoke); }
dd { margin: 0; }
@media (max-width: 560px) {
  dl { grid-template-columns: 1fr; gap: 2px; }
  dd { margin-bottom: 10px; }
}

img { max-width: 100%; }
/* See --logo-blend: blends into dark pages, sits on a dark tile on light ones. */
.logo { mix-blend-mode: var(--logo-blend); background: var(--logo-bg); }
.hero .logo { border-radius: 24px; }
.avatar { border-radius: 50%; object-fit: cover; }

/* Sign in with Discord / Google (#66, option B: official dark styles) */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 16px;
  color: var(--smoke);
  font-size: 0.9rem;
  max-width: 40rem;
}
.or-divider::before,
.or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.social-buttons { display: flex; flex-direction: column; gap: 12px; max-width: 40rem; margin-bottom: 24px; }
.social-buttons form { max-width: none; margin: 0; }
.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  border: 1px solid transparent;
}
.btn-social-logo { flex: 0 0 auto; }
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; color: #fff; }
.btn-google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
.btn-google:hover { background: #1f1f20; color: #fff; }
.btn-social:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* Venue cards on the pre-commit page (#79) */
.venues { margin: 32px 0 8px; }
.venue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 24px;
  margin-top: 24px;
}
.venue-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; margin: 0; }
.venue-media { aspect-ratio: 16 / 9; background: var(--raised); }
.venue-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* No photo yet: a slim themed banner instead of a big empty box. */
.venue-media.no-image {
  aspect-ratio: auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--crimson);
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, var(--raised) 0 14px, var(--stripe) 14px 28px);
}
.venue-media.no-image span {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--smoke);
}
.venue-body { padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.venue-body h3 { margin-bottom: 0.2em; }
.venue-location { color: var(--smoke); font-size: 0.9rem; margin-bottom: 0.75em; }
.venue-highlights { margin: 0 0 1.25em; padding-left: 1.2em; color: var(--bone-soft); }
.venue-highlights li { margin-bottom: 4px; }
.venue-highlights li::marker { color: var(--ember); }
.venue-body .button { align-self: flex-start; margin-top: auto; }

/* Role badges on profiles (#57) */
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 1rem; }
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-input);
  color: var(--bone-soft);
}
.badge-council { background: var(--crimson); border-color: var(--crimson); color: #fff; }

/* Discord invite on the date availability poll (#87) */
.discord-invite { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }
.discord-invite > div { flex: 1 1 280px; }
.discord-invite p { margin-bottom: 0; }
.discord-invite .btn-social { width: auto; text-decoration: none; }

/* Members-only merch page (#88) */
.merch-note { max-width: 48rem; }
.merch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 24px;
}
.merch-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; margin: 0; }
.merch-media { display: block; aspect-ratio: 1 / 1; background: var(--raised); }
.merch-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.merch-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.merch-body h2 { font-size: 1.1rem; margin-bottom: 0.2em; }
.merch-body .button { align-self: flex-start; margin-top: auto; }

/* Avatar menu in the nav (#94, option A) */
.user-menu { position: relative; background: none; border: 0; padding: 0; margin: 0; }
.user-menu > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  color: var(--bone-soft);
  font-weight: 500;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { color: var(--bone); }
.user-menu[open] > summary { margin-bottom: 0; }
.user-menu[open] .chevron { transform: rotate(180deg); }
.user-menu .avatar { width: 34px; height: 34px; }
.user-menu img.avatar { display: block; }
.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--crimson);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.user-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 20;
  min-width: 240px;
  padding: 6px 0;
  background: var(--raised);
  border: 1px solid var(--line-input);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.user-menu .menu > a {
  display: block;
  padding: 9px 16px;
  color: var(--bone);
  text-decoration: none;
}
.user-menu .menu > a:hover,
.user-menu .menu > a[aria-current="page"] { background: var(--card); color: var(--ember); }
.menu-head {
  margin: 0 0 6px;
  padding: 6px 16px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--smoke);
}
.menu-head strong { color: var(--bone); font-weight: 600; }
.user-menu .theme-switch { padding: 8px 16px; }
.user-menu .menu-signout { border-top: 1px solid var(--line); margin-top: 6px; color: var(--smoke); }

/* Light / Dark / Auto switch (#95) */
.theme-switch { display: flex; gap: 4px; }
.theme-switch button {
  flex: 1;
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  background: transparent;
  color: var(--bone-soft);
  border: 1px solid var(--line-input);
  border-radius: 6px;
}
.theme-switch button:hover { background: var(--card); color: var(--bone); }
.theme-switch button[aria-pressed="true"] { background: var(--crimson); border-color: var(--crimson); color: #fff; }
.site-footer .theme-switch button { flex: 0 0 auto; }

/* Announcements on the home page (#92) */
.news { max-width: 48rem; }
.news-post header { margin-bottom: 12px; }
.news-post h3 { margin-bottom: 4px; }
.news-post.pinned { border-color: var(--crimson); }
.news-date { margin: 0; font-size: 0.875rem; color: var(--smoke); }
.badge-pinned { margin-bottom: 10px; border-color: var(--crimson); color: var(--ember); }
.prose h3 { margin-top: 1.4em; }
.prose > :first-child { margin-top: 0; }
.prose ul { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: 4px; }
.prose li::marker { color: var(--ember); }
.location-details { max-width: 48rem; }

/* Your date poll answers on the Polls page (#91) */
.my-answers { list-style: none; padding: 0; margin: 0 0 1.25em; }
.my-answers li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.rating { font-weight: 700; }
.rating-preferred { color: var(--ok); }
.rating-open { color: var(--bone); }
.rating-cant { color: var(--ember); }
.rating-none { color: var(--smoke); font-weight: 500; }

/* Compact venue cards on the pre-commit page (#93) */
.venue-grid.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.venue-grid.compact .venue-body { padding: 16px 20px 20px; }
.venue-grid.compact .venue-body p { font-size: 0.95rem; }
