/* KC Ironcore — LAYOUT SYSTEM ONLY.
 *
 * This file owns structure, spacing, grid, responsive behavior, and the shared
 * layout classes named in BUILD-PLAN's "Shared contract". It does NOT define
 * colors or fonts — every color/font value comes from the --ic-* custom
 * properties in /brand.css (owned by ws/brand). If you find yourself typing a
 * hex code or a font family here, it belongs in brand.css instead.
 *
 * Loaded AFTER /brand.css (see lib/render.ts), so the var() references resolve.
 *
 * Custom properties consumed (defined by ws/brand in /brand.css):
 *   --ic-bg, --ic-bg-elev, --ic-ink, --ic-ink-dim, --ic-steel, --ic-steel-light,
 *   --ic-spark, --ic-spark-dim, --ic-line, --ic-font-display, --ic-font-body,
 *   --ic-radius, --ic-shadow, --ic-maxw
 * Fallbacks below are intentionally NEUTRAL (greys / system fonts) so the layout
 * is legible before brand.css loads or in isolation — they are NOT the brand.
 */

/* ---- design tokens: spacing + layout scale (structure, not brand) ---- */
:root {
  --ic-maxw: 1180px;          /* brand.css may override */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --section-y: clamp(3rem, 7vw, 6.5rem);
  --header-h: 64px;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  min-height: 100dvh;
  font-family: var(--ic-font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  background: var(--ic-bg, #16181b);
  color: var(--ic-ink, #e8e8e8);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, svg, video, canvas { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
h1, h2, h3, h4 { font-family: var(--ic-font-display, var(--ic-font-body, system-ui, sans-serif)); line-height: 1.15; font-weight: 700; }
ul, ol { padding-left: 1.25em; }
:focus-visible { outline: 2px solid var(--ic-spark, currentColor); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  padding: var(--space-3) var(--space-4);
  background: var(--ic-bg-elev, #1f2226); color: var(--ic-ink, #fff);
}
.skip-link:focus { left: var(--space-4); top: var(--space-4); }

/* ---- containers / sections ---- */
.wrap { width: 100%; max-width: var(--ic-maxw, 1180px); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: var(--section-y); }
.section--dark { background: var(--ic-bg-elev, #1f2226); }
.section + .section { padding-top: var(--section-y); }
.section--tight { padding-block: clamp(2rem, 4vw, 3.5rem); }

/* ---- typography helpers (sizes/weights — colors come from brand) ---- */
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; font-weight: 700;
  color: var(--ic-spark, var(--ic-ink-dim, #9aa0a6));
  margin-bottom: var(--space-3);
}
.headline { font-size: clamp(1.9rem, 4.5vw, 3.1rem); margin-bottom: var(--space-4); }
.headline--xl { font-size: clamp(2.4rem, 7vw, 4.5rem); }
.lede { font-size: clamp(1.05rem, 1.8vw, 1.3rem); color: var(--ic-ink-dim, #b6bbc1); max-width: 60ch; margin-bottom: var(--space-5); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.85em 1.4em; border-radius: var(--ic-radius, 6px);
  font-weight: 700; line-height: 1; letter-spacing: 0.01em;
  border: 1.5px solid var(--ic-line, currentColor);
  background: var(--ic-bg-elev, transparent); color: var(--ic-ink, inherit);
  transition: transform .12s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
  text-decoration: none; cursor: pointer;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--spark { background: var(--ic-spark, #c8341a); border-color: var(--ic-spark, #c8341a); color: var(--ic-bg, #fff); }
.btn--spark:hover { background: var(--ic-spark-dim, #a82b14); border-color: var(--ic-spark-dim, #a82b14); }
.btn--ghost { background: transparent; border-color: var(--ic-line, currentColor); color: var(--ic-ink, inherit); }
.btn--ghost:hover { border-color: var(--ic-ink, currentColor); }
.btn--lg { padding: 1em 1.8em; font-size: 1.05rem; }
.btn--block { display: flex; width: 100%; justify-content: center; }

/* ---- cards + grids ---- */
.card {
  background: var(--ic-bg-elev, #1f2226);
  border: 1px solid var(--ic-line, rgba(255,255,255,.08));
  border-radius: var(--ic-radius, 8px);
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.card h3 { font-size: 1.25rem; }
.card p { color: var(--ic-ink-dim, #b6bbc1); }
.card--link { transition: border-color .15s ease, transform .12s ease; }
.card--link:hover { border-color: var(--ic-spark, currentColor); transform: translateY(-2px); text-decoration: none; }
.card__more, .card__meta { margin-top: auto; font-size: 0.82rem; color: var(--ic-spark, var(--ic-ink-dim, #9aa0a6)); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.card__meta { color: var(--ic-ink-dim, #9aa0a6); text-transform: none; letter-spacing: normal; }

.grid-2, .grid-3 { display: grid; gap: var(--space-5); margin-top: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- prose (rendered markdown body) ---- */
.prose .wrap { max-width: min(72ch, var(--ic-maxw, 1180px)); }
.prose h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-top: var(--space-7); margin-bottom: var(--space-4); }
.prose h3 { font-size: 1.3rem; margin-top: var(--space-6); margin-bottom: var(--space-3); }
.prose p, .prose ul, .prose ol { margin-bottom: var(--space-4); }
.prose li { margin-bottom: var(--space-2); }
.prose a { color: var(--ic-spark, currentColor); text-decoration: underline; }
.prose hr { border: 0; border-top: 1px solid var(--ic-line, rgba(255,255,255,.1)); margin: var(--space-7) 0; }
.prose img { border-radius: var(--ic-radius, 8px); margin-block: var(--space-5); }
.prose blockquote { border-left: 3px solid var(--ic-spark, currentColor); padding-left: var(--space-4); color: var(--ic-ink-dim, #b6bbc1); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-5); }
.prose th, .prose td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--ic-line, rgba(255,255,255,.1)); }
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; background: var(--ic-bg-elev, rgba(255,255,255,.06)); padding: 0.15em 0.35em; border-radius: 4px; }

/* ---- header / nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--ic-bg, #16181b) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ic-line, rgba(255,255,255,.08));
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); min-height: var(--header-h); }
.brand-lockup { display: inline-flex; align-items: center; flex-shrink: 0; }
.brand-lockup__img { height: 32px; width: auto; }
.brand-lockup:hover { text-decoration: none; }

.primary-nav { display: flex; align-items: center; gap: var(--space-6); }
.primary-nav ul { display: flex; align-items: center; gap: var(--space-5); list-style: none; padding: 0; margin: 0; }
.primary-nav a { font-weight: 600; font-size: 0.95rem; color: var(--ic-ink-dim, #c2c7cd); }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { color: var(--ic-ink, #fff); text-decoration: none; }
.primary-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--ic-spark, currentColor); }
.site-header__cta { padding: 0.6em 1.1em; font-size: 0.92rem; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--ic-ink, #fff); transition: transform .2s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 880px) {
  .nav-toggle { display: flex; }
  .primary-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: var(--space-4);
    padding: var(--space-5);
    background: var(--ic-bg-elev, #1f2226);
    border-bottom: 1px solid var(--ic-line, rgba(255,255,255,.1));
    transform: translateY(-120%); transition: transform .25s ease; visibility: hidden;
  }
  .primary-nav.is-open { transform: translateY(0); visibility: visible; }
  .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .primary-nav li { border-bottom: 1px solid var(--ic-line, rgba(255,255,255,.06)); }
  .primary-nav li a { display: block; padding: var(--space-4) 0; font-size: 1.05rem; }
  .site-header__cta { margin-top: var(--space-2); text-align: center; }
}

/* ---- footer ---- */
.site-footer { padding-block: var(--space-8) var(--space-6); }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-7) var(--space-5); }
.site-footer__brand img { height: 56px; width: auto; }
.site-footer__tagline { color: var(--ic-ink-dim, #9aa0a6); margin-top: var(--space-3); max-width: 32ch; }
.site-footer__col { display: flex; flex-direction: column; gap: var(--space-2); }
.site-footer__head { font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ic-ink, #e8e8e8); margin-bottom: var(--space-2); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.site-footer ul a { font-size: 0.92rem; color: var(--ic-ink-dim, #9aa0a6); }
.site-footer ul a:hover { color: var(--ic-ink, #fff); }
.site-footer__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--ic-line, rgba(255,255,255,.1)); font-size: 0.88rem; color: var(--ic-ink-dim, #9aa0a6); }
@media (max-width: 700px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .site-footer__grid { grid-template-columns: 1fr; } }

/* ---- page hero (interior pages) ---- */
.page-hero { padding-block: clamp(3.5rem, 8vw, 6rem) clamp(2.5rem, 5vw, 4rem); position: relative; }
.page-hero__title { max-width: 18ch; }

/* ---- home hero scaffolding (ws/hero-3d targets #experience-root) ---- */
.home-hero {
  position: relative; min-height: min(86vh, 760px); display: flex; align-items: flex-end;
  padding-block: var(--space-9) var(--space-8); overflow: clip;
}
#experience-root { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.home-hero .wrap { position: relative; z-index: 1; }
.home-hero__title { max-width: 16ch; }
.home-hero__cta-row { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

/* ---- trust strip ---- */
.trust-strip { padding-block: var(--space-5); border-block: 1px solid var(--ic-line, rgba(255,255,255,.08)); }
.trust-strip__list { display: flex; flex-wrap: wrap; gap: var(--space-5) var(--space-7); align-items: center; justify-content: center; list-style: none; padding: 0; margin: 0; }
.trust-strip__list li { font-size: 0.92rem; font-weight: 600; color: var(--ic-ink-dim, #b6bbc1); display: inline-flex; align-items: center; gap: 0.5em; }

/* ---- generic media + content rows ---- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7); align-items: center; }
.split--reverse > :first-child { order: 2; }
@media (max-width: 820px) { .split, .split--reverse { grid-template-columns: 1fr; } .split--reverse > :first-child { order: 0; } }

.media-frame { border-radius: var(--ic-radius, 8px); overflow: hidden; background: var(--ic-bg-elev, #1f2226); aspect-ratio: 4 / 3; }
.media-frame img { width: 100%; height: 100%; object-fit: cover; }
.media-frame--wide { aspect-ratio: 16 / 9; }

/* ---- gallery teaser grid ---- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-3); margin-top: var(--space-6); }
.gallery-grid figure { margin: 0; border-radius: var(--ic-radius, 6px); overflow: hidden; aspect-ratio: 1; background: var(--ic-bg-elev, #1f2226); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; }

/* ---- pricing teaser ---- */
.pricing-teaser__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-5); margin-top: var(--space-6); }
.price-card { text-align: center; }
.price-card .price { font-family: var(--ic-font-display, inherit); font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 800; color: var(--ic-spark, currentColor); }
.price-card .price small { display: block; font-size: 0.9rem; font-weight: 600; color: var(--ic-ink-dim, #9aa0a6); margin-top: var(--space-1); }

/* ---- reviews placeholder ---- */
.reviews-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-5); margin-top: var(--space-6); }
.review-card blockquote { border: 0; padding: 0; font-style: normal; }
.review-card cite { display: block; margin-top: var(--space-3); font-size: 0.85rem; color: var(--ic-ink-dim, #9aa0a6); font-style: normal; }
.review-card .stars { color: var(--ic-spark, currentColor); letter-spacing: 0.15em; margin-bottom: var(--space-3); }

/* ---- FAQ accordion ---- */
.faq__list { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-5); max-width: 72ch; }
.faq__item { border: 1px solid var(--ic-line, rgba(255,255,255,.1)); border-radius: var(--ic-radius, 6px); padding: 0 var(--space-4); }
.faq__q { padding: var(--space-4) 0; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); }
.faq__q::-webkit-details-marker { display: none; }
.faq__q::after { content: "+"; font-size: 1.4em; line-height: 1; color: var(--ic-spark, currentColor); flex-shrink: 0; }
.faq__item[open] .faq__q::after { content: "\2212"; }
.faq__a { padding-bottom: var(--space-4); color: var(--ic-ink-dim, #b6bbc1); }
.faq__a p { margin-bottom: var(--space-3); }
.faq__a p:last-child { margin-bottom: 0; }

/* ---- CTA band ---- */
.cta-band__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-6); }
.cta-band__inner .lede { margin-bottom: 0; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
@media (max-width: 720px) { .cta-band__inner { flex-direction: column; align-items: flex-start; } }

/* ---- utilities ---- */
.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; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.stack > * + * { margin-top: var(--space-4); }
.lede-narrow { max-width: 50ch; }
[hidden] { display: none !important; }

/* Honor reduced-motion globally for the GSAP layer too (hero-3d should re-check this). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
