/* Appsurge - design tokens & shared styles */

:root {
  /* Type */
  --font-sans: "Schibsted Grotesk", "Söhne", "Helvetica Neue", Helvetica, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Light palette (warm neutral) */
  --bg: oklch(99% 0.005 80);
  --bg-soft: oklch(97% 0.006 80);
  --fg: oklch(15% 0.008 80);
  --fg-soft: oklch(28% 0.008 80);
  --muted: oklch(52% 0.008 80);
  --line: oklch(90% 0.005 80);
  --line-strong: oklch(82% 0.005 80);
  --accent: oklch(58% 0.22 25);
  --accent-ink: oklch(98% 0 0);

  /* Spacing rhythm */
  --max: 1320px;
  --gutter: clamp(20px, 4vw, 56px);

  --radius: 2px;
}

:root[data-theme="dark"] {
  --bg: oklch(13% 0.005 80);
  --bg-soft: oklch(17% 0.006 80);
  --fg: oklch(96% 0.005 80);
  --fg-soft: oklch(82% 0.005 80);
  --muted: oklch(60% 0.01 80);
  --line: oklch(24% 0.005 80);
  --line-strong: oklch(32% 0.005 80);
  --accent: oklch(68% 0.22 25);
  --accent-ink: oklch(15% 0 0);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a.inline { border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; transition: border-color 160ms ease, color 160ms ease; }
a.inline:hover { color: var(--accent); border-color: var(--accent); }

::selection { background: var(--accent); color: var(--accent-ink); }

img, svg { display: block; max-width: 100%; }

/* Layout primitives */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }
.rule-strong { height: 1px; background: var(--line-strong); border: 0; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}

.h-display {
  font-size: clamp(48px, 9vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
.h-display .accent { color: var(--accent); }
.h1 {
  font-size: clamp(38px, 6vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
.h2 {
  font-size: clamp(28px, 3.4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 500;
  margin: 0;
  text-wrap: balance;
}
.h3 {
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 500;
  margin: 0;
}
.lead {
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.45;
  color: var(--fg-soft);
  letter-spacing: -0.01em;
  text-wrap: pretty;
  max-width: 60ch;
}
.body-l { font-size: 17px; line-height: 1.55; color: var(--fg-soft); text-wrap: pretty; }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; color: var(--muted); }
.mono-up { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 32px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
}
.nav-brand .mark { height: 18px; width: auto; color: var(--accent); }
.nav-brand .wordmark {
  font-size: 16px;
  letter-spacing: -0.01em;
  font-weight: 500;
}
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-link {
  font-size: 14px;
  color: var(--muted);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  transition: color 160ms ease;
}
.nav-link .num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.nav-link:hover { color: var(--fg); }
.nav-link.is-active { color: var(--fg); }
.nav-link.is-active .num { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px 8px 16px;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.nav-cta::after { content: "→"; font-size: 13px; }
.nav-cta:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.theme-toggle {
  --size: 36px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.theme-toggle:hover { border-color: var(--fg); }
.theme-toggle svg {
  width: 16px;
  height: 16px;
  position: absolute;
  inset: 0;
  margin: auto;
  transition: transform 320ms cubic-bezier(.6,.05,.2,1), opacity 220ms ease;
}
.theme-toggle .i-sun { transform: rotate(0deg) scale(1); opacity: 1; }
.theme-toggle .i-moon { transform: rotate(-90deg) scale(0.6); opacity: 0; }
:root[data-theme="dark"] .theme-toggle .i-sun { transform: rotate(90deg) scale(0.6); opacity: 0; }
:root[data-theme="dark"] .theme-toggle .i-moon { transform: rotate(0deg) scale(1); opacity: 1; }

@media (max-width: 760px) {
  .nav-links { gap: 18px; }
  .nav-links .nav-link .num { display: none; }
  .nav-cta { display: none; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 15px;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
  text-decoration: none;
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--fg); }
.btn .arrow { transition: transform 200ms ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* Page header */
.page-head {
  padding: clamp(56px, 9vw, 120px) 0 clamp(48px, 7vw, 88px);
  border-bottom: 1px solid var(--line);
}
.page-head .meta {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
}
.page-head .meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* Sections */
section { padding: clamp(64px, 9vw, 120px) 0; }
section + section { border-top: 1px solid var(--line); }
.section-head {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  margin-bottom: clamp(40px, 6vw, 72px);
  align-items: baseline;
}
.section-head .label { padding-top: 6px; }
@media (max-width: 760px) {
  .section-head { grid-template-columns: 1fr; gap: 16px; }
}

/* Footer */
footer {
  border-top: 1px solid var(--line);
  padding: 64px 0 28px;
  margin-top: 40px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 80px;
}
.foot-grid h4 {
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.foot-grid a { color: var(--fg-soft); font-size: 15px; }
.foot-grid a:hover { color: var(--accent); }
.foot-brand .lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.foot-brand .lockup svg { height: 22px; color: var(--accent); }
.foot-brand p { margin: 0; color: var(--muted); font-size: 14px; max-width: 36ch; line-height: 1.5; }
.foot-base {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.foot-base span:nth-child(2) { text-transform: uppercase; }
@media (max-width: 760px) {
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 36px; }
  .foot-brand { grid-column: 1 / -1; }
  .foot-base { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* Logo motif background */
.motif {
  position: absolute;
  pointer-events: none;
  color: var(--accent);
}

/* Marquee */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 22px 0;
}
.marquee-track {
  display: flex;
  gap: 64px;
  width: max-content;
  animation: marquee 38s linear infinite;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.marquee-track span.dot { color: var(--accent); }
@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* Tweaks panel */
.tweaks-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  background: var(--fg);
  color: var(--bg);
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 24px -8px rgba(0,0,0,0.25);
  transition: transform 160ms ease;
}
.tweaks-toggle:hover { transform: translateY(-2px); }
.tweaks-toggle svg { width: 18px; height: 18px; }

.tweaks-panel {
  position: fixed;
  right: 20px;
  bottom: 76px;
  z-index: 81;
  width: 300px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.28);
  padding: 18px;
  display: none;
}
.tweaks-panel.open { display: block; }
.tweaks-panel h4 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-weight: 400;
}
.tweaks-row { margin-bottom: 16px; }
.tweaks-row:last-child { margin-bottom: 0; }
.tweaks-seg {
  display: flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.tweaks-seg button {
  flex: 1;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease;
}
.tweaks-seg button.active {
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
:root[data-theme="dark"] .tweaks-seg button.active { box-shadow: 0 0 0 1px var(--line-strong); }

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}