/* CueClass site — base: tokens, reset, typography, header + nav. Design system: site/DESIGN.md (v6).
   Formal product-site style: white, 1px lines in the app icon's cool blue-grey, one brand blue,
   system fonts only (no font download for the main site). No colour ramps, frosting, glow or shadows
   outside the themes section.
   Text colour pairs (WCAG): ink #111827 on #FFF 17.7:1 · muted #4B5563 on #FFF 7.6:1, on #F5F7FA 7.0:1
   · brand #1F5BF0 / white 5.5:1 · brand-ink #1747C4 on #FFF 7.7:1, on #EEF3FF 6.9:1
   · white on night #0B1220 18.7:1 · #AEB8C6 on night 9.3:1 · ink on accent yellow 13.5:1 */

:root {
  --bg: #ffffff;
  --surface: #f5f7fa;
  --surface-2: #eef2f6;
  --line: #e2e8ef;
  --line-strong: #c9d2dc;
  --ink: #111827;
  --ink-2: #1f2937;
  --muted: #4b5563;
  --brand: #1f5bf0;
  --brand-ink: #1747c4;
  --brand-tint: #eef3ff;
  --accent: #ffe033;
  --night: #0b1220;
  --night-2: #111a2c;
  --on-night: #ffffff;
  --on-night-muted: #aeb8c6;
  --disabled-bg: #eef2f6;
  --disabled-ink: #3d4552;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 18px;
  --section: clamp(88px, 11vw, 160px);
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "微軟正黑體", "Helvetica Neue", sans-serif;
  --code: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

img,
video {
  max-width: 100%;
  display: block;
}

img {
  height: auto;
}

a {
  color: var(--brand-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

a:hover {
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: var(--brand-tint);
  color: var(--ink);
}

code {
  font-family: var(--code);
  font-size: 0.86em;
  padding: 0.05em 0.4em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

h1,
h2,
h3 {
  margin: 0 0 0.6em;
  color: inherit;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  /* proportional CJK punctuation in large type */
  font-feature-settings: "palt";
}

h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.5rem);
  line-height: 1.1;
}

h2 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.16;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.4;
  font-weight: 650;
}

p,
ul,
ol {
  margin: 0 0 1em;
}

strong {
  font-weight: 650;
}

.wrap {
  width: min(1200px, 100% - 48px);
  margin-inline: auto;
}

.narrow {
  width: min(760px, 100% - 48px);
}

.fine {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--muted);
}

.fine a {
  color: inherit;
}

.lead {
  max-width: 34em;
  font-size: clamp(1.1rem, 1.4vw, 1.28rem);
  line-height: 1.7;
  color: var(--muted);
  text-wrap: pretty;
}

/* section label: small blue text with a dot */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--brand-ink);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.eyebrow .dot {
  display: none;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

/* a few words of a heading underlined in the accent yellow (a flat bar, not a colour ramp) */
.mark {
  position: relative;
  z-index: 0;
  white-space: nowrap;
}

.mark::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.04em;
  right: -0.04em;
  bottom: 0.06em;
  height: 0.32em;
  background: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  font-weight: 650;
  color: #ffffff;
  background: var(--brand);
  border-radius: var(--r-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
  color: #ffffff;
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* reading progress along the header's bottom edge (scaleX set by scrollfx.js) */
.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
  transform-origin: left center;
  transform: scaleX(var(--progress, 0));
  pointer-events: none;
}

.header-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  width: min(1240px, 100% - 32px);
  min-height: var(--header-h);
  margin-inline: auto;
  padding: 8px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand img {
  width: 30px;
  height: 30px;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 12px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}

.nav-list a:hover {
  color: var(--ink);
  background: var(--surface);
}

/* current page (aria-current="page") and current section (aria-current="true") */
.nav-list a[aria-current] {
  color: var(--ink);
  font-weight: 650;
}

.nav-list a[aria-current]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}

.nav-toggle {
  display: none;
}

@media (max-width: 960px) {
  .has-menu .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 6px 14px;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    cursor: pointer;
  }
  .nav-toggle-icon {
    position: relative;
    width: 16px;
    height: 12px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
  }
  .nav-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 3px;
    border-top: 2px solid currentColor;
  }
  .has-menu .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    padding: 8px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 160ms var(--ease), transform 220ms var(--ease), visibility 0s linear 220ms;
  }
  .has-menu .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 160ms var(--ease), transform 220ms var(--ease), visibility 0s;
  }
  .has-menu .nav-list {
    flex-direction: column;
  }
  .has-menu .nav-list a {
    display: flex;
    min-height: 50px;
    font-size: 1.06rem;
  }
  .has-menu .nav-list a[aria-current]::after {
    left: 0;
    right: auto;
    top: 14px;
    bottom: 14px;
    width: 3px;
    height: auto;
  }
}

@media (max-width: 640px) {
  .wrap,
  .narrow {
    width: calc(100% - 36px);
  }
  .nav-list a {
    padding: 2px 8px;
    font-size: 0.9rem;
  }
}

.nowrap {
  white-space: nowrap;
}
