/* ============================================================
   Vigil — premium, photographic, editorial-restraint.
   Light theme. Newsreader display serif (justified: IEEE-published
   research brand). Inter body. One warm amber accent. Real photos.
   ============================================================ */

:root {
  --paper:    #faf8f5;   /* warm off-white, not pure */
  --paper-2:  #f1ece4;
  --ink:      #1a1815;   /* warm near-black */
  --ink-2:    #4a4540;
  --ink-3:    #837b71;
  --line:     #e4ddd2;
  --line-2:   #d6cdbf;
  --accent:   #b87a2b;   /* burnt amber — single accent, locked */
  --accent-soft: #f3e7d3;
  --alert:    #c4452f;   /* warm red, eyes-closing/alert */
  --ok:       #4f7a52;   /* muted forest, vigilant */
  --shadow:   0 1px 2px rgba(40,30,15,0.04), 0 8px 30px -12px rgba(40,30,15,0.18);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, Menlo, monospace;

  --wrap: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
img { display: block; max-width: 100%; }
a { color: inherit; }

/* shared ----------------------------------------------------- */
.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.kicker-dark { color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  padding: 13px 24px; border-radius: 999px;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); }

.section-head { max-width: 680px; margin: 0 auto 60px; text-align: center; }
.section-head h2 { font-size: clamp(30px, 4vw, 46px); line-height: 1.08; margin-bottom: 20px; }
.section-sub { font-size: 18px; color: var(--ink-2); line-height: 1.6; }

/* NAV -------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 16px max(24px, 5vw);
  background: rgba(250,248,245,0.82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--serif); font-size: 21px; font-weight: 500;
  text-decoration: none; color: var(--ink); letter-spacing: -0.01em;
}
.wordmark-eye {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid var(--accent); position: relative; flex: none;
}
.wordmark-eye::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent); }
.nav-links { display: flex; gap: 30px; margin-left: auto; }
.nav-links a { font-size: 14.5px; color: var(--ink-2); text-decoration: none; transition: color .15s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta {
  font-size: 14.5px; font-weight: 500; text-decoration: none;
  color: var(--paper); background: var(--ink);
  padding: 9px 18px; border-radius: 999px; transition: background .15s;
}
.nav-cta:hover { background: #000; }

/* HERO ------------------------------------------------------- */
.hero { position: relative; min-height: 86vh; display: flex; align-items: flex-end; overflow: hidden; }
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(12,10,8,0.30) 0%, rgba(12,10,8,0.05) 30%, rgba(12,10,8,0.55) 78%, rgba(12,10,8,0.82) 100%);
}
.hero-copy {
  position: relative; z-index: 2;
  max-width: var(--wrap); width: 100%;
  margin: 0 auto; padding: 0 max(24px, 5vw) 7vh;
  color: #fff;
}
.hero-copy .kicker { color: #f0d9b4; }
.hero-copy h1 {
  font-size: clamp(36px, 6vw, 76px);
  line-height: 1.02; color: #fff; max-width: 16ch;
  text-shadow: 0 2px 30px rgba(0,0,0,0.35);
}
.hero-copy .lede {
  font-size: clamp(16px, 1.7vw, 20px); line-height: 1.55;
  color: rgba(255,255,255,0.86); max-width: 50ch; margin: 24px 0 32px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-actions .btn-primary { background: #fff; color: var(--ink); }
.hero-actions .btn-primary:hover { background: #f0ece6; }
.hero-actions .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.4); }
.hero-actions .btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,0.08); }

/* PROOF STRIP ------------------------------------------------ */
.proof {
  max-width: var(--wrap); margin: 0 auto;
  padding: 48px max(24px, 5vw);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px;
  border-bottom: 1px solid var(--line);
}
.proof-item { display: flex; flex-direction: column; gap: 6px; }
.proof-n { font-family: var(--serif); font-size: 30px; color: var(--ink); }
.proof-l { font-size: 13.5px; color: var(--ink-3); }

/* HOW IT WORKS ----------------------------------------------- */
.how { max-width: var(--wrap); margin: 0 auto; padding: 100px max(24px, 5vw); }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-bottom: 80px; }
.how-step { padding-top: 22px; border-top: 1px solid var(--line-2); }
.how-num { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.1em; }
.how-step h3 { font-size: 23px; margin: 14px 0 10px; }
.how-step p { font-size: 15.5px; color: var(--ink-2); line-height: 1.6; }

.how-portrait {
  position: relative;
  display: grid; grid-template-columns: 1.2fr 1fr;
  align-items: stretch;
  border-radius: 18px; overflow: hidden;
  background: var(--ink); box-shadow: var(--shadow);
}
.how-portrait img { width: 100%; height: 100%; object-fit: cover; min-height: 380px; }
.how-portrait figcaption {
  padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 18px;
  color: var(--paper);
}
.how-portrait .formula {
  font-family: var(--mono); font-size: 15px; color: #f0d9b4;
  line-height: 1.7; letter-spacing: 0.01em;
}
.how-portrait figcaption p { font-size: 16px; color: rgba(255,255,255,0.72); line-height: 1.6; }

/* LIVE DEMO -------------------------------------------------- */
.demo { background: var(--paper-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.demo { padding: 100px max(24px, 5vw); }
.console {
  max-width: var(--wrap); margin: 0 auto;
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px;
  align-items: stretch;
}

/* camera */
.cam { border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); background: #0e0d0c; }
.cam-frame { position: relative; aspect-ratio: 4 / 3; background: #0e0d0c; height: 100%; }
#video, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-status {
  position: absolute; top: 14px; left: 14px; z-index: 3;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: #fff; background: rgba(0,0,0,0.45); backdrop-filter: blur(6px);
  padding: 6px 11px; border-radius: 999px;
}
.cam-start, .cam-load {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px;
  background: rgba(14,13,12,0.55); backdrop-filter: blur(3px);
  color: #fff; border: none; cursor: pointer; text-align: center; padding: 24px;
  font-family: var(--sans); font-size: 16px; font-weight: 500;
}
[hidden] { display: none !important; }
.cam-start small { font-size: 12.5px; font-weight: 400; color: rgba(255,255,255,0.7); max-width: 260px; line-height: 1.5; }
.cam-start-ring {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.45); display: grid; place-items: center; position: relative;
}
.cam-start-ring::after { content: "\25B6"; font-size: 16px; margin-left: 3px; }
.cam-start:hover .cam-start-ring { border-color: #fff; }
.cam-load { cursor: default; font-size: 13px; font-family: var(--mono); letter-spacing: 0.08em; }
.cam-load-bar { width: 130px; height: 2px; background: rgba(255,255,255,0.2); overflow: hidden; position: relative; }
.cam-load-bar::after { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--accent); animation: sweep 1s linear infinite; }
@keyframes sweep { to { left: 100%; } }

/* panel */
.panel {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px;
  display: flex; flex-direction: column; gap: 22px;
}
.status-line {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em;
  color: var(--ink-3);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); transition: background .3s; }
.status-line.is-ok { color: var(--ok); } .status-line.is-ok .status-dot { background: var(--ok); }
.status-line.is-warn { color: var(--accent); } .status-line.is-warn .status-dot { background: var(--accent); }
.status-line.is-alert { color: var(--alert); } .status-line.is-alert .status-dot { background: var(--alert); animation: pulse .7s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.readings { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.reading { background: var(--paper); padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; }
.reading-k { font-size: 12px; color: var(--ink-3); }
.reading-v { font-family: var(--mono); font-size: 24px; font-weight: 500; color: var(--ink); }
.reading-v small { font-size: 12px; color: var(--ink-3); margin-left: 3px; }

.graph { display: flex; flex-direction: column; gap: 8px; }
.graph figcaption { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
#graph { width: 100%; height: 84px; display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; }

.controls { display: flex; flex-direction: column; gap: 16px; }
.ctrl { display: flex; flex-direction: column; gap: 8px; }
.ctrl-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); }
.ctrl-row output { font-family: var(--mono); color: var(--accent); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: var(--line-2); border-radius: 999px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); cursor: pointer; border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--line-2); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); cursor: pointer; border: 3px solid var(--paper); }

.ctrl-toggles { display: flex; gap: 22px; }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.switch input { display: none; }
.switch span { width: 34px; height: 19px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); }

.btn-stop { background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); margin-top: 2px; }
.btn-stop:hover:not(:disabled) { border-color: var(--alert); color: var(--alert); }
.btn-stop:disabled { opacity: .45; cursor: not-allowed; }

/* RESEARCH --------------------------------------------------- */
.paper { padding: 110px max(24px, 5vw); }
.paper-inner { max-width: 760px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.paper blockquote { font-family: var(--serif); font-size: clamp(24px, 3.2vw, 36px); line-height: 1.3; color: var(--ink); }
.paper cite { font-style: normal; font-family: var(--mono); font-size: 13px; color: var(--ink-3); letter-spacing: 0.04em; }
.paper .btn { margin-top: 8px; }

/* FOOTER ----------------------------------------------------- */
.foot {
  border-top: 1px solid var(--line);
  max-width: var(--wrap); margin: 0 auto;
  padding: 44px max(24px, 5vw);
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.foot .wordmark { font-size: 18px; }
.foot p { font-size: 13.5px; color: var(--ink-3); max-width: 60ch; line-height: 1.6; }

/* RESPONSIVE ------------------------------------------------- */
@media (max-width: 880px) {
  .nav-links { display: none; }
  .proof { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .how-grid { grid-template-columns: 1fr; gap: 0; }
  .how-step { padding: 22px 0; }
  .how-portrait { grid-template-columns: 1fr; }
  .how-portrait img { min-height: 280px; }
  .how-portrait figcaption { padding: 32px; }
  .console { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .proof { grid-template-columns: 1fr 1fr; }
  .hero { min-height: 80vh; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .status-line.is-alert .status-dot, .cam-load-bar::after { animation: none; }
  * { transition-duration: .01ms !important; }
}
