/* ==========================================================================
   TOKENS — light, corporate, datasheet-clean (inspired by TI.com / power.com)
   ========================================================================== */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f7f9;
  --surface: #ffffff;
  --border: #e3e7eb;
  --border-strong: #cdd4db;

  --navy: #0b2545;
  --text: #1c2530;
  --text-dim: #5b6774;
  --text-faint: #8a94a1;

  --accent: #1257c4;
  --accent-dark: #0d3f96;
  --accent-soft: #eaf1fd;

  --tag-new-bg: #eaf1fd;   --tag-new-text: #1257c4;
  --tag-active-bg: #eaf8f1; --tag-active-text: #157a4a;
  --tag-preview-bg: #fff6e6; --tag-preview-text: #96690d;

  --danger: #c02b2b;

  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  --maxw: 1180px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

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

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.mono { font-family: var(--mono); }

/* ==========================================================================
   NAV
   ========================================================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--navy); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand span { color: var(--text-faint); font-weight: 400; font-size: 0.82rem; }
.nav-links { display: flex; gap: 30px; align-items: center; list-style: none; margin: 0; padding: 0; font-size: 0.92rem; }
.nav-links a { text-decoration: none; color: var(--text-dim); font-weight: 500; }
.nav-links a:hover { color: var(--accent); }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero { padding: 72px 0 56px; background: var(--bg); border-bottom: 1px solid var(--border); }

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 52px;
  align-items: center;
}
.hero-media { width: 100%; }
.hero-media .media-slot img { height: 380px; }
.hero-media .media-slot.is-empty { height: 380px; }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 30px; }
  .hero-media { order: -1; }
  .hero-media .media-slot img { height: 260px; }
  .hero-media .media-slot.is-empty { height: 260px; }
}

.eyebrow-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero h1 {
  font-weight: 700;
  font-size: clamp(2.1rem, 4.2vw, 3.3rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin: 0 0 20px;
  max-width: 18ch;
}

.hero-sub { max-width: 60ch; color: var(--text-dim); font-size: 1.12rem; margin: 0 0 30px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 44px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.95rem; font-weight: 600;
  padding: 13px 24px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; transform: translateY(-1px); }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
.section { padding: 64px 0; }
.section.alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { margin-bottom: 34px; max-width: 720px; }
.section-kicker { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 0 0 8px; }
.section-head h2 { font-size: 1.7rem; font-weight: 700; color: var(--navy); margin: 0 0 10px; letter-spacing: -0.01em; }
.section-note { color: var(--text-dim); font-size: 1rem; margin: 0; }

/* ==========================================================================
   PRODUCT GRID (index) — tile cards like power.com's category grid
   ========================================================================== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.product-card:hover { border-color: var(--border-strong); box-shadow: 0 8px 24px rgba(11,37,69,0.08); transform: translateY(-2px); }

.card-media {
  height: 150px;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  color: var(--border-strong);
}
.card-media svg { width: 56px; height: 56px; }

.card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; flex: 1; }

.card-top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.part-num { font-weight: 700; font-size: 1.35rem; color: var(--navy); margin: 0; letter-spacing: -0.01em; }

.tag { display: inline-flex; align-items: center; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tag-active { background: var(--tag-active-bg); color: var(--tag-active-text); }
.tag-new { background: var(--tag-new-bg); color: var(--tag-new-text); }
.tag-preview { background: var(--tag-preview-bg); color: var(--tag-preview-text); }

.tagline { color: var(--text-dim); font-size: 0.92rem; margin: 0 0 18px; flex: 1; }

.view-link { font-size: 0.88rem; font-weight: 600; color: var(--accent); }
.product-card:hover .view-link { color: var(--accent-dark); }

/* ==========================================================================
   MEDIA SLOTS (placeholders for images / schematics / scope captures)
   ========================================================================== */
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.media-slot { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.media-thumb { position: relative; }
.media-slot img { width: 100%; height: 220px; object-fit: cover; display: block; background: var(--bg-alt); cursor: zoom-in; }
.media-slot.is-empty {
  height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: repeating-linear-gradient(135deg, var(--bg-alt) 0 10px, #ffffff 10px 20px);
  color: var(--text-faint);
  text-align: center;
  padding: 18px;
}
.media-slot.is-empty .icon {
  font-size: 1.3rem; color: var(--text-faint);
  border: 1px solid var(--border-strong); border-radius: 50%;
  width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
  background: #fff;
}
.media-slot.is-empty .hint { font-family: var(--mono); font-size: 0.7rem; color: var(--text-faint); word-break: break-all; max-width: 90%; }
.media-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: 0.85rem; color: var(--text-dim); border-top: 1px solid var(--border); background: #fff; }
.media-download { flex: 0 0 auto; font-weight: 600; font-size: 0.84rem; color: var(--accent); text-decoration: none; white-space: nowrap; }
.media-download:hover { color: var(--accent-dark); text-decoration: underline; }

/* Zoom affordance on hover, for both photo and PDF thumbnails */
.zoom-badge {
  position: absolute;
  bottom: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(11, 37, 69, 0.72);
  color: #fff;
  font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.media-slot:hover .zoom-badge { opacity: 1; }

/* PDF schematic preview */
.pdf-preview-link { display: block; position: relative; }
.pdf-frame { width: 100%; height: 220px; border: none; display: block; background: #fff; pointer-events: none; }
.media-thumb.pdf-checking {
  height: 220px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  font-size: 0.85rem;
  background: var(--bg-alt);
}

/* ==========================================================================
   LIGHTBOX (full-size image viewer)
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(11, 37, 69, 0.92);
}
.lightbox.is-open { display: flex; }
.lightbox-figure { max-width: 92vw; max-height: 92vh; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lightbox-img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: var(--radius); background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,0.45); }
.lightbox-caption { color: #fff; font-size: 0.95rem; text-align: center; max-width: 70ch; }
.lightbox-close {
  position: absolute;
  top: 22px; right: 26px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.32);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { background: rgba(255,255,255,0.26); }

@media (max-width: 640px) {
  .lightbox-close { top: 14px; right: 14px; width: 38px; height: 38px; }
}

/* ==========================================================================
   RATINGS TABLE
   ========================================================================== */
.ratings-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ratings-table tr { border-bottom: 1px solid var(--border); }
.ratings-table tr:last-child { border-bottom: none; }
.ratings-table tr:nth-child(even) { background: var(--bg-alt); }
.ratings-table td { padding: 15px 18px; }
.ratings-table td:first-child { color: var(--text-dim); width: 42%; font-weight: 500; }
.ratings-table td:last-child { color: var(--text); font-weight: 600; }

/* ==========================================================================
   NOTES (optional per-board callout — hidden entirely when empty)
   ========================================================================== */
.notes-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 24px;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.7;
  white-space: pre-line;
  max-width: 74ch;
}

/* ==========================================================================
   PRODUCT DETAIL PAGE
   ========================================================================== */
.product-hero { padding: 44px 0 40px; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.breadcrumb { font-size: 0.85rem; color: var(--text-faint); margin-bottom: 20px; }
.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.product-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.product-hero h1 { font-size: clamp(2rem, 4.5vw, 2.8rem); font-weight: 700; color: var(--navy); margin: 0 0 8px; letter-spacing: -0.02em; }
.product-hero .tagline { color: var(--text-dim); font-size: 1.05rem; max-width: 55ch; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.download-bar { margin-top: 26px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.license-note { font-size: 0.85rem; color: var(--text-faint); }
.no-downloads { font-size: 0.95rem; color: var(--text-faint); font-style: italic; }

.summary-block { max-width: 74ch; color: var(--text-dim); font-size: 1.02rem; margin-top: 20px; }

.product-crumbs-row { display: flex; justify-content: space-between; align-items: center; padding: 30px 0; }
.crumb-nav-link { font-size: 0.92rem; font-weight: 600; text-decoration: none; color: var(--text-dim); }
.crumb-nav-link:hover { color: var(--accent); }

/* ==========================================================================
   LICENSE PAGE
   ========================================================================== */
.license-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px 44px;
  max-width: 78ch;
}
.license-card .license-title {
  font-weight: 700;
  color: var(--navy);
  font-size: 1.05rem;
  margin: 0 0 8px;
}
.license-card h2 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--navy);
  margin: 34px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.license-card h2:first-of-type { margin-top: 26px; }
.license-card p {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.7;
}
.license-card p.clause { display: flex; gap: 10px; }
.license-card p.clause .num {
  flex: 0 0 auto;
  min-width: 38px;
  font-weight: 700;
  color: var(--accent);
}
.license-card .sublist,
.license-card .subsublist {
  margin: 0 0 14px 40px;
}
.license-card .sublist p,
.license-card .subsublist p {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.license-card .letter {
  flex: 0 0 auto;
  min-width: 24px;
  font-weight: 600;
  color: var(--text-dim);
}

/* ==========================================================================
   CONTACT PAGE
   ========================================================================== */
.contact-email {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 22px 0;
}
.contact-email:hover { color: var(--accent-dark); text-decoration: underline; }

/* ==========================================================================
   FOOTER — dark bookend like PI/TI
   ========================================================================== */
.site-footer { background: var(--navy); color: #c7d2e0; padding: 46px 0 34px; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-brand { font-weight: 600; color: #ffffff; font-size: 0.95rem; }
.footer-links { display: flex; gap: 26px; list-style: none; padding: 0; margin: 0; font-size: 0.88rem; }
.footer-links a { color: #b7c4d6; text-decoration: none; }
.footer-links a:hover { color: #ffffff; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
  .hero { padding: 52px 0 40px; }
  .section { padding: 46px 0; }
  .nav-links { gap: 18px; }
  .nav-links .hide-mobile { display: none; }
  .license-card { padding: 24px 20px 30px; }
  .license-card .sublist, .license-card .subsublist { margin-left: 22px; }
}
