/* ==========================================================================
   Kazaro Tech — shared stylesheet
   Design tokens: navy/paper/brass, Fraunces + Public Sans + IBM Plex Mono
   ========================================================================== */

:root {
  /* ---- Color tokens (light) ---- */
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #edeae0;
  --ink: #12161d;
  --ink-muted: #4c5a6e;
  --ink-faint: #5b6676;
  --border: #ddd6c6;
  --border-strong: #c6bea9;
  --navy: #0b1f3a;
  --navy-700: #142b4d;
  --gold: #855e2c;
  --gold-strong: #7d5726;
  --focus-ring: #14639e;
  --error: #9c2b20;

  /* Hero + footer are deliberately dark in both themes — a fixed brand
     surface, like a printed cover, not a themed content panel. */
  --hero-bg: #08152a;
  --hero-bg-2: #0f2544;
  --hero-ink: #f4f1e8;
  --hero-ink-muted: #b9c4d6;
  --hero-line: rgba(210, 168, 104, 0.35);
  --hero-node: #d2a868;
  --hero-node-2: #e7cfa2;

  /* ---- Type ---- */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --fs-2xl: clamp(1.9rem, 1.5rem + 1.8vw, 2.75rem);
  --fs-3xl: clamp(2.4rem, 1.7rem + 3vw, 3.6rem);

  --content-max: 1180px;
  --measure: 66ch;
  --radius: 3px;

  /* ---- Depth: layered shadows read as elevation, not drop-shadow ---- */
  --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.06), 0 2px 6px rgba(11, 31, 58, 0.05);
  --shadow-md: 0 2px 4px rgba(11, 31, 58, 0.07), 0 8px 20px rgba(11, 31, 58, 0.08);
  --shadow-lg: 0 4px 8px rgba(11, 31, 58, 0.08), 0 18px 42px rgba(11, 31, 58, 0.14);
  --mesh-line: rgba(11, 31, 58, 0.09);
  --sheen: rgba(255, 255, 255, 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1526;
    --surface: #101e33;
    --surface-2: #16263f;
    --ink: #ecebe4;
    --ink-muted: #a9b4c4;
    --ink-faint: #79879c;
    --border: #223349;
    --border-strong: #2c405a;
    --navy: #0b1f3a;
    --navy-700: #16263f;
    --gold: #d2a868;
    --gold-strong: #e7cfa2;
    --focus-ring: #6fb2e6;
    --error: #f0968a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.45), 0 10px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5), 0 22px 48px rgba(0, 0, 0, 0.55);
    --mesh-line: rgba(169, 180, 196, 0.13);
    --sheen: rgba(236, 235, 228, 0.14);
  }
}

:root[data-theme="dark"] {
  --bg: #0a1526;
  --surface: #101e33;
  --surface-2: #16263f;
  --ink: #ecebe4;
  --ink-muted: #a9b4c4;
  --ink-faint: #79879c;
  --border: #223349;
  --border-strong: #2c405a;
  --navy: #0b1f3a;
  --navy-700: #16263f;
  --gold: #d2a868;
  --gold-strong: #e7cfa2;
  --focus-ring: #6fb2e6;
  --error: #f0968a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.45), 0 10px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5), 0 22px 48px rgba(0, 0, 0, 0.55);
  --mesh-line: rgba(169, 180, 196, 0.13);
  --sheen: rgba(236, 235, 228, 0.14);
}

/* ---- Reset / base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
  color: var(--ink);
}

p { margin: 0; max-width: var(--measure); }
p + p { margin-top: 0.9em; }

a { color: inherit; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold-strong);
}

.section {
  padding-block: clamp(3rem, 6vw, 5.5rem);
}

.section--tight { padding-block: clamp(2.25rem, 4vw, 3.25rem); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.section-head h2 { font-size: var(--fs-2xl); }

.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }

.btn--gold {
  background: var(--hero-node);
  color: #14100a;
  border-color: var(--hero-node);
}
.btn--gold:hover { background: var(--hero-node-2); border-color: var(--hero-node-2); }

.btn--outline {
  background: transparent;
  color: var(--hero-ink);
  border-color: rgba(244, 241, 232, 0.4);
}
.btn--outline:hover { border-color: var(--hero-ink); background: rgba(244, 241, 232, 0.08); }

.btn--dark {
  background: var(--navy);
  color: #f4f1e8;
  border-color: var(--navy);
}
.btn--dark:hover { background: var(--navy-700); }

/* ---- Header / nav ---- */
.site-header {
  position: relative;
  z-index: 20;
}

.nav {
  /* Positioning ancestor for the mobile .nav-links dropdown, and above
     .hero-inner (z-index 1) so the open menu covers the hero copy. */
  position: relative;
  z-index: 3;
  max-width: var(--content-max);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.35rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--hero-ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: 0.01em;
}
.brand-word span { color: var(--hero-node); }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2vw, 2.1rem);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-sm);
}

.nav-links a {
  text-decoration: none;
  color: var(--hero-ink-muted);
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--hero-ink);
  border-bottom-color: var(--hero-node);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(244, 241, 232, 0.35);
  color: var(--hero-ink);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--hero-bg-2);
    border-bottom: 1px solid var(--hero-line);
    padding: 1rem clamp(1.25rem, 4vw, 2.5rem) 1.5rem;
    gap: 0.9rem;
    display: none;
  }
  .nav-links.is-open { display: flex; }
}

/* ---- Hero (dark, brand-fixed, holds the 3D network) ---- */
.hero {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 140% at 15% 0%, var(--hero-bg-2) 0%, var(--hero-bg) 60%);
  color: var(--hero-ink);
  margin-inline: calc(-1 * clamp(1.25rem, 4vw, 2.5rem));
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--hero-line);
}

.hero-canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* Decorative only — must never intercept clicks on the nav above it. */
  pointer-events: none;
}
#hero-canvas { width: 100%; height: 100%; display: block; }

/* Perspective floor grid + vignette: gives the WebGL mesh a ground plane to
   sit above, so the hero reads as a space rather than a flat panel. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(85% 60% at 50% 42%, transparent 40%, rgba(4, 10, 20, 0.55) 100%),
    linear-gradient(to top, rgba(4, 10, 20, 0.5), transparent 45%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(3rem, 7vw, 6rem);
}

.hero--page {
  padding-block: 0;
}
.hero--page .hero-inner {
  padding-block: clamp(2.75rem, 6vw, 4.5rem);
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hero-node);
  display: block;
  margin-bottom: 1.1rem;
}

.hero h1 {
  color: var(--hero-ink);
  font-size: var(--fs-3xl);
  max-width: 15ch;
}

.hero-sub {
  margin-top: 1.4rem;
  max-width: 46ch;
  font-size: var(--fs-md);
  color: var(--hero-ink-muted);
}

.hero-cta {
  margin-top: 2.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero-meta {
  margin-top: 3.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2.5rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--hero-ink-muted);
  letter-spacing: 0.03em;
}
.hero-meta strong { color: var(--hero-ink); font-weight: 500; }

/* ---- Cards ---- */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  .grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

/* A hairline of light along the top edge — reads as a lit face, which is
   what separates a raised panel from a flat one. */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sheen), transparent);
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Cards in a grid are the interactive ones: they lift, and script.js feeds
   --rx/--ry from the pointer so the panel turns toward the cursor. */
.grid > .card {
  transform: perspective(1400px)
    rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg))
    translate3d(0, var(--lift, 0px), 0);
  transition: box-shadow 0.28s ease, transform 0.18s ease, border-color 0.28s ease;
  will-change: transform;
}
.grid > .card:hover,
.grid > .card:focus-within {
  --lift: -5px;
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}
.grid > .card:hover::before,
.grid > .card:focus-within::before { opacity: 1; }

.card-index {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--gold-strong);
  letter-spacing: 0.06em;
}

.card h3 {
  font-size: var(--fs-lg);
}

.card p { color: var(--ink-muted); font-size: var(--fs-sm); }

.card ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  color: var(--ink-muted);
  font-size: var(--fs-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ---- Value / feature list rows ---- */
.feature-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 1.1rem;
  padding-block: 1.5rem;
}
.feature-row + .feature-row { border-top: 1px solid var(--border); }
.feature-row svg { width: 26px; height: 26px; color: var(--gold); flex: none; }
.feature-row h3 { font-size: var(--fs-md); margin-bottom: 0.4rem; }
.feature-row p { color: var(--ink-muted); font-size: var(--fs-sm); }

/* ---- Data / capability strip (mono, document-like) ---- */
.data-strip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem clamp(1.5rem, 4vw, 2.75rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}
@media (max-width: 900px) { .data-strip { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .data-strip { grid-template-columns: 1fr; } }

.data-item dt {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}
.data-item dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink);
}

.note {
  margin-top: 1.25rem;
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}

/* ---- Quote / callout ---- */
.callout {
  border-left: 3px solid var(--gold);
  padding-left: 1.5rem;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--ink);
  max-width: 52ch;
}

/* ---- Two column layout ---- */
.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
}

/* ---- Table (past-performance / engagement model) ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
th, td {
  text-align: left;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}
td { color: var(--ink-muted); }
td:first-child, th:first-child { color: var(--ink); font-weight: 500; }

/* ---- Forms ---- */
.form-grid {
  display: grid;
  gap: 1.25rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

label {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}
textarea { resize: vertical; min-height: 130px; }

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error);
}

.field-error {
  margin: 0.45rem 0 0;
  font-size: var(--fs-xs);
  color: var(--error);
}
.field-error[hidden] { display: none; }

.label-opt {
  text-transform: none;
  letter-spacing: 0;
  font-style: italic;
  color: var(--ink-faint);
}

.form-note {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  max-width: 44ch;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#form-status {
  display: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: var(--fs-sm);
}
#form-status.is-visible { display: block; }
#form-status.is-error { border-color: var(--error); }
#form-status.is-success { border-color: var(--gold); }

/* ---- Contact info list ---- */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.contact-list dt {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}
.contact-list dd { margin: 0; font-size: var(--fs-md); }
.contact-list a { text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.contact-list a:hover { border-color: var(--gold); }

/* ---- Footer (dark, matches hero) ---- */
.site-footer {
  background: var(--hero-bg);
  color: var(--hero-ink-muted);
  margin-inline: calc(-1 * clamp(1.25rem, 4vw, 2.5rem));
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
  border-top: 1px solid var(--hero-line);
}
.footer-inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-block: 3rem 2rem;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 2.5rem;
}
@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
}
.footer-inner h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hero-ink);
  margin-bottom: 1rem;
}
.footer-inner ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; font-size: var(--fs-sm); }
.footer-inner a { text-decoration: none; color: var(--hero-ink-muted); }
.footer-inner a:hover { color: var(--hero-ink); }
.footer-bottom {
  max-width: var(--content-max);
  margin-inline: auto;
  border-top: 1px solid var(--hero-line);
  padding-block: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
}

/* ---- Layered mesh figure (CSS 3D) ----
   Three planes on one perspective, drawn as a wireframe grid. Decorative,
   but it maps to the three layers described beside it. */
.mesh-stage {
  position: relative;
  height: clamp(280px, 34vw, 400px);
  perspective: 1000px;
  perspective-origin: 50% 38%;
  transform-style: preserve-3d;
}

.mesh-plane {
  position: absolute;
  inset: 21% 8%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, var(--mesh-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--mesh-line) 1px, transparent 1px);
  background-size: 30px 30px;
  box-shadow: var(--shadow-md);
  transform: rotateX(58deg) rotateZ(-42deg) translateZ(var(--z, 0px));
  animation: mesh-float 9s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.mesh-plane--data { --z: 0px; }
.mesh-plane--api {
  --z: 58px;
  --delay: -3s;
  border-color: var(--gold);
  background-color: color-mix(in srgb, var(--surface) 88%, var(--gold));
}
.mesh-plane--security { --z: 116px; --delay: -6s; }

@keyframes mesh-float {
  0%, 100% { transform: rotateX(58deg) rotateZ(-42deg) translateZ(var(--z, 0px)); }
  50%      { transform: rotateX(58deg) rotateZ(-42deg) translateZ(calc(var(--z, 0px) + 14px)); }
}

.mesh-legend {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.mesh-legend li { display: flex; align-items: center; gap: 0.5rem; }
.mesh-legend li::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  transform: rotate(45deg);
  flex: none;
}
.mesh-legend li.is-key::before { border-color: var(--gold); background: var(--gold); }

/* ---- Utility ---- */
.tabular { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
