/* ==========================================================================
   Callida Technologies — landing page
   Single stylesheet, no build step. Tokens first, then layout, then blocks.
   ========================================================================== */

:root {
  /* Surface */
  --bg:            #08090b;
  --bg-raised:     #0d0f13;
  --surface:       #101318;
  --surface-hover: #14181e;

  /* Line */
  --line:          rgba(255, 255, 255, 0.08);
  --line-strong:   rgba(255, 255, 255, 0.16);

  /* Text */
  --text:          #edeff3;
  --muted:         #9aa2ae;
  --faint:         #6b7280;

  /* Accent — Potentilla callida is a yellow-flowered cinquefoil */
  --accent:        #e3b04b;
  --accent-bright: #f3cd84;
  --accent-wash:   rgba(227, 176, 75, 0.12);
  --accent-line:   rgba(227, 176, 75, 0.34);

  /* Type */
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
           "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Rhythm */
  --shell: 1160px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --section-y: clamp(5rem, 11vw, 9rem);
  --radius: 14px;
  --radius-lg: 22px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.03em; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s var(--ease);
}

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

::selection { background: var(--accent); color: #12100a; }

.skip-link {
  position: absolute;
  left: 50%;
  top: 0.75rem;
  transform: translate(-50%, -200%);
  z-index: 200;
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: #12100a;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

/* ── Layout ────────────────────────────────────────────────────────────── */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.shell-narrow { max-width: 760px; }

.section { padding-block: var(--section-y); }

.section-alt {
  background: var(--bg-raised);
  border-block: 1px solid var(--line);
}

/* ── Header ────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
}
.wordmark .mark { width: 26px; height: 26px; color: var(--accent); flex: none; }
.wordmark-sub { color: var(--muted); font-weight: 500; }
.wordmark:hover .wordmark-sub { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  font-size: 0.9375rem;
}
.nav > a:not(.btn) { color: var(--muted); }
.nav > a:not(.btn):hover { color: var(--text); }

@media (max-width: 40em) {
  .nav > a:not(.btn) { display: none; }
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  --btn-py: 0.75rem;
  --btn-px: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: var(--btn-py) var(--btn-px);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease),
              border-color 0.18s var(--ease), color 0.18s var(--ease),
              box-shadow 0.18s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #12100a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset,
              0 10px 26px -14px rgba(227, 176, 75, 0.85);
}
.btn-primary:hover { background: var(--accent-bright); }

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent-line); background: var(--accent-wash); }

.btn-sm { --btn-py: 0.5rem; --btn-px: 1rem; font-size: 0.875rem;
  border-color: var(--line-strong); }
.btn-sm:hover { border-color: var(--accent-line); background: var(--accent-wash); }

.btn-lg {
  --btn-py: 0.95rem;
  --btn-px: 1.9rem;
  font-size: clamp(0.95rem, 2.6vw, 1.0625rem);
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -0.02em;
  max-width: 100%;
}

.btn-arrow { width: 15px; height: 15px; flex: none; transition: transform 0.18s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.75rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9375rem;
}
.link-arrow svg { width: 15px; height: 15px; transition: transform 0.18s var(--ease); }
.link-arrow:hover { color: var(--accent-bright); }
.link-arrow:hover svg { transform: translateX(3px); }

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  padding-block: clamp(4.5rem, 13vw, 9.5rem) clamp(4.5rem, 11vw, 8rem);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-glow {
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 130%;
  pointer-events: none;
  background:
    radial-gradient(46% 42% at 20% 22%, rgba(227, 176, 75, 0.13), transparent 68%),
    radial-gradient(38% 40% at 82% 12%, rgba(120, 150, 255, 0.09), transparent 70%);
  filter: blur(6px);
}

.hero-inner { position: relative; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 7.2vw, 4.75rem);
  max-width: 18ch;
  text-wrap: balance;
}
.hero h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent-bright);
}

.lede {
  margin-top: 1.75rem;
  max-width: 56ch;
  font-size: clamp(1.0625rem, 2.2vw, 1.1875rem);
  color: var(--muted);
  text-wrap: pretty;
}

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

.hero-note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 2.25rem;
  font-size: 0.875rem;
  color: var(--faint);
}
.hero-note .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58c98a;
  box-shadow: 0 0 0 4px rgba(88, 201, 138, 0.16);
}

/* ── Section headings ──────────────────────────────────────────────────── */

.section-head { max-width: 60ch; }
.section-head-center { margin-inline: auto; text-align: center; }

.section-kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.section-head h2 {
  font-size: clamp(1.85rem, 4.4vw, 2.75rem);
  text-wrap: balance;
}

.section-sub {
  margin-top: 1.15rem;
  color: var(--muted);
  font-size: 1.0625rem;
  text-wrap: pretty;
}

/* ── Capability cards ──────────────────────────────────────────────────── */

/* Explicit column counts rather than auto-fit: four cards must break 1 → 2 → 4,
   never 3, which would strand the fourth card on its own row. */
.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
}
@media (min-width: 40em) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 68em) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card {
  position: relative;
  padding: 1.85rem 1.6rem 1.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.22s var(--ease), background 0.22s var(--ease),
              transform 0.22s var(--ease);
}
.card:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.card-num {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--faint);
  letter-spacing: 0.06em;
}

.card-icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.card h3 {
  font-size: 1.125rem;
  margin-bottom: 0.7rem;
  letter-spacing: -0.02em;
}
.card p {
  color: var(--muted);
  font-size: 0.9375rem;
  text-wrap: pretty;
}

/* ── Approach ──────────────────────────────────────────────────────────── */

.split {
  display: grid;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}
@media (min-width: 60em) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .split-head { position: sticky; top: 7rem; }
}

.steps { display: grid; gap: 0.75rem; }

.step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.22s var(--ease);
}
.step:hover { border-color: var(--accent-line); }

.step-num {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--accent-wash);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8125rem;
  flex: none;
}

.step h3 { font-size: 1.0625rem; margin-bottom: 0.45rem; }
.step p { color: var(--muted); font-size: 0.9375rem; text-wrap: pretty; }

/* ── Story ─────────────────────────────────────────────────────────────── */

.story {
  margin-top: clamp(2.25rem, 5vw, 3.25rem);
  display: grid;
  gap: 1.5rem;
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 2.4vw, 1.25rem);
  line-height: 1.72;
  color: var(--muted);
  text-wrap: pretty;
}
.story strong { color: var(--text); font-weight: 600; }
.story em { color: var(--accent-bright); font-style: italic; }

.story-close {
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-style: italic;
  font-size: clamp(1.1875rem, 3vw, 1.5rem);
  line-height: 1.5;
  letter-spacing: -0.015em;
}

.story-mark {
  margin: clamp(2.5rem, 6vw, 3.5rem) auto 0;
  width: 34px;
  color: var(--accent);
  opacity: 0.55;
}

/* ── Contact ───────────────────────────────────────────────────────────── */

.contact { padding-top: 0; }

.contact-card {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(2.5rem, 7vw, 4.25rem) clamp(1.5rem, 5vw, 3.5rem);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(90% 130% at 50% -20%, rgba(227, 176, 75, 0.14), transparent 62%),
    var(--surface);
}

.contact-card h2 {
  font-size: clamp(1.65rem, 4.2vw, 2.4rem);
  text-wrap: balance;
}
.contact-card > p {
  margin: 1.15rem auto 0;
  max-width: 48ch;
  color: var(--muted);
  text-wrap: pretty;
}
.contact-card .btn { margin-top: 2.25rem; }

.contact-note {
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: var(--faint);
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem;
  background: var(--bg-raised);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  font-size: 0.875rem;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}
.footer-brand .mark { width: 20px; height: 20px; color: var(--accent); }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  color: var(--muted);
}
.footer-nav a:hover { color: var(--accent); }

.footer-legal {
  color: var(--faint);
  font-size: 0.8125rem;
  width: 100%;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.footer-legal #footer-year::before { content: "© "; }

/* ── Scroll reveal ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
  .js .cards .reveal:nth-child(2),
  .js .steps .reveal:nth-child(2) { transition-delay: 80ms; }
  .js .cards .reveal:nth-child(3),
  .js .steps .reveal:nth-child(3) { transition-delay: 160ms; }
  .js .cards .reveal:nth-child(4) { transition-delay: 240ms; }

  /* Safety net: if main.js never runs, the head script un-hides everything
     rather than leaving a blank page. */
  .js.reveal-all .reveal { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
