/* Ubigraph Lab - custom theme styles
   Voice: virtual graph lab, soft scientific surfaces, simulation panels.
   No external CDNs. No framework. */

:root {
  --bg: #f6efe2;
  --bg-card: #fbf6ec;
  --bg-panel: #efe5d1;
  --ink: #1d1d1d;
  --ink-soft: #4a4a47;
  --rule: #d8cdb6;
  --teal: #2f6f7a;
  --teal-deep: #1f4f57;
  --coral: #d9784a;
  --coral-deep: #b15a31;
  --moss: #6a8b3a;
  --lavender: #b3a4c6;
  --focus: #e2a92a;
  --shadow: 0 1px 0 #d8cdb6, 0 16px 30px -20px rgba(20, 30, 40, 0.18);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1180px;
  --ff-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  --ff-display: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --ff-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-ui);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--coral-deep); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.lab-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100;
}
.lab-skip:focus { left: 12px; top: 12px; }

/* ---------- Header ---------- */
.lab-header {
  background: linear-gradient(180deg, #fbf6ec 0%, #f6efe2 100%);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 30;
}
.lab-header__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 22px;
}
.lab-brand {
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink);
}
.lab-brand__mark {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; border: 1px solid var(--rule);
  display: grid; place-items: center;
}
.lab-brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.lab-brand__name { font-family: var(--ff-display); font-weight: 700; font-size: 19px; }
.lab-brand__sub { font-size: 11px; color: var(--ink-soft); letter-spacing: 0.04em; text-transform: uppercase; }
.lab-nav { margin-left: auto; }
.lab-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.lab-nav a {
  display: inline-block; padding: 8px 12px;
  border-radius: 999px; color: var(--ink-soft);
  text-decoration: none; font-size: 14px;
}
.lab-nav a:hover, .lab-nav a.is-active {
  background: var(--bg-panel); color: var(--ink);
}
.lab-search-toggle {
  border: 1px solid var(--rule); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.lab-search-toggle:hover { background: var(--bg-panel); }
.lab-search {
  border-top: 1px solid var(--rule); background: #fbf6ec; padding: 16px 22px;
}

@media (max-width: 820px) {
  .lab-header__inner { flex-wrap: wrap; }
  .lab-nav { width: 100%; order: 3; }
}

/* ---------- Main + prose ---------- */
.lab-main {
  max-width: var(--maxw); margin: 0 auto;
  padding: 32px 22px 64px;
}
.lab-crumbs { font-size: 13px; color: var(--ink-soft); margin: 0 0 18px; }
.lab-crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.lab-crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--rule); }

.lab-pagehead { margin: 0 0 28px; }
.lab-eyebrow {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--coral-deep); margin: 0 0 6px;
}
.lab-pagehead h1, .lab-hero h1 {
  font-family: var(--ff-display); font-weight: 700;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15; margin: 0 0 10px;
}
.lab-lede {
  font-size: clamp(17px, 1.4vw, 19px);
  color: var(--ink-soft); max-width: 64ch; margin: 0;
}

.lab-prose { max-width: 72ch; }
.lab-prose h2 {
  font-family: var(--ff-display);
  font-size: clamp(22px, 2.4vw, 28px);
  margin: 36px 0 12px;
  border-bottom: 1px dashed var(--rule); padding-bottom: 6px;
}
.lab-prose h3 { font-size: 19px; margin: 28px 0 8px; }
.lab-prose p, .lab-prose li { line-height: 1.7; }
.lab-prose ul, .lab-prose ol { padding-left: 22px; }
.lab-prose blockquote {
  margin: 22px 0; padding: 14px 18px;
  background: var(--bg-card); border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-soft);
}
.lab-prose code {
  font-family: var(--ff-mono); font-size: 0.92em;
  background: var(--bg-panel); padding: 1px 6px; border-radius: 4px;
}
.lab-prose pre {
  background: #1d1d1d; color: #f6efe2;
  padding: 14px 16px; border-radius: var(--radius-sm); overflow-x: auto;
  font-family: var(--ff-mono); font-size: 14px; line-height: 1.55;
}
.lab-prose pre code { background: transparent; padding: 0; color: inherit; }
.lab-prose table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.lab-prose th, .lab-prose td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.lab-prose th { background: var(--bg-panel); }

.lab-figure, .lab-hero__figure {
  margin: 0 0 24px;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-panel); border: 1px solid var(--rule);
}
.lab-figure img, .lab-hero__figure img { width: 100%; height: auto; display: block; }

/* ---------- Hero ---------- */
.lab-hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px;
  align-items: center;
  padding: 22px; margin: 0 0 36px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.lab-hero--home { padding: 28px; }
.lab-hero__copy h1 { font-size: clamp(30px, 4vw, 46px); }
.lab-hero__ctas { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.lab-cta {
  display: inline-block; padding: 10px 16px;
  background: var(--coral); color: #fff; border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: 14px;
}
.lab-cta:hover { background: var(--coral-deep); color: #fff; }
.lab-cta--ghost {
  background: transparent; color: var(--teal-deep);
  border: 1px solid var(--teal);
}
.lab-cta--ghost:hover { background: var(--teal); color: #fff; }

.lab-hero__sim {
  position: relative;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
}
.lab-hero__panel {
  position: absolute; right: 16px; bottom: 16px;
  background: var(--bg-panel); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 12px; min-width: 160px;
}
.lab-hero__panel span {
  display: block; font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px;
}
.lab-hero__panel ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.lab-hero__panel strong { display: inline-block; min-width: 56px; color: var(--teal-deep); }

@media (max-width: 820px) {
  .lab-hero { grid-template-columns: 1fr; }
  .lab-hero__sim { order: -1; }
}

/* ---------- Tiles, cards, shelves ---------- */
.lab-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin: 0 0 36px;
}
.lab-tile {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--bg-card); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 18px; transition: transform 0.15s ease;
}
.lab-tile:hover { transform: translateY(-2px); border-color: var(--teal); color: var(--ink); }
.lab-tile h2 { font-family: var(--ff-display); font-size: 22px; margin: 6px 0 6px; }
.lab-tile p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.lab-tile__tag, .lab-card__tag {
  display: inline-block; font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--coral-deep);
  background: #fbe5d6; padding: 2px 8px; border-radius: 999px;
}

.lab-shelf { margin: 0 0 36px; padding: 22px;
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: var(--radius); }
.lab-shelf h2 { margin-top: 0; }
.lab-shelf__intro { color: var(--ink-soft); max-width: 70ch; }
.lab-shelf__list {
  list-style: none; padding: 0; margin: 18px 0 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.lab-shelf__list > li {
  background: #fff; border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 14px;
}
.lab-shelf__list h3 { margin: 0 0 4px; font-size: 17px; }
.lab-shelf__path { font-family: var(--ff-mono); font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; }
.lab-shelf__path a { color: var(--ink-soft); }

.lab-strip { margin: 0 0 36px; }
.lab-strip__cards {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.lab-card {
  display: block; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 16px;
}
.lab-card:hover { border-color: var(--coral); color: var(--ink); }
.lab-card h3 { font-family: var(--ff-display); margin: 6px 0 4px; font-size: 18px; }
.lab-card p { margin: 0; color: var(--ink-soft); font-size: 14px; }

.lab-notes-strip { margin: 0 0 36px; }
.lab-notes-strip__list { list-style: none; padding: 0; display: grid; gap: 10px; }
.lab-notes-strip__list li {
  background: var(--bg-card); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.lab-notes-strip__list a { font-weight: 600; }
.lab-notes-strip__list p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }
.lab-text-link { font-weight: 600; }

.lab-snapshot {
  background: var(--bg-card); border: 1px dashed var(--rule);
  border-radius: var(--radius); padding: 18px 22px;
}
.lab-snapshot h2 { margin-top: 0; }

/* ---------- Footer ---------- */
.lab-footer {
  background: #efe5d1; border-top: 1px solid var(--rule);
  margin-top: 64px;
}
.lab-footer__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 26px 22px; display: grid;
  grid-template-columns: 1.2fr 2fr; gap: 24px;
  align-items: start;
}
.lab-footer__name { font-family: var(--ff-display); font-weight: 700; font-size: 18px; }
.lab-footer__line { color: var(--ink-soft); margin: 4px 0 0; font-size: 14px; }
.lab-footer__nav ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px 14px;
}
.lab-footer__nav a { color: var(--ink); text-decoration: none; font-size: 14px; }
.lab-footer__nav a:hover { color: var(--coral-deep); }
.lab-footer__note { grid-column: 1 / -1; margin: 12px 0 0; color: var(--ink-soft); font-size: 13px; }

@media (max-width: 760px) {
  .lab-footer__inner { grid-template-columns: 1fr; }
}

/* ---------- Utility ---------- */
.lab-panels {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 22px 0;
}
.lab-panel {
  background: var(--bg-card); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 14px 16px;
}
.lab-panel h3 { margin-top: 0; }
.lab-callout {
  border-left: 4px solid var(--moss);
  background: #f0eedb; padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 18px 0;
}
.lab-callout--warn { border-left-color: var(--coral); background: #fbe7da; }
.lab-tray {
  background: #fff; border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 18px 20px; margin: 20px 0;
}
.lab-tray h3 { margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ========== Newsletter forms ========== */
.nsf-required { color: var(--coral); }

/* Honeypot — visually hidden, not display:none so bots still render it */
.nsf-a-honeypot,
.nsf-b-honeypot,
.nsf-c-honeypot {
  position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px;
  overflow: hidden; pointer-events: none;
}

/* Status messages */
.nsf-ok { color: #0a7c5c; }
.nsf-err { color: #c0392b; }

/* Variant A — Lab bench strip */
.nsf-a-wrap {
  background: #e8f5f3; border: 1px solid #b2dcd7;
  border-radius: var(--radius); padding: 32px 28px; margin: 48px 0;
}
.nsf-a-inner { max-width: var(--maxw); margin: 0 auto; }
.nsf-a-label {
  text-transform: uppercase; letter-spacing: .08em;
  font-size: .72rem; color: var(--teal); margin: 0 0 6px;
}
.nsf-a-heading { margin: 0 0 8px; font-size: 1.35rem; }
.nsf-a-desc { margin: 0 0 20px; color: #4a5568; font-size: .93rem; }
.nsf-a-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.nsf-a-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.nsf-a-field label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.nsf-a-field input {
  padding: 9px 12px; border: 1px solid #b2c4c2;
  border-radius: var(--radius-sm); font-size: .93rem;
  background: #fff; width: 100%; box-sizing: border-box;
}
.nsf-a-btn {
  padding: 10px 22px; background: var(--teal); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: .93rem; font-weight: 600; cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.nsf-a-btn:hover { background: #0a8f83; }
.nsf-a-btn:disabled { opacity: .65; cursor: default; }
.nsf-a-note, .nsf-a-status { font-size: .8rem; margin: 8px 0 0; color: #5a6675; }

/* Variant B — Compact sidebar panel */
.nsf-b-panel {
  background: var(--bg-card); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); padding: 20px 18px; margin: 28px 0;
}
.nsf-b-eyebrow {
  text-transform: uppercase; letter-spacing: .07em;
  font-size: .7rem; color: var(--teal); margin: 0 0 6px;
}
.nsf-b-pitch { font-size: .88rem; color: #4a5568; margin: 0 0 16px; }
.nsf-b-form { display: flex; flex-direction: column; gap: 8px; }
.nsf-b-label { font-size: .8rem; font-weight: 600; color: var(--ink); }
.nsf-b-input {
  padding: 8px 11px; border: 1px solid var(--rule);
  border-radius: var(--radius-sm); font-size: .88rem;
  background: #fff; width: 100%; box-sizing: border-box;
}
.nsf-b-btn {
  padding: 9px 18px; background: var(--teal); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.nsf-b-btn:hover { background: #0a8f83; }
.nsf-b-btn:disabled { opacity: .65; cursor: default; }
.nsf-b-fine, .nsf-b-status { font-size: .76rem; color: #6b7280; margin: 4px 0 0; }

/* Variant C — Research card */
.nsf-c-card {
  display: flex; gap: 18px; align-items: flex-start;
  background: #f5f0e8; border: 1px solid #d8cdb7;
  border-radius: var(--radius); padding: 24px 22px; margin: 36px 0;
}
.nsf-c-icon { font-size: 2.2rem; color: var(--teal); line-height: 1; flex-shrink: 0; }
.nsf-c-title { margin: 0 0 6px; font-size: 1.1rem; }
.nsf-c-body { font-size: .9rem; color: #4a5568; margin: 0 0 16px; }
.nsf-c-fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.nsf-c-field-wrap { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; }
.nsf-c-field-wrap label { font-size: .8rem; font-weight: 600; }
.nsf-c-field-wrap input {
  padding: 8px 11px; border: 1px solid #c4b89a;
  border-radius: var(--radius-sm); font-size: .9rem;
  background: #fff; width: 100%; box-sizing: border-box;
}
.nsf-c-btn {
  padding: 9px 18px; background: var(--coral); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.nsf-c-btn:hover { background: #d4522a; }
.nsf-c-btn:disabled { opacity: .65; cursor: default; }
.nsf-c-terms, .nsf-c-status { font-size: .78rem; color: #6b7280; margin: 8px 0 0; }
@media (max-width: 480px) {
  .nsf-c-card { flex-direction: column; }
}
