/* =========================================================================
   AI Stack Cost Calculator — styles
   Palette: deep midnight navy + electric lime accent + warm slate text.
   Type: Space Grotesk (display) / Inter (body).
   ========================================================================= */

:root {
  --bg:        #0a0f1c;
  --bg-2:      #0c1322;
  --surface:   #121b2e;
  --surface-2: #16223a;
  --border:    #243149;
  --border-2:  #2e3e5c;
  --text:      #e8edf6;
  --text-dim:  #9aa8c2;
  --text-mute: #6c7a96;
  --accent:    #c6ff4a;   /* electric lime */
  --accent-d:  #a6e215;
  --accent-ink:#10180a;
  --good:      #4ad4a0;
  --warn:      #ffb454;
  --danger:    #ff6b81;
  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --maxw:      1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(198,255,74,.07), transparent 60%),
    radial-gradient(900px 500px at 5% 0%, rgba(74,212,160,.06), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

h1, h2, .total-value, .brand-name {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.01em;
}

a { color: var(--accent); }

.visually-hidden, .skip-link {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus {
  position: fixed; top: 10px; left: 10px; width: auto; height: auto; clip: auto;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px;
  border-radius: 8px; z-index: 100; font-weight: 600;
}

/* ---------------------------- header ---------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(10,15,28,.78);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700; font-size: 1.4rem; color: var(--accent);
  background: var(--surface-2); width: 34px; height: 34px;
  display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--border-2);
}
.brand-name { font-weight: 600; font-size: 1.02rem; }

.header-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; }
.seg {
  border: 0; background: transparent; color: var(--text-dim);
  font: inherit; font-weight: 600; font-size: .86rem;
  padding: 7px 16px; border-radius: 999px; cursor: pointer;
  transition: background .18s, color .18s;
}
.seg.active { background: var(--accent); color: var(--accent-ink); }
.seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------- layout ---------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  padding-top: 34px;
  padding-bottom: 48px;
  align-items: start;
}

.picker-intro h1 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin: 0 0 10px; line-height: 1.1; }
.lede { color: var(--text-dim); font-size: 1.04rem; margin: 0 0 22px; max-width: 56ch; }

.controls { display: flex; gap: 10px; margin-bottom: 22px; }
#search {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 12px 14px; font: inherit; font-size: .98rem;
}
#search::placeholder { color: var(--text-mute); }
#search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--border-2); }

.btn-ghost {
  background: transparent; border: 1px solid var(--border-2); color: var(--text-dim);
  border-radius: var(--radius-sm); padding: 0 16px; font: inherit; font-weight: 600;
  font-size: .9rem; cursor: pointer; transition: border-color .15s, color .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------- categories ------------------------------- */
.categories { display: flex; flex-direction: column; gap: 26px; }
.cat-group { }
.cat-head {
  display: flex; align-items: baseline; gap: 10px;
  font-size: .82rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-mute); font-weight: 600; margin: 0 0 12px;
}
.cat-count { color: var(--text-mute); font-weight: 500; letter-spacing: 0; text-transform: none; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }

.tool-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 14px 12px;
  transition: border-color .15s, background .15s, transform .1s;
}
.tool-card.selected { border-color: var(--accent); background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--accent) inset; }

.tool-top { display: flex; align-items: flex-start; gap: 10px; }
.tool-check {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; flex: none; margin-top: 2px;
  border: 1.5px solid var(--border-2); border-radius: 6px; background: var(--bg-2);
  cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.tool-check:checked { background: var(--accent); border-color: var(--accent); }
.tool-check:checked::after {
  content: ""; width: 6px; height: 11px; border: solid var(--accent-ink);
  border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translateY(-1px);
}
.tool-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tool-meta { flex: 1; min-width: 0; }
.tool-name { font-weight: 600; font-size: .98rem; cursor: pointer; display: block; }
.tool-blurb { color: var(--text-mute); font-size: .8rem; margin: 3px 0 0; line-height: 1.4; }

.tool-plan { margin-top: 12px; }
.plan-label { font-size: .74rem; color: var(--text-mute); display: block; margin-bottom: 5px; }
.plan-select {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px;
  font: inherit; font-size: .9rem; cursor: pointer;
}
.plan-select:disabled { opacity: .45; cursor: not-allowed; }
.plan-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.plan-price { float: right; color: var(--accent); font-weight: 600; }

.no-results { color: var(--text-dim); padding: 20px 0; }

/* ---------------------------- summary --------------------------------- */
.summary-sticky { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 16px; }

.total-card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.total-label { margin: 0; font-size: .8rem; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .06em; }
.total-value { margin: 6px 0 4px; font-size: clamp(2.2rem, 5vw, 2.9rem); font-weight: 700;
  color: var(--accent); line-height: 1; }
.total-sub { margin: 0; color: var(--text-mute); font-size: .86rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.panel-title { margin: 0 0 12px; font-size: .95rem; font-weight: 600; }
.panel-note { margin: -6px 0 12px; font-size: .8rem; color: var(--text-mute); }

.biggest-list, .breakdown-list, .save-list { list-style: none; margin: 0; padding: 0; }

.biggest-list li { display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: .9rem; }
.biggest-list li:last-child { border-bottom: 0; }
.biggest-list .amt { color: var(--text); font-weight: 600; white-space: nowrap; }

.breakdown-list li { margin-bottom: 11px; }
.breakdown-list li:last-child { margin-bottom: 0; }
.bd-top { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 5px; }
.bd-cat { color: var(--text-dim); }
.bd-amt { color: var(--text); font-weight: 600; }
.bd-bar { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bd-fill { height: 100%; background: linear-gradient(90deg, var(--accent-d), var(--accent));
  border-radius: 99px; transition: width .3s ease; }

.save-list li {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; background: var(--bg-2);
}
.save-list li:last-child { margin-bottom: 0; }
.save-swap { font-size: .9rem; font-weight: 600; margin: 0 0 4px; }
.save-swap .from { color: var(--text-dim); }
.save-swap .to { color: var(--accent); }
.save-reason { font-size: .8rem; color: var(--text-mute); margin: 0 0 9px; line-height: 1.4; }
.save-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.save-amount { font-size: .8rem; color: var(--good); font-weight: 600; }
.save-cta {
  font-size: .8rem; font-weight: 600; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}
.save-cta:hover { background: var(--accent-d); }
.save-cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.actions { display: flex; flex-direction: column; gap: 10px; }
.btn-primary {
  background: var(--accent); color: var(--accent-ink); border: 0;
  font: inherit; font-weight: 700; font-size: .95rem;
  padding: 13px 18px; border-radius: var(--radius-sm); cursor: pointer;
  text-align: center; text-decoration: none; transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--accent-d); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.cta-deals {
  text-align: center; font-size: .88rem; font-weight: 600; color: var(--accent);
  text-decoration: none; padding: 4px; border-radius: 8px;
}
.cta-deals:hover { text-decoration: underline; }
.cta-deals:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------- CTA band -------------------------------- */
.cta-band { padding-bottom: 30px; }
.cta-pv {
  background: linear-gradient(120deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-2); border-radius: 18px;
  padding: 26px 28px; display: flex; align-items: center; justify-content: space-between;
  gap: 22px; flex-wrap: wrap;
}
.cta-pv h2 { margin: 0 0 4px; font-size: 1.25rem; }
.cta-pv p { margin: 0; color: var(--text-dim); font-size: .92rem; }
.cta-pv .btn-primary { white-space: nowrap; }

/* ---------------------------- footer ---------------------------------- */
.site-footer { padding: 26px 22px 48px; border-top: 1px solid var(--border); }
.disclosure, .price-note { color: var(--text-mute); font-size: .8rem; max-width: 78ch; margin: 0 0 10px; }
.disclosure strong, .price-note strong { color: var(--text-dim); }
.built-by { font-size: .85rem; color: var(--text-dim); margin: 14px 0 0; }
.built-by a { font-weight: 600; }

/* ---------------------------- responsive ------------------------------ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .summary { order: -1; }            /* total surfaces above the list on mobile */
  .summary-sticky { position: static; }
}
@media (max-width: 560px) {
  .header-inner { height: 58px; }
  .brand-name { font-size: .92rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .controls { flex-wrap: wrap; }
  .cta-pv { flex-direction: column; align-items: flex-start; }
}

/* ----------------------------- print ---------------------------------- */
.print-sheet { display: none; }

@media print {
  .site-header, .controls, .summary .actions, .cta-band, .save-cta,
  .cta-deals, .skip-link, #search, #clearAll { display: none !important; }
  body { background: #fff; color: #111; }
  .wrap { max-width: 100%; }
  .picker, .summary, .summary-sticky { all: unset; display: block; }
  .total-card, .panel { border: 1px solid #ccc !important; background: #fff !important;
    box-shadow: none !important; color: #111 !important; }
  .total-value { color: #111 !important; }
  .bd-fill { background: #888 !important; }
  .tool-card:not(.selected) { display: none; }  /* only print the chosen stack */
  .print-sheet { display: block; margin-top: 14px; color: #111; }
  .print-sheet h2 { font-size: 1rem; }
  .print-sheet table { width: 100%; border-collapse: collapse; font-size: .85rem; }
  .print-sheet td, .print-sheet th { border-bottom: 1px solid #ddd; padding: 6px 4px; text-align: left; }
  .print-sheet td.num { text-align: right; }
  a { color: #111 !important; text-decoration: underline; }
}
