
/* altengine.net - heritage identity, neutral surfaces with teal + coral accents.
   WCAG 2.1 AA: semantic landmarks, visible focus, reduced-motion, AA contrast. */

:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Neutral warm surfaces */
  --bg: #f4f3ee;
  --surface: #ffffff;
  --surface-2: #efeee7;
  --border: #e5e3da;
  --border-strong: #d0cdc1;
  --text: #1b1a16;
  --muted: #5c5a51;
  --subtle: #6b675b;

  /* Accents (used sparingly) */
  --brand: #0e3a35;          /* teal */
  --brand-hover: #14504a;
  --brand-fg: #f4f1e8;       /* chalk */
  --brand-tint: #e6ede9;
  --accent: #b8401f;         /* coral, AA on light */
  --accent-bright: #f26d57;
  --accent-tint: #f7e6df;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(20, 18, 12, 0.06), 0 1px 3px rgba(20, 18, 12, 0.05);
  --shadow: 0 6px 22px rgba(20, 18, 12, 0.10);
  --ring: 0 0 0 3px rgba(14, 58, 53, 0.65);
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1813;
    --surface: #221f18;
    --surface-2: #2a271f;
    --border: #38342a;
    --border-strong: #4a4536;
    --text: #f0ece1;
    --muted: #b1aa99;
    --subtle: #938d7c;
    --brand: #4db3a3;
    --brand-hover: #62c1b1;
    --brand-fg: #0e1f1c;
    --brand-tint: #253029;
    --accent: #f4907c;
    --accent-bright: #f26d57;
    --accent-tint: #33201a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --ring: 0 0 0 3px rgba(77, 179, 163, 0.65);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.18; margin: 0 0 0.5em; font-weight: 700; text-wrap: balance; }
h1 { font-family: var(--font-serif); font-size: clamp(2.1rem, 5vw, 3.3rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
/* WCAG 1.4.1 (Use of Color): inline links in running text are underlined, not
   distinguished by color alone. Layout/nav/button links are exempt (context conveys them). */
.prose p a:not(.btn), .prose li a:not(.btn), .prose td a:not(.btn),
.prose blockquote a:not(.btn) { text-decoration: underline; text-underline-offset: 0.15em; }
img, svg { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
strong { font-weight: 700; }
::selection { background: var(--accent-tint); color: var(--text); }

code, pre, kbd { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}
pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 1.2rem;
  line-height: 1.5;
}
pre code { background: none; border: 0; padding: 0; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--brand); color: var(--brand-fg);
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600;
  transition: top 0.15s;
}
.skip-link:focus { top: 8px; text-decoration: none; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---- brand badge (inherits theme accents) ---- */
.brand-badge { display: block; flex: none; }
.bm-hex { fill: var(--brand); stroke: var(--brand); stroke-width: 7; stroke-linejoin: round; }
.bm-part { fill: var(--brand-fg); stroke: var(--brand-fg); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.bm-ring { fill: none; stroke: var(--brand-fg); stroke-width: 6; }
.bm-h { fill: none; stroke: var(--brand-fg); stroke-width: 2.6; stroke-linecap: round; }
.bm-sun { fill: var(--accent-bright); }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-name { font-family: var(--font-serif); font-size: 1.35rem; letter-spacing: -0.01em; }

/* ---- header / nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.site-nav { display: flex; align-items: center; gap: 4px 6px; margin-left: auto; flex-wrap: wrap; }
.site-nav > a:not(.btn) {
  color: var(--muted); font-weight: 550; font-size: 0.96rem;
  padding: 8px 12px; border-radius: var(--radius-sm);
}
.site-nav > a:not(.btn):hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.site-nav > a.active:not(.btn) { color: var(--text); }
.site-nav > a.active:not(.btn)::after {
  content: ""; display: block; height: 2px; margin-top: 4px; border-radius: 2px; background: var(--accent-bright);
}
.header-cta { margin-left: 6px; }

/* ---- mobile menu toggle (hamburger) ---- */
.nav-toggle {
  display: none; /* shown only under the mobile breakpoint */
  width: 42px; height: 42px; padding: 0; margin-left: auto;
  align-items: center; justify-content: center;
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle-bar { position: relative; width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: background 0.15s; }
.nav-toggle-bar::before, .nav-toggle-bar::after {
  content: ""; position: absolute; left: 0; width: 20px; height: 2px;
  background: currentColor; border-radius: 2px; transition: transform 0.15s, top 0.15s;
}
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--brand-fg); border: 1px solid var(--brand);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, transform 0.14s;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-sm { padding: 8px 14px; font-size: 0.92rem; }
.btn-lg { padding: 15px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; margin-top: 8px; }

/* ---- sections ---- */
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
.section--alt { background: var(--surface-2); border-block: 1px solid var(--border); }
.eyebrow {
  display: inline-block; font-family: var(--font-mono); font-size: 0.76rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px;
}
.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head p { color: var(--muted); font-size: 1.06rem; margin: 0; }
.lead { font-size: 1.2rem; color: var(--muted); }

/* ---- hero ---- */
.hero { padding: 76px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center; }
.hero h1 { margin-bottom: 18px; }
.hero .hero-lead { font-size: 1.24rem; color: var(--muted); margin-bottom: 28px; max-width: 40ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-note { margin-top: 18px; color: var(--subtle); font-size: 0.92rem; }
.hero-art {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.hero-art .code-head {
  display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); font-family: var(--font-mono); font-size: 0.8rem; color: var(--subtle);
}
.hero-art .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.hero-art pre { margin: 0; border: 0; border-radius: 0; background: var(--surface); font-size: 0.86rem; }
.tok-key { color: var(--accent); }
.tok-str { color: var(--brand); }
@media (prefers-color-scheme: dark) { .tok-str { color: var(--brand); } }

/* ---- feature / card grids ---- */
.cards { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--muted); margin: 0; }
.card .ic {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand-tint); color: var(--brand); margin-bottom: 14px; font-size: 1.2rem;
}
@media (prefers-color-scheme: dark) { .card .ic { color: var(--brand); } }

/* ---- service split ---- */
.service { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: center; }
.service + .service { margin-top: 64px; }
.service--rev .service-body { order: 2; }
.service-body h2 { margin-bottom: 12px; }
.service-body ul { margin: 16px 0 0; padding: 0; list-style: none; }
.service-body li { position: relative; padding-left: 28px; margin-bottom: 10px; color: var(--muted); }
.service-body li::before {
  content: ""; position: absolute; left: 4px; top: 0.55em; width: 10px; height: 10px;
  border-radius: 3px; background: var(--accent-bright);
}
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.panel pre { margin: 0; }
/* Let grid tracks shrink so wide code blocks scroll internally instead of
   stretching the page past the viewport (mobile horizontal overflow). */
.hero-art, .panel, .service-body, .hero-grid > div { min-width: 0; }

/* ---- pricing ---- */
.plans { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.plan {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow-sm);
}
.plan--featured { border-color: var(--brand); box-shadow: var(--shadow); position: relative; }
.plan--featured .plan-tag {
  position: absolute; top: -12px; left: 28px; background: var(--brand); color: var(--brand-fg);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.plan h3 { font-family: var(--font-serif); font-size: 1.4rem; }
.plan .price { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 2px; }
.plan .price small { font-size: 0.95rem; font-weight: 500; color: var(--subtle); }
.plan .plan-sub { color: var(--muted); margin-bottom: 18px; }
.plan ul { list-style: none; margin: 18px 0; padding: 0; }
.plan li { padding-left: 26px; position: relative; margin-bottom: 10px; color: var(--muted); }
.plan li::before { content: "✓"; position: absolute; left: 2px; color: var(--brand); font-weight: 700; }
@media (prefers-color-scheme: dark) { .plan li::before { color: var(--brand); } }

.freebox {
  display: flex; gap: 30px; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--brand); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow-sm);
}
.freebox-amt { font-family: var(--font-serif); font-size: clamp(3rem, 8vw, 4.4rem); line-height: 1; color: var(--brand); font-weight: 700; flex: none; }
.freebox-amt span { display: block; font-size: 1rem; color: var(--subtle); letter-spacing: 0.02em; margin-top: 6px; }
.freebox h2 { margin: 0 0 8px; }
.freebox p { color: var(--muted); max-width: 54ch; margin: 0 0 18px; }

.examples { display: grid; gap: 10px; margin: 8px 0 0; padding: 0; }
.examples li {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 13px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); list-style: none; color: var(--muted);
}
.examples .free { color: var(--brand); font-weight: 600; white-space: nowrap; }

.price-table-wrap { overflow-x: auto; margin-top: 8px; }
table.price-table { width: 100%; border-collapse: collapse; }
.price-table th, .price-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.price-table th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--subtle); }
.price-table td.num, .price-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- FAQ ---- */
.faq details {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 18px; margin-bottom: 12px;
  background: var(--surface);
}
.faq summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq details p { color: var(--muted); padding: 12px 0 6px; margin: 0; }

/* ---- CTA band ---- */
.cta-band { background: var(--brand); color: var(--brand-fg); border-radius: var(--radius); padding: 48px; text-align: center; }
.cta-band h2 { color: var(--brand-fg); }
.cta-band p { color: color-mix(in srgb, var(--brand-fg) 82%, transparent); max-width: 52ch; margin: 0 auto 24px; }
.cta-band .btn { background: var(--brand-fg); color: var(--brand); border-color: var(--brand-fg); }
.cta-band .btn:hover { background: color-mix(in srgb, var(--brand-fg) 88%, #000); }

/* ---- prose (blog, legal, about) ---- */
.prose { max-width: 72ch; margin: 0 auto; }
/* Wider column for reference docs (wide tables + code blocks). */
.prose--wide { max-width: 960px; }
.prose h1 { margin-bottom: 0.3em; }
.prose h2 { font-family: var(--font-serif); margin-top: 1.8em; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2rem; }
.prose li { margin-bottom: 0.5rem; }
.prose blockquote {
  margin: 1.4rem 0; padding: 8px 20px; border-left: 3px solid var(--accent-bright);
  color: var(--muted); font-style: italic;
}
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.4rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.article-meta { color: var(--subtle); font-size: 0.92rem; margin: 0 0 8px; }
.article-meta time { font-variant-numeric: tabular-nums; }
.back-link { display: inline-block; margin-top: 32px; font-weight: 600; }

/* ---- blog list ---- */
.post-list { display: grid; gap: 18px; }
.post-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm);
  transition: border-color 0.14s, transform 0.14s;
}
.post-card:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-2px); }
.post-card h2 { font-size: 1.18rem; margin: 4px 0 8px; color: var(--text); }
.post-card p { color: var(--muted); margin: 0; }
.pagination { display: flex; gap: 8px; margin-top: 28px; }
.pagination a {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination a.active { background: var(--brand); color: var(--brand-fg); border-color: var(--brand); }

/* ---- pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; background: var(--brand-tint); color: var(--brand);
}
@media (prefers-color-scheme: dark) { .pill { color: var(--brand); } }
.pill--coral { background: var(--accent-tint); color: var(--accent); }

/* ---- footer ---- */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); margin-top: 40px; }
.footer-grid {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; padding-top: 56px; padding-bottom: 32px;
}
.footer-tag { color: var(--muted); margin: 14px 0 0; max-width: 32ch; }
.footer-col h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--subtle); margin-bottom: 14px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--muted); }
.footer-col a:hover { color: var(--text); }
.footer-base { border-top: 1px solid var(--border); padding-top: 20px; padding-bottom: 32px; }
.footer-base p { color: var(--subtle); font-size: 0.88rem; margin: 0; }

/* ---- 404 ---- */
.notfound { min-height: 62vh; display: grid; place-items: center; text-align: center; padding: 40px 24px; }
.notfound .big { font-family: var(--font-serif); font-size: clamp(4rem, 14vw, 8rem); line-height: 1; margin: 0; color: var(--brand); }

/* ---- responsive ---- */
@media (max-width: 768px) {
  .header-inner { flex-wrap: nowrap; }
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    margin: 0; padding: 10px 24px 16px;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .site-nav.is-open { display: flex; }
  .site-nav > a:not(.btn) { padding: 12px; font-size: 1rem; }
  .site-nav > a.active:not(.btn)::after { display: none; }
  .header-cta { margin: 8px 0 0; width: 100%; }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-art { order: -1; }
  .service { grid-template-columns: 1fr; gap: 24px; }
  .service--rev .service-body { order: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .section { padding: 52px 0; }
  .brand-name { font-size: 1.2rem; }
  .cta-band { padding: 32px 22px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

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