/*
 * Component CSS. Copied from the Astro Tools hub (photon-ledger-website/website/css/components.css,
 * EKE Services LLC) and trimmed: the storefront pieces (pricing tiers, promo pills, test-mode banner, product
 * cards) are gone, and every hard-coded colour is now a token so the light theme works.
 * Site-specific components live in collab.css.
 */

/* ----- Navigation ----- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav__row {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.nav__brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--text);
  border: none;
}
.nav__brand:hover { color: var(--text); }
.nav__brand img { width: 28px; height: 28px; }
.nav__links { display: flex; gap: 22px; align-items: center; }
.nav__links a { color: var(--text-muted); border: none; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); }
.nav__links a[aria-current="page"] { font-weight: 600; }
.nav__cta { margin-left: 8px; }

.nav__toggle {
  display: none;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; font: inherit;
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; }
  .nav.is-open .nav__links {
    display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
    position: absolute; left: 0; right: 0; top: 64px;
    background: var(--surface-1); border-bottom: 1px solid var(--border);
    padding: 16px var(--page-gutter);
  }
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-prop); font-weight: 600; font-size: 1rem; line-height: 1.2;
  padding: 12px 22px; border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform .12s, background-color .15s, color .15s, box-shadow .15s, border-color .15s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) { .btn:hover { transform: none; } }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary); color: var(--on-primary);
  font-weight: 700;
  box-shadow: 0 6px 18px var(--primary-glow);
}
.btn-primary:hover { background: var(--primary-hi); color: var(--on-primary); }

/* Override .nav__links a { color: var(--text-muted) } so a primary button in the nav keeps its own text colour. */
.nav__links a.btn-primary,
.nav__links a.btn-primary:hover { color: var(--on-primary); }

.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--link); }

.btn-danger { background: transparent; color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--badge-err-bg); color: var(--error); }

.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 8px 14px; font-size: 14px; }

/* ----- Cards & tiles ----- */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-card);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.card:hover, .card--hover:hover { box-shadow: var(--shadow-hover); border-color: var(--primary); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { a.card:hover, .card--hover:hover { transform: none; } }

.card__title { font-size: var(--size-h3); margin-bottom: 6px; }
.card__body { color: var(--text-muted); margin: 0; }

/* ----- Chips (filter colours) ----- */
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-1); color: var(--text);
  border: 1px solid var(--border);
}
.chip--lum  { color: var(--f-lum);  border-color: currentColor; }
.chip--red  { color: var(--f-red);  border-color: currentColor; }
.chip--green{ color: var(--f-green);border-color: currentColor; }
.chip--blue { color: var(--f-blue); border-color: currentColor; }
.chip--ha   { color: var(--f-ha);   border-color: currentColor; }
.chip--oiii { color: var(--f-oiii); border-color: currentColor; }
.chip--sii  { color: var(--f-sii);  border-color: currentColor; }
.chip--other{ color: var(--f-other);border-color: currentColor; }

/* ----- Stat tiles ----- */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px;
}
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  text-align: left;
}
.stat-tile__label { color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.stat-tile__value { font-family: var(--font-mono); font-size: clamp(24px, 3vw, 32px); color: var(--text); margin-top: 6px; }
.stat-tile__sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ----- Section headers ----- */
.section-header { margin-bottom: 28px; }
.section-header h2 { margin-bottom: 8px; }
.section-header h2::after {
  content: ""; display: block; height: 3px; width: 60px;
  background: var(--primary); border-radius: 2px; margin-top: 10px;
}
.section-header p { color: var(--text-muted); max-width: 60ch; margin: 0; }

/* ----- Grids ----- */
.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid--3, .grid--2 { grid-template-columns: 1fr; } }

/* ----- Hero ----- */
.hero { position: relative; padding-block: clamp(56px, 9vw, 104px); overflow: hidden; }
.hero__starfield {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at top, var(--badge-accent-bg), transparent 55%);
}
.hero__inner { position: relative; max-width: 820px; }
.hero h1 { margin-bottom: 18px; }
.hero p.lede { font-size: clamp(17px, 2vw, 20px); color: var(--text-muted); max-width: 62ch; margin-bottom: 28px; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }

/* ----- Forms ----- */
.form { display: flex; gap: 12px; flex-wrap: wrap; }
.form input[type="email"], .form input[type="text"], .form input[type="password"], .form input[type="number"],
.form textarea, .form select {
  flex: 1 1 240px;
  background: var(--surface-1); color: var(--text);
  border: 1px solid var(--border-input); border-radius: 10px;
  padding: 12px 14px; font: inherit;
}
.form textarea { min-height: 120px; resize: vertical; width: 100%; flex: 1 1 100%; }
.form input::placeholder, .form textarea::placeholder { color: var(--text-muted); }
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 1px; }
.form__row { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.form__row label, .form__row .label { font-size: 13.5px; color: var(--text-muted); font-weight: 500; }
.form__row input[type="email"], .form__row input[type="text"], .form__row input[type="password"],
.form__row input[type="number"], .form__row select { flex: 0 0 auto; width: 100%; }
.form__row textarea { flex: 0 0 auto; width: 100%; }
.form__check { display: flex; gap: 10px; align-items: flex-start; width: 100%; }
.form__check input { margin-top: 5px; accent-color: var(--primary); width: 18px; height: 18px; flex: 0 0 auto; }
.form__check label { color: var(--text); font-size: 15px; }
.form__msg { width: 100%; font-size: 14px; margin-top: 6px; min-height: 1.2em; }
.form__msg.is-ok { color: var(--success); }
.form__msg.is-err { color: var(--error); }
.form__hint { width: 100%; font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.form__actions { width: 100%; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.honeypot { position: absolute; left: -9999px; height: 0; width: 0; }

/* ----- Tables ----- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; }
.data-table tbody tr:hover { background: var(--surface-1); }
.data-table .num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; background: var(--surface-3); color: var(--text); border: 1px solid var(--border); white-space: nowrap; }
.badge--ok { background: var(--badge-ok-bg); color: var(--success); border-color: currentColor; }
.badge--warn { background: var(--badge-warn-bg); color: var(--warning); border-color: currentColor; }
.badge--err { background: var(--badge-err-bg); color: var(--error); border-color: currentColor; }
.badge--info { background: var(--badge-info-bg); color: var(--live); border-color: currentColor; }
.badge--accent { background: var(--badge-accent-bg); color: var(--link); border-color: currentColor; }

/* ----- Footer ----- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface-1);
  padding: 36px 0 28px;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 64px;
}
.footer__row {
  display: flex; gap: 28px; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
}
.footer__nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer__nav a { color: var(--text-muted); border: none; }
.footer__nav a:hover { color: var(--text); }
.footer__legal { font-size: 13px; }

/* ----- Download cards ----- */
.dl-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0,1fr)); }
@media (max-width: 760px) { .dl-grid { grid-template-columns: 1fr; } }
.dl-card { display: flex; flex-direction: column; gap: 8px; }
.dl-card .btn { width: 100%; justify-content: center; }
.dl-card.is-primary { border-color: var(--primary); }
.dl-meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); word-break: break-all; }

/* ----- Misc ----- */
.kbd {
  display: inline-block; font-family: var(--font-mono); font-size: 12px;
  padding: 2px 6px; border-radius: 5px;
  background: var(--surface-1); border: 1px solid var(--border);
}

.callout {
  background: var(--surface-1); border: 1px solid var(--border); border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm); padding: 14px 16px; margin: 18px 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout--warning { border-left-color: var(--warning); }
.callout--error { border-left-color: var(--error); }

/* ----- Content tables (docs). Wrap in .table-wrap so wide tables scroll instead of breaking the page. ----- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--size-body); min-width: 560px; }
.table th, .table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-weight: 600; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: none; }

/* ----- Lightbox ----- */
.lightbox {
  background: transparent; border: none; padding: 0;
  max-width: min(94vw, 1400px); max-height: 92vh;
}
.lightbox::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.lightbox img {
  display: block; max-width: 100%; max-height: 88vh;
  width: auto; height: auto; margin: 0 auto; cursor: zoom-out;
  border-radius: var(--radius); border: 1px solid var(--border);
}
.lightbox__close {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  width: 36px; height: 36px; border-radius: 999px;
  background: var(--surface-1); color: var(--text);
  border: 1px solid var(--border); font-size: 20px; cursor: pointer;
}
.lightbox__close:hover { border-color: var(--primary); color: var(--link); }
