/* base.css — reset, tokens, primitives
   iYouth 公共事務領袖培訓計劃 (redesign prototype) */

/* ---------- TOKENS ---------- */
:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.85rem + 0.2vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.25rem + 1.1vw, 2.125rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --text-3xl: clamp(2.375rem, 1.4rem + 3.6vw, 4.5rem);

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Fonts */
  --font-body: 'Switzer', 'Noto Sans HK', 'PingFang HK', 'Microsoft JhengHei', sans-serif;
  --font-serif: 'Noto Serif HK', 'Songti TC', Georgia, serif;

  /* Radius — restrained */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;

  /* Widths */
  --content-narrow: 44rem;
  --content-default: 62rem;
  --content-wide: 76rem;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);

  --transition-interactive: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 5.5rem;
}

/* ---------- LIGHT (default) ---------- */
:root,
[data-theme='light'] {
  --color-bg: #f7faf1; /* warm off-white, derived from #fcfef9 */
  --color-surface: #fcfef9;
  --color-surface-2: #eaf0dd;
  --color-border: #d9e2c8;
  --color-hairline: #bfcda9;

  --color-text: #16302a; /* deep forest ink */
  --color-text-muted: #43594c;
  --color-text-faint: #59705f;

  /* Brand greens — deep forest dominant, two green accents per viewport */
  --color-forest: #18322b; /* deep forest — dark bands */
  --color-forest-deep: #0f221c;
  --color-green: #4c904a; /* mid green — graphics, rules, large type */
  --color-green-text: #357033; /* AA-safe green for small text */
  --color-leaf: #8db648; /* warm leaf — supporting graphic green */
  --color-lime: #87ca29; /* vivid lime — highlights on dark bands */
  --color-accent-ui: #4c904a; /* AA-safe UI indicator on light surfaces */
  --color-pale-lime: #e5f578; /* small emphasis on dark only */
  --color-primary: #2f6f3a;
  --color-primary-hover: #245c2e;

  --color-on-dark: #f2f7ea;
  --color-on-dark-muted: #bcd3b4;
  --color-on-dark-hairline: #2f5145;
  --color-lime-on-dark: #a9d94b;

  --shadow-sm: 0 1px 2px rgb(18 42 32 / 0.07);
  --shadow-md: 0 10px 30px rgb(18 42 32 / 0.12);
}

/* ---------- DARK ---------- */
[data-theme='dark'] {
  --color-bg: #0b1712; /* green-black */
  --color-surface: #101d17;
  --color-surface-2: #16261e;
  --color-border: #24352c;
  --color-hairline: #35473b;

  --color-text: #e7efe4;
  --color-text-muted: #a7b8a8;
  --color-text-faint: #8d9e8e;

  --color-forest: #0e2019;
  --color-forest-deep: #081411;
  --color-green: #4cb75f;
  --color-green-text: #6ccf7a;
  --color-leaf: #8db648;
  --color-lime: #a5db3f;
  --color-accent-ui: #a5db3f;
  --color-pale-lime: #e5f578;
  --color-primary: #9ad57a;
  --color-primary-hover: #b8e59a;

  --color-on-dark: #e7efe4;
  --color-on-dark-muted: #a7b8a8;
  --color-on-dark-hairline: #2b4238;
  --color-lime-on-dark: #a9d94b;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 10px 30px rgb(0 0 0 / 0.45);
}

/* ---------- RESET ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-6));
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.75;
  color: var(--color-text);
  background: var(--color-bg);
  transition:
    background-color 300ms ease,
    color 300ms ease;
}

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

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  font-weight: 500;
  line-height: 1.28;
  text-wrap: balance;
  letter-spacing: 0.01em;
}

p,
li,
dd,
figcaption {
  text-wrap: pretty;
}

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

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.hero :focus-visible,
.apply :focus-visible,
.section--record :focus-visible,
.section--camp :focus-visible {
  outline-color: var(--color-lime-on-dark);
}

a,
button {
  transition:
    color var(--transition-interactive),
    background-color var(--transition-interactive),
    border-color var(--transition-interactive),
    opacity var(--transition-interactive);
}

/* ---------- PRIMITIVES ---------- */
.container {
  width: 100%;
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  z-index: 200;
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
}
.skip-link:focus-visible {
  top: var(--space-3);
}

/* Eyebrow / micro-label */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  line-height: 1.4;
}
.eyebrow--light {
  color: var(--color-on-dark-muted);
}
.eyebrow__word {
  text-transform: none;
  letter-spacing: 0.06em;
}

/* Buttons — min 44px targets */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
[data-theme='dark'] .btn--primary {
  background: #2c7a3c;
  color: #fff;
}
.btn--primary:hover {
  background: var(--color-primary-hover);
}
[data-theme='dark'] .btn--primary:hover {
  background: #58c46b;
  color: #0f221c;
}
.btn--invert {
  background: var(--color-on-dark);
  color: #16302a;
}
.btn--invert:hover {
  background: #fff;
  color: #0f221c;
}
[data-theme='dark'] .btn--invert {
  background: #e7efe4;
  color: #16302a;
}
.btn--sm {
  padding-inline: var(--space-5);
}
.btn--lg {
  min-height: 52px;
  padding-inline: var(--space-8);
  font-size: var(--text-base);
}
.btn--block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
}
.icon-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  border-bottom: 1px solid color-mix(in oklab, currentColor 35%, transparent);
  padding-bottom: 1px;
}
.link-arrow span {
  transition: transform var(--transition-interactive);
}
.link-arrow:hover span {
  transform: translateX(4px);
}
.link-arrow--light {
  color: var(--color-on-dark);
}

/* Reveal motion */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 700ms cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms),
    transform 700ms cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms);
}
.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
