/* Hyaecord website — shared design system.
   Implements DESIGN.md: flat, no gradients, all colours from the logo,
   OKLCH ramps → semantic tokens, AA contrast verified per pairing. */

/* ---------- tokens ----------
   Neutral scale mirrors Discord's own dark/light surfaces (structure users
   already know) — but every accent (buttons, links, highlights) is drawn
   from the Hyaecord logo instead of Discord's blurple. Brand colour is used
   for maybe 10% of any given screen; the rest is neutral, same as Discord
   itself. Contrast for every pairing below is computed, not eyeballed. */
:root {
  /* brand anchors (from the logo) — accents only, never a page canvas */
  --brand-amber: #c88633;
  --brand-red: #e44550;
  --brand-pink: #d4495f;
  --brand-brown: #2e1d11;
  --brand-cream: #f1e9d5;

  /* ramp steps used below */
  --amber-300: #e8a962; --amber-500: #aa6a00; --amber-600: #835000; --amber-700: #653e05;
  --red-300: #ff9593;   --red-500: #d73142;   --red-600: #a82231;
  --pink-500: #ce3e57;  --pink-600: #a02d42;

  /* semantic — dark (default), neutral scale modeled on Discord's own dark theme */
  --bg: #313338;
  --bg-raise: #1e1f22;
  --bg-card: #2b2d31;
  --border: #3f4147;
  --text: #f2f3f5;
  --text-dim: #949ba4;
  --heading-accent: var(--amber-300);   /* 6.2:1+ on all dark surfaces */
  --link: #e0a352;                      /* 5.7:1+ on all dark surfaces */
  --btn-red: #c93341;                   /* 5.2:1 with white label */
  --btn-red-text: #fefefe;
  --btn-amber: var(--brand-amber);
  --btn-amber-text: var(--brand-brown); /* 5.3:1 */
  --card-accent-1: var(--brand-amber);
  --card-accent-2: var(--brand-red);
  --card-accent-3: var(--brand-pink);

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
}

@media (prefers-color-scheme: light) {
  :root {
    /* neutral scale modeled on Discord's own light theme */
    --bg: #ffffff;
    --bg-raise: #e3e5e8;
    --bg-card: #f2f3f5;
    --border: #d4d7dc;
    --text: #060607;
    --text-dim: #5c5e66;
    --heading-accent: var(--amber-600);   /* 6.7:1+ on all light surfaces */
    --link: var(--pink-600);              /* 7:1+ on all light surfaces */
  }
}

/* ---------- base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
a { color: var(--link); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--heading-accent);
  outline-offset: 2px;
  border-radius: 2px;
}
code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}
.wrap { max-width: 1060px; margin: 0 auto; padding: 0 1.25rem; width: 100%; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--btn-amber); color: var(--btn-amber-text);
  padding: 0.5rem 1rem; border-radius: 0 0 var(--radius-m) 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---------- announcement banner ---------- */
.banner {
  background: var(--bg-raise);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 0.87rem;
  color: var(--text-dim);
  position: relative;
}
.banner strong { color: var(--heading-accent); }
.banner a { color: var(--link); font-weight: 600; }
.banner-close {
  position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim);
  font-size: 1.1rem; line-height: 1; padding: 0.3rem 0.5rem; cursor: pointer;
  border-radius: var(--radius-s);
}
.banner-close:hover { color: var(--text); background: var(--bg-card); }
.banner[hidden] { display: none; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-raise);
  border-bottom: 2px solid var(--brand-amber);
}
.nav-inner {
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0.65rem 1.25rem; max-width: 1060px; margin: 0 auto;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.55rem;
  font-weight: 800; font-size: 1.1rem;
  color: var(--text); text-decoration: none;
}
.nav-brand img { width: 30px; height: 30px; }
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-s);
  color: var(--text); cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }
.nav-links { display: flex; gap: 1.1rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.nav-links a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover { color: var(--heading-accent); text-decoration: underline; }
.nav-links a[aria-current="page"] { color: var(--heading-accent); }
.nav-cta {
  background: var(--btn-red);
  color: var(--btn-red-text) !important;
  padding: 0.45rem 1.1rem; border-radius: 999px; font-weight: 700;
}
.nav-cta:hover { background: var(--brand-pink); color: var(--brand-brown) !important; text-decoration: none !important; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-inner { flex-wrap: wrap; }
  .nav-links {
    order: 3; width: 100%; margin-left: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    max-height: 0; overflow: hidden;
    transition: max-height var(--dur-base) var(--ease);
  }
  .nav.is-open .nav-links { max-height: 20rem; }
  .nav-links a {
    padding: 0.7rem 0.25rem; border-top: 1px solid var(--border);
  }
  .nav-cta { text-align: center; margin: 0.6rem 0.25rem; }
}

.chip {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.2rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.chip .dot-live {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-amber); margin-right: 0.4rem;
}

/* ---------- eyebrow headings ---------- */
.eyebrow {
  color: var(--heading-accent);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

/* ---------- hero (home) ---------- */
.hero { text-align: center; padding: clamp(3rem, 8vw, 5rem) 1.25rem clamp(2.5rem, 6vw, 4rem); border-bottom: 1px solid var(--border); }
.hero img.logo { width: clamp(96px, 20vw, 140px); height: auto; }
.hero h1 {
  margin-top: 1.1rem;
  font-size: clamp(2.2rem, 8vw, 4.2rem);
  letter-spacing: -0.03em; line-height: 1.08; font-weight: 900;
}
.hero .accent-line { color: var(--heading-accent); }
.hero .tag { color: var(--text-dim); font-size: clamp(1rem, 3vw, 1.2rem); max-width: 36rem; margin: 1rem auto 0; }
.hero .buttons { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; margin-top: 2.2rem; }
.hero .sub { margin-top: 1rem; color: var(--text-dim); font-size: 0.85rem; padding: 0 0.5rem; }

/* ---------- pronunciation (collapsed by default — a footnote, not a section) ---------- */
.pronounce {
  margin-top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 0.9rem 1.1rem;
  text-align: left;
}
.pronounce[open] { padding-bottom: 1.25rem; }
.pronounce summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--heading-accent);
}
.pronounce .pronounce-body { margin-top: 1rem; }
.pronounce .pronounce-body .lead { margin-bottom: 0.9rem; }
.pronounce .ipa {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--heading-accent);
  overflow-x: auto;
  white-space: nowrap;
  padding-bottom: 0.25rem;
}
.pronounce .breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.9rem;
  margin: 1.25rem 0;
}
.pronounce .syllable {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 0.75rem 0.9rem;
}
.pronounce .syllable b {
  display: block; font-size: 1.15rem; color: var(--text);
}
.pronounce .syllable span {
  display: block; color: var(--text-dim); font-size: 0.82rem; margin-top: 0.15rem;
}
.pronounce footer.credential {
  color: var(--text-dim); font-size: 0.82rem; font-style: italic; margin-top: 1rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.7rem; border-radius: 999px;
  font-weight: 700; font-size: 1rem; text-decoration: none;
  border: 2px solid var(--border);
  color: var(--text); background: var(--bg-card);
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--brand-amber); }
.btn.primary { background: var(--btn-amber); border-color: var(--btn-amber); color: var(--btn-amber-text); }
.btn.primary:hover { border-color: var(--brand-brown); }
.btn.discord { background: var(--btn-red); border-color: var(--btn-red); color: var(--btn-red-text); }
.btn.discord:hover { border-color: var(--brand-brown); }

/* ---------- sections & cards ---------- */
section { padding: 2.4rem 0; }
section > h2, .page-title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  letter-spacing: -0.02em; margin-bottom: 0.4rem;
}
.lead { color: var(--text-dim); margin-bottom: 1.75rem; max-width: 44rem; }
.accent { color: var(--heading-accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 0.9rem; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.1rem 1.2rem;
  border-top: 4px solid var(--border);
  transition: transform var(--dur-base) var(--ease);
}
.card:hover { transform: translateY(-3px); }
.card:nth-child(3n+1) { border-top-color: var(--card-accent-1); }
.card:nth-child(3n+2) { border-top-color: var(--card-accent-2); }
.card:nth-child(3n+3) { border-top-color: var(--card-accent-3); }
.card .emoji { font-size: 1.6rem; }

.contributor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.contributor-card img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.contributor-card h3 { margin: 0; font-size: 0.95rem; }

/* ---------- app preview ----------
   Live renders of Hyaecord's real shell (server rail / channel list / chat
   / member list) — not screenshots — each card a full mini client in one
   of the actual built-in Theme Store options, deliberately independent of
   this page's own amber-accented tokens above since the point is showing
   the *app's* real palettes accurately. Placeholder content only. Each
   theme still follows prefers-color-scheme, same mechanism as the rest of
   this page — no separate toggle to fiddle with. */
.app-preview-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 2.5rem 1.75rem;
  padding: 1rem 0 1.5rem;
}
.app-preview { width: min(320px, 100%); }
.ap-card-label {
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
  margin-bottom: 0.5rem;
}
.app-preview-frame {
  display: grid;
  /* Matches the real client's actual rail/channels/members ratio
     (72px/240px/240px in src/renderer/styles.css), scaled down. */
  grid-template-columns: 25px 84px 1fr 84px;
  height: 220px;
  border-radius: var(--radius-l);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.3);
  font-size: 0.68rem;
  transition: transform var(--dur-base) var(--ease);
}
@media (max-width: 400px) {
  .app-preview-frame { grid-template-columns: 30px 1fr; }
  .app-preview-frame .ap-members { display: none; }
}
.ap-tilt-1 .app-preview-frame { transform: rotate(-3deg); }
.ap-tilt-2 .app-preview-frame { transform: rotate(2deg) translateY(0.6rem); }
.ap-tilt-3 .app-preview-frame { transform: rotate(-1.5deg) translateY(-0.3rem); }
.app-preview:hover .app-preview-frame { transform: rotate(0deg) translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .ap-tilt-1 .app-preview-frame,
  .ap-tilt-2 .app-preview-frame,
  .ap-tilt-3 .app-preview-frame { transition: none; }
}

/* Each theme's dark set is the default; prefers-color-scheme:light swaps in
   its light set. Values match community-themes/registry.json exactly. */
.ap-theme-default {
  --ap-deep: #16130e; --ap-base: #1c1812; --ap-raise: #241f16; --ap-hover: #2d271c;
  --ap-border: #3a3325; --ap-text: #f2f3f5; --ap-text-dim: #949ba4;
  --ap-accent: #2dd4bf; --ap-accent-strong: #5eead4;
}
.ap-theme-hyena {
  --ap-deep: #1a120a; --ap-base: #201610; --ap-raise: #2b1e14; --ap-hover: #37281c;
  --ap-border: #4a3626; --ap-text: #f5eee2; --ap-text-dim: #b9a892;
  --ap-accent: #e8a962; --ap-accent-strong: #f5cc9f;
}
.ap-theme-tubular {
  --ap-deep: #0a0f0e; --ap-base: #0f1614; --ap-raise: #16211d; --ap-hover: #1d2b26;
  --ap-border: #274038; --ap-text: #eef9f6; --ap-text-dim: #93b3aa;
  --ap-accent: #22e6c8; --ap-accent-strong: #7ff5e0;
}
@media (prefers-color-scheme: light) {
  .ap-theme-default {
    --ap-deep: #e3e5e8; --ap-base: #ffffff; --ap-raise: #f2f3f5; --ap-hover: #e3e5e8;
    --ap-border: #d4d7dc; --ap-text: #060607; --ap-text-dim: #5c5e66;
    --ap-accent: #115e59; --ap-accent-strong: #0d4f4a;
  }
  .ap-theme-hyena {
    --ap-deep: #ece1cd; --ap-base: #fbf6ec; --ap-raise: #f3ebd9; --ap-hover: #ece1cd;
    --ap-border: #ddccaf; --ap-text: #2e1d11; --ap-text-dim: #6b5645;
    --ap-accent: #835000; --ap-accent-strong: #653e05;
  }
  .ap-theme-tubular {
    --ap-deep: #e2f2ee; --ap-base: #ffffff; --ap-raise: #eefaf7; --ap-hover: #e2f2ee;
    --ap-border: #c8e3dc; --ap-text: #052620; --ap-text-dim: #4c7168;
    --ap-accent: #0f7a68; --ap-accent-strong: #0a5c4e;
  }
}

.ap-rail {
  background: var(--ap-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0;
}
.ap-pill {
  width: 17px; height: 17px;
  border-radius: 6px;
  background: var(--ap-raise);
  color: var(--ap-text-dim);
  display: grid; place-items: center;
  font-size: 0.42rem; font-weight: 700;
}
.ap-pill-home { background: var(--ap-accent); color: var(--ap-deep); border-radius: 30%; }
.ap-pill-active { border: 2px solid var(--ap-accent); color: var(--ap-text); }
.ap-divider { width: 11px; height: 2px; background: var(--ap-border); border-radius: 1px; }

.ap-channels { background: var(--ap-base); padding: 0.5rem 0.4rem; border-right: 1px solid var(--ap-border); overflow: hidden; }
.ap-server-name { color: var(--ap-text); font-weight: 700; margin-bottom: 0.4rem; font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-channel { color: var(--ap-text-dim); padding: 0.2rem 0.35rem; border-radius: 5px; margin-bottom: 0.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-channel.is-active { background: var(--ap-hover); color: var(--ap-text); }

.ap-chat { background: var(--ap-base); display: flex; flex-direction: column; min-width: 0; }
.ap-chat-header {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--ap-border);
  color: var(--ap-text);
  font-weight: 700;
}
.ap-msg { display: flex; gap: 0.4rem; padding: 0.35rem 0.65rem; align-items: flex-start; }
.ap-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  /* Accent fills are light in dark mode (dark text reads) and dark in light
     mode (light text reads) across every theme — so this just tracks which
     mode is active rather than needing a colour per theme. */
  color: var(--ap-deep);
  font-weight: 700; font-size: 0.56rem;
}
@media (prefers-color-scheme: light) {
  .ap-avatar { color: var(--ap-base); }
}
.ap-msg-meta { display: flex; align-items: baseline; gap: 0.35rem; }
.ap-author { color: var(--ap-text); font-weight: 600; }
.ap-time { color: var(--ap-text-dim); font-size: 0.6rem; }
.ap-msg-text { color: var(--ap-text); overflow-wrap: anywhere; }
.ap-composer {
  margin: auto 0.65rem 0.55rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: var(--ap-raise);
  color: var(--ap-text-dim);
}

.ap-members { background: var(--ap-base); border-left: 1px solid var(--ap-border); padding: 0.55rem 0.5rem; }
.ap-member-group { color: var(--ap-text-dim); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em; margin: 0.5rem 0 0.35rem; }
.ap-member-group:first-child { margin-top: 0; }
.ap-member { display: flex; align-items: center; gap: 0.35rem; color: var(--ap-text); padding: 0.15rem 0; font-size: 0.68rem; }
.ap-status { width: 7px; height: 7px; border-radius: 50%; background: var(--ap-text-dim); }
.ap-status.online { background: #23a55a; }
.ap-status.idle { background: #f0b232; }
.card h3 { font-size: 1.08rem; margin: 0.5rem 0 0.35rem; }
.card p { color: var(--text-dim); font-size: 0.95rem; }

/* ---------- download tiles ---------- */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 0.9rem; }
.dl {
  display: block; text-decoration: none; text-align: center;
  background: var(--bg-card); border: 2px solid var(--border); border-radius: 14px;
  padding: 1.1rem 1rem; color: var(--text); font-weight: 700;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.dl:hover { transform: translateY(-2px); border-color: var(--brand-amber); }
.dl span { display: block; font-weight: 400; color: var(--text-dim); font-size: 0.85rem; margin-top: 0.2rem; }

/* ---------- notice ---------- */
.notice {
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--brand-red); border-radius: var(--radius-m);
  padding: 1.1rem 1.3rem; color: var(--text-dim); font-size: 0.95rem;
}

/* ---------- prose pages (docs, privacy, legal) ---------- */
.prose { max-width: 68ch; margin: 0 auto; padding: 3rem 1.25rem; width: 100%; }
.prose-wide { max-width: 860px; }
.prose .page-title { margin-bottom: 0.25rem; }
.prose .meta { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 2rem; }
.prose h2 { font-size: 1.25rem; color: var(--heading-accent); margin: 2.25rem 0 0.75rem; }
.prose p, .prose ul { margin-bottom: 1rem; }
.prose ul { padding-left: 1.5rem; }
.prose li { margin-bottom: 0.5rem; }
.prose .grid { margin-bottom: 1rem; }
.prose .card { padding: 1.1rem 1.25rem; }
.prose .card h3 { font-size: 1rem; margin: 0 0 0.35rem; }
.prose .card p { margin: 0; font-size: 0.92rem; }

details {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 0.8rem 1.1rem; margin-bottom: 0.6rem;
}
details summary { cursor: pointer; font-weight: 600; }
details p { color: var(--text-dim); margin: 0.6rem 0 0; font-size: 0.95rem; }
details[open] { border-color: var(--brand-amber); }

/* ---------- 404 ---------- */
.error-page {
  flex: 1; display: grid; place-items: center; text-align: center; padding: 3rem 1.25rem;
}
.error-page h1 { font-size: 4.5rem; letter-spacing: -0.03em; color: var(--heading-accent); }
.error-page p { color: var(--text-dim); margin: 0.5rem 0 1.5rem; }

/* ---------- footer ---------- */
footer {
  border-top: 2px solid var(--brand-amber);
  margin-top: 2.5rem; padding: 2.2rem 0;
  text-align: center; color: var(--text-dim); font-size: 0.9rem;
  background: var(--bg-raise);
}
footer a { color: var(--text); }
footer a:hover { color: var(--heading-accent); }
footer p + p { margin-top: 0.5rem; }
