/* StormIA — site-level styles */
@import url("./tokens.css");

/* font paths in tokens.css are relative to the css file */

/* ── Density (controlled by Tweaks panel) ────────────────────── */
:root {
  --d: 1;             /* density multiplier */
  --section-y: calc(var(--space-24) * var(--d)); /* 96px * d */
}
:root[data-density="compact"] { --d: 0.72; }
:root[data-density="aere"]    { --d: 1.2; }

/* ── Theme ──────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --bg-base:        #0D0D0D;
  --bg-subtle:      #1A1A19;
  --bg-muted:       #232322;
  --bg-card:        #16161514;
  --fg-primary:     #FFFFFF;
  --fg-secondary:   rgba(255,255,255,0.65);
  --fg-tertiary:    rgba(255,255,255,0.40);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);
  --bg-accent-subtle: rgba(114,184,0,0.12);
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.40), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.50), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.60);
}
:root[data-theme="dark"] .surface-card { background: #16161A; border-color: rgba(255,255,255,0.08); }
:root[data-theme="dark"] .surface-subtle { background: #131312; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--fg-primary);
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  line-height: var(--leading-relaxed);
}
::selection { background: #EEF7DB; color: #0D0D0D; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

/* ── Layout helpers ─────────────────────────────────────────── */
.container { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 720px) { .container { padding: 0 20px; } }

.section { padding: var(--section-y) 0; }
.section-tight { padding: calc(var(--section-y) * 0.7) 0; }

/* ── Typography helpers ─────────────────────────────────────── */
.overline {
  font-size: var(--text-xs); font-weight: 600;
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--color-green-500);
  display: inline-block;
}
:root[data-theme="dark"] .overline { color: var(--color-green-500); }

.eyebrow-row { display: flex; align-items: center; gap: 10px; }
.eyebrow-row::before {
  content: ""; width: 22px; height: 1px; background: currentColor;
  display: block; opacity: 0.8;
}

h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; color: var(--fg-primary); }
h1 { font-size: clamp(40px, 6.4vw, 80px); letter-spacing: -0.035em; line-height: 1.02; }
h2 { font-size: clamp(28px, 3.4vw, 44px); }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
p { color: var(--fg-secondary); line-height: 1.65; }

/* Shared glass shadow — available everywhere */
:root {
  --_lg-shadow:
    inset 0 0 0 1px color-mix(in srgb, white 10%, transparent),
    inset 1.8px 3px 0px -2px color-mix(in srgb, white 90%, transparent),
    inset -2px -2px 0px -2px color-mix(in srgb, white 80%, transparent),
    inset -3px -8px 1px -6px color-mix(in srgb, white 60%, transparent),
    inset -0.3px -1px 4px 0px color-mix(in srgb, black 12%, transparent),
    inset -1.5px 2.5px 0px -2px color-mix(in srgb, black 20%, transparent),
    inset 0px 3px 4px -2px color-mix(in srgb, black 20%, transparent),
    inset 2px -6.5px 1px -4px color-mix(in srgb, black 10%, transparent),
    0px 1px 5px 0px color-mix(in srgb, black 10%, transparent),
    0px 6px 16px 0px color-mix(in srgb, black 8%, transparent);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px 22px; border-radius: 12px;
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform 0.25s ease, filter 0.25s ease;
  white-space: nowrap;
  position: relative; isolation: isolate;
  backdrop-filter: blur(8px) url('#lg-filter') saturate(1.5);
  -webkit-backdrop-filter: blur(8px) saturate(1.5);
}
.btn:active { transform: scale(0.97); }

/* Primary — green glass */
.btn-primary {
  background: rgba(114,184,0,0.88); color: #fff;
  border-color: rgba(66,108,0,0.5);
  box-shadow: var(--_lg-shadow), 0 0 14px rgba(114,184,0,0.18);
}
.btn-primary:hover { filter: brightness(1.09); transform: scale(1.03); }

/* Dark — near-black glass */
.btn-dark {
  background: rgba(13,13,13,0.88); color: #fff;
  border-color: rgba(0,0,0,0.30);
  box-shadow: var(--_lg-shadow), 0 0 12px rgba(0,0,0,0.15);
}
.btn-dark:hover { filter: brightness(1.2); transform: scale(1.03); }

/* Ghost — pure glass */
.btn-ghost {
  background: rgba(255,255,255,0.10); color: var(--fg-primary);
  border-color: rgba(0,0,0,0.09);
  box-shadow: var(--_lg-shadow);
}
.btn-ghost:hover { background: rgba(255,255,255,0.20); transform: scale(1.03); }

/* Ghost on dark */
.btn-ghost-on-dark {
  background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.85);
  border-color: rgba(255,255,255,0.15);
  box-shadow: var(--_lg-shadow);
}
.btn-ghost-on-dark:hover { border-color: rgba(255,255,255,0.35); color: #fff; transform: scale(1.03); }

.btn-sm { padding: 9px 16px; font-size: 14px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(8px) url('#lg-filter') saturate(1.4);
  -webkit-backdrop-filter: blur(8px) saturate(1.4);
  transition: transform 200ms var(--ease-default), box-shadow 200ms var(--ease-default);
  box-shadow: var(--_lg-shadow);
}
.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--_lg-shadow), 0 4px 20px rgba(0,0,0,0.09);
  border-color: rgba(0,0,0,0.14);
}
.icon-tile {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--bg-accent-subtle);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-green-500);
}
:root[data-theme="dark"] .icon-tile {
  background: rgba(114,184,0,0.16);
}

/* ── Tags / chips ───────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  background: var(--color-neutral-100); color: var(--color-neutral-700);
  padding: 4px 10px; border-radius: var(--radius-pill);
}
:root[data-theme="dark"] .tag {
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.75);
}
.tag-accent {
  background: var(--bg-accent-subtle); color: var(--color-green-700);
}
:root[data-theme="dark"] .tag-accent { color: var(--color-green-500); }

/* ── Inputs ─────────────────────────────────────────────────── */
.input, .textarea, .select {
  font-family: inherit;
  width: 100%; padding: 11px 14px;
  font-size: 14px; color: var(--fg-primary);
  background: var(--bg-base);
  border: 1.5px solid var(--border-default); border-radius: 8px;
  outline: none;
  transition: border-color 150ms var(--ease-default);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--color-green-500);
  box-shadow: 0 0 0 3px rgba(114,184,0,0.12);
}
.field-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--fg-primary); margin-bottom: 6px; letter-spacing: 0.01em;
}

/* ── Hero scribble underline ────────────────────────────────── */
.scribble {
  position: relative;
  isolation: isolate;
  display: inline;
  background-image: linear-gradient(transparent 62%, var(--color-green-500) 62%, var(--color-green-500) 92%, transparent 92%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 0 0.06em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ── Hero gooey morph text ──────────────────────────────────── */
.gooey-morph {
  position: relative;
  display: inline-flex;
  vertical-align: baseline;
  white-space: nowrap;
}
.gooey-morph__sizer {
  display: inline-block;
  visibility: hidden;
  pointer-events: none;
  color: var(--color-green-500);
}
.gooey-morph__stage {
  position: absolute;
  inset: 0;
  filter: url(#gooey-threshold);
  contain: layout paint style;
}
.gooey-morph__text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--color-green-500);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .gooey-morph__stage { filter: none; }
  .gooey-morph__text[data-gooey="2"] { opacity: 0 !important; }
  .gooey-morph__text[data-gooey="1"] { opacity: 1 !important; filter: none !important; }
}

/* ── Section divider ────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-default); }

/* ── Sticky header ──────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  transition: all 200ms var(--ease-default);
}
.site-header .container {
  max-width: none;
  padding: 0 32px;
}
.site-header[data-scrolled="true"] {
  background: color-mix(in srgb, var(--bg-base) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-default);
}
.site-header.on-dark[data-scrolled="false"] { background: transparent; }
.site-header .nav-link {
  font-size: 14px; font-weight: 500;
  color: var(--fg-secondary);
  padding: 8px 14px; border-radius: 8px;
  transition: color 150ms var(--ease-default), background 150ms;
  cursor: pointer;
}
.site-header .nav-link:hover { color: var(--fg-primary); background: var(--overlay-subtle); }
.site-header .nav-link.active { color: var(--fg-primary); }

.site-header.on-dark[data-scrolled="false"] .nav-link { color: rgba(255,255,255,0.65); }
.site-header.on-dark[data-scrolled="false"] .nav-link:hover,
.site-header.on-dark[data-scrolled="false"] .nav-link.active { color: #fff; }

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--color-black); color: rgba(255,255,255,0.55);
  padding: 80px 0 32px;
}
.site-footer .container {
  max-width: none;
  padding: 0 32px;
}

/* ── Lucide icon sizing default ─────────────────────────────── */
[data-lucide] { stroke-width: 1.75; }

/* ── Utility ────────────────────────────────────────────────── */
.flex { display: flex; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.gap-6 { gap: 24px; } .gap-8 { gap: 32px; } .gap-12 { gap: 48px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; } .mb-12 { margin-bottom: 48px; }
.mb-16 { margin-bottom: 64px; }

/* responsive grid helpers */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* hero / dark sections */
.dark-section { background: var(--color-black); color: #fff; }
.dark-section h1, .dark-section h2, .dark-section h3, .dark-section h4 { color: #fff; }
.dark-section p { color: rgba(255,255,255,0.60); }

/* image slot styling */
image-slot {
  --image-slot-bg: var(--color-neutral-100);
  --image-slot-border: var(--border-default);
  --image-slot-color: var(--fg-tertiary);
}
:root[data-theme="dark"] image-slot {
  --image-slot-bg: rgba(255,255,255,0.04);
  --image-slot-border: rgba(255,255,255,0.10);
  --image-slot-color: rgba(255,255,255,0.40);
}

/* mobile nav */
.menu-btn { display: none; }
@media (max-width: 880px) {
  .nav-desktop { display: none !important; }
  .menu-btn { display: inline-flex; }
}
