/* =====================================================================
   OPCUAexport — shared stylesheet
   Used by: faq.html, format.html, license.html, why.html
   ===================================================================== */

/* ROOT VARIABLES */
:root {
  --bg: #0A0A0D;
  --surface: #111115;
  --surface-hi: #17171C;
  --border: #1E1E28;
  --border-hi: #2C2C3A;
  --text: #E2E6EF;
  --muted: #878FA2;
  --faint: #525A6E;
  --accent: #3B82F6;
  --accent-hi: #60A5FA;
  --ok: #22C55E;
  --mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --max: 1120px;
  --r: 8px;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
img, svg { display: block; max-width: 100%; }
code {
  font-family: var(--mono);
  font-size: .85em;
  color: var(--text);
  background: var(--surface-hi);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* =====================================================================
   NAV
   ===================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 13, .96);
  backdrop-filter: blur(14px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  gap: 12px;
}
.brand {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: -.01em;
  flex-shrink: 0;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-links { display: flex; gap: 0; align-items: stretch; height: 52px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: flex-end; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a:not(.btn-primary) {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  padding: 0 12px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  text-decoration: none;
}
.nav-links a:not(.btn-primary):hover { color: var(--text); border-bottom-color: var(--border-hi); }
.nav-links a.active { color: var(--text); border-bottom-color: var(--accent); }
.nav-links .btn-primary { align-self: center; margin-left: 8px; flex-shrink: 0; }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity .1s, background .1s, border-color .1s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .86; color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border-color: var(--border-hi); }
.btn-outline:hover { border-color: var(--muted); background: var(--surface-hi); color: var(--text); text-decoration: none; }
.btn-lg { padding: 9px 18px; font-size: 14px; }

/* =====================================================================
   PAGE HERO
   ===================================================================== */
.page-hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
}
.page-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-label::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}
.page-h1 {
  font-size: clamp(1.7rem, 3.5vw, 2.5rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.025em;
  color: var(--text);
  margin-bottom: 14px;
}
.page-sub {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.65;
  max-width: 600px;
}

/* =====================================================================
   SECTIONS
   ===================================================================== */
section { padding: 60px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

.sec-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
h2 {
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
h3 {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -.018em;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.sec-sub {
  color: var(--muted);
  font-size: 13.5px;
  max-width: 560px;
  margin-bottom: 32px;
  line-height: 1.6;
}

/* =====================================================================
   FAQ ACCORDION
   ===================================================================== */
.faq-list { max-width: 660px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:first-child { border-top: 1px solid var(--border); }
.faq-q {
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  color: var(--text);
  padding: 15px 0;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
.faq-q:hover { color: var(--accent-hi); }
.faq-icon {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 17px;
  flex-shrink: 0;
  transition: transform .15s;
  line-height: 1;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .25s ease, padding-bottom .2s; }
.faq-item.open .faq-a { max-height: 600px; padding-bottom: 15px; }
.faq-a p { color: var(--muted); font-size: 13.5px; line-height: 1.65; }
.faq-a a { color: var(--accent); }
.faq-more { margin-top: 20px; font-size: 13px; color: var(--muted); }
.faq-more a { color: var(--accent); }

/* =====================================================================
   LICENSE GRID
   ===================================================================== */
.lic-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-top: 8px;
}
.lic-tier { background: var(--surface); padding: 24px 22px; }
.lic-tier.featured { background: var(--surface-hi); }
.lic-name {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 10px;
}
.lic-price {
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.025em;
  margin-bottom: 4px;
  line-height: 1;
}
.lic-note { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.lic-feats { list-style: none; font-size: 13px; color: var(--muted); }
.lic-feats li {
  padding: 4px 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.lic-feats li:last-child { border: 0; }
.lic-feats li::before { content: '›'; color: var(--accent); flex-shrink: 0; }
.lic-cta { margin-top: 16px; }

/* =====================================================================
   FORMAT TABLE
   ===================================================================== */
.fmt-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
table.fmt { width: 100%; border-collapse: collapse; }
table.fmt th {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--surface-hi);
}
table.fmt td {
  font-size: 13.5px;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}
table.fmt td:first-child { font-family: var(--mono); color: var(--text); font-size: 12.5px; }
table.fmt tr:last-child td { border-bottom: none; }

/* =====================================================================
   CSV PREVIEW
   ===================================================================== */
.csv-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-top: 28px;
}
.csv-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--surface-hi);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  flex-wrap: wrap;
  gap: 6px;
}
.csv-fname { color: var(--text); }
.csv-meta { color: var(--faint); }
.csv-scroll { overflow-x: auto; }
.csv-scroll pre {
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  white-space: pre;
}
.ch { color: var(--accent); }
.cv { color: var(--text); }

/* =====================================================================
   ARTICLE (story.html)
   ===================================================================== */
.article { max-width: 700px; }
.article p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
  margin-bottom: 18px;
}
.article h2 { margin-top: 40px; margin-bottom: 12px; }
.article h2:first-child { margin-top: 0; }
.article blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  background: var(--surface);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  margin: 24px 0;
  font-size: 14.5px;
  line-height: 1.7;
}

/* =====================================================================
   NODESET CALLOUT (story.html CTA, copied from index.html)
   ===================================================================== */
.nodeset-callout {
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  padding: 24px 28px;
}
.nodeset-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.nodeset-body { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0; }

/* =====================================================================
   FOOTER
   ===================================================================== */
footer { padding: 40px 0 28px; border-top: 1px solid var(--border); }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; }
.foot-grid h4 {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 10px;
}
.foot-grid a { display: block; color: var(--muted); font-size: 13px; padding: 3px 0; transition: color .1s; }
.foot-grid a:hover { color: var(--text); text-decoration: none; }
.foot-grid p { color: var(--faint); font-size: 12.5px; line-height: 1.6; }
.foot-bottom {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  flex-wrap: wrap;
  gap: 8px;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 900px) {
  .lic-grid { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr; gap: 24px; }
  .nav-inner { padding: 0 16px; }
  .nav-links a:not(.btn-primary) { padding: 0 8px; font-size: 13px; }
}
@media (max-width: 768px) {
  .nav .brand-text { display: none; }
}
@media (max-width: 540px) {
  .lic-grid { grid-template-columns: 1fr; }
  .fmt-wrap { overflow-x: auto; }
}

.foot-privacy {
  margin-top: 12px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
}

/* =====================================================================
   ACCESSIBILITY
   ===================================================================== */
.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;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent); color: #fff; }
