/* ============================================================
   Edmonds College Chess Club — design tokens
   Adapted from the Relume export to complement the crest logo
   (deep navy + royal purple + aged gold) with the school's
   Triton aqua as a third accent.
   ============================================================ */

/* ---- Fonts ----------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/sora-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/sora-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/sora-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/sora-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Crest-derived palette */
  --midnight: #050a1a;          /* page background, deepest */
  --navy: #0a1330;              /* surface base */
  --navy-rich: #0f1a3d;         /* elevated surface */
  --navy-line: #1a2550;         /* hairline borders on dark */

  --purple: #7d5fb8;            /* royal purple, knight cape */
  --purple-bright: #9b7ed4;     /* hover / interactive purple */
  --purple-deep: #3d2a6b;       /* purple smoke / fills */

  --gold: #c9a96e;              /* aged frame gold */
  --gold-bright: #e0c187;       /* hover gold */
  --gold-deep: #6b5530;         /* deep gold for fills */

  --aqua: #4fc3d9;              /* Triton school aqua */
  --aqua-bright: #7ddbe9;       /* hover aqua */
  --aqua-deep: #1a5a6b;

  --parchment: #f4ecd8;         /* warm cream — light surfaces */
  --parchment-soft: #ebe1c7;

  /* Text on dark */
  --text: #f6f2e6;
  --text-muted: rgba(246, 242, 230, 0.62);
  --text-faint: rgba(246, 242, 230, 0.38);
  --border-on-dark: rgba(246, 242, 230, 0.14);
  --border-on-dark-strong: rgba(246, 242, 230, 0.28);

  /* Text on light */
  --ink: #0a1330;
  --ink-muted: rgba(10, 19, 48, 0.65);
  --border-on-light: rgba(10, 19, 48, 0.16);

  /* Type scale (matching DESIGN.md desktop) */
  --h1: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  --h2: clamp(2rem, 3.2vw + 1rem, 3.25rem);
  --h3: clamp(1.5rem, 2.2vw + 0.8rem, 2.75rem);
  --h4: clamp(1.3rem, 1.4vw + 0.8rem, 2.25rem);
  --h5: clamp(1.15rem, 0.8vw + 0.8rem, 1.75rem);
  --h6: 1.375rem;

  --text-large: 1.375rem;
  --text-medium: 1.125rem;
  --text-regular: 1rem;
  --text-small: 0.875rem;
  --text-tiny: 0.75rem;

  /* Radii */
  --r-button: 6px;
  --r-card: 10px;
  --r-input: 6px;
  --r-pill: 999px;

  /* Shadows */
  --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow-purple: 0 0 30px -8px rgba(125, 95, 184, 0.5);
  --shadow-glow-gold: 0 0 24px -6px rgba(201, 169, 110, 0.45);
  --shadow-glow-aqua: 0 0 30px -8px rgba(79, 195, 217, 0.55);
}

/* ---- Base ----------------------------------------------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--midnight);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
  font-family: "Sora", system-ui, sans-serif;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--h1); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: var(--h2); line-height: 1.1; }
h3 { font-size: var(--h3); line-height: 1.15; }
h4 { font-size: var(--h4); line-height: 1.2; }
h5 { font-size: var(--h5); line-height: 1.3; }
h6 { font-size: var(--h6); line-height: 1.4; }
p { margin: 0; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
img { display: block; max-width: 100%; }

/* ---- Layout primitives ---------------------------------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 5%;
}
.section {
  padding: 4rem 0;
}
@media (min-width: 768px) {
  .section { padding: 6rem 0; }
}
@media (min-width: 992px) {
  .section { padding: 7rem 0; }
}

/* ---- Schemes -------------------------------------------- */
.scheme-dark { background: var(--midnight); color: var(--text); }
.scheme-dark-rich {
  background: linear-gradient(180deg, var(--midnight) 0%, #08122e 100%);
  color: var(--text);
}
.scheme-navy { background: var(--navy); color: var(--text); }
.scheme-parchment { background: var(--parchment); color: var(--ink); }
.scheme-parchment-soft { background: var(--parchment-soft); color: var(--ink); }

/* ---- Buttons -------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--r-button);
  font-family: "Sora", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: var(--midnight);
  border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  box-shadow: var(--shadow-glow-gold);
}
.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-on-dark-strong);
}
.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-purple {
  background: var(--purple);
  color: var(--text);
  border-color: var(--purple);
}
.btn-purple:hover {
  background: var(--purple-bright);
  box-shadow: var(--shadow-glow-purple);
}
.btn-link {
  background: transparent;
  color: var(--gold);
  padding: 0.25rem 0;
  border-radius: 0;
  border-bottom: 1px solid var(--gold);
}
.btn-link:hover { color: var(--gold-bright); border-color: var(--gold-bright); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-on-dark);
}
.btn-ghost:hover { border-color: var(--border-on-dark-strong); background: rgba(255,255,255,0.04); }

/* light-scheme button overrides */
.scheme-parchment .btn-secondary,
.scheme-parchment-soft .btn-secondary {
  color: var(--ink);
  border-color: var(--border-on-light);
}
.scheme-parchment .btn-secondary:hover,
.scheme-parchment-soft .btn-secondary:hover {
  border-color: var(--ink);
}
.scheme-parchment .btn-primary,
.scheme-parchment-soft .btn-primary {
  background: var(--ink);
  color: var(--parchment);
  border-color: var(--ink);
}
.scheme-parchment .btn-primary:hover,
.scheme-parchment-soft .btn-primary:hover {
  background: #1a2550;
  border-color: #1a2550;
  box-shadow: 0 10px 30px -8px rgba(10,19,48,0.4);
}

/* ---- Eyebrow / kicker ----------------------------------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Sora", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  display: inline-block;
}
.scheme-parchment .eyebrow,
.scheme-parchment-soft .eyebrow { color: var(--ink); }

/* ---- Cards ---------------------------------------------- */
.card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border-on-dark);
  border-radius: var(--r-card);
  padding: 1.5rem;
}
.scheme-parchment .card,
.scheme-parchment-soft .card {
  background: rgba(255,255,255,0.5);
  border-color: var(--border-on-light);
}

/* ---- Navbar -------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 10, 26, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-on-dark);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.85rem 0;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.nav-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px var(--border-on-dark-strong), 0 4px 16px -4px rgba(0,0,0,0.6);
  flex-shrink: 0;
}
.nav-brand-text {
  font-family: "Sora", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.nav-brand-text small {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease;
  position: relative;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -6px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
.nav-cta { display: flex; gap: 0.6rem; align-items: center; }
.nav-toggle { display: none; }
.nav-mobile-auth { display: none; }

@media (max-width: 860px) {
  .nav-inner { gap: 0.75rem; padding: 0.65rem 0; }
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-brand-text { display: none; }
  .nav-brand { margin-left: 0; }
  .nav-brand-mark { width: 38px; height: 38px; }
  .nav-cta { margin-left: auto; gap: 0.45rem; }
  .nav-cta > .btn-primary,
  .nav-cta > .btn-secondary,
  .nav-username { display: none !important; }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    background: var(--navy);
    padding: 0.75rem 5% 1rem;
    border-top: 1px solid var(--border-on-dark);
    box-shadow: 0 18px 40px -18px rgba(0,0,0,0.8);
  }
  .nav-links.open a,
  .nav-mobile-auth a,
  .nav-mobile-auth button {
    display: block;
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border-on-dark);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    text-align: left;
    font: inherit;
  }
  .nav-mobile-auth { display: block; }
  .nav-mobile-auth button { color: var(--gold); }
  .nav-links a.active::after { display: none; }
}

@media (max-width: 420px) {
  .container { padding-inline: 4%; }
  .btn { padding: 0.65rem 0.85rem; font-size: 0.86rem; }
  .nav-cta .btn-secondary { padding-inline: 0.75rem; }
  .card { padding: 1rem; }
  .section { padding: 2.75rem 0; }
  h1 { line-height: 1.08; }
  .eyebrow { font-size: 0.68rem; letter-spacing: 0.14em; }
  .eyebrow::before { width: 16px; }
}

@media (max-width: 360px) {
  .nav-cta .btn-secondary { display: none; }
}

/* ---- Footer -------------------------------------------- */
.footer {
  background: var(--navy);
  border-top: 1px solid var(--border-on-dark);
  padding: 4rem 0 2rem;
  color: var(--text-muted);
}
.footer-top {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border-on-dark);
}
@media (max-width: 768px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 480px) {
  .footer-top { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 0.6rem; text-align: center; }
}
.footer h6 {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  margin-bottom: 1.2rem;
}
.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}
.footer ul a { font-size: 0.95rem; color: var(--text-muted); }
.footer ul a:hover { color: var(--text); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}
.footer-brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.footer-brand .nav-brand-mark { width: 52px; height: 52px; }
.footer-tagline {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 28ch;
  line-height: 1.6;
}

/* ---- Crest illustration utilities ---------------------- */
.crest-img {
  background-image: url("assets/crest.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* ---- Crest 3D flip ------------------------------------- */
.crest-flip {
  position: relative;
  perspective: 1400px;
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.crest-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 1.1s cubic-bezier(0.7, 0.05, 0.2, 1);
  transform-style: preserve-3d;
  will-change: transform;
}
.crest-flip.is-flipped .crest-flip-inner {
  transform: rotateY(180deg);
}
.crest-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 50%;
  overflow: hidden;
}
.crest-back {
  transform: rotateY(180deg);
  filter: drop-shadow(0 30px 60px rgba(125, 95, 184, 0.35));
}
.crest-hint {
  position: absolute;
  bottom: -2.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Sora", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  pointer-events: none;
}
.crest-flip.is-flipped .crest-hint,
.crest-flip:focus-visible .crest-hint {
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .crest-flip-inner { transition: none; }
}

/* ---- Decorative bits ----------------------------------- */
.divider-fleur {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--gold);
  margin: 1rem 0;
}
.divider-fleur::before,
.divider-fleur::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.5;
}
.scheme-parchment .divider-fleur,
.scheme-parchment-soft .divider-fleur { color: var(--ink); }

.glow-bg {
  position: relative;
  overflow: hidden;
}
.glow-bg::before {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(125,95,184,0.18), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(79,195,217,0.10), transparent 45%);
  pointer-events: none;
  z-index: 0;
}
.glow-bg > * { position: relative; z-index: 1; }

/* ---- Forms ---------------------------------------------- */
.input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-on-dark);
  color: var(--text);
  padding: 0.75rem 0.9rem;
  border-radius: var(--r-input);
  font: inherit;
  width: 100%;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.18);
}
.scheme-parchment .input,
.scheme-parchment-soft .input {
  background: rgba(255,255,255,0.7);
  border-color: var(--border-on-light);
  color: var(--ink);
}
.scheme-parchment .input:focus,
.scheme-parchment-soft .input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10,19,48,0.12);
}

/* ---- Accent text --------------------------------------- */
.t-gold { color: var(--gold); }
.t-purple { color: var(--purple-bright); }
.t-aqua { color: var(--aqua); }
.t-muted { color: var(--text-muted); }
.scheme-parchment .t-muted,
.scheme-parchment-soft .t-muted { color: var(--ink-muted); }

/* ---- Image placeholder ---------------------------------- */
.portrait-badge {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid currentColor;
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.18), transparent 22%),
    linear-gradient(135deg, rgba(201,169,110,0.16), rgba(125,95,184,0.18)),
    var(--navy-rich);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 18px 50px -28px currentColor;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-align: center;
  padding: 1rem;
}
.portrait-badge span {
  font-family: "Sora", sans-serif;
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 700;
  line-height: 1;
}
.portrait-badge small {
  font-family: "Sora", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.portrait-badge-wide { aspect-ratio: 4 / 5; border-radius: var(--r-card); }
.portrait-badge-wide span { font-size: clamp(4rem, 18vw, 8rem); }
.portrait-badge-small {
  max-width: 120px;
  margin: 0 auto 1rem;
}
.portrait-badge-small span { font-size: 2.4rem; }
.portrait-badge-small small { font-size: 0.58rem; letter-spacing: 0.12em; }

.img-placeholder {
  position: relative;
  border-radius: var(--r-card);
  overflow: hidden;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(201,169,110,0.05) 0px,
      rgba(201,169,110,0.05) 8px,
      rgba(201,169,110,0.10) 8px,
      rgba(201,169,110,0.10) 16px
    ),
    var(--navy-rich);
  border: 1px solid var(--border-on-dark);
  color: var(--text-faint);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  aspect-ratio: 4/3;
}
.scheme-parchment .img-placeholder,
.scheme-parchment-soft .img-placeholder {
  background:
    repeating-linear-gradient(
      135deg,
      rgba(10,19,48,0.04) 0px,
      rgba(10,19,48,0.04) 8px,
      rgba(10,19,48,0.08) 8px,
      rgba(10,19,48,0.08) 16px
    ),
    var(--parchment-soft);
  color: var(--ink-muted);
  border-color: var(--border-on-light);
}

/* ---- Scroll behavior ----------------------------------- */
html { scroll-behavior: smooth; background: var(--navy); }
html, body { overflow-x: hidden; }
body { min-height: 100%; }

/* ---- Mobile polish ------------------------------------- */
@media (max-width: 900px) {
  .hero-grid,
  .play-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 640px) {
  .section { padding-block: 3rem; }
  .container { width: min(100% - 1.25rem, var(--container)); }
  .leader-hero-grid { grid-template-columns: 1fr !important; gap: 1.35rem !important; }
  .leader-hero-grid h1 { margin-top: 1rem !important; margin-bottom: 0.85rem !important; font-size: clamp(2.55rem, 12vw, 3.65rem) !important; }
  .leader-hero-grid .t-muted { font-size: 0.98rem !important; }
  .leader-rating-card { width: 100%; max-width: none; justify-self: stretch; }
  .footer { padding: 2.5rem 0 1.25rem; }
  .footer-top { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-bottom { align-items: flex-start; }
  .footer-bottom > div:last-child { flex-wrap: wrap; gap: 0.8rem 1rem !important; }
  .rsvp-card { padding: 1rem !important; }
  .rsvp-3col,
  .rsvp-4col { grid-template-columns: 1fr !important; gap: 6px !important; padding: 5px !important; }
  .rsvp-btn-group button { min-height: 44px; padding: 0.65rem 0.55rem !important; white-space: normal; }
  .input { min-height: 46px; }
}

@media (max-width: 380px) {
  .container { width: min(100% - 1rem, var(--container)); }
  h1 { font-size: clamp(2.2rem, 14vw, 4rem); }
  h2 { font-size: clamp(1.6rem, 10vw, 3rem); }
}

/* ---- selection ----------------------------------------- */
::selection { background: var(--purple); color: var(--text); }

/* ---- utility ------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
