/* MatDrone base — reset, type, layout, shared components. Owned by the Director. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--r-xs); }
html.is-locked, html.is-locked body { overflow: hidden; }

/* ---------- Type ---------- */
.display, .h1, .h2 {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  line-height: 0.94;
  text-wrap: balance;
}
.display { font-size: var(--fs-hero); font-weight: 800; line-height: 0.9; }
.h1 { font-size: var(--fs-h1); }
.h2 { font-size: var(--fs-h2); line-height: 1; }
.h3 {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-size: var(--fs-h3);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.12;
}
.lead { font-size: var(--fs-lead); line-height: 1.4; color: var(--fg-2); text-wrap: pretty; max-width: 46ch; }
.body { color: var(--fg-2); max-width: 62ch; text-wrap: pretty; }
.small { font-size: var(--fs-small); color: var(--fg-2); }
/* The accent word: one or two words inside a display heading, set like the logo's "Drone" —
   heavy italic, mixed case, scan blue. (Class name kept for markup compatibility.) */
.serif {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-stretch: 125%;
  text-transform: none;
  letter-spacing: -0.035em;
  font-size: 1em;
  line-height: inherit;
  color: var(--accent);
  padding-right: 0.05em; /* italic overhang */
}
/* Mono micro-label: section eyebrows, HUD readouts, captions */
.label {
  font-family: var(--font-mono);
  font-size: var(--fs-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-2);
  line-height: 1.4;
}
.label__idx { color: var(--accent); margin-right: 0.9em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.accent { color: var(--accent); }

/* ---------- Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.section { position: relative; padding-block: var(--section-y); }
.section--ground { background: var(--bg); border-top: 1px solid var(--line); }
.section--air { background: transparent; }
main, .footer { position: relative; z-index: var(--z-content); }

/* Shared section header: eyebrow label + heading (+ optional lead) */
.section-head { display: grid; gap: clamp(1rem, 2vw, 1.75rem); margin-bottom: clamp(2.5rem, 6vw, 5.5rem); }
.section-head .lead { margin-top: 0.5rem; }

.rule { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- Scene layers (WebGL world sits behind everything) ---------- */
.scene-fallback, .scene, .scene-dim {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: var(--z-canvas); pointer-events: none;
}
.scene { display: block; }
.scene-dim { background: var(--bg); opacity: 0; }

/* Film grain: cheap cinematic texture over everything */
.grain {
  position: fixed; inset: 0; z-index: var(--z-grain); pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--fg); --btn-bd: var(--line-2);
  position: relative; display: inline-flex; align-items: center; gap: 0.85em;
  min-height: 3.25rem; padding: 0 1.5rem 0 1.6rem;
  border: 1px solid var(--btn-bd); border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-fg);
  font-family: var(--font-body); font-size: 0.9375rem; font-weight: 500; letter-spacing: 0.01em; line-height: 1;
  white-space: nowrap; cursor: pointer; isolation: isolate; overflow: hidden;
  transition: color var(--t) var(--ease-out), border-color var(--t) var(--ease-out);
}
.btn::before { /* fill that rises on hover */
  content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit;
  background: var(--fg); transform: translateY(101%);
  transition: transform var(--t) var(--ease-out);
}
.btn__icon { display: inline-block; transition: transform var(--t) var(--ease-out); }
@media (hover: hover) {
  .btn:hover { color: var(--bg); border-color: var(--fg); }
  .btn:hover::before { transform: translateY(0); }
  .btn:hover .btn__icon { transform: translate(3px, -3px); }
}
.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--accent-ink); --btn-bd: var(--accent); font-weight: 600; }
.btn--sm { min-height: 2.5rem; padding-inline: 1.1rem; font-size: 0.875rem; }

/* Text link with a line that redraws on hover */
.link { position: relative; display: inline-block; padding-bottom: 0.15em; }
.link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: currentColor;
  transform-origin: right; transition: transform var(--t) var(--ease-out);
}
@media (hover: hover) { .link:hover::after { transform: scaleX(0); transform-origin: left; } }

/* Chip: selectable pill (sensor modes, planner options). Use on <button> or <label> */
.chip {
  display: inline-flex; align-items: center; gap: 0.6em; min-height: 2.5rem; padding: 0 1rem;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-2); cursor: pointer; user-select: none;
  transition: color var(--t-fast), border-color var(--t-fast), background-color var(--t-fast);
}
.chip:hover { color: var(--fg); border-color: var(--fg); }
.chip.is-active, .chip[aria-pressed="true"], .chip[aria-checked="true"], .chip[aria-selected="true"] {
  background: var(--fg); border-color: var(--fg); color: var(--bg);
}

/* HUD corner brackets: the signature frame motif. Add to any positioned box. */
.hud-frame { position: relative; }
.hud-frame::before {
  --l: 14px; --c: var(--line-2);
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left top / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right top / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / 1px var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--l) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / 1px var(--l) no-repeat;
}
.hud-frame--accent::before { --c: var(--accent); }

/* Key/value readout row (telemetry, specs, planner results) */
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem; padding-block: 0.7rem; border-bottom: 1px solid var(--line); }
.kv__k { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); }
.kv__v { font-family: var(--font-mono); font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--fg); text-align: right; }

/* Status dot */
.dot { display: inline-block; width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--accent); }
.dot--ok { background: var(--ok); }
.dot--pulse { animation: dot-pulse 1.6s var(--ease-in-out) infinite; }
@keyframes dot-pulse { 50% { opacity: 0.25; } }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-style: italic; letter-spacing: -0.02em; font-size: 1.15rem; line-height: 1; }
.logo-mark { width: 1.6em; height: 1.6em; flex: none; color: var(--silver); }
.logo-mat { color: var(--silver); }
.logo-drone { color: var(--accent); }

/* A11y helpers */
.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; }
.skip-link { position: fixed; top: 0.75rem; left: 0.75rem; z-index: calc(var(--z-preloader) + 1); padding: 0.75rem 1rem; background: var(--fg); color: var(--bg); border-radius: var(--r); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

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