/* Apitri landing — timed light/dark themes via CSS variables */

:root {
  --font-display: "Syne", "Segoe UI", sans-serif;
  --font-body: "Outfit", "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --theme-duration: 480ms;
}

/* Dark (evening / night) */
html[data-theme="dark"] {
  --bg: #0b0e11;
  --bg-elev: #12171c;
  --fg: #e7ebe6;
  --muted: #8b958c;
  --accent: #2f9e8f;
  --accent-ink: #06221e;
  --line: rgba(231, 235, 230, 0.12);
  --glow: rgba(47, 158, 143, 0.14);
  --grad-a: #101820;
  --grad-b: #0b0e11;
  --grad-c: #1a1410;
  --noise: rgba(255, 255, 255, 0.035);
  --btn-ghost-bg: rgba(231, 235, 230, 0.04);
  --thumb: #e7ebe6;
  --track: #1c242b;
  color-scheme: dark;
}

/* Light (day) — cool mist, not cream */
html[data-theme="light"] {
  --bg: #e9eef2;
  --bg-elev: #f5f7f9;
  --fg: #12161b;
  --muted: #5a6570;
  --accent: #18685d;
  --accent-ink: #f3faf8;
  --line: rgba(18, 22, 27, 0.12);
  --glow: rgba(24, 104, 93, 0.1);
  --grad-a: #dfe8ef;
  --grad-b: #e9eef2;
  --grad-c: #e4e0d8;
  --noise: rgba(0, 0, 0, 0.03);
  --btn-ghost-bg: rgba(18, 22, 27, 0.04);
  --thumb: #12161b;
  --track: #c9d2da;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color var(--theme-duration) var(--ease-out),
    color var(--theme-duration) var(--ease-out);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

/* Soft atmosphere — gradient + grain, not flat */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, var(--glow), transparent 55%),
    radial-gradient(900px 600px at 92% 8%, var(--grad-c), transparent 50%),
    linear-gradient(165deg, var(--grad-a), var(--grad-b) 45%, var(--grad-c));
  transition: opacity var(--theme-duration) var(--ease-out);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
  opacity: 0.45;
  transition: opacity var(--theme-duration) var(--ease-out);
}

html[data-theme="light"] .atmosphere::after {
  opacity: 0.28;
  mix-blend-mode: multiply;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.top-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  opacity: 0.7;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.35rem 0.15rem;
  transition: color 200ms var(--ease-out);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--fg);
  outline: none;
}

.theme-toggle:focus-visible .toggle-track {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.toggle-track {
  position: relative;
  width: 2.6rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--track);
  border: 1px solid var(--line);
  transition:
    background-color var(--theme-duration) var(--ease-out),
    border-color var(--theme-duration) var(--ease-out),
    transform 220ms var(--ease-out);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: var(--thumb);
  transition:
    transform var(--theme-duration) var(--ease-out),
    background-color var(--theme-duration) var(--ease-out);
}

html[data-theme="light"] .toggle-thumb {
  transform: translateX(1.2rem);
}

.theme-toggle.is-pressed .toggle-track {
  transform: scale(0.92);
}

.theme-toggle.is-flash .toggle-thumb {
  transform: translateX(1.2rem) scale(1.08);
}

html[data-theme="dark"] .theme-toggle.is-flash .toggle-thumb {
  transform: scale(1.08);
}

/* Hero — one composition, brand first */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(3.5rem, 14vh, 7.5rem) 1.5rem 4rem;
  min-height: min(88vh, 820px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  letter-spacing: -0.035em;
  line-height: 0.95;
  color: var(--fg);
}

.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.55rem, 3.6vw, 2.35rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 34ch;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--muted);
  font-weight: 400;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.7rem 1.25rem;
  border-radius: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    background-color 200ms var(--ease-out),
    color 200ms var(--ease-out),
    border-color 200ms var(--ease-out),
    transform 200ms var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
  color: inherit;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  filter: brightness(1.06);
  color: var(--accent-ink);
}

.btn.ghost {
  background: var(--btn-ghost-bg);
  border-color: var(--line);
  color: var(--fg);
}

.btn.ghost:hover {
  border-color: var(--fg);
}

/* How it works — list, not cards */
.how {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4.5rem;
  border-top: 1px solid var(--line);
  transition: border-color var(--theme-duration) var(--ease-out);
}

.how h2 {
  margin: 2.5rem 0 1.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 760px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

.steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
}

.step-n {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 0.2rem;
}

.steps strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 28ch;
}

.foot {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color var(--theme-duration) var(--ease-out);
}

.foot p {
  margin: 0;
}

.fine {
  opacity: 0.85;
}

/* Entrance motions */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 700ms var(--ease-out) forwards;
  animation-delay: var(--d, 0ms);
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
