/* ibuildrigs — shared styles for every public page.
   Monochrome, with light and dark themes. The theme follows the device unless the
   visitor picks one with the header toggle (stored as <html data-theme="light|dark">). */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-panel: #f6f6f6;
  --bg-panel-2: #eeeeee;
  --line: #d4d4d4;
  --line-soft: #e8e8e8;
  --line-strong: #8f8f8f;
  --text: #000000;
  --text-dim: #525252;
  --text-dimmer: #6b6b6b;
  --accent: #000000;
  --accent-ink: #ffffff;
  --accent-hover: #2b2b2b;
  --tint: #f1f1f1;
  --header-bg: rgba(255, 255, 255, 0.86);
  --backdrop: rgba(0, 0, 0, 0.45);
  --ok: #15803d;
  --ok-bg: #ecf8f0;
  --ok-ink: #14532d;
  --warn: #a16207;
  --warn-bg: #fdf7e6;
  --warn-ink: #713f12;
  --err: #c62828;
  --err-bg: #fdeeee;
  --err-ink: #7f1d1d;

  --radius: 2px;
  --wrap: 1180px;
  --gutter: 32px;
  --header-h: 68px;
  --font-display: "Archivo", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --bg-panel: #0f0f0f;
    --bg-panel-2: #181818;
    --line: #303030;
    --line-soft: #1f1f1f;
    --line-strong: #727272;
    --text: #ffffff;
    --text-dim: #a8a8a8;
    --text-dimmer: #8c8c8c;
    --accent: #ffffff;
    --accent-ink: #000000;
    --accent-hover: #d9d9d9;
    --tint: #161616;
    --header-bg: rgba(0, 0, 0, 0.8);
    --backdrop: rgba(0, 0, 0, 0.72);
    --ok: #4ade80;
    --ok-bg: rgba(74, 222, 128, 0.09);
    --ok-ink: #bbf7d0;
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, 0.09);
    --warn-ink: #fde68a;
    --err: #ff6b6b;
    --err-bg: rgba(255, 107, 107, 0.1);
    --err-ink: #fecaca;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --bg-panel: #0f0f0f;
  --bg-panel-2: #181818;
  --line: #303030;
  --line-soft: #1f1f1f;
  --line-strong: #727272;
  --text: #ffffff;
  --text-dim: #a8a8a8;
  --text-dimmer: #8c8c8c;
  --accent: #ffffff;
  --accent-ink: #000000;
  --accent-hover: #d9d9d9;
  --tint: #161616;
  --header-bg: rgba(0, 0, 0, 0.8);
  --backdrop: rgba(0, 0, 0, 0.72);
  --ok: #4ade80;
  --ok-bg: rgba(74, 222, 128, 0.09);
  --ok-ink: #bbf7d0;
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.09);
  --warn-ink: #fde68a;
  --err: #ff6b6b;
  --err-bg: rgba(255, 107, 107, 0.1);
  --err-ink: #fecaca;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; background: var(--bg); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
@media (max-width: 600px) { :root { --gutter: 20px; } }

.mono { font-family: var(--font-mono); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 300;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; font-weight: 600; border-radius: var(--radius);
}
.skip-link:focus { top: 12px; }

/* ---------- Logo (EF4: split hexagon + bracketed wordmark) ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand .mark { width: 30px; height: 30px; flex-shrink: 0; }
.mark .mark-halves { fill: none; stroke: currentColor; stroke-width: 3.8; }
.mark .mark-core { fill: currentColor; }
.brand-name { font-family: var(--font-mono); font-weight: 500; font-size: 17px; letter-spacing: -0.03em; white-space: nowrap; line-height: 1; }
.brand-name b { font-weight: 600; }
.brand-name .hb { display: inline; height: 1em; width: 0.25em; vertical-align: -0.18em; margin: 0 0.04em; fill: none; stroke: currentColor; stroke-width: 2.8; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
@supports (backdrop-filter: blur(8px)) {
  .site-header { background: var(--header-bg); backdrop-filter: blur(8px); }
}
.site-nav {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.nav-right { display: flex; align-items: center; gap: 8px; }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a { font-size: 14.5px; color: var(--text-dim); transition: color .15s ease; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }
.nav-links .nav-cta {
  color: var(--accent-ink); background: var(--accent); font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius); margin-left: 4px;
}
.nav-links .nav-cta[aria-current="page"] { color: var(--accent-ink); }
.nav-links .nav-cta:hover { color: var(--accent-ink); background: var(--accent-hover); }

.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--line); }
.icon-btn svg { width: 19px; height: 19px; }

/* Theme toggle: shows the moon in light mode (switch to dark) and the sun in dark mode. */
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

.nav-toggle { display: none; margin-right: -8px; }

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  .nav-links.open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .nav-links a { padding: 13px 0; border-bottom: 1px solid var(--line-soft); font-size: 16px; }
  .nav-links .nav-cta { margin: 14px 0 0; text-align: center; border-bottom: 0; padding: 13px 16px; }
}

/* ---------- Announcement ---------- */
.announce { background: var(--accent); color: var(--accent-ink); font-size: 14px; }
.announce .wrap { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 40px; padding-top: 8px; padding-bottom: 8px; text-align: center; flex-wrap: wrap; }
.announce a { text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 0 22px;
  font-weight: 600; font-size: 15px; line-height: 1;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--text); }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--bg-panel-2); color: var(--text-dimmer); border-color: var(--bg-panel-2); cursor: not-allowed;
}
.text-link { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .15s ease; }
.text-link:hover { text-decoration-color: var(--text); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label, .field .label { display: block; font-size: 13.5px; font-weight: 500; color: var(--text-dim); margin-bottom: 7px; }
.field .optional { color: var(--text-dimmer); font-weight: 400; }
.input, .field input, .field textarea, .field select {
  width: 100%; min-height: 46px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; font-size: 15px; color: var(--text);
  transition: border-color .15s ease;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--text); outline: none; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--text); }
.field [aria-invalid="true"] { border-color: var(--err); }
.field input::placeholder, .field textarea::placeholder { color: var(--text-dimmer); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.select-wrap { position: relative; }
.select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer; }
.select-wrap::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-dim); border-bottom: 1.5px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
select option { background: var(--bg); color: var(--text); }
select option:disabled { color: var(--text-dimmer); }

.form-status { font-size: 14px; margin-top: 14px; min-height: 1.4em; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }

.choice-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field .choice, .choice {
  position: relative; margin: 0; color: var(--text); flex: 1 1 140px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer;
  font-size: 14.5px;
}
.choice input { accent-color: var(--text); width: 16px; height: 16px; min-height: 0; }
.choice:has(input:checked) { border-color: var(--text); background: var(--tint); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 36px; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; } .footer-about { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h2 { font-size: 13.5px; font-family: var(--font-body); font-weight: 600; color: var(--text-dim); letter-spacing: 0; margin-bottom: 14px; }
.footer-about p { color: var(--text-dim); font-size: 14.5px; max-width: 340px; margin-top: 14px; }
.footer-list { list-style: none; display: grid; gap: 9px; font-size: 14.5px; }
.footer-list a { color: var(--text); }
.footer-list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  border-top: 1px solid var(--line-soft); margin-top: 40px; padding-top: 22px;
  font-size: 13px; color: var(--text-dimmer);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--accent); color: var(--accent-ink);
  padding: 11px 16px; border-radius: var(--radius); font-size: 14px; z-index: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: calc(100% - 40px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Text pages (policies, contact) ---------- */
.page-head { padding: 56px 0 28px; max-width: 760px; }
.page-head h1 { font-size: clamp(2rem, 4.4vw, 2.8rem); }
.page-head p { color: var(--text-dim); margin-top: 12px; font-size: 15px; }
.prose { max-width: 760px; padding-bottom: 80px; font-size: 16px; }
.prose h2 { font-size: 21px; margin: 40px 0 12px; }
.prose h3 { font-size: 17px; margin: 24px 0 8px; }
.prose p, .prose li { color: var(--text-dim); }
.prose p + p { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 22px; margin: 10px 0; display: grid; gap: 6px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.prose a:hover { text-decoration-color: var(--text); }
.prose .callout { border: 1px solid var(--line); background: var(--bg-panel); padding: 16px 18px; margin: 20px 0; }
.prose .callout p { color: var(--text); }
