/* ---------- Tokens ---------- */
:root {
  --bg: #120e19;
  --bg-raised: #1c1526;
  --surface: #201a2c;
  --line: rgba(230, 224, 245, 0.1);
  --line-strong: rgba(230, 224, 245, 0.24);
  --text: #f4f1fa;
  --muted: #9c90af;
  --muted-dim: #6b6080;
  --accent: #c77dff;
  --accent-dim: #a855f7;
  --violet: #9d4edd;
  --teal: #c9a0dc;
  --byzantium: #702963;
  --gradient-brand: linear-gradient(90deg, var(--teal), var(--accent), var(--byzantium));
  --glow-1: rgba(199, 125, 255, 0.18);
  --glow-2: rgba(112, 41, 99, 0.28);
  --glow-contact: rgba(199, 125, 255, 0.16);
  --header-bg: rgba(18, 14, 25, 0.72);
  --radius: 2px;
  --radius-glass: 20px;
  --glass-bg: rgba(244, 241, 250, 0.05);
  --glass-bg-hover: rgba(244, 241, 250, 0.09);
  --glass-border: rgba(244, 241, 250, 0.14);
  --glass-shadow: rgba(0, 0, 0, 0.35);
  --glass-highlight: rgba(255, 255, 255, 0.08);
  --font-display: "Fraunces", ui-serif, Georgia, serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --maxw: 1180px;
}

/* Light mode — explicit toggle only (default appearance is dark, per the
   tokens above). Same purple/violet family, pushed to a proper light
   ground this time: bg/text are literally the dark theme's text/bg colors
   swapped, so the two themes share the same two anchor colors inverted. */
:root[data-theme="light"] {
  --bg: #f4f1fa;
  --bg-raised: #e9e1f2;
  --surface: #fbf9fd;
  --line: rgba(18, 14, 25, 0.1);
  --line-strong: rgba(18, 14, 25, 0.22);
  --text: #120e19;
  --muted: #6b6080;
  --muted-dim: #9c90af;
  --accent: #c77dff;
  --accent-dim: #a855f7;
  --violet: #9d4edd;
  --teal: #c9a0dc;
  --byzantium: #702963;
  --glow-1: rgba(199, 125, 255, 0.22);
  --glow-2: rgba(112, 41, 99, 0.14);
  --glow-contact: rgba(199, 125, 255, 0.16);
  --header-bg: rgba(244, 241, 250, 0.8);
  --glass-bg: rgba(18, 14, 25, 0.04);
  --glass-bg-hover: rgba(18, 14, 25, 0.07);
  --glass-border: rgba(18, 14, 25, 0.12);
  --glass-shadow: rgba(112, 41, 99, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.5);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.ambient-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 45% at 15% 18%, var(--glow-1), transparent 70%),
    radial-gradient(42% 48% at 85% 12%, var(--glow-2), transparent 70%),
    radial-gradient(48% 55% at 50% 95%, var(--glow-contact), transparent 70%);
  filter: blur(70px);
  transition: background 0.4s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
p { margin: 0; line-height: 1.65; }
ol { margin: 0; padding: 0; }
button { font: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--bg); padding: 12px 18px; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 15px 30px; border-radius: var(--radius); font-weight: 700; font-size: 0.92rem;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--text); transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-lg { padding: 18px 36px; font-size: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 76px; }

.logo-wordmark { display: block; }
/* White-ink wordmark for the dark ground, black-ink for the light one. */
.logo-img-light { display: none; }
:root[data-theme="light"] .logo-img-dark { display: none; }
:root[data-theme="light"] .logo-img-light { display: block; }
.brand-mark { height: 30px; width: auto; }

.header-actions { display: flex; align-items: center; gap: 6px; }
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: none; background: none; cursor: pointer;
  color: var(--text); padding: 0; border-radius: var(--radius);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); background: var(--bg-raised); }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.primary-nav { display: flex; align-items: center; gap: 34px; }
.primary-nav a {
  font-weight: 600; font-size: 0.9rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  transition: color 0.15s ease;
}
.primary-nav a:hover { color: var(--text); }
.nav-cta {
  background: var(--text); color: var(--bg) !important;
  padding: 10px 22px; border-radius: var(--radius);
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.nav-cta:hover { background: var(--accent); transform: translateY(-1px); }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; border: none; background: none; cursor: pointer; padding: 0;
}
.nav-toggle span { width: 22px; height: 1.5px; background: var(--text); margin: 0 auto; transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 160px 0 130px;
  overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(46% 60% at var(--mx, 78%) var(--my, 10%), var(--glow-1), transparent 68%),
    radial-gradient(34% 50% at 6% 92%, var(--glow-2), transparent 70%);
  transition: background 0.4s ease;
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(70% 60% at 50% 20%, #000 0%, transparent 75%);
  mask-image: radial-gradient(70% 60% at 50% 20%, #000 0%, transparent 75%);
  opacity: 0.5;
}
.hero-inner { position: relative; z-index: 1; text-align: center; display: flex; flex-direction: column; align-items: center; }
.eyebrow {
  font-family: var(--font-body);
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 22px;
}
.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.6rem); font-weight: 600; margin-bottom: 30px;
}
.hero-title em {
  font-style: italic; font-weight: 500; color: var(--accent);
}
.hero-sub {
  max-width: 600px; font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--muted); margin-bottom: 44px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

/* ---------- About ---------- */
.about { padding: 40px 0 130px; border-bottom: 1px solid var(--line); }
.about-inner { max-width: 980px; margin: 0 auto; }
.about-text {
  max-width: 760px; margin: 0 auto 70px; text-align: center;
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-family: var(--font-display); font-weight: 500; font-style: italic;
  color: var(--text); line-height: 1.45;
}
.process-grid { grid-template-columns: repeat(4, 1fr); }
.process-step { padding: 30px 26px; }
.process-num {
  display: block; font-family: var(--font-display); font-weight: 600; font-style: italic;
  font-size: 1.1rem; color: var(--accent-dim); margin-bottom: 18px;
}
.process-step h3 { font-size: 1.15rem; margin-bottom: 10px; }
.process-step p { color: var(--muted); font-size: 0.92rem; }

/* ---------- Section shared ---------- */
.section-head { max-width: 640px; margin: 0 auto 56px; text-align: center; }
.kicker {
  font-family: var(--font-body); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
}
.section-head h2 { font-size: clamp(2.1rem, 4vw, 3.1rem); }
.section-sub { margin-top: 16px; color: var(--muted); font-size: 1.05rem; }

.grid { display: grid; gap: 20px; }

/* ---------- Iced-glass panels ---------- */
/* Shared frosted-glass treatment for every floating card/panel: a
   translucent tint over the ambient-glow backdrop, blurred and saturated,
   with a soft light-catching top edge and a rounded, sharp-elsewhere
   silhouette consistent with the rest of the site's zero-radius system. */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-glass);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 8px 32px var(--glass-shadow), inset 0 1px 0 var(--glass-highlight);
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.glass-panel:hover { background: var(--glass-bg-hover); border-color: var(--accent-dim); }

/* ---------- Services ---------- */
.services { padding: 130px 0; border-bottom: 1px solid var(--line); }
.services-grid { grid-template-columns: repeat(4, 1fr); }
.card { padding: 34px 28px; }
.service-icon {
  width: 44px; height: 44px; margin-bottom: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.service-card h3 { font-size: 1.05rem; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.02em; }
.service-card p { color: var(--muted); font-size: 0.93rem; }

/* ---------- Portfolio ---------- */
.portfolio { padding: 130px 0; border-bottom: 1px solid var(--line); }
.portfolio-grid { grid-template-columns: repeat(3, 1fr); }
.portfolio-card { display: flex; flex-direction: column; text-align: left; position: relative; padding: 34px; }
.portfolio-icon { width: 52px; height: 52px; margin-bottom: 24px; border-radius: 12px; }
.portfolio-body h3 { font-size: 1.3rem; margin-bottom: 10px; }
.portfolio-body p { color: var(--muted); font-size: 0.95rem; }
.portfolio-link {
  margin-top: 24px; font-weight: 700; color: var(--accent); font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.gallery-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.gallery-item {
  margin: 0; position: relative; overflow: hidden;
  aspect-ratio: 1 / 1; display: block; width: 100%;
  padding: 0; cursor: pointer; font: inherit; color: inherit;
  -webkit-appearance: none; appearance: none;
}
.gallery-item:focus-visible { border-color: var(--accent); }
.gallery-caption {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; text-align: center; font-size: 0.85rem; font-weight: 700;
  letter-spacing: 0.04em; color: var(--muted);
  transition: opacity 0.2s ease, color 0.2s ease;
}
.gallery-item:hover .gallery-caption,
.gallery-item:focus-visible .gallery-caption { color: var(--accent); }
.gallery-item img {
  width: 100%; height: 100%; object-fit: contain; padding: 18px;
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.3s ease;
}
.gallery-item.is-revealed img { opacity: 1; }
.gallery-item.is-revealed .gallery-caption {
  inset: auto 0 0 0; padding: 10px 14px; justify-content: flex-start;
  background: linear-gradient(180deg, transparent, var(--bg) 85%);
  color: var(--text);
}

/* ---------- Utilities ---------- */
.utilities { padding: 130px 0; }
.testing-note { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
.testing-note a { color: var(--accent); font-weight: 600; }
.testing-note a:hover { text-decoration: underline; }
.util-card { padding: 48px; margin-bottom: 20px; scroll-margin-top: 90px; }
.util-head { display: flex; align-items: center; gap: 22px; margin-bottom: 36px; }
.util-icon { width: 60px; height: 60px; border-radius: var(--radius); flex-shrink: 0; }
.util-head h3 { font-size: 1.6rem; margin-bottom: 8px; }
.util-tagline { color: var(--muted); font-size: 1rem; }
.util-body { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; }
.util-how h4, .util-downloads h4 {
  font-family: var(--font-body); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 18px; font-weight: 700;
}
.util-how ol { counter-reset: step; display: flex; flex-direction: column; gap: 16px; }
.util-how li { list-style: none; counter-increment: step; position: relative; padding-left: 36px; font-size: 0.96rem; color: var(--text); }
.util-how li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 22px; height: 22px; border-radius: 50%; background: transparent; border: 1.5px solid var(--accent);
  color: var(--accent); font-weight: 700; font-size: 0.72rem; display: flex; align-items: center; justify-content: center;
}
.download-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 18px; }
.dl-btn {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 15px 18px; background: var(--bg); border-radius: 0;
  font-weight: 700; font-size: 0.92rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.dl-btn:hover { background: var(--accent); color: var(--bg); }
.dl-btn:hover .dl-file { color: var(--bg); opacity: 0.7; }
.dl-file { color: var(--muted); font-weight: 500; font-size: 0.82rem; }

.util-interest {
  margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.interest-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius);
  border: 1.5px solid var(--line-strong); background: transparent; color: var(--text);
  font-weight: 700; font-size: 0.86rem; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.interest-btn svg { width: 17px; height: 17px; }
.interest-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.interest-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.interest-btn[aria-pressed="true"]:hover { transform: none; }
.interest-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.interest-count { font-size: 0.85rem; color: var(--muted); }

/* ---------- Stats ---------- */
.stats { padding: 0 0 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat { padding: 40px 20px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.stat-num {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(2.4rem, 4vw, 3.2rem);
  color: var(--text);
}
.stat-label {
  font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}

/* ---------- Contact ---------- */
.contact {
  padding: 150px 0 140px; text-align: center; border-top: 1px solid var(--line); position: relative; overflow: hidden;
}
.contact::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(50% 90% at 50% 100%, var(--glow-contact), transparent 70%);
}
.contact-inner { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.contact h2 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); margin-bottom: 18px; }
.contact p { color: var(--muted); margin-bottom: 40px; font-size: 1.05rem; }

/* ---------- Footer ---------- */
.site-footer { padding: 40px 0; border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer-mark { height: 20px; width: auto; opacity: 0.55; }
.footer-inner p { color: var(--muted-dim); font-size: 0.82rem; }

/* ---------- Reveal-on-scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .process-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .util-body { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: absolute; top: 76px; left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    flex-direction: column; align-items: stretch; gap: 0;
    max-height: 0; overflow: hidden; transition: max-height 0.25s ease;
  }
  .primary-nav.is-open { max-height: 320px; }
  .primary-nav a { padding: 18px 28px; border-top: 1px solid var(--line); }
  .nav-cta { margin: 16px 28px; text-align: center; }

  .hero { padding: 120px 0 90px; }
  .services-grid { grid-template-columns: 1fr; }
  .portfolio-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .process-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .util-card { padding: 30px; }
  .download-grid { grid-template-columns: 1fr; }
  .about-text { font-size: 1.3rem; }
}
