/* ==========================================================================
   Forelytica — chart-inspired dark theme
   Fonts: Bricolage Grotesque (display) / Atkinson Hyperlegible (body)
          Spline Sans Mono (figure labels, data accents)
   ========================================================================== */

:root {
  /* palette */
  --bg: #0e1514;
  --bg-raised: #131c1a;
  --card: #16211e;
  --card-edge: #223029;
  --ink: #e9f2ee;
  --muted: #9fb3ac;
  --gridline: rgba(159, 214, 197, 0.07);

  /* chart series */
  --amber: #ffb454;
  --mint: #56d4a0;
  --lavender: #b8a7f0;
  --coral: #ff8a7a;

  /* amber ramp (brand mark: pale gold rising to deep ember) */
  --amber-light: #ffdfae;
  --amber-deep: #f0872e;

  /* type */
  --font-display: "Bricolage Grotesque", "Georgia", serif;
  --font-body: "Atkinson Hyperlegible", "Verdana", sans-serif;
  --font-mono: "Spline Sans Mono", "Consolas", monospace;

  --radius: 14px;
  --container: 1080px;
}

/* ---------- reset & base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--bg);
}

/* graph-paper atmosphere: faint gridlines + a warm glow up top.
   Lives on a fixed pseudo-element rather than background-attachment: fixed,
   which mobile Safari ignores and desktop Chromium repaints poorly. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 90% 55% at 70% -10%, rgba(255, 180, 84, 0.07), transparent 60%),
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(86, 212, 160, 0.05), transparent 55%),
    linear-gradient(var(--gridline) 1px, transparent 1px),
    linear-gradient(90deg, var(--gridline) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}

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

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- typography ---------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 5.5vw, 3.9rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 650;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  max-width: 62ch;
}

a {
  color: var(--mint);
}

::selection {
  background: var(--amber);
  color: #201503;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--amber);
  margin-bottom: 0.9rem;
}

.fig-caption {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.lede,
.section-lede {
  font-size: 1.15rem;
  color: var(--muted);
  margin-top: 1.1rem;
}

.section-lede {
  margin-bottom: 2.5rem;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(14, 21, 20, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-edge);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--muted);
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--mint);
}

.site-nav .nav-cta {
  color: var(--amber);
}

.site-nav .nav-cta:hover,
.site-nav .nav-cta:focus-visible {
  border-bottom-color: var(--amber);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--mint);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn-primary {
  background: var(--amber);
  color: #241703;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(255, 180, 84, 0.28);
}

.btn-ghost {
  color: var(--ink);
  border-color: var(--card-edge);
  background: transparent;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--mint);
  transform: translateY(-2px);
}

:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 3px;
}

/* ---------- hero ---------- */

.hero {
  padding: clamp(64px, 10vh, 120px) 0 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 2rem;
}

/* hero chart */

.hero-chart {
  background: linear-gradient(160deg, var(--bg-raised), var(--card));
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 22px 18px 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.hero-chart .fig-caption {
  margin-top: 8px;
  padding-left: 6px;
}

.hero-chart .grid line {
  stroke: rgba(159, 214, 197, 0.28);
  stroke-width: 1.5;
}

.hero-chart .grid line.faint {
  stroke: rgba(159, 214, 197, 0.1);
  stroke-dasharray: 3 5;
}

.hero-chart .axis-labels text,
.hero-chart .annotation text {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--muted);
}

.hero-chart .annotation text {
  fill: var(--amber);
}

.hero-chart .annotation line {
  stroke: var(--amber);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.hero-chart .line-draw {
  stroke: var(--mint);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: draw-line 1.6s cubic-bezier(0.65, 0, 0.35, 1) 0.5s forwards;
}

.hero-chart .points circle {
  fill: var(--bg);
  stroke: var(--mint);
  stroke-width: 3;
  opacity: 0;
  animation: pop-point 0.35s ease forwards;
}

.hero-chart .points circle:nth-child(1) { animation-delay: 0.55s; }
.hero-chart .points circle:nth-child(2) { animation-delay: 0.8s; }
.hero-chart .points circle:nth-child(3) { animation-delay: 1.05s; }
.hero-chart .points circle:nth-child(4) { animation-delay: 1.3s; }
.hero-chart .points circle:nth-child(5) { animation-delay: 1.55s; }
.hero-chart .points circle:nth-child(6) { animation-delay: 1.85s; }

.hero-chart .point-hot {
  stroke: var(--amber);
}

.hero-chart .area {
  opacity: 0;
  animation: fade-in 0.9s ease 1.7s forwards;
}

.hero-chart .annotation {
  opacity: 0;
  animation: fade-in 0.6s ease 2.1s forwards;
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

@keyframes pop-point {
  from { opacity: 0; transform: scale(0.4); transform-origin: center; transform-box: fill-box; }
  to   { opacity: 1; transform: scale(1);   transform-origin: center; transform-box: fill-box; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* staggered load-in for hero copy */

.anim-1, .anim-2, .anim-3, .anim-4, .anim-5 {
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

.anim-1 { animation-delay: 0.05s; }
.anim-2 { animation-delay: 0.15s; }
.anim-3 { animation-delay: 0.28s; }
.anim-4 { animation-delay: 0.4s; }
.anim-5 { animation-delay: 0.3s; }

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

/* scroll-triggered reveals (toggled by js/main.js) */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- sections ---------- */

.section {
  padding: clamp(64px, 9vh, 110px) 0;
}

/* ---------- inner-page hero ---------- */

.page-hero {
  padding: clamp(56px, 9vh, 100px) 0 12px;
}

/* ---------- service detail pages ---------- */

.service-detail {
  padding: clamp(44px, 6vh, 72px) 0;
}

.service-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: start;
}

/* alternate rows swap the deliverables panel to the left */
.service-detail-alt .service-grid {
  grid-template-columns: 0.85fr 1.15fr;
}

.service-detail-alt .service-copy {
  order: 2;
}

.service-detail-alt .service-deliverables {
  order: 1;
}

.service-copy p + p {
  margin-top: 1rem;
}

.service-deliverables {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-top: 8px;
}

.deliverables-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 14px;
}

.service-deliverables ul {
  list-style: none;
  display: grid;
  gap: 12px;
}

.service-deliverables li {
  position: relative;
  padding-left: 22px;
  font-size: 0.97rem;
  color: var(--muted);
}

.service-deliverables li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--mint);
}

.service-deliverables li:nth-child(2)::before { background: var(--amber); }
.service-deliverables li:nth-child(3)::before { background: var(--lavender); }
.service-deliverables li:nth-child(4)::before { background: var(--coral); }

/* ---------- process steps ---------- */

.step-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 2rem;
}

.step {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 24px 22px;
}

.step-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--amber);
  border: 1px solid var(--card-edge);
  border-radius: 6px;
  padding: 3px 9px;
  margin-bottom: 14px;
}

.step h3 {
  font-size: 1.08rem;
}

.step p {
  font-size: 0.92rem;
  color: var(--muted);
}

.step-grid .step:nth-child(2) { transition-delay: 0.08s; }
.step-grid .step:nth-child(3) { transition-delay: 0.16s; }
.step-grid .step:nth-child(4) { transition-delay: 0.24s; }

/* ---------- cta band ---------- */

.cta-band {
  background: linear-gradient(160deg, var(--bg-raised), var(--card));
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 40px 38px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cta-band h2 {
  margin-bottom: 0.35rem;
}

.cta-note {
  color: var(--muted);
  font-size: 0.97rem;
}

.section-alt {
  background: linear-gradient(180deg, transparent, rgba(19, 28, 26, 0.85) 18% 82%, transparent);
}

/* ---------- service cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.card-grid-3 {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 2rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 28px 26px 26px;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(86, 212, 160, 0.45);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

.card-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
}

.card p {
  color: var(--muted);
  font-size: 0.98rem;
}

/* stagger the card reveals slightly */
.card-grid .card:nth-child(2) { transition-delay: 0.08s; }
.card-grid .card:nth-child(3) { transition-delay: 0.16s; }
.card-grid .card:nth-child(4) { transition-delay: 0.24s; }

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.about-copy p + p {
  margin-top: 1rem;
}

.about-stats {
  display: grid;
  gap: 18px;
  list-style: none;
}

.stat {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-left: 4px solid var(--mint);
  border-radius: 10px;
  padding: 18px 22px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.stat:nth-child(2) { border-left-color: var(--amber); }
.stat:nth-child(3) { border-left-color: var(--lavender); }

.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 3.2ch;
}

.stat-label {
  font-size: 0.92rem;
  color: var(--muted);
}

/* ---------- contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 56px;
  align-items: start;
}

.contact-copy p + p {
  margin-top: 1rem;
}

.contact-form {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 30px 28px;
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.field input,
.field textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--card-edge);
  border-radius: 8px;
  padding: 12px 14px;
  transition: border-color 160ms ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--mint);
}

.field textarea {
  resize: vertical;
}

.contact-form .btn {
  justify-self: start;
}

/* "coming soon" placeholder shown until the contact form is enabled.
   Reuses the form styles above, which stay in place for when it returns. */
.contact-soon {
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0 11px,
      rgba(159, 214, 197, 0.03) 11px 22px
    ),
    var(--card);
  border: 1px dashed var(--card-edge);
  border-radius: var(--radius);
  padding: 44px 28px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.soon-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #241703;
  background: var(--amber);
  padding: 5px 14px;
  border-radius: 999px;
}

.soon-line {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--card-edge);
  padding: 30px 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero-grid,
  .about-grid,
  .contact-grid,
  .service-grid,
  .service-detail-alt .service-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .card-grid,
  .card-grid-3 {
    grid-template-columns: 1fr;
  }

  .step-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* on one column, copy always reads before the deliverables panel */
  .service-detail-alt .service-copy {
    order: 1;
  }

  .service-detail-alt .service-deliverables {
    order: 2;
  }

  .hero {
    padding-top: 48px;
  }
}

@media (max-width: 560px) {
  .step-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-nav {
    gap: 16px;
  }

  .header-inner {
    height: 60px;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .anim-1, .anim-2, .anim-3, .anim-4, .anim-5,
  .hero-chart .line-draw,
  .hero-chart .points circle,
  .hero-chart .area,
  .hero-chart .annotation {
    animation: none;
    opacity: 1;
    transform: none;
    stroke-dashoffset: 0;
  }

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