/* Components: tables, tabs, drawers, maps, gallery, calculator, glossary. */

/* Comp tabs */
.tabbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.tabbar button {
  border: 1.5px solid var(--line); background: var(--paper); color: var(--gray);
  border-radius: 999px; padding: 10px 18px; font-size: 0.85rem; font-weight: 700;
  transition: all 0.16s var(--ease);
}
.tabbar button:hover { border-color: var(--ink); color: var(--ink); }
.tabbar button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--yellow); }
.tabpanel[hidden] { display: none; }
.comp-intro { max-width: 760px; color: var(--gray); margin-bottom: 20px; }
.stats-strip { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.chip { background: var(--paper2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 0.8rem; color: var(--gray); }
.chip b { color: var(--ink); font-weight: 900; }

/* Tables */
.tscroll { overflow-x: auto; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
table.comp { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 760px; }
table.comp th {
  text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gray); padding: 12px 14px; border-bottom: 2px solid var(--ink); white-space: nowrap; background: var(--paper2);
}
table.comp th.numc { text-align: right; }
table.comp th .sort-btn { background: none; border: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; display: inline-flex; gap: 5px; align-items: center; }
table.comp th .sort-btn:hover { color: var(--ink); }
table.comp th .sort-arrow { opacity: 0.5; font-size: 0.9em; }
table.comp th.sorted .sort-btn { color: var(--ink); }
table.comp th.sorted .sort-arrow { opacity: 1; color: var(--yellow-deep); }
table.comp td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.comp td.numc { text-align: right; white-space: nowrap; }
table.comp td:first-child { min-width: 220px; }
table.comp tr.row { cursor: pointer; transition: background 0.14s; }
table.comp tr.row:hover { background: var(--paper2); }
table.comp tr.row.open { background: var(--yellow-tint); }
table.comp tr.subj td { background: var(--yellow-tint); border-bottom: 1px solid #f0e3ac; }
table.comp tr.subj td:first-child { border-left: 4px solid var(--yellow); padding-left: 12px; }
table.comp tr.subj .cell-main { font-weight: 900; }
.cell-main { display: block; font-weight: 700; }
.cell-sub { display: block; font-size: 0.74rem; color: var(--gray); margin-top: 3px; max-width: 340px; line-height: 1.35; }
table.comp tfoot td { padding: 12px 14px; font-weight: 900; background: var(--paper2); border-top: 2px solid var(--ink); border-bottom: none; text-align: right; white-space: nowrap; }
table.comp tfoot td:first-child { text-align: left; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray); font-weight: 700; }
.th-tip { border-bottom: 1.5px dotted var(--gray-soft); cursor: help; background: none; border-top: none; border-left: none; border-right: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.th-tip:hover { color: var(--ink); border-bottom-color: var(--yellow-deep); }

/* Row drawer */
tr.drawer td { padding: 0; border-bottom: 1px solid var(--line); background: var(--paper); }
.drawer-in { padding: 20px 22px; display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.drawer-in img { border-radius: var(--r-sm); width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--line); }
.dr-quote { border-left: 3px solid var(--yellow); padding: 4px 0 4px 14px; font-size: 0.86rem; color: var(--ink); margin: 10px 0; background: var(--paper2); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding-right: 12px; }
.dr-line { font-size: 0.84rem; margin-bottom: 6px; }
.dr-line b { font-weight: 700; }
.dr-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dr-why { font-size: 0.82rem; color: var(--gray); margin-top: 8px; }

/* Dot-plot scale */
.scale-wrap { margin: 6px 0 22px; }
.scale-wrap svg { width: 100%; height: auto; display: block; }
.scale-dot { cursor: pointer; }
.scale-dot:hover circle, .scale-dot:focus circle { fill: var(--yellow-deep); }
.scale-tip { font-size: 0.72rem; color: var(--gray); margin-top: 4px; }

/* Maps */
.map-frame { border: 1.5px solid var(--ink); border-radius: var(--r-md); overflow: hidden; background: var(--paper2); position: relative; }
.map-host { height: 420px; width: 100%; }
.map-host .maplibregl-map { font-family: "Lato", sans-serif; }
.map-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gray); background: var(--paper2); z-index: 5; }
.map-fallback { width: 100%; height: 100%; object-fit: cover; }
.map-cap { padding: 10px 16px; font-size: 0.76rem; color: var(--gray); border-top: 1.5px solid var(--ink); background: var(--paper); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.map-layers { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; background: var(--paper); border-bottom: 1.5px solid var(--ink); }
.map-layers button { border: 1.5px solid var(--line); background: var(--paper); border-radius: 999px; padding: 5px 12px; font-size: 0.72rem; font-weight: 700; color: var(--gray); }
.map-layers button.on { background: var(--ink); color: var(--yellow); border-color: var(--ink); }
.comp-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.maplibregl-popup-content { border-radius: 10px; padding: 0; box-shadow: var(--shadow); font-family: "Lato", sans-serif; }
.sv-pop { padding: 12px 14px; min-width: 210px; max-width: 260px; }
.sv-pop img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; margin-bottom: 8px; }
.sv-pop .pop-name { font-weight: 900; font-size: 0.86rem; margin-bottom: 6px; }
.sv-pop .pop-stat { display: flex; justify-content: space-between; gap: 12px; font-size: 0.76rem; padding: 2px 0; }
.sv-pop .pop-stat span:first-child { color: var(--gray); }
.sv-pop .pop-stat span:last-child { font-weight: 700; text-align: right; }
.sv-pop .pop-links { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sv-pop .pdf-link { justify-content: center; }
.sv-pop .btn { justify-content: center; width: 100%; }
.maplibregl-popup-close-button { font-size: 18px; padding: 2px 8px; color: var(--gray); }
.maplibregl-ctrl-attrib { font-size: 10px; }

/* Gallery + lightbox */
.gallery { columns: 3; column-gap: 16px; }
.gitem { break-inside: avoid; margin-bottom: 16px; position: relative; border-radius: var(--r-md); overflow: hidden; border: 1.5px solid var(--line); }
.gitem a { display: block; position: relative; text-decoration: none; }
.gitem img { width: 100%; height: auto; transition: transform 0.5s var(--ease); }
.gitem:hover img { transform: scale(1.03); }
.gitem .gc {
  position: absolute; inset: auto 0 0 0; padding: 26px 14px 12px;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
  color: var(--paper); font-size: 0.8rem; font-weight: 700; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
}
.gitem .gcat { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--yellow); white-space: nowrap; }
.lightbox { position: fixed; inset: 0; z-index: 1400; background: rgba(0, 0, 0, 0.94); display: none; align-items: center; justify-content: center; flex-direction: column; padding: 30px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: min(1100px, 92vw); max-height: 78vh; object-fit: contain; border-radius: 6px; }
.lb-cap { color: var(--paper); margin-top: 16px; font-size: 0.95rem; font-weight: 700; text-align: center; }
.lb-count { color: var(--gray-dark); font-size: 0.78rem; margin-top: 4px; letter-spacing: 0.12em; }
.lb-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.1); border: none; color: var(--paper); width: 48px; height: 48px; border-radius: 50%; font-size: 1.4rem; }
.lb-btn:hover { background: var(--yellow); color: var(--black); }
.lb-prev { left: 22px; } .lb-next { right: 22px; }
.lb-close { position: absolute; top: 18px; right: 22px; background: none; border: none; color: var(--paper); font-size: 2rem; }
.lb-close:hover { color: var(--yellow); }

/* Glossary drawer */
.glossary-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.glossary-scrim.open { opacity: 1; pointer-events: auto; }
.glossary {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1100; width: min(440px, 94vw);
  background: var(--paper); transform: translateX(102%); transition: transform 0.3s var(--ease);
  overflow-y: auto; padding: 28px 26px 40px; box-shadow: var(--shadow);
}
.glossary.open { transform: none; }
.glossary h3 { font-size: 1.5rem; margin-bottom: 6px; }
.glossary .gsub { font-size: 0.85rem; color: var(--gray); margin-bottom: 20px; }
.glossary-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--paper); font-size: 1.1rem; }
.glossary-close:hover { background: var(--yellow); border-color: var(--yellow); }
.gterm { padding: 13px 0; border-bottom: 1px solid var(--line); }
.gterm .gt-t { font-weight: 900; font-size: 0.95rem; margin-bottom: 4px; }
.gterm .gt-b { font-size: 0.84rem; color: var(--gray); }
.gterm .gt-b strong { color: var(--ink); }
.gterm.flash { background: var(--yellow-tint); }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 34px; align-items: start; }
.calc-panel { background: rgba(255, 255, 255, 0.04); border: 1.5px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-lg); padding: 28px; }
.calc-field { margin-bottom: 20px; }
.cfl { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray-dark); margin-bottom: 8px; }
.cfl .hint { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 0.76rem; }
.price-input { display: flex; align-items: center; gap: 8px; border: 1.5px solid rgba(255, 255, 255, 0.3); border-radius: var(--r-md); padding: 10px 16px; background: rgba(0, 0, 0, 0.35); }
.price-input:focus-within { border-color: var(--yellow); }
.price-input .cur { font-weight: 900; font-size: 1.3rem; color: var(--yellow); }
.price-input input { flex: 1; width: 0; background: none; border: none; color: var(--paper); font-family: inherit; font-size: 1.5rem; font-weight: 900; min-width: 0; font-variant-numeric: tabular-nums; }
.price-input input:focus { outline: none; }
input[type="range"].calc-slider { width: 100%; appearance: none; -webkit-appearance: none; height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--yellow) var(--fill, 50%), rgba(255, 255, 255, 0.18) var(--fill, 50%)); margin-top: 14px; }
input[type="range"].calc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--black); box-shadow: 0 0 0 2px var(--yellow); cursor: grab; }
input[type="range"].calc-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--black); cursor: grab; }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mini-input { display: flex; align-items: center; gap: 6px; border: 1.5px solid rgba(255, 255, 255, 0.24); border-radius: var(--r-sm); padding: 8px 12px; background: rgba(0, 0, 0, 0.3); }
.mini-input:focus-within { border-color: var(--yellow); }
.mini-input input { width: 100%; background: none; border: none; color: var(--paper); font-family: inherit; font-size: 0.95rem; font-weight: 700; min-width: 0; font-variant-numeric: tabular-nums; }
.mini-input input:focus { outline: none; }
.mini-input .unit { color: var(--gray-dark); font-size: 0.8rem; font-weight: 700; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.preset-row button { border: 1.5px solid rgba(255, 255, 255, 0.3); background: transparent; color: var(--paper); border-radius: 999px; padding: 8px 15px; font-size: 0.78rem; font-weight: 700; }
.preset-row button:hover { border-color: var(--yellow); color: var(--yellow); }
.preset-row button.on { background: var(--yellow); border-color: var(--yellow); color: var(--black); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.toggle-row .tg-label { font-size: 0.86rem; font-weight: 700; }
.toggle-row .tg-sub { font-size: 0.74rem; color: var(--gray-dark); }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 2; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.2); transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--paper); transition: transform 0.2s var(--ease); }
.switch input:checked + .track { background: var(--yellow); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--black); }
.info-i { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--gray-dark); color: var(--gray-dark); font-size: 0.66rem; font-weight: 900; font-style: normal; background: none; padding: 0; vertical-align: middle; margin-left: 5px; }
.info-i:hover { border-color: var(--yellow); color: var(--yellow); }
/* Waterfall output */
.calc-out { position: sticky; top: calc(var(--nav-h) + 20px); }
.net-hero { background: var(--yellow); color: var(--black); border-radius: var(--r-lg); padding: 26px 28px; margin-bottom: 18px; }
.net-hero .nh-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; opacity: 0.7; }
.net-hero .nh-value { font-size: clamp(2.2rem, 4vw, 3.2rem); font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; margin: 6px 0; font-variant-numeric: tabular-nums; }
.net-hero .nh-sub { font-size: 0.82rem; font-weight: 700; opacity: 0.78; }
.waterfall { border: 1.5px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-lg); overflow: hidden; }
.wf-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 20px; font-size: 0.88rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.wf-row:last-child { border-bottom: none; }
.wf-row .wf-l { color: var(--gray-dark); }
.wf-row .wf-v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wf-row.neg .wf-v { color: #ffb3ab; }
.wf-row.total { background: rgba(255, 205, 1, 0.1); font-weight: 900; }
.wf-row.total .wf-l { color: var(--paper); font-weight: 900; }
.wf-row.total .wf-v { color: var(--yellow); font-size: 1.02rem; }
.wf-row.gain .wf-v { color: var(--yellow); }
.calc-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.cc-col { border: 1.5px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-md); padding: 14px; font-size: 0.78rem; }
.cc-col .cc-t { font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.66rem; color: var(--gray-dark); margin-bottom: 6px; }
.cc-col .cc-v { font-weight: 900; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.cc-col.live { border-color: var(--yellow); }
.cc-col.live .cc-v { color: var(--yellow); }

/* I&E + voting + timeline + tax */
.ie-table td:first-child { min-width: 250px; }
.ie-table tr.total-row td { background: var(--paper3); font-weight: 900; border-top: 2px solid var(--ink); }
.ie-table tr.total-row.noi td { background: var(--yellow); color: var(--black); }
.ie-table tr.section-row td { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gray); font-weight: 700; background: var(--paper2); padding: 8px 14px; }
.vote-bar { position: relative; height: 54px; border-radius: var(--r-md); overflow: hidden; display: flex; border: 1.5px solid rgba(255,255,255,0.2); margin: 18px 0 8px; }
.vote-you { background: var(--yellow); color: var(--black); display: flex; align-items: center; padding-left: 16px; font-weight: 900; font-size: 1.05rem; }
.vote-other { background: rgba(255, 255, 255, 0.12); color: var(--gray-dark); display: flex; align-items: center; justify-content: flex-end; padding-right: 14px; font-weight: 700; font-size: 0.85rem; }
.vote-mark { position: absolute; top: -8px; bottom: -8px; width: 2.5px; background: var(--paper); }
.vote-mark span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; color: var(--gray-dark); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 20px 34px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 3.5px solid var(--yellow-deep); }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-date { font-size: 0.72rem; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gray); }
.timeline .tl-event { font-size: 0.9rem; margin-top: 2px; }
.tax-hero { display: flex; align-items: center; gap: 34px; flex-wrap: wrap; }
.tax-big { font-size: clamp(3.4rem, 7vw, 5.4rem); font-weight: 900; letter-spacing: -0.03em; color: var(--yellow-deep); line-height: 1; }
.dark .tax-big { color: var(--yellow); }

/* Recommendations */
.rec { border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 28px; background: var(--paper); position: relative; overflow: hidden; }
.rec::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--yellow); }
.rec-no { font-size: 0.72rem; font-weight: 900; letter-spacing: 0.2em; color: var(--gray-soft); }
.rec-tag { display: inline-block; margin-left: 10px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; background: var(--yellow); color: var(--black); padding: 4px 10px; border-radius: 999px; }
.rec h3 { font-size: 1.25rem; margin: 12px 0 10px; }
.rec-metric { font-size: 1.7rem; font-weight: 900; letter-spacing: -0.02em; }
.rec-metric-sub { font-size: 0.78rem; color: var(--gray); margin-bottom: 12px; }
.rec-body { font-size: 0.9rem; color: var(--ink); }
.rec-roi { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; display: grid; gap: 6px; }
.rec-roi-row { display: flex; justify-content: space-between; gap: 14px; font-size: 0.82rem; }
.rec-roi-row b { font-weight: 900; white-space: nowrap; }
.rec-proof { margin-top: 14px; }
.dev-card img { border-radius: var(--r-sm); aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border: 1px solid var(--line); }

@media (max-width: 1020px) {
  .comp-layout { grid-template-columns: 1fr; }
  .calc { grid-template-columns: 1fr; }
  .calc-out { position: static; }
  .gallery { columns: 2; }
}
@media (max-width: 860px) {
  .drawer-in { grid-template-columns: 1fr; }
  .drawer-in img { max-width: 320px; }
  table.comp { min-width: 0; }
  .tscroll { border: none; background: none; overflow: visible; }
  .tscroll.ie-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.comp thead { display: none; }
  table.comp, table.comp tbody, table.comp tr, table.comp td { display: block; width: 100%; }
  table.comp tr.row, table.comp tr.subj { border: 1.5px solid var(--line); border-radius: var(--r-md); margin-bottom: 12px; background: var(--paper); padding: 6px 0; }
  table.comp tr.subj { border-color: var(--yellow-deep); }
  table.comp tr.subj td:first-child { border-left: none; padding-left: 14px; }
  table.comp td { border-bottom: none; padding: 7px 14px; display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
  table.comp td::before { content: attr(data-th); font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray); flex: none; }
  table.comp td.numc { text-align: right; white-space: normal; }
  table.comp td:first-child { display: block; min-width: 0; }
  table.comp td:first-child::before { display: none; }
  table.comp .sub { margin-left: auto; }
  table.comp tfoot { display: block; border: 1.5px solid var(--ink); border-radius: var(--r-md); overflow: hidden; margin-bottom: 12px; }
  table.comp tfoot tr { display: flex; flex-wrap: wrap; }
  table.comp tfoot td { flex: 1 1 40%; border: none; padding: 10px 14px; }
  table.comp tfoot td::before { content: attr(data-th); display: block; font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gray); font-weight: 700; }
  table.comp tfoot td:first-child { flex-basis: 100%; }
  tr.drawer td { display: block; }
  tr.drawer { border: none !important; margin-top: -12px; }
  .calc-row { grid-template-columns: 1fr; }
  .calc-compare { grid-template-columns: 1fr; }
  .map-host { height: 320px; }
}
@media (max-width: 560px) { .gallery { columns: 2; column-gap: 10px; } .gitem { margin-bottom: 10px; } .gitem .gc { font-size: 0.68rem; padding: 20px 10px 8px; } }