/* ===================== Tokens ===================== */
:root {
  --bg: #0a0c12;
  --bg-soft: #11141d;
  --card: #141822;
  --card-hover: #1a1f2c;
  --border: #232838;
  --border-hover: #38415a;
  --fg: #eef1f7;
  --muted: #9aa3b6;
  --muted-2: #7c8398;
  --accent: #5b8cff;
  --accent-soft: #8fb0ff;
  /* MIAI signature colors — matched to the MIAI app (Industrial Midnight) */
  --miai: #EF9F27;        /* LED amber-orange (lamp) */
  --miai-soft: #f2b659;   /* lit highlight */
  --miai-amber: #BA7517;  /* furniture / panel trim */
  --radius: 16px;
  --maxw: 1080px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(900px 500px at 80% -5%, rgba(91,140,255,0.10), transparent 60%),
    radial-gradient(700px 500px at 10% 0%, rgba(91,140,255,0.06), transparent 55%),
    var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ===== Accessibility: visible keyboard focus (WCAG 2.4.7 Focus Visible) ===== */
a:focus-visible, button:focus-visible, [role="button"]:focus-visible,
.btn:focus-visible, .card__link:focus-visible, .card__demo:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ===================== Nav ===================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1.2rem, 4vw, 3rem);
  background: rgba(10,12,18,0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav__brand { display: flex; align-items: center; gap: 0.7rem; }
.nav__mark, .foot__mark {
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.1rem;
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  padding: 0.15rem 0.5rem;
}
.nav__mark-accent { color: var(--accent); }
.nav__name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fg);
}
.nav__links { display: flex; gap: 1.6rem; }
.nav__links a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.4rem 0;            /* taller hit area (WCAG 2.5.8 target size) */
  transition: color 0.15s ease;
}
.nav__links a:hover, .nav__links a:focus-visible {
  color: var(--fg); text-decoration: underline; text-underline-offset: 4px;
}

/* ===================== Buttons ===================== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}
.btn--primary { background: var(--accent); color: #06090f; }
.btn--primary:hover { transform: translateY(-2px); background: var(--accent-soft); }
.btn--ghost { border-color: var(--border-hover); color: var(--fg); }
.btn--ghost:hover { transform: translateY(-2px); border-color: var(--accent); }

/* ===================== Hero ===================== */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4rem, 12vw, 8rem) clamp(1.2rem, 4vw, 3rem) clamp(3rem, 7vw, 5rem);
  text-align: center;
}
.hero__eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  margin-bottom: 1.8rem;
}
.hero__title {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.4rem;
}
.hero__sub {
  max-width: 640px;
  margin: 0 auto 2.4rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.18rem);
}
.hero__cta { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }
.hero__trust {
  margin-top: 1.8rem; font-size: 0.8rem; letter-spacing: 0.04em;
  color: var(--muted-2); text-transform: uppercase;
}

/* ===================== Sections ===================== */
.section-head { text-align: center; margin-bottom: 2.6rem; }
.section-head h2 {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-head p { color: var(--muted); margin-top: 0.4rem; }

.projects {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.2rem, 4vw, 3rem);
}

/* ===================== Project grid + cards ===================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-height: 190px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
a.card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: var(--border-hover);
}
a.card:hover .card__arrow { color: var(--accent); transform: translate(2px,-2px); }
.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.card__tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--accent-soft);
}
.card__arrow { color: var(--muted); font-size: 1.1rem; transition: transform 0.18s ease, color 0.18s ease; }
.card__badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.card__title { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.5rem; }
.card__desc { color: var(--muted); font-size: 0.95rem; }
.card__price {
  margin-top: 12px; font-size: 0.9rem; font-weight: 700;
  letter-spacing: 0.02em; color: var(--accent-soft);
}
.card--soon { opacity: 0.85; }

/* MIAI card — a window into the product. Blue-black machined panel with
   amber trim, top accent lighting, an LED lamp, and a recessed base well,
   echoing the MIAI field app (Industrial Midnight). */
.card--miai {
  border-color: var(--miai-amber);
  /* top-lit panel face: light source above, shading to dark at the base */
  background-image: linear-gradient(180deg,
    rgba(239, 159, 39, 0.07) 0, rgba(0, 0, 0, 0.22) 60%);
  /* inset top highlight = accent lighting; inset bottom = sunken tray edge */
  box-shadow:
    inset 0 1px 0 rgba(239, 159, 39, 0.45),
    inset 0 -10px 18px -10px rgba(0, 0, 0, 0.85),
    0 6px 16px rgba(0, 0, 0, 0.45);
}
.card--miai .card__tag { color: var(--miai); letter-spacing: 0.14em; }
.card--miai .card__title { color: var(--miai); text-shadow: 0 0 12px rgba(239, 159, 39, 0.35); }
/* LED status lamp next to the title, like the app's cabinet lamps */
.card--miai .card__title::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  margin-right: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, var(--miai) 55%);
  box-shadow: 0 0 8px var(--miai);
  vertical-align: middle;
}
.card--miai:hover {
  border-color: var(--miai);
  box-shadow:
    inset 0 1px 0 rgba(239, 159, 39, 0.6),
    inset 0 -10px 18px -10px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(239, 159, 39, 0.25),
    0 10px 22px rgba(0, 0, 0, 0.5);
}
/* MIAI card actions: amber demo button + plain open link */
.card__actions {
  display: flex; align-items: center; gap: 14px;
  margin-top: auto; padding-top: 16px; flex-wrap: wrap;
}
.card__demo {
  display: inline-flex; align-items: center; gap: 9px;
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--miai-soft); cursor: pointer;
  background-color: rgba(186, 117, 23, 0.12);
  background-image: linear-gradient(180deg, rgba(239,159,39,.10), rgba(0,0,0,.25));
  border: 1.5px solid var(--miai-amber); border-radius: 4px;
  padding: 9px 14px;
  box-shadow: inset 0 1px 0 rgba(239,159,39,.25), 0 3px 0 var(--miai-amber), 0 5px 10px rgba(0,0,0,.35);
  transition: transform 0.1s ease, background 0.15s ease;
}
.card__demo:hover { background-color: rgba(186, 117, 23, 0.22); color: var(--miai); }
.card__demo:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(239,159,39,.25); }
.card__demo-led {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, var(--miai) 55%);
  box-shadow: 0 0 8px var(--miai);
  animation: miai-pulse 1.8s ease-in-out infinite;
}
@keyframes miai-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .card__demo-led { animation: none; } }
.card__link {
  font-size: 0.95rem; font-weight: 700; color: var(--accent-soft);
  text-decoration: none; opacity: 1;
  display: inline-flex; align-items: center; min-height: 30px; /* ≥24px target (WCAG 2.5.8) */
}
.card__link:hover, .card__link:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.card--miai .card__link { color: var(--miai-soft); }
.card--miai .card__link:hover { color: var(--miai); }

/* Boone-on-Cairn card — NV-green signature (mirrors the MIAI amber card). The
   flagship: full private suite + AI for small business & creators. */
.card--boone {
  border-color: #1f6b40;
  background-image: linear-gradient(180deg,
    rgba(79,217,138,0.07) 0, rgba(0,0,0,0.22) 60%);
  box-shadow:
    inset 0 1px 0 rgba(79,217,138,0.45),
    inset 0 -10px 18px -10px rgba(0,0,0,0.85),
    0 6px 16px rgba(0,0,0,0.45);
}
.card--boone .card__tag { color: #4fd98a; letter-spacing: 0.13em; }
.card--boone .card__title { color: #8effb4; text-shadow: 0 0 12px rgba(79,217,138,0.35); }
.card--boone .card__title::before {
  content: ""; display: inline-block; width: 9px; height: 9px;
  margin-right: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, #4dff88 55%);
  box-shadow: 0 0 8px #4dff88; vertical-align: middle;
}
.card--boone:hover {
  border-color: #4dff88;
  box-shadow:
    inset 0 1px 0 rgba(79,217,138,0.6),
    inset 0 -10px 18px -10px rgba(0,0,0,0.85),
    0 0 0 1px rgba(79,217,138,0.25),
    0 10px 22px rgba(0,0,0,0.5);
}
.card--boone .card__demo {
  color: #8effb4;
  background-color: rgba(31,107,64,0.18);
  background-image: linear-gradient(180deg, rgba(79,217,138,.10), rgba(0,0,0,.25));
  border-color: #1f6b40;
  box-shadow: inset 0 1px 0 rgba(79,217,138,.25), 0 3px 0 #1f6b40, 0 5px 10px rgba(0,0,0,.35);
}
.card--boone .card__demo:hover { background-color: rgba(31,107,64,0.3); color: #4dff88; }
.card--boone .card__demo-led {
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, #4dff88 55%);
  box-shadow: 0 0 8px #4dff88;
}
.card--boone .card__link { color: #8effb4; }
.card--boone .card__link:hover { color: #4dff88; }

/* ===================== Contact ===================== */
.contact {
  max-width: 720px;
  margin: clamp(2rem, 6vw, 4rem) auto;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.contact h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 700; margin-bottom: 0.7rem; }
.contact p { color: var(--muted); margin-bottom: 1.8rem; }

/* ===================== Footer ===================== */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem clamp(1.2rem, 4vw, 3rem) 3rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
.foot__mark { font-size: 0.95rem; padding: 0.1rem 0.45rem; }

@media (max-width: 560px) {
  .nav__name { display: none; }
}

/* ============================================================
   MIAI LIVE DEMO POPUP — replays the field app answering an
   F059 PowerFlex 525 query. Scoped under .md-app so the app's
   "Industrial Midnight" look never collides with the site theme.
   ============================================================ */
.md-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}
.md-overlay[hidden] { display: none; }
.md-app {
  /* the app's own palette — independent of the site tokens */
  --b: #0c0e12; --fg: #fff; --card: #15171d; --line: #3a3a3a;
  --dim: #c8c8c8; --amber: #BA7517; --led: #EF9F27; --tint: #1a1205;
  --amberdim: #633806; --ok: #1D9E75; --well: #07080b;
  --wellshadow: inset 0 3px 6px rgba(0,0,0,.95), inset 0 -1px 0 rgba(255,255,255,.14);
  --mtop: rgba(255,255,255,.055); --mbot: rgba(0,0,0,.28);
  width: min(560px, 100%); max-height: 88vh;
  display: flex; flex-direction: column;
  background-color: var(--b);
  background-image: radial-gradient(120% 70% at 50% 0, rgba(255,255,255,.05), transparent 55%);
  color: var(--fg);
  font: 16px/1.5 system-ui, sans-serif;
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.65);
}
.md-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 3px solid var(--amber); flex: none;
  background-image: linear-gradient(180deg, var(--mtop), var(--mbot));
}
.md-head h3 {
  font-size: 20px; letter-spacing: 3px; font-weight: 500; color: var(--fg);
  text-shadow: 0 -1px 0 rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.07);
}
.md-rev {
  font-family: ui-monospace, monospace; font-size: 11px;
  letter-spacing: 1px; color: var(--dim); opacity: .65; align-self: flex-end;
}
.md-dot {
  width: 13px; height: 13px; background: var(--ok);
  clip-path: polygon(20% 0, 100% 0, 100% 80%, 80% 100%, 0 100%, 0 20%);
}
.md-x {
  margin-left: auto; min-width: 40px; min-height: 36px;
  background-color: var(--tint); color: var(--led);
  border: 2px solid var(--amber); border-radius: 3px;
  font: inherit; font-weight: 700; cursor: pointer;
}
.md-strip { height: 6px; flex: none; background-color: var(--b);
  background-image: linear-gradient(90deg, var(--amber) 0 34%, var(--amberdim) 34% 38%, transparent 38%); }
.md-strip.working { background-size: 200% 100%; animation: md-sweep 1.6s linear infinite; }
@keyframes md-sweep { 0% { background-position: 0 0; } 100% { background-position: 100% 0; } }
.md-log { flex: 1; overflow-y: auto; padding: 16px; }
.md-card {
  position: relative; background-color: var(--card);
  background-image: linear-gradient(180deg, rgba(255,255,255,.025), rgba(0,0,0,.1));
  border: 2px solid var(--line); border-left: 6px solid var(--amber);
  border-radius: 0 3px 3px 0; padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 14px rgba(0,0,0,.5);
}
.md-q { font-weight: 700; margin-bottom: 10px; }
.md-q::before { content: "> "; color: var(--led); }
.md-status {
  display: inline-block; padding: 5px 12px; border-radius: 3px;
  background: var(--well); box-shadow: var(--wellshadow);
  font-family: ui-monospace, monospace; font-size: 14px;
  letter-spacing: 1px; color: var(--dim);
}
.md-status::before {
  content: ""; display: inline-block; width: 13px; height: 13px;
  border-radius: 50%; margin-right: 8px; vertical-align: -2px;
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.9) 0 18%, transparent 50%), var(--line);
  box-shadow: 0 2px 0 rgba(0,0,0,.5), inset 0 -2px 3px rgba(0,0,0,.35);
}
.md-status.working { color: var(--led); text-shadow: 0 0 7px; }
.md-status.working::before {
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.9) 0 18%, transparent 50%), var(--led);
  box-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 8px var(--led);
  animation: md-blink 1s step-end infinite;
}
.md-status.ok { color: var(--ok); text-shadow: 0 0 7px; }
.md-status.ok::before {
  background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.9) 0 18%, transparent 50%), var(--ok);
  box-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 8px var(--ok);
}
@keyframes md-blink { 50% { opacity: 0.3; } }
.md-answer { white-space: pre-wrap; margin-top: 10px; }
.md-answer .cite {
  font-family: ui-monospace, monospace; font-size: 14px;
  color: var(--led); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
}
.md-answer b { color: var(--fg); }
.md-sources { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.md-src {
  position: relative; display: inline-flex; align-items: center;
  font-family: ui-monospace, monospace; font-size: 13px;
  background-color: var(--tint); color: var(--dim);
  background-image: linear-gradient(180deg, var(--mtop), var(--mbot));
  border: 1.5px solid var(--amber); border-radius: 2px;
  padding: 6px 10px 6px 20px;
  box-shadow: 0 3px 0 var(--amberdim), inset 0 1px 0 rgba(255,255,255,.08);
}
.md-src::before {
  content: ""; position: absolute; left: 7px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--b); border: 1.5px solid var(--amber);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.8);
}
.md-src b { color: var(--led); font-weight: 700; }
.md-tray {
  display: flex; gap: 10px; padding: 12px; flex: none;
  border-top: 3px solid var(--amber);
}
.md-well {
  flex: 1; min-height: 46px; padding: 10px 14px;
  background: var(--well); color: var(--fg);
  border: 2px solid var(--line); border-radius: 3px;
  box-shadow: var(--wellshadow);
  font-family: ui-monospace, monospace; font-size: 14px;
  display: flex; align-items: center;
}
.md-well .caret { color: var(--led); animation: md-blink 1s step-end infinite; }
.md-replay {
  min-width: 96px; background-color: var(--tint); color: var(--led);
  background-image: linear-gradient(180deg, var(--mtop), var(--mbot));
  border: 2.5px solid var(--amber); border-radius: 3px;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  font: inherit; font-weight: 700; letter-spacing: 1px; cursor: pointer;
}
.md-foot {
  flex: none; padding: 8px 12px; text-align: center;
  font-family: ui-monospace, monospace; font-size: 11px;
  letter-spacing: 1px; color: var(--dim); opacity: .7;
  border-top: 1px solid var(--line);
}

/* DAY MODE — friendlier default for mixed audiences. Overrides the
   midnight panel palette with daylight values; paper stays as printed. */
.md-app.day {
  --b: #eceef1; --fg: #16181d; --card: #ffffff; --line: #c4c7cd;
  --dim: #5a5f6a; --amber: #9a6011; --led: #8a5512; --tint: #FAEEDA;
  --amberdim: #e6c388; --ok: #1b7a4b; --well: #e7e9ec;
  --wellshadow: inset 0 2px 4px rgba(0,0,0,.16), inset 0 -1px 0 #fff;
  --mtop: rgba(255,255,255,.7); --mbot: rgba(0,0,0,.05);
  background-image: radial-gradient(120% 70% at 50% 0, rgba(0,0,0,.03), transparent 55%);
}
.md-mode {
  min-width: 86px; min-height: 36px;
  background-color: var(--b); color: var(--fg);
  background-image: linear-gradient(180deg, var(--mtop), var(--mbot));
  border: 2px solid var(--line); border-radius: 3px;
  font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--line), inset 0 1px 0 rgba(255,255,255,.1);
}
.md-mode:active { transform: translateY(3px); box-shadow: none; }

/* ===== Reference pane (slides over the chat log) ===== */
.md-ref {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  background: var(--b);
}
.md-ref[hidden] { display: none; }
.md-refbar {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: 8px 10px 8px 14px; border-bottom: 3px solid var(--amber);
  background-image: linear-gradient(180deg, var(--mtop), var(--mbot));
}
.md-reftitle {
  font-family: ui-monospace, monospace; font-size: 13px; color: var(--dim);
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.md-refpage {
  font-family: ui-monospace, monospace; font-size: 14px; font-weight: 700;
  letter-spacing: 1px; color: var(--led); flex: none;
}
.md-refx {
  min-width: 38px; min-height: 34px; flex: none;
  background-color: var(--tint); color: var(--led);
  border: 2px solid var(--amber); border-radius: 3px;
  font: inherit; font-weight: 700; cursor: pointer;
}
/* tech notes strip */
.md-tn { flex: none; padding: 8px 12px; border-bottom: 2px solid var(--line); }
.md-tnbar { display: flex; align-items: center; gap: 10px; }
.md-tnlabel {
  font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700;
  letter-spacing: 2px; color: var(--fg);
}
.md-tncount {
  flex: 1; font-family: ui-monospace, monospace; font-size: 12px;
  letter-spacing: 1px; color: var(--dim);
}
.md-tnadd {
  min-height: 34px; font: inherit; font-family: ui-monospace, monospace;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  background-color: var(--tint); color: var(--led);
  border: 2px solid var(--amber); border-radius: 3px; cursor: pointer;
}
.md-tndisc {
  font-family: ui-monospace, monospace; font-size: 11px;
  letter-spacing: 1px; color: var(--dim); opacity: .8; margin-top: 3px;
}
.md-tnlist { margin-top: 6px; }
.md-tnote {
  background: var(--card);
  border: 1.5px solid var(--line); border-left: 6px solid var(--fg);
  border-radius: 2px; padding: 6px 10px; margin: 6px 0;
}
.md-tnhead {
  font-family: ui-monospace, monospace; font-size: 11px;
  letter-spacing: 1px; color: var(--dim);
}
.md-tnbody { font-size: 15px; color: var(--fg); }
/* mini note-entry form */
.md-tnform { margin-top: 8px; display: flex; gap: 8px; align-items: stretch; }
.md-tnform[hidden] { display: none; }
.md-tnentry {
  flex: 1; min-height: 40px; padding: 8px 12px;
  background: var(--well); color: var(--fg);
  border: 2px solid var(--line); border-radius: 3px;
  box-shadow: var(--wellshadow);
  font-family: ui-monospace, monospace; font-size: 14px;
  display: flex; align-items: center;
}
.md-tnsave {
  min-width: 84px; font: inherit; font-weight: 700; letter-spacing: 1px;
  background-color: var(--tint); color: var(--led);
  border: 2px solid var(--amber); border-radius: 3px; cursor: pointer;
}
/* paper viewport + zoom */
.md-refbody {
  flex: 1; overflow: hidden; padding: 14px;
  display: flex; align-items: flex-start; justify-content: center;
}
.md-zoom {
  transition: transform 1.15s cubic-bezier(.4,0,.2,1);
  transform-origin: 50% 0%;
}
.md-paper {
  width: 100%; max-width: 460px; background: #fff; color: #1a1a1a;
  border: 1px solid #cfcfcf; box-shadow: 0 8px 22px rgba(0,0,0,.35);
  padding: 22px 24px; position: relative;
  font-family: Georgia, "Times New Roman", serif;
}
.md-paper .pp-head {
  font-size: 12px; letter-spacing: 1px; color: #888;
  border-bottom: 1px solid #ddd; padding-bottom: 6px; margin-bottom: 12px;
  display: flex; justify-content: space-between;
}
.md-paper h4 { font-size: 16px; margin-bottom: 12px; color: #111; }
.md-ftable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.md-ftable th {
  text-align: left; border-bottom: 1.5px solid #333; padding: 5px 6px;
  font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: #444;
}
.md-ftable td { border-bottom: 1px solid #e3e3e3; padding: 7px 6px; vertical-align: top; }
.md-ftable .no { font-weight: 700; white-space: nowrap; color: #111; }
.md-ftable tr.row-f059 { position: relative; }
/* amber wash over the cited row — overlay UI; paper stays as printed */
.md-wash {
  position: absolute; left: 0; right: 0; pointer-events: none;
  background: rgba(239, 159, 39, 0.34);
  border-top: 2px solid #BA7517; border-bottom: 2px solid #BA7517;
  opacity: 0; transition: opacity 0.5s ease; z-index: 2;
}
.md-wash.show { opacity: 1; }
.md-refstatus {
  flex: none; padding: 7px 12px; text-align: center;
  font-family: ui-monospace, monospace; font-size: 12px;
  letter-spacing: 1px; color: var(--dim); border-top: 1px solid var(--line);
}
.md-refstatus.working { color: var(--led); }
.md-refstatus.ok { color: var(--ok); }

/* ===== Demo chain: CTA, PT chart, guides, safety flag, policy ===== */
/* "Want to see another?" prompt in the chat log */
.md-cta {
  max-width: 900px; margin: 4px auto 8px; text-align: center;
}
.md-ctabtn {
  display: inline-flex; align-items: center; gap: 9px;
  font: inherit; font-weight: 700; letter-spacing: 1px; font-size: 14px;
  color: var(--led); cursor: pointer;
  background-color: var(--tint);
  background-image: linear-gradient(180deg, var(--mtop), var(--mbot));
  border: 2px solid var(--amber); border-radius: 4px;
  padding: 10px 16px;
  box-shadow: 0 3px 0 var(--amberdim), 0 5px 10px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.1);
}
.md-ctabtn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.md-cta-led {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, var(--led) 55%);
  box-shadow: 0 0 8px var(--led); animation: md-blink 1.4s step-end infinite;
}

/* R-404A PT chart paper: highlight the cited column + 20F row */
.md-ftable td.psig { font-weight: 700; color: #111; }
.md-ftable tr.row-hl td { background: #fff7e6; }
.md-paper .pp-foot {
  margin-top: 12px; font-size: 10px; color: #999; font-style: italic;
  border-top: 1px solid #eee; padding-top: 6px;
}

/* straightedge guides — bands the tech drags to read the printed scale */
.md-guide-h, .md-guide-v {
  position: absolute; pointer-events: none; z-index: 3;
  background: rgba(239, 159, 39, 0.20);
}
.md-guide-h {
  left: 0; right: 0; height: 18px;
  border-top: 2px solid #BA7517; border-bottom: 2px solid #BA7517;
  transition: top 1.1s cubic-bezier(.4,0,.2,1);
}
.md-guide-v {
  top: 0; bottom: 0; width: 18px;
  border-left: 2px solid #BA7517; border-right: 2px solid #BA7517;
  transition: left 1.1s cubic-bezier(.4,0,.2,1);
}
.md-guide-h[hidden], .md-guide-v[hidden] { display: none; }

/* SAFETY PROGRAM flag card — deliberate refusal, distinct from a fault */
.md-card.safety { border-left-color: var(--err); }
.md-safety-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: 1px;
  font-size: 13px; color: var(--err);
  background: rgba(255, 82, 82, 0.12); border: 1.5px solid var(--err);
  border-radius: 3px; padding: 5px 11px;
}
.md-disc {
  margin-top: 10px; font-family: ui-monospace, monospace; font-size: 11px;
  letter-spacing: 1px; color: var(--dim); opacity: .85;
}

/* POLICY easter-egg — glowing orange MIAI box revealed after the flag */
.md-policy {
  max-width: 900px; margin: 4px auto 8px; padding: 14px 16px;
  border: 2px solid var(--led); border-radius: 6px;
  background-image: linear-gradient(180deg, rgba(239,159,39,.12), rgba(0,0,0,.18));
  animation: md-reveal .55s ease both, md-policy-glow 2.6s ease-in-out .55s infinite;
}
.md-policy-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 8px;
  font-family: ui-monospace, monospace; font-weight: 800; letter-spacing: 2px;
  font-size: 13px; color: var(--led);
}
.md-policy-head .led {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 20%, var(--led) 55%);
  box-shadow: 0 0 9px var(--led);
}
.md-policy p { font-size: 14.5px; color: var(--fg); margin: 0; }
.md-policy .md-disc { margin-top: 8px; }
@keyframes md-reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes md-policy-glow {
  50% { box-shadow: 0 0 16px rgba(239,159,39,.32), inset 0 1px 0 rgba(239,159,39,.4); }
}
@media (prefers-reduced-motion: reduce) {
  .md-policy { animation: md-reveal .4s ease both; }
  .md-cta-led { animation: none; }
}
