/* ============================================================
   FILAMENTDB — Power3D Edition
   Brand: Power3D (@power_3d) — dark teal + orange accent
   Mobile-first responsive design
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,600;0,700;0,800;0,900;1,900&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── TOKENS ───────────────────────────────────────────────── */
:root {
  /* Power3D palette */
  --p3d-dark:      #0d1a1a;
  --p3d-darker:    #071010;
  --p3d-teal:      #0a8a75;
  --p3d-teal-mid:  #0e6b5a;
  --p3d-teal-light:#12a88e;
  --p3d-orange:    #ff6b00;
  --p3d-orange-lt: #ff8c35;
  --p3d-silver:    #c8d6d6;

  /* Surfaces */
  --bg-base:    #0d1a1a;
  --bg-surface: #102020;
  --bg-card:    #152828;
  --bg-card2:   #1a3030;
  --border:     rgba(10,138,117,0.18);
  --border-hover: rgba(10,138,117,0.4);

  /* Accents */
  --accent:       var(--p3d-teal);
  --accent-lt:    var(--p3d-teal-light);
  --accent-orange: var(--p3d-orange);
  --accent-red:   #f87171;
  --accent-green: #34d399;
  --accent-yellow:#fbbf24;

  /* Text */
  --text-primary:  #e8f0f0;
  --text-secondary:#8aadaa;
  --text-muted:    #3d6060;

  /* Tare pills */
  --tare-light-bg:  #052e16;
  --tare-light-fg:  #34d399;
  --tare-medium-bg: #0a2828;
  --tare-medium-fg: #0ae8c0;
  --tare-heavy-bg:  #2d0800;
  --tare-heavy-fg:  var(--p3d-orange-lt);

  /* Shapes */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; width: 100%; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 16px;
}

/* ── BACKGROUND ───────────────────────────────────────────── */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 5%, rgba(10,138,117,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 85% 90%, rgba(255,107,0,0.06) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--p3d-teal-mid); border-radius: 2px; }

/* ── CONTAINER ────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; position: relative; z-index: 1; }

/* ── TOP NAV BAR ──────────────────────────────────────────── */
.topnav {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(7,16,16,0.92);
  border-bottom: 2px solid var(--p3d-teal-mid);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 100;
}
.topnav-logo {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2px solid var(--p3d-teal);
  object-fit: cover;
  flex-shrink: 0;
}
.topnav-title {
  display: flex; flex-direction: column; line-height: 1.1;
}
.topnav-name {
  font-family: 'Barlow', sans-serif;
  font-weight: 900; font-style: italic;
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.topnav-name span { color: var(--p3d-teal-light); }
.topnav-sub {
  font-size: 0.65rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.mobile-menu-toggle { display: none; }
.mobile-menu-overlay { display: none; }
.mobile-menu-btn {
  display: none;
  background: transparent; border: none;
  color: var(--text-primary);
  margin-left: auto;
  cursor: pointer;
  padding: 0.75rem;
  margin-right: -0.25rem;
  position: relative;
  z-index: 10000;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-panel {
  display: none; /* Only visible on mobile via media query */
}
.nav-link {
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); text-decoration: none; padding: 0.4rem 0.6rem; border-radius: 6px; transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--p3d-teal-light); background: rgba(10,138,117,0.15); }

/* Mobile Menu Styles */
@media (max-width: 600px) {
  .mobile-menu-btn {
    display: block;
  }
  .topnav-links {
    display: none !important; /* Hide desktop links on mobile */
  }
  .mobile-nav-panel {
    display: flex !important;
    position: fixed;
    top: 0; 
    bottom: 0;
    right: -320px;
    width: 300px;
    background: #071010;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    flex-direction: column;
    padding: 0;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100000;
    box-shadow: -20px 0 50px rgba(0,0,0,0.9);
  }
  .mobile-nav-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
  }
  .mobile-nav-panel .nav-link {
    padding: 0.85rem 1.5rem;
  }
  .mobile-menu-toggle:checked ~ .mobile-nav-panel {
    right: 0;
  }
  .mobile-menu-toggle:checked ~ .mobile-menu-overlay {
    display: block;
    position: fixed; inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  .mobile-nav-panel .nav-link {
    font-size: 1.15rem;
    padding: 0.85rem 1rem;
    width: 100%;
    text-align: left;
    background: transparent;
    border-radius: 8px;
  }
  .mobile-nav-panel .nav-link.active {
    background: rgba(10,138,117,0.15);
    color: var(--p3d-teal-light);
  }
  .mobile-nav-panel .topnav-yt {
    margin-top: auto;
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.1rem;
    margin-bottom: 2rem;
  }
}
.topnav-yt {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.4rem;
  background: var(--p3d-orange);
  color: #fff; font-weight: 700; font-size: 0.75rem;
  padding: 0.35rem 0.75rem; border-radius: 99px;
  text-decoration: none;
  transition: background var(--transition);
  white-space: nowrap;
}
.topnav-yt:hover { background: var(--p3d-orange-lt); }

/* ── HERO ─────────────────────────────────────────────────── */
.hero {
  padding: 2rem 1rem 1.5rem;
  text-align: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(10,138,117,0.15);
  border: 1px solid rgba(10,138,117,0.35);
  border-radius: 99px;
  padding: 0.3rem 0.85rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--p3d-teal-light);
  margin-bottom: 1rem;
}
.hero h1 {
  font-family: 'Barlow', sans-serif;
  font-weight: 900; font-style: italic;
  font-size: clamp(2rem, 8vw, 3.2rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.6rem;
}
.hero h1 .word-filament { color: var(--text-primary); }
.hero h1 .word-db       { color: var(--p3d-teal-light); }
.hero p {
  font-size: 0.95rem; color: var(--text-secondary);
  max-width: 600px; margin: 0 auto 1.5rem;
}

/* ── STATS BAR ────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.75rem;
  text-align: center;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--p3d-teal-light); display: block; line-height: 1.1; }
.stat-label { font-size: 0.65rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── DISTRIBUTION ─────────────────────────────────────────── */
.distribution-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.2rem;
  margin-bottom: 2rem;
}
.distribution-card h3 {
  font-size: 0.8rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 1rem;
}
.dist-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.6rem; }
.dist-label { font-size: 0.72rem; color: var(--text-secondary); min-width: 160px; flex-shrink: 0; }
.dist-bar-wrap { flex: 1; background: rgba(255,255,255,0.04); border-radius: 99px; height: 8px; overflow: hidden; }
.dist-bar { height: 100%; border-radius: 99px; transition: width 0.8s cubic-bezier(0.4,0,0.2,1); }
#bar-light  { background: linear-gradient(90deg, #34d399, #6ee7b7); }
#bar-medium { background: linear-gradient(90deg, var(--p3d-teal), var(--p3d-teal-light)); }
#bar-heavy  { background: linear-gradient(90deg, var(--p3d-orange), var(--p3d-orange-lt)); }

/* ── SECTION TITLES ───────────────────────────────────────── */
.section-title {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.6rem;
  font-family: 'Barlow', sans-serif; letter-spacing: -0.01em;
}

/* ── CONTROLS ─────────────────────────────────────────────── */
.controls {
  display: flex; flex-wrap: wrap; gap: 0.6rem;
  align-items: stretch; margin-bottom: 1rem;
}
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap input {
  width: 100%; height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0.9rem 0 2.3rem;
  color: var(--text-primary); font-size: 0.9rem; font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}
.search-wrap input:focus { border-color: var(--accent); }
.search-icon {
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; font-size: 0.85rem;
}
select {
  width: 100%;
  max-width: 100%;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0.9rem;
  color: var(--text-primary); font-size: 0.87rem; font-family: inherit;
  cursor: pointer; outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364a0a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}
select:focus { border-color: var(--accent); }
.result-count { font-size: 0.78rem; color: var(--text-muted); align-self: center; white-space: nowrap; }

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap; flex-shrink: 0;
}
.tab-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.tab-btn.active {
  background: var(--p3d-teal-mid);
  border-color: var(--p3d-teal); color: #fff;
}

/* ── CALLOUT ──────────────────────────────────────────────── */
.callout {
  display: flex; gap: 0.75rem; align-items: flex-start;
  background: rgba(255,107,0,0.06);
  border: 1px solid rgba(255,107,0,0.2);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem; margin-bottom: 1rem;
  font-size: 0.82rem; line-height: 1.6; color: var(--text-secondary);
}
.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }

/* ── TABLE WRAPPER ────────────────────────────────────────── */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 480px; }
thead { background: var(--bg-card2); }
th {
  padding: 0.75rem 0.85rem; text-align: left;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-secondary); white-space: nowrap;
  border-bottom: 1px solid var(--border);
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--p3d-teal-light); }
th.active-sort { color: var(--p3d-teal-light); }
td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(10,138,117,0.07);
  vertical-align: middle;
}
.table-row { transition: background var(--transition); }
.table-row:hover { background: rgba(10,138,117,0.05); }
.table-row:last-child td { border-bottom: none; }
.brand-cell { font-weight: 700; color: var(--text-primary); white-space: nowrap; font-size: 0.88rem; }
.model-cell { color: var(--text-secondary); font-size: 0.78rem; max-width: 200px; }
.dim-cell   { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--text-secondary); white-space: nowrap; }
.notes-cell { font-size: 0.72rem; color: var(--text-muted); max-width: 200px; line-height: 1.4; }

/* ── TARE PILLS ───────────────────────────────────────────── */
.tare-pill {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem; font-weight: 500; white-space: nowrap;
}
.tare-light  { background: var(--tare-light-bg);  color: var(--tare-light-fg); }
.tare-medium { background: var(--tare-medium-bg); color: var(--tare-medium-fg); }
.tare-heavy  { background: var(--tare-heavy-bg);  color: var(--tare-heavy-fg); }

/* ── BADGES ───────────────────────────────────────────────── */
.format-badge {
  display: inline-block;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
  color: var(--text-secondary);
}
.cat-badge {
  display: inline-block; border-radius: var(--radius-sm);
  padding: 0.12rem 0.5rem; font-size: 0.68rem; font-weight: 700; white-space: nowrap;
}
.cat-plastic1kg  { background: rgba(10,138,117,0.15); color: var(--p3d-teal-light); }
.cat-cardboard1kg{ background: rgba(255,107,0,0.14);  color: var(--p3d-orange-lt); }
.cat-smallFormat { background: rgba(52,211,153,0.12);  color: #34d399; }
.cat-largeFormat { background: rgba(248,113,113,0.12);  color: #f87171; }

/* ── TRUST VOTE ───────────────────────────────────────────── */
.trust-cell { white-space: nowrap; }
.trust-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: transparent;
  border: 1px solid rgba(10,138,117,0.25);
  border-radius: 99px;
  padding: 0.2rem 0.55rem;
  color: var(--text-muted); font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
  font-family: inherit;
}
.trust-btn:hover {
  border-color: var(--p3d-teal);
  color: var(--p3d-teal-light);
  background: rgba(10,138,117,0.08);
}
.trust-btn.voted {
  border-color: var(--p3d-teal);
  background: rgba(10,138,117,0.15);
  color: var(--p3d-teal-light);
}
.trust-btn .thumb { font-size: 0.85rem; }
.trust-count { font-variant-numeric: tabular-nums; }

/* ── CALCULATOR ───────────────────────────────────────────── */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 2.5rem;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem; margin-bottom: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label { font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
input[type="number"] {
  width: 100%;
  max-width: 100%;
  height: 44px;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0 0.9rem;
  color: var(--text-primary); font-size: 0.95rem; font-family: 'JetBrains Mono', monospace;
  outline: none; transition: border-color var(--transition);
  -webkit-appearance: none; appearance: none;
}
input[type="number"]:focus { border-color: var(--accent); }
.calc-btn {
  display: block; width: 100%; max-width: 320px;
  background: linear-gradient(135deg, var(--p3d-teal-mid), var(--p3d-teal-light));
  border: none; border-radius: var(--radius-md);
  padding: 0.85rem 1.5rem; color: #fff; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: opacity var(--transition), transform var(--transition);
  font-family: 'Barlow', sans-serif; letter-spacing: 0.03em;
}
.calc-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.calc-output {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.7rem; margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}
.calc-item {
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.9rem;
}
.calc-label { display: block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 0.25rem; }
.calc-value { font-size: 1.25rem; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.calc-value.accent   { color: var(--p3d-teal-light); }
.calc-value.secondary{ font-size: 0.85rem; color: var(--text-secondary); }

/* ── ECOSYSTEM CARDS ──────────────────────────────────────── */
.ecosystem-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.85rem;
  margin-top: 1rem;
}
.eco-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.2rem;
  transition: border-color var(--transition), transform var(--transition);
}
.eco-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.eco-icon { font-size: 1.5rem; margin-bottom: 0.6rem; }
.eco-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.35rem; }
.eco-desc  { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6; }
.eco-link  { display: inline-block; margin-top: 0.5rem; font-size: 0.75rem; color: var(--p3d-teal-light); text-decoration: none; }
.eco-link:hover { text-decoration: underline; }

/* ── TRUST LEGEND ─────────────────────────────────────────── */
.trust-legend {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(10,138,117,0.07); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.75rem 1rem;
  font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.75rem;
}
.trust-legend .thumb { font-size: 1rem; }

/* ── FOOTER ───────────────────────────────────────────────── */
footer {
  margin-top: 3rem; padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center; color: var(--text-muted); font-size: 0.75rem;
}
footer a { color: var(--p3d-teal-light); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.footer-brand {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.footer-logo { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--p3d-teal); }
.footer-name {
  font-family: 'Barlow', sans-serif;
  font-weight: 900; font-style: italic;
  color: var(--text-primary); font-size: 0.95rem;
}
.footer-name span { color: var(--p3d-teal-light); }

/* ── ANIMATIONS ───────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ── MOBILE-FIRST RESPONSIVE ─────────────────────────────── */

/* Small phones (< 480px) */
@media (max-width: 479px) {
  .topnav-yt .yt-text { display: none; }  /* hide text, keep icon */
  .hero h1 { font-size: 2.2rem; }
  .hero p { font-size: 0.87rem; }
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .stat-value { font-size: 1.25rem; }
  .stat-label { font-size: 0.58rem; }
  .dist-label { min-width: 130px; font-size: 0.65rem; }
  .controls { flex-direction: column; }
  .calc-grid { grid-template-columns: 1fr; }
  .calc-output { grid-template-columns: 1fr 1fr; }
  .ecosystem-grid { grid-template-columns: 1fr; }
  /* Hide less important columns on tiny screens */
  th.col-notes, td.notes-cell { display: none; }
  th.col-dim,   td.dim-cell   { display: none; }
}

/* Tablets and up (>= 640px) */
@media (min-width: 640px) {
  .container { padding: 0 1.5rem; }
  .hero { padding: 2.5rem 1.5rem 2rem; }
  .hero h1 { font-size: 2.8rem; }
  .stats-bar { grid-template-columns: repeat(5, 1fr); }
  .controls { flex-direction: row; }
}

/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
  .hero { padding: 3rem 0 2.5rem; }
  .container { padding: 0 2rem; }
}

/* Touch targets — all tappable elements ≥ 44px */
.tab-btn { min-height: 44px; display: flex; align-items: center; }
.trust-btn { min-height: 36px; min-width: 52px; justify-content: center; }
input[type="number"], select, .search-wrap input { font-size: 16px; } /* prevent iOS zoom */

/* ── NAV LINKS (page navigation) ─────────────────────────── */
.topnav-links {
  display: flex; gap: 0.3rem; margin-left: 0.5rem;
}
.nav-link {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); text-decoration: none;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--text-primary); border-color: var(--border); }
.nav-link.active {
  color: var(--p3d-teal-light);
  border-color: var(--p3d-teal-mid);
  background: rgba(10,138,117,0.10);
}
/* No more display: none here, logic handled above for better isolation */

/* ── CALC CARD — no top margin when first element ─────────── */
#calculator .calc-card { margin-top: 0; }

/* ── TEXT INPUT (contribute form) ─────────────────────────── */
input[type="text"].text-input, input[type="number"].text-input {
  width: 100%;
  height: 44px;
  background: var(--bg-card2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0 0.9rem;
  color: var(--text-primary); font-size: 16px; font-family: inherit;
  outline: none; transition: border-color var(--transition);
}
input[type="text"].text-input:focus,
input[type="number"].text-input:focus { border-color: var(--p3d-teal); }

/* ── FORM ROW (two columns) ───────────────────────────────── */
.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem;
}
@media (max-width: 479px) { .form-row { grid-template-columns: 1fr; } }

/* ── FORM INFO (current tare display) ─────────────────────── */
.form-info {
  background: rgba(10,138,117,0.08); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.7rem 0.9rem;
  font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5;
  min-height: 48px; display: flex; align-items: center;
}

/* ── CONTRIBUTE GRID & PANELS ─────────────────────────────── */
.contribute-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.contribute-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.3rem;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.contribute-panel-header {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.25rem;
}
.contribute-icon { font-size: 1.3rem; }
.contribute-title { font-weight: 700; font-size: 1rem; font-family: 'Barlow', sans-serif; letter-spacing: -0.01em; }
.contribute-btn {
  display: block; width: 100%;
  background: rgba(10,138,117,0.15);
  border: 1px solid var(--p3d-teal-mid); border-radius: var(--radius-md);
  padding: 0.75rem 1rem; color: var(--p3d-teal-light);
  font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: all var(--transition); font-family: inherit;
  margin-top: 0.25rem;
}
.contribute-btn:hover {
  background: rgba(10,138,117,0.25);
  transform: translateY(-1px);
}
.contribute-msg {
  font-size: 0.82rem; min-height: 24px;
  animation: fadeIn 0.3s ease;
}
.contribute-msg.success { color: var(--accent-green); }
.contribute-msg.error   { color: var(--accent-red); }

/* ── SOURCE CARDS (sources.html) ──────────────────────────── */
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.source-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.1rem;
  display: flex; gap: 1rem; align-items: flex-start;
  transition: border-color var(--transition);
}
.source-card:hover { border-color: var(--border-hover); }
.source-card.primary { border-color: rgba(10,138,117,0.4); background: rgba(10,138,117,0.05); }
.source-rank {
  font-family: 'Barlow', sans-serif; font-weight: 900; font-style: italic;
  font-size: 1.8rem; color: var(--p3d-teal-mid); line-height: 1; flex-shrink: 0;
  min-width: 36px;
}
.source-card.primary .source-rank { color: var(--p3d-teal-light); }
.source-body { flex: 1; }

/* ── VARIABLE CARDS (sources.html) ───────────────────────── */
.variables-list { display: flex; flex-direction: column; gap: 0.75rem; }
.variable-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden;
}
.var-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg-card2); border-bottom: 1px solid var(--border);
}
.var-icon { font-size: 1.2rem; flex-shrink: 0; }
.var-title { font-weight: 700; font-size: 0.95rem; flex: 1; font-family: 'Barlow', sans-serif; }
.var-impact {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.25rem 0.65rem; border-radius: 99px; white-space: nowrap; flex-shrink: 0;
}
.var-impact.high   { background: rgba(248,113,113,0.15); color: #f87171; }
.var-impact.medium { background: rgba(251,191,36,0.12);  color: var(--accent-yellow); }
.var-impact.low    { background: rgba(10,138,117,0.12);  color: var(--p3d-teal-light); }
.var-body { padding: 1rem 1.1rem; font-size: 0.83rem; color: var(--text-secondary); line-height: 1.7; display: flex; flex-direction: column; gap: 0.75rem; }
.var-example {
  background: var(--bg-card2); border-left: 3px solid var(--p3d-teal-mid);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.7rem 0.9rem; font-size: 0.8rem; line-height: 1.6;
}
.var-fix { color: var(--accent-green); font-size: 0.8rem; }

/* ── STEP GUIDE ───────────────────────────────────────────── */
.steps-guide {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem 1.5rem;
  margin: 1.2rem 0 0; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.step-item {
  display: flex; align-items: center; gap: 0.75rem;
  flex-shrink: 0; min-width: 180px;
}
.step-num {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Barlow', sans-serif; font-weight: 900; font-size: 1rem;
  background: var(--bg-card2); border: 2px solid var(--p3d-teal-mid);
  color: var(--p3d-teal-light);
}
.step-num.active { background: var(--p3d-teal-mid); border-color: var(--p3d-teal-light); color: #fff; }
.step-text { line-height: 1.3; }
.step-text strong { font-size: 0.88rem; color: var(--text-primary); display: block; }
.step-text span    { font-size: 0.73rem; color: var(--text-muted); }
.step-divider { flex: 1; height: 1px; background: var(--border); min-width: 24px; flex-shrink: 0; }
@media (max-width: 600px) {
  .steps-guide { gap: 0.5rem; padding: 0.9rem; }
  .step-item { min-width: 140px; }
}

/* ── CONTRIB STATS ROW ────────────────────────────────────── */
.contrib-stats-row {
  display: flex; align-items: stretch; gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.contrib-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.9rem 1.2rem;
  text-align: center; flex: 1;
}
.contrib-stat-value {
  display: block; font-size: 1.8rem; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; color: var(--p3d-teal-light); line-height: 1.1;
}
.contrib-stat-label { font-size: 0.65rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.contrib-stat-cta { display: flex; align-items: center; justify-content: center; flex: 0; white-space: nowrap; }
.contrib-stat-link {
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 600;
  text-decoration: none; transition: color var(--transition);
}
.contrib-stat-link:hover { color: var(--p3d-teal-light); }

.hidden { display: none !important; }

/* ── FORM CARD ────────────────────────────────────────────── */
.form-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden; margin-bottom: 1rem;
}

/* ── CONTRIB TABS ─────────────────────────────────────────── */
.contrib-tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.contrib-tab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 1rem; background: transparent; border: none;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 700;
  cursor: pointer; transition: all var(--transition); font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.contrib-tab:hover { color: var(--text-secondary); background: rgba(255,255,255,0.02); }
.contrib-tab.active {
  color: var(--p3d-teal-light);
  border-bottom-color: var(--p3d-teal-light);
  background: rgba(10,138,117,0.06);
}

/* ── TAB PANELS ───────────────────────────────────────────── */
.tab-panel {
  padding: 1.5rem; display: flex; flex-direction: column; gap: 0.85rem;
  animation: fadeIn 0.2s ease;
}
.tab-panel.hidden { display: none; }
.panel-desc {
  font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6;
  padding: 0.7rem 0.9rem; background: rgba(10,138,117,0.06);
  border-radius: var(--radius-md); border-left: 3px solid var(--p3d-teal-mid);
  margin-bottom: 0.25rem;
}

/* ── LIVE PREVIEW ─────────────────────────────────────────── */
.form-preview {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: var(--bg-card2); border: 1px dashed var(--border);
  border-radius: var(--radius-md); padding: 0.9rem 1rem;
  font-size: 0.83rem;
}
.preview-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); flex-basis: 100%;
  margin-bottom: 0.1rem;
}
.preview-brand { font-weight: 700; color: var(--text-primary); }
.preview-model { color: var(--text-secondary); flex: 1; }

/* ── PRIMARY CONTRIBUTE BUTTON ────────────────────────────── */
.contribute-btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  width: 100%; padding: 1rem;
  background: linear-gradient(135deg, var(--p3d-teal-mid), var(--p3d-teal-light));
  border: none; border-radius: var(--radius-md);
  color: #fff; font-size: 1rem; font-weight: 700; font-family: 'Barlow', sans-serif;
  cursor: pointer; transition: opacity var(--transition), transform var(--transition);
  letter-spacing: 0.03em; margin-top: 0.5rem;
}
.contribute-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.contribute-btn-primary:active { transform: translateY(0); }
.btn-icon { font-size: 1.1rem; }

/* ── SUCCESS OVERLAY ──────────────────────────────────────── */
.success-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7,16,16,0.85); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; animation: fadeIn 0.3s ease;
}
.success-overlay.hidden { display: none; }
.success-card {
  background: var(--bg-card2); border: 1px solid rgba(10,138,117,0.5);
  border-radius: var(--radius-xl); padding: 2.5rem 2rem;
  max-width: 520px; width: 100%; text-align: center;
  box-shadow: 0 0 60px rgba(10,138,117,0.2);
  animation: popIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
}
.success-icon { font-size: 3.5rem; margin-bottom: 0.75rem; animation: bounce 0.6s ease 0.2s both; }
.success-title { font-family: 'Barlow', sans-serif; font-weight: 900; font-style: italic; font-size: 1.8rem; margin-bottom: 0.5rem; color: var(--p3d-teal-light); }
.success-sub { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.2rem; }
.success-copy-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 0.9rem 1rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem;
  color: var(--p3d-teal-light); text-align: left; line-height: 1.7;
  margin-bottom: 1.2rem; white-space: pre-wrap; word-break: break-word;
}
.success-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; margin-bottom: 1rem; }
.success-btn-copy {
  background: var(--p3d-orange); border: none; border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem; color: #fff; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: opacity var(--transition); font-family: inherit;
}
.success-btn-copy:hover { opacity: 0.85; }
.success-btn-copy.copied { background: var(--accent-green); }
.success-btn-new {
  background: rgba(10,138,117,0.15); border: 1px solid var(--p3d-teal-mid);
  border-radius: var(--radius-md); padding: 0.75rem 1.5rem;
  color: var(--p3d-teal-light); font-weight: 700; font-size: 0.9rem;
  cursor: pointer; transition: all var(--transition); font-family: inherit;
}
.success-btn-new:hover { background: rgba(10,138,117,0.25); }
.success-footnote { font-size: 0.73rem; color: var(--text-muted); }
.success-footnote a { color: var(--p3d-teal-light); }

/* ── CORRECTION DIFF ──────────────────────────────────────── */
.diff-old { color: var(--accent-red); text-decoration: line-through; }
.diff-new { color: var(--accent-green); font-weight: 700; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes bounce {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}


