/* ==========================================================================
   Ghostwork — design tokens
   Palette concept: quiet graphite/slate neutrals + one desaturated copper
   accent. Monospace touch for technical artifacts (pricing, process steps).
   ========================================================================== */

:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 4.5rem);

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.625rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 880px;
  --content-wide: 1180px;
  --content-full: 100%;

  /* Fonts */
  --font-display: 'General Sans', 'Segoe UI', sans-serif;
  --font-body: 'General Sans', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

/* ---------------- Light mode (default) ---------------- */
:root,
[data-theme='light'] {
  --color-bg: #f4f4f2;
  --color-surface: #ffffff;
  --color-surface-2: #fbfbfa;
  --color-surface-offset: #ebeae6;
  --color-surface-offset-2: #e2e1dc;
  --color-divider: #dcdbd6;
  --color-border: #d2d1cb;

  --color-text: #1d211f;
  --color-text-muted: #5b5f5c;
  --color-text-faint: #8f938f;
  --color-text-inverse: #f7f6f2;

  /* Primary accent — desaturated copper/amber, technical warning-lamp feel */
  --color-primary: #a15c2c;
  --color-primary-hover: #7e4720;
  --color-primary-active: #613617;
  --color-primary-highlight: #ecdccb;

  --color-success: #3f6b3a;
  --color-success-highlight: #dde6da;
  --color-warning: #a15c2c;
  --color-warning-highlight: #ecdccb;
  --color-error: #9c3b32;
  --color-error-highlight: #ecd6d2;

  --shadow-sm: 0 1px 2px oklch(0.2 0.01 150 / 0.06);
  --shadow-md: 0 4px 14px oklch(0.2 0.01 150 / 0.08);
  --shadow-lg: 0 16px 40px oklch(0.2 0.01 150 / 0.14);

  --grain-opacity: 0.025;
  color-scheme: light;
}

/* ---------------- Dark mode ---------------- */
[data-theme='dark'] {
  --color-bg: #14171a;
  --color-surface: #191d21;
  --color-surface-2: #1e2226;
  --color-surface-offset: #21262b;
  --color-surface-offset-2: #262c31;
  --color-divider: #2b3136;
  --color-border: #343b41;

  --color-text: #dfe2e4;
  --color-text-muted: #929a9f;
  --color-text-faint: #656d72;
  --color-text-inverse: #14171a;

  --color-primary: #d68a4e;
  --color-primary-hover: #e5a06a;
  --color-primary-active: #c47a3c;
  --color-primary-highlight: #3a2c1f;

  --color-success: #7fae74;
  --color-success-highlight: #23301f;
  --color-warning: #d68a4e;
  --color-warning-highlight: #3a2c1f;
  --color-error: #d68076;
  --color-error-highlight: #372220;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 14px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 20px 48px oklch(0 0 0 / 0.5);

  --grain-opacity: 0.05;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #14171a;
    --color-surface: #191d21;
    --color-surface-2: #1e2226;
    --color-surface-offset: #21262b;
    --color-surface-offset-2: #262c31;
    --color-divider: #2b3136;
    --color-border: #343b41;

    --color-text: #dfe2e4;
    --color-text-muted: #929a9f;
    --color-text-faint: #656d72;
    --color-text-inverse: #14171a;

    --color-primary: #d68a4e;
    --color-primary-hover: #e5a06a;
    --color-primary-active: #c47a3c;
    --color-primary-highlight: #3a2c1f;

    --color-success: #7fae74;
    --color-success-highlight: #23301f;
    --color-warning: #d68a4e;
    --color-warning-highlight: #3a2c1f;
    --color-error: #d68076;
    --color-error-highlight: #372220;

    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
    --shadow-md: 0 4px 14px oklch(0 0 0 / 0.35);
    --shadow-lg: 0 20px 48px oklch(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

/* ==========================================================================
   Base typography
   ========================================================================== */

body {
  background-color: var(--color-bg);
  background-image:
    radial-gradient(oklch(0.5 0.01 150 / var(--grain-opacity)) 1px, transparent 1px);
  background-size: 3px 3px;
}

p, li {
  max-width: 65ch;
}

a {
  color: inherit;
}

.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--narrow {
  max-width: var(--content-narrow);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.container--default {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

section {
  padding-block: clamp(var(--space-16), 9vw, var(--space-32));
}

.section-tight {
  padding-block: clamp(var(--space-12), 6vw, var(--space-20));
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-4);
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  flex-shrink: 0;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 650;
  margin-bottom: var(--space-6);
  max-width: 34ch;
}

.section-lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  font-weight: 400;
  max-width: 62ch;
  margin-bottom: var(--space-10);
}

.body-copy {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.body-copy + .body-copy {
  margin-top: var(--space-4);
}

strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: oklch(from var(--color-bg) l c h / 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid oklch(from var(--color-text) l c h / 0.08);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: 650;
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.brand__mark {
  color: var(--color-primary);
  flex-shrink: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

a.nav-cta.btn {
  display: none;
}

@media (min-width: 720px) {
  a.nav-cta.btn {
    display: inline-flex;
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid oklch(from var(--color-text) l c h / 0.1);
}

.theme-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 550;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: 1px solid var(--color-primary);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

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

.btn--ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid oklch(from var(--color-text) l c h / 0.16);
}

.btn--ghost:hover {
  background: var(--color-surface-offset);
  border-color: oklch(from var(--color-text) l c h / 0.28);
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  min-height: 36px;
}

.placeholder-note {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-3);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 46ch;
}

.placeholder-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-text-faint);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  padding-block: clamp(var(--space-20), 12vw, var(--space-32)) clamp(var(--space-16), 8vw, var(--space-24));
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(oklch(from var(--color-text) l c h / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, oklch(from var(--color-text) l c h / 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  max-width: 860px;
}

.hero h1 {
  font-size: var(--text-3xl);
  line-height: 1.08;
  margin-bottom: var(--space-6);
}

.hero__lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-bottom: var(--space-4);
}

.hero__lede + .hero__lede {
  margin-bottom: var(--space-8);
}

.hero__closer {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--color-text);
  margin-bottom: var(--space-10);
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

/* ==========================================================================
   Problem section — list styling
   ========================================================================== */

.problem-list {
  display: grid;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
}

.problem-list li {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: none;
}

.problem-list li::before {
  content: '';
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 0.55em;
  border-radius: var(--radius-full);
  background: var(--color-text-faint);
}

.callout {
  font-size: var(--text-lg);
  color: var(--color-text);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-8);
  max-width: 62ch;
  font-weight: 500;
}

/* ==========================================================================
   What We Do
   ========================================================================== */

.two-col {
  display: grid;
  gap: var(--space-16);
  align-items: start;
}

@media (min-width: 860px) {
  .two-col {
    grid-template-columns: 1.1fr 1fr;
    gap: var(--space-20);
  }
}

.check-list {
  display: grid;
  gap: var(--space-3);
}

.check-list li {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: none;
}

.check-list li svg {
  flex-shrink: 0;
  margin-top: 0.2em;
  color: var(--color-primary);
}

.subblock-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-4);
}

.not-list li svg {
  color: var(--color-text-faint);
}

.not-list {
  margin-top: var(--space-8);
}

/* ==========================================================================
   Case studies
   ========================================================================== */

.case-study {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: clamp(var(--space-8), 4vw, var(--space-12));
}

.case-study--light {
  background: transparent;
  border-style: dashed;
}

.case-study__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}

.case-study h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-5);
  max-width: 46ch;
}

.case-study__steps {
  display: grid;
  gap: var(--space-2);
  margin-block: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.case-study__steps li {
  max-width: none;
  padding-left: var(--space-6);
  position: relative;
}

.case-study__steps li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--color-primary);
}

.result-strip {
  display: grid;
  gap: var(--space-6);
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
}

@media (min-width: 620px) {
  .result-strip {
    grid-template-columns: repeat(3, 1fr);
  }
}

.result-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.result-stat__value {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-primary);
  line-height: 1.1;
}

.result-stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.case-study__note {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-base);
  color: var(--color-text-muted);
}

.case-study__takeaway {
  margin-top: var(--space-6);
  font-size: var(--text-base);
  color: var(--color-text);
}

/* ==========================================================================
   Who This Is For
   ========================================================================== */

.fit-grid {
  display: grid;
  gap: var(--space-8);
}

@media (min-width: 860px) {
  .fit-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.fit-card {
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.fit-card--not {
  background: transparent;
  border-style: dashed;
}

.fit-card h3 {
  font-size: var(--text-base);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-5);
  color: var(--color-text-muted);
  font-weight: 600;
}

.fit-note {
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 68ch;
}

/* ==========================================================================
   How It Works
   ========================================================================== */

.process-list {
  display: grid;
  gap: 0;
  counter-reset: step;
}

.process-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-6);
  padding-block: var(--space-8);
  border-bottom: 1px solid var(--color-divider);
}

.process-step:first-child {
  padding-top: 0;
}

.process-step:last-child {
  border-bottom: none;
}

.process-step__index {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--color-primary);
  font-weight: 600;
  min-width: 2.5ch;
}

.process-step h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.process-step p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

/* ==========================================================================
   Pricing
   ========================================================================== */

.pricing-note {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 68ch;
  margin-bottom: var(--space-10);
}

.pricing-scroll-hint {
  display: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}

@media (max-width: 719px) {
  .pricing-scroll-hint {
    display: block;
  }
}

.pricing-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  -webkit-overflow-scrolling: touch;
}

.pricing-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-family: var(--font-mono);
}

.pricing-table th,
.pricing-table td {
  text-align: left;
  padding: var(--space-5) var(--space-6);
  vertical-align: top;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}

.pricing-table thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
  border-bottom: 1px solid var(--color-border);
  font-weight: 500;
}

.pricing-table thead th.tier-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-text);
  text-transform: none;
  letter-spacing: -0.01em;
  font-weight: 650;
}

.pricing-table tbody th {
  color: var(--color-text-faint);
  font-weight: 400;
  white-space: nowrap;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pricing-table tbody td {
  color: var(--color-text-muted);
  line-height: 1.55;
}

.pricing-table td.price {
  color: var(--color-primary);
  font-weight: 600;
  font-size: var(--text-base);
}

.pricing-table tbody tr:last-child th,
.pricing-table tbody tr:last-child td {
  border-bottom: none;
}

.pricing-table tbody tr:nth-child(even) {
  background: oklch(from var(--color-text) l c h / 0.015);
}

.pricing-footer {
  margin-top: var(--space-10);
}

.pricing-footer p {
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 68ch;
}

.pricing-footer p + p {
  margin-top: var(--space-4);
}

.pricing-cta {
  margin-top: var(--space-10);
}

/* ==========================================================================
   FAQ
   ========================================================================== */

.faq-list {
  display: grid;
  gap: var(--space-3);
}

.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  font-size: var(--text-base);
  font-weight: 550;
  color: var(--color-text);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary .q-icon {
  flex-shrink: 0;
  color: var(--color-text-faint);
  transition: transform var(--transition-interactive);
}

.faq-item[open] summary .q-icon {
  transform: rotate(45deg);
  color: var(--color-primary);
}

.faq-item summary:hover {
  background: var(--color-surface-offset);
}

.faq-item__body {
  padding: 0 var(--space-6) var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-base);
  max-width: 68ch;
}

/* ==========================================================================
   Closing CTA
   ========================================================================== */

.closing {
  background: var(--color-surface-offset);
  border-top: 1px solid var(--color-divider);
  text-align: left;
}

.closing__inner {
  max-width: 720px;
}

.closing h2 {
  font-size: var(--text-2xl);
  line-height: 1.12;
  margin-bottom: var(--space-8);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding-block: var(--space-10);
  border-top: 1px solid var(--color-divider);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-footer p {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  z-index: 100;
  border-radius: var(--radius-md);
}

.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
}

@media (max-width: 719px) {
  section {
    padding-block: clamp(var(--space-12), 12vw, var(--space-20));
  }
  .hero {
    padding-block: var(--space-16) var(--space-12);
  }
}
