/* Rust Almost Legacy — landing page styles.
   Palette is derived from the logo: #800080 purple on #181c1a near-black. */

:root {
  --bg: #0b0a0d;
  --bg-deep: #070609;
  --surface: rgba(24, 22, 28, 0.72);
  --surface-hover: rgba(34, 30, 40, 0.85);
  --hairline: rgba(255, 255, 255, 0.07);
  --hairline-strong: rgba(232, 121, 249, 0.28);

  --brand: #800080;
  --brand-lift: #a81aa8;
  --accent: #d946ef;
  --accent-soft: #e879f9;
  --accent-dim: rgba(217, 70, 239, 0.14);
  --accent-glow: rgba(168, 26, 168, 0.4);

  --text: #f4f1f6;
  --text-muted: #a49fac;
  --text-dim: #6d6875;

  --radius: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --shell: 1120px;
  --shell-narrow: 760px;
  --header-h: 64px;

  --font-body: Inter, "IBM Plex Sans Thai", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", "IBM Plex Sans Thai", "Segoe UI", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Thai copy sits a touch lower and needs more leading than Latin */
html[lang="th"] body {
  line-height: 1.85;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Background layers ─────────────────────────────────────────────────────── */

.bg-glow,
.bg-grid,
.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  background:
    radial-gradient(ellipse 70% 55% at 50% -8%, rgba(168, 26, 168, 0.3) 0%, transparent 62%),
    radial-gradient(ellipse 50% 40% at 88% 12%, rgba(217, 70, 239, 0.14) 0%, transparent 60%),
    radial-gradient(ellipse 60% 45% at 8% 78%, rgba(128, 0, 128, 0.16) 0%, transparent 62%),
    linear-gradient(180deg, transparent 40%, var(--bg-deep) 100%);
}

.bg-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}

.bg-noise {
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.shell-narrow {
  max-width: var(--shell-narrow);
}

main {
  position: relative;
  z-index: 1;
}

.section {
  padding: 5.5rem 0;
}

.section-head {
  text-align: center;
  max-width: 44rem;
  margin: 0 auto 3rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-sub {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

/* ── Brand ─────────────────────────────────────────────────────────────────── */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--hairline-strong), 0 6px 20px rgba(128, 0, 128, 0.35);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-name-accent {
  color: var(--accent-soft);
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), backdrop-filter 0.3s var(--ease);
}

.site-header.is-stuck {
  background: rgba(11, 10, 13, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--hairline);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-inline: auto;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.18s var(--ease);
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ── Language switch ───────────────────────────────────────────────────────── */

.lang-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.03);
}

.lang-btn {
  min-width: 2.75rem;
  min-height: 2rem;
  padding: 0 0.6rem;
  border: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 16px rgba(128, 0, 128, 0.5);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease), transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.btn-sm {
  min-height: 36px;
  padding: 0 0.95rem;
  font-size: 0.8125rem;
}

.btn-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

.btn-sm .btn-icon {
  width: 1rem;
  height: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  box-shadow: 0 8px 28px rgba(128, 0, 128, 0.42);
}

.btn-primary:hover:not([aria-disabled="true"]),
.btn-primary:focus-visible:not([aria-disabled="true"]) {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px var(--accent-glow);
}

.btn-primary[aria-disabled="true"] {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--hairline);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: var(--accent-dim);
  border-color: var(--hairline-strong);
}

:where(a, button):focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.hero {
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  padding: 3rem 0 4.5rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-logo {
  width: clamp(104px, 16vw, 156px);
  height: auto;
  border-radius: 24px;
  box-shadow: 0 0 0 1px var(--hairline-strong), 0 24px 70px rgba(128, 0, 128, 0.5);
}

.hero-kicker {
  margin-top: 2rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.hero-title {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-title-accent {
  background: linear-gradient(120deg, var(--accent-soft) 0%, #fff 55%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-tagline {
  margin-top: 1.25rem;
  max-width: 40rem;
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  color: var(--text-muted);
}

.cta-row {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2rem;
}

.hero-note {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.hero-note + .hero-note {
  margin-top: 0.35rem;
}

.hero-note[hidden] {
  display: none;
}

/* ── Features ──────────────────────────────────────────────────────────────── */

.feature-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
  gap: 1rem;
}

.feature {
  padding: 1.75rem;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.feature:hover {
  background: var(--surface-hover);
  border-color: var(--hairline-strong);
  transform: translateY(-3px);
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1.125rem;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--accent-dim);
  color: var(--accent-soft);
}

.feature-icon svg {
  width: 1.375rem;
  height: 1.375rem;
}

.feature-title {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.feature-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* ── Steps ─────────────────────────────────────────────────────────────────── */

.step-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  counter-reset: step;
}

.step {
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
}

.step::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--brand), var(--accent), transparent);
}

.step-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent-soft);
  opacity: 0.75;
}

.step-title {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.step-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* ── Rules ─────────────────────────────────────────────────────────────────── */

.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rule {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.375rem 1.5rem;
}

.rule-num {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--accent-soft);
  opacity: 0.85;
}

.rule-text {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  padding-top: 0.125rem;
}

.rules-final {
  margin-top: 0.25rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-soft);
  border-color: var(--hairline-strong);
  background: linear-gradient(135deg, rgba(128, 0, 128, 0.14) 0%, rgba(24, 22, 28, 0.85) 100%);
  box-shadow: 0 0 0 1px var(--hairline-strong), inset 0 1px 0 rgba(232, 121, 249, 0.08);
}

/* ── FAQ ───────────────────────────────────────────────────────────────────── */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.faq {
  overflow: hidden;
  transition: border-color 0.25s var(--ease);
}

.faq[open] {
  border-color: var(--hairline-strong);
}

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.375rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.faq-q::-webkit-details-marker {
  display: none;
}

.faq-q::after {
  content: "";
  width: 0.625rem;
  height: 0.625rem;
  flex-shrink: 0;
  border-right: 2px solid var(--accent-soft);
  border-bottom: 2px solid var(--accent-soft);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s var(--ease);
}

.faq[open] .faq-q::after {
  transform: rotate(225deg) translateY(-2px);
}

.faq-a {
  padding: 0 1.375rem 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */

.site-footer {
  position: relative;
  z-index: 1;
  padding: 2.5rem 0;
  border-top: 1px solid var(--hairline);
}

.site-footer-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-brand .brand-logo {
  width: 32px;
  height: 32px;
}

.footer-tagline {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-link {
  color: var(--accent-soft);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  margin-inline: auto;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-legal {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-disclaimer {
  max-width: 26rem;
  line-height: 1.5;
}

/* ── Scroll reveal ─────────────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Staggered entrance inside grids */
.feature-grid .reveal:nth-child(2),
.step-grid .reveal:nth-child(2),
.faq-list .reveal:nth-child(2) { transition-delay: 0.06s; }
.feature-grid .reveal:nth-child(3),
.step-grid .reveal:nth-child(3),
.faq-list .reveal:nth-child(3) { transition-delay: 0.12s; }
.rules-list .reveal:nth-child(2) { transition-delay: 0.12s; }
.rules-final.reveal { transition-delay: 0.2s; }
.feature-grid .reveal:nth-child(4),
.faq-list .reveal:nth-child(4) { transition-delay: 0.18s; }
.feature-grid .reveal:nth-child(5),
.faq-list .reveal:nth-child(5) { transition-delay: 0.24s; }
.feature-grid .reveal:nth-child(6),
.faq-list .reveal:nth-child(6) { transition-delay: 0.3s; }

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .site-nav {
    display: none;
  }

  .header-actions {
    margin-inline-start: auto;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 0 1.125rem;
  }

  .section {
    padding: 4rem 0;
  }

  .hero {
    min-height: auto;
    padding: 3rem 0 4rem;
  }

  /* Shrink the wordmark so the language switch and Discord button still fit */
  .brand {
    gap: 0.5rem;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 0.9375rem;
  }

  .header-discord span {
    display: none;
  }

  .header-discord {
    padding: 0 0.7rem;
  }

  .cta-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .feature,
  .step,
  .rule {
    padding: 1.375rem;
  }

  .site-footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-link {
    margin-inline: 0;
  }

  .footer-legal {
    text-align: left;
  }
}

/* Very narrow phones: drop the header wordmark so the logo mark, language
   switch, and Discord button all keep their full tap targets. The name is
   still spelled out in the hero heading right below. */
@media (max-width: 380px) {
  .site-header .brand-name {
    display: none;
  }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
