/* ==========================================================================
   CUST 天文协会 — base.css
   Design tokens + reset + shared primitives.

   Colour strategy
   ---------------
   Both themes walk the SAME hue path: azure (--h-brand) -> periwinkle
   (--h-mid) -> violet (--h-violet). Only the lightness journey differs:

     light mode : near-white  ->  pale periwinkle  ->  light azure
     dark mode  : near-black  ->  deep indigo      ->  deep violet

   Every token is declared in the light block and given a dark counterpart
   in the dark block, so nothing is left at an inherited value.
   ========================================================================== */

/* ------------------------------ tokens ---------------------------------- */

:root {
  color-scheme: light;

  /* hue anchors — shared by both themes so the two never drift apart */
  --h-brand: 214;
  --h-mid: 232;
  --h-violet: 268;

  /* --- surfaces ------------------------------------------------------- */
  --bg: #eef4ff;
  --bg-tint: #e2ecff;
  --surface: #ffffff;
  --surface-2: #f4f8ff;
  --surface-3: #e9f1ff;
  --surface-glass: rgba(255, 255, 255, 0.74);
  --surface-glass-strong: rgba(255, 255, 255, 0.9);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --overlay: rgba(12, 26, 54, 0.72);
  --scrim: rgba(255, 255, 255, 0.55);

  /* --- lines ---------------------------------------------------------- */
  --border: rgba(37, 99, 235, 0.16);
  --border-strong: rgba(37, 99, 235, 0.32);
  --divider: rgba(37, 99, 235, 0.1);

  /* --- type ----------------------------------------------------------- */
  --text: #0d1b33;
  --text-soft: #3d5680;
  --text-muted: #5b708f;
  --text-on-brand: #ffffff;

  /* --- brand ---------------------------------------------------------- */
  /* Stops are dark enough that white label text clears 4.5:1 at every point
     along the gradient, not just at its lightest end. */
  --brand: #1d63d8;
  --brand-strong: #1550bb;
  --brand-soft: #e2ecff;
  --accent: #4f6ff0;
  --accent-2: #7b5cf0;
  --star: #e8a63a;

  /* --- gradient walks (light: blue -> white) --------------------------- */
  --grad-page: linear-gradient(
    170deg,
    hsl(var(--h-brand) 78% 92%) 0%,
    hsl(var(--h-mid) 72% 95%) 42%,
    #ffffff 100%
  );
  --grad-hero: linear-gradient(
    155deg,
    hsl(var(--h-brand) 82% 88%) 0%,
    hsl(var(--h-mid) 76% 93%) 45%,
    #ffffff 100%
  );
  --grad-page-head: linear-gradient(
    150deg,
    hsl(var(--h-brand) 80% 91%) 0%,
    hsl(var(--h-mid) 70% 95%) 58%,
    #ffffff 100%
  );
  --grad-panel: linear-gradient(
    160deg,
    #ffffff 0%,
    hsl(var(--h-brand) 70% 97%) 100%
  );
  --grad-footer: linear-gradient(
    180deg,
    hsl(var(--h-brand) 62% 96%) 0%,
    hsl(var(--h-mid) 58% 93%) 100%
  );
  --grad-brand: linear-gradient(
    118deg,
    hsl(var(--h-brand) 88% 43%) 0%,
    hsl(238 80% 45%) 48%,
    hsl(var(--h-violet) 68% 45%) 100%
  );
  --grad-text: linear-gradient(
    100deg,
    hsl(216 88% 42%) 0%,
    hsl(240 78% 46%) 50%,
    hsl(var(--h-violet) 62% 47%) 100%
  );
  --grad-hairline: linear-gradient(
    90deg,
    transparent,
    hsl(var(--h-brand) 80% 60%) 18%,
    hsl(238 72% 62%) 50%,
    hsl(262 66% 64%) 82%,
    transparent
  );

  /* --- depth ---------------------------------------------------------- */
  --shadow-1: 0 1px 2px rgba(16, 39, 84, 0.05),
    0 4px 12px rgba(16, 39, 84, 0.05);
  --shadow-2: 0 2px 6px rgba(16, 39, 84, 0.06),
    0 14px 32px rgba(16, 39, 84, 0.09);
  --shadow-3: 0 8px 24px rgba(16, 39, 84, 0.09),
    0 28px 64px rgba(16, 39, 84, 0.14);
  --shadow-brand: 0 8px 22px rgba(29, 99, 216, 0.28);
  --ring: 0 0 0 3px rgba(29, 99, 216, 0.28);

  /* --- geometry & motion ---------------------------------------------- */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;
  --shell: 1180px;
  --gutter: clamp(1.15rem, 4vw, 2.5rem);
  --sec-y: clamp(3.5rem, 8vw, 6.5rem);
  --nav-h: 66px;

  --ease: cubic-bezier(0.22, 0.68, 0.3, 1);
  --t-fast: 0.18s var(--ease);
  --t-base: 0.32s var(--ease);
  --t-slow: 0.6s var(--ease);

  --font-sans: "Inter", "Segoe UI Variable Text", "Segoe UI",
    -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino,
    "Source Han Serif SC", "Noto Serif SC", "Songti SC", "SimSun", Georgia,
    serif;
  --font-mono: "Cascadia Mono", ui-monospace, "SFMono-Regular", Consolas,
    "Liberation Mono", monospace;

  /* Hero artwork — the club lockup, which carries both themes.
     Source: image/aaclogo3.png. Kept transparent so the theme's own gradient
     veil stays visible through it; the two themes use colour-inverted twins
     with opposite blend modes (multiply / screen). */
  --hero-img: url("../img/aac-hero-1920.webp");
  --hero-blend: multiply;
  --hero-veil: linear-gradient(
      155deg,
      hsl(var(--h-brand) 82% 90% / 0.97) 0%,
      hsl(var(--h-mid) 74% 94% / 0.93) 46%,
      #ffffff 100%
    );
  --hero-filter: saturate(1.02) contrast(0.94) brightness(1.02);

  /* One focal point shared by the home hero and the sub-page photo washes. */
  --hero-focus: center 42%;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  /* --- surfaces ------------------------------------------------------- */
  --bg: #06070f;
  --bg-tint: #0a0d1c;
  --surface: #111629;
  --surface-2: #161d34;
  --surface-3: #1c2442;
  --surface-glass: rgba(21, 27, 48, 0.66);
  --surface-glass-strong: rgba(24, 31, 56, 0.9);
  --nav-bg: rgba(10, 13, 26, 0.72);
  --overlay: rgba(3, 5, 12, 0.82);
  --scrim: rgba(18, 23, 42, 0.5);

  /* --- lines ---------------------------------------------------------- */
  --border: rgba(139, 172, 255, 0.15);
  --border-strong: rgba(150, 182, 255, 0.3);
  --divider: rgba(139, 172, 255, 0.1);

  /* --- type ----------------------------------------------------------- */
  --text: #eaefff;
  --text-soft: #b7c4e4;
  --text-muted: #8593b8;
  --text-on-brand: #05070f;

  /* --- brand ---------------------------------------------------------- */
  --brand: #74a4ff;
  --brand-strong: #9dc0ff;
  --brand-soft: #17203c;
  --accent: #9db4ff;
  --accent-2: #b9a3ff;
  --star: #f0c169;

  /* --- gradient walks (dark: blue -> violet -> black) ------------------ */
  --grad-page: linear-gradient(
    170deg,
    hsl(var(--h-brand) 55% 15%) 0%,
    hsl(var(--h-mid) 48% 11%) 40%,
    #05060d 100%
  );
  --grad-hero: linear-gradient(
    155deg,
    hsl(var(--h-brand) 62% 12%) 0%,
    hsl(var(--h-mid) 52% 14%) 44%,
    #04050c 100%
  );
  --grad-page-head: linear-gradient(
    150deg,
    hsl(var(--h-brand) 58% 13%) 0%,
    hsl(var(--h-mid) 46% 12%) 58%,
    #05060d 100%
  );
  --grad-panel: linear-gradient(
    160deg,
    #141a30 0%,
    hsl(var(--h-mid) 45% 10%) 100%
  );
  --grad-footer: linear-gradient(
    180deg,
    hsl(var(--h-mid) 42% 10%) 0%,
    hsl(var(--h-mid) 34% 7%) 100%
  );
  --grad-brand: linear-gradient(
    118deg,
    hsl(var(--h-brand) 84% 62%) 0%,
    hsl(238 76% 66%) 48%,
    hsl(var(--h-violet) 68% 70%) 100%
  );
  --grad-text: linear-gradient(
    100deg,
    hsl(216 92% 76%) 0%,
    hsl(240 86% 80%) 50%,
    hsl(var(--h-violet) 80% 82%) 100%
  );
  --grad-hairline: linear-gradient(
    90deg,
    transparent,
    hsl(var(--h-brand) 70% 52%) 18%,
    hsl(238 66% 58%) 50%,
    hsl(262 62% 62%) 82%,
    transparent
  );

  /* --- depth ---------------------------------------------------------- */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.34);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.44), 0 14px 32px rgba(0, 0, 0, 0.44);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, 0.5), 0 28px 64px rgba(0, 0, 0, 0.56);
  --shadow-brand: 0 8px 26px rgba(93, 137, 255, 0.32);
  --ring: 0 0 0 3px rgba(140, 178, 255, 0.36);

  /* --- hero treatment. aaclogo3 is an opaque white plate with dark blue
         artwork, so dark mode uses a luminance-inverted twin (light artwork,
         near-black plate) and `screen`: the plate contributes nothing and only
         the artwork lights the background. Inverting a blue hue yields its
         complement — amber — so the filter also rotates the hue ~200° back
         into the theme's blue-violet band. */
  --hero-img: url("../img/aac-hero-dark-1920.webp");
  --hero-blend: screen;
  --hero-veil: linear-gradient(
      155deg,
      hsl(var(--h-brand) 68% 10% / 0.87) 0%,
      hsl(var(--h-mid) 55% 11% / 0.84) 44%,
      #04050c 100%
    );
  --hero-filter: saturate(2.2) brightness(1.1) hue-rotate(210deg);
}

/* ------------------------------ reset ----------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 18px);
  overflow-x: clip;
}

body {
  min-height: 100vh;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.97rem + 0.16vw, 1.075rem);
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--grad-page);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t-slow), color var(--t-slow);
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--brand);
  text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent);
  text-underline-offset: 0.22em;
  transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

a:hover {
  color: var(--brand-strong);
  text-decoration-color: currentColor;
}

ul,
ol {
  padding-inline-start: 1.15em;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: color-mix(in srgb, var(--brand) 30%, transparent);
  color: var(--text);
}

/* thin, theme-aware scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand) 45%, transparent) transparent;
}

/* ------------------------------ a11y helpers ---------------------------- */

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

.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 200;
  padding: 0.65rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--grad-brand);
  color: var(--text-on-brand);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--t-base);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--text-on-brand);
}

/* ------------------------------ layout ---------------------------------- */

.shell {
  width: min(100% - (var(--gutter) * 2), var(--shell));
  margin-inline: auto;
}

.section {
  padding-block: var(--sec-y);
  position: relative;
}

.section--tinted {
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(1.2);
  border-block: 1px solid var(--border);
}

.section--flush-top {
  padding-block-start: clamp(2rem, 4vw, 3rem);
}

/* ------------------------------ typography utilities -------------------- */

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 0.9rem;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.eyebrow--center {
  justify-content: center;
}

.eyebrow--center::after {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.section-head {
  max-width: 62ch;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head--center .eyebrow {
  justify-content: center;
}

.section-head--center .eyebrow::after {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.section-head h2 {
  font-size: clamp(1.7rem, 1.15rem + 2.3vw, 2.6rem);
}

.section-head p {
  margin-top: 0.85rem;
  color: var(--text-soft);
  font-size: 1.03rem;
}

.lede {
  font-size: clamp(1.04rem, 1rem + 0.35vw, 1.2rem);
  color: var(--text-soft);
}

.hairline {
  height: 1px;
  border: 0;
  background: var(--grad-hairline);
  opacity: 0.75;
}

/* ------------------------------ buttons --------------------------------- */

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.78rem 1.5rem;
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t-base),
    background var(--t-base), border-color var(--t-base), color var(--t-base);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  color: var(--btn-fg);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  --btn-bd: transparent;
  --btn-bg: var(--grad-brand);
  --btn-fg: var(--text-on-brand);
  box-shadow: var(--shadow-brand);
}

.btn--primary:hover {
  box-shadow: var(--shadow-3);
}

.btn--ghost {
  --btn-bg: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(10px);
}

.btn--ghost:hover {
  --btn-bd: var(--brand);
  --btn-bg: var(--brand-soft);
  color: var(--brand-strong);
}

.btn--sm {
  padding: 0.52rem 1.05rem;
  font-size: 0.87rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn .icon {
  width: 1.05em;
  height: 1.05em;
}

/* ------------------------------ placeholders ---------------------------- */

/* Inline marker for a value the club still has to fill in. Deliberately
   visible: an unfinished figure should look unfinished, not like real data. */
.ph {
  display: inline-block;
  padding: 0.05em 0.4em;
  border: 1px dashed color-mix(in srgb, var(--text-muted) 55%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--text-muted) 11%, transparent);
  font-family: var(--font-mono);
  font-size: 0.86em;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  /* opt out of the gradient text fill used by .stat__num / .gradient-text */
  -webkit-text-fill-color: var(--text-muted);
  background-clip: border-box;
}

.placeholder-note {
  margin-top: 1rem;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.placeholder-note::before {
  content: "✎ ";
  opacity: 0.7;
}

/* A whole sentence or paragraph still to be written. It keeps the paragraph's
   box — and therefore the page's rhythm and column width — while making it
   obvious that no text has been supplied yet. */
.ph-block {
  display: block;
  margin-block: 0.15em;
  padding-block-end: 0.15em;
  border-block-end: 1px dashed
    color-mix(in srgb, var(--text-muted) 45%, transparent);
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-style: normal;
  line-height: 1.9;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  background: none;
}

/* a placeholder standing in for a stat figure must not dominate it */
.stat__num.ph {
  padding: 0.06em 0.45em;
  font-size: clamp(1.15rem, 0.95rem + 0.9vw, 1.6rem);
}

/* ------------------------------ chips / tags ---------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-glass);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  text-transform: uppercase;
}

.chip--brand {
  border-color: color-mix(in srgb, var(--brand) 34%, transparent);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--star);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--star) 24%, transparent);
}

/* ------------------------------ motion ---------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ?motion=off — same final state, driven by a query flag rather than an OS
   preference, so screenshots and visual checks are deterministic. */
:root[data-motion="off"] {
  scroll-behavior: auto;
}

:root[data-motion="off"] *,
:root[data-motion="off"] *::before,
:root[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}

:root[data-motion="off"] .reveal {
  opacity: 1;
  transform: none;
}

:root[data-motion="off"] .nav-menu {
  transition: none;
}
