:root {
  --ink: #173532;
  --muted: #5b6d69;
  --green: #0c7564;
  --green-deep: #075448;
  --green-pale: #e9f4ef;
  --gold: #d8a72f;
  --paper: #fbfcfb;
  --line: #d8e2df;
  --white: #fff;
  --shadow: 0 18px 50px rgba(18, 58, 51, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.65 "Segoe UI", Arial, sans-serif;
}
a { color: var(--green-deep); text-underline-offset: 3px; }
a:hover { color: #9b6810; }
button { font: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 30px 24px; color: white;
  background: linear-gradient(165deg, rgba(5,63,54,.95), rgba(8,99,82,.93)),
              url("assets/sidebar-background.jpg") center/cover;
}
.brand { padding-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,.25); }
.eyebrow { margin: 0 0 7px; color: #d7ecdf; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.brand h1 { margin: 0; font: 700 1.7rem/1.18 Georgia, serif; }
.brand p { margin: 12px 0 0; color: #e5f0ed; font-size: .94rem; line-height: 1.5; }
.toc-title { margin: 24px 0 10px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: #cce5df; }
.toc { display: grid; gap: 5px; }
.toc button {
  display: grid; grid-template-columns: 28px 1fr; align-items: center; width: 100%;
  border: 0; border-radius: 8px; padding: 9px 10px; color: #f5faf8; background: transparent;
  cursor: pointer; text-align: left; transition: background .18s, transform .18s;
}
.toc button:hover, .toc button.active { background: rgba(255,255,255,.15); transform: translateX(2px); }
.toc .num { color: #a9d4ca; font-size: .8rem; font-weight: 700; }
.toc .home .num { color: var(--gold); }
.source-note { margin: 22px 8px 0; color: #cae0db; font-size: .75rem; }
.source-note a { color: inherit; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(22px, 5vw, 70px); background: rgba(251,252,251,.94); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar strong { font-family: Georgia, serif; }
.progress { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .86rem; }
.progress-bar { width: 90px; height: 4px; overflow: hidden; border-radius: 20px; background: #dfe9e6; }
.progress-bar span { display: block; width: 10%; height: 100%; background: var(--gold); transition: width .25s; }
.menu-button { display: none; border: 1px solid var(--line); border-radius: 7px; background: white; padding: 6px 10px; color: var(--ink); }

.page { display: none; padding: clamp(34px, 6vw, 78px) clamp(24px, 8vw, 110px) 80px; animation: enter .28s ease-out; }
.page.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.content { max-width: 990px; margin: 0 auto; }
.kicker { color: var(--green); font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page h2 { max-width: 850px; margin: 7px 0 12px; font: 700 clamp(2.15rem, 4.5vw, 4rem)/1.08 Georgia, serif; letter-spacing: -.025em; }
.lede { max-width: 760px; margin: 0 0 32px; color: var(--muted); font-size: 1.15rem; }
.hero-image { width: 100%; max-height: 525px; object-fit: contain; padding: 12px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.caption { margin: 8px 0 36px; color: var(--muted); font-size: .82rem; text-align: center; }
.section { margin: 36px 0; }
.section h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 1.18rem; }
.section h3 span { display: inline-grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; color: white; background: var(--green); font-size: .8rem; }
.section p { margin: 10px 0; }
.io-grid, .pros-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.card strong.label { display: block; margin-bottom: 6px; color: var(--green-deep); }
.pros-grid .good { border-top: 4px solid var(--green); }
.pros-grid .consider { border-top: 4px solid var(--gold); }
.links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid #b9d2cb; border-radius: 999px; background: white; font-size: .9rem; font-weight: 650; text-decoration: none; }
.pill::after { content: "↗"; font-size: .8rem; }
.page-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 54px; padding-top: 24px; border-top: 1px solid var(--line); }
.page-nav button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; color: var(--green-deep); background: white; cursor: pointer; font-weight: 700; }
.page-nav button:hover { border-color: var(--green); background: var(--green-pale); }

.home-page { padding-top: 0; }
.home-hero {
  position: relative; min-height: 410px; margin: 0 calc(-1 * clamp(24px, 8vw, 110px)) 46px;
  display: grid; align-items: end; padding: 58px clamp(24px, 8vw, 110px);
  color: white; background: linear-gradient(90deg, rgba(5,48,42,.86), rgba(5,48,42,.2)),
              url("assets/cover-background.jpg") center/cover;
}
.home-hero div { max-width: 820px; }
.home-hero h2 { margin-bottom: 16px; color: white; }
.home-hero p { max-width: 680px; color: #eef7f4; font-size: 1.12rem; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tool-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; padding: 0; background: white; cursor: pointer; text-align: left; transition: transform .18s, box-shadow .18s; }
.tool-card:hover { transform: translateY(-3px); box-shadow: 0 10px 25px rgba(18,58,51,.10); }
.tool-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.tool-card[hidden] { display: none; }
.tool-card img { display: block; width: 100%; height: 132px; object-fit: cover; border-bottom: 1px solid var(--line); background: var(--green-pale); }
.tool-card .card-copy { display: block; padding: 16px 18px 18px; }
.tool-card .number { color: var(--gold); font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.tool-card strong { display: block; margin-top: 4px; color: var(--ink); font-size: 1.02rem; }
.tool-card small { display: block; margin-top: 5px; color: var(--muted); }
.match-snippet { display: block; margin-top: 10px; color: var(--green-deep); font-size: .79rem; line-height: 1.45; }
.match-snippet:empty { display: none; }
.search-wrap { margin: 0 0 22px; }
.search-wrap > label { display: block; margin-bottom: 8px; color: var(--green-deep); font-weight: 750; }
.search-field { display: flex; align-items: center; gap: 10px; max-width: 680px; padding: 0 12px; border: 1px solid #aac8c0; border-radius: 12px; background: white; box-shadow: 0 5px 18px rgba(18,58,51,.06); }
.search-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(12,117,100,.14); }
.search-field > span { color: var(--green); font-size: 1.45rem; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; padding: 13px 0; color: var(--ink); background: transparent; font: inherit; }
.search-field button { display: none; border: 0; padding: 2px 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 1.35rem; }
.search-field button.visible { display: block; }
.search-status { margin: 8px 2px 0; color: var(--muted); font-size: .86rem; }
.no-results { padding: 34px; border: 1px dashed #aac8c0; border-radius: 12px; color: var(--muted); text-align: center; }
.no-results strong, .no-results span { display: block; }
.no-results strong { color: var(--ink); }
.stat-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 42px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.stat { padding: 18px; background: white; }
.stat strong { display: block; color: var(--green); font: 700 1.55rem Georgia, serif; }
.estimap-visual { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 28px; background: linear-gradient(145deg, #e4f3ee, #f4f8f5); border: 1px solid var(--line); border-radius: 14px; }
.estimap-visual div { min-height: 95px; display: grid; place-items: center; padding: 10px; border-radius: 9px; background: white; text-align: center; font-weight: 700; color: var(--green-deep); }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(88vw, 340px); transform: translateX(-105%); transition: transform .22s; }
  .sidebar.open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.25); }
  .menu-button { display: inline-block; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .topbar { padding: 11px 16px; }
  .topbar > strong { display: none; }
  .page { padding: 30px 18px 55px; }
  .home-hero { margin-left: -18px; margin-right: -18px; padding: 44px 18px; min-height: 360px; }
  .io-grid, .pros-grid, .tool-grid, .stat-panel { grid-template-columns: 1fr; }
  .estimap-visual { grid-template-columns: repeat(2, 1fr); padding: 15px; }
}

@media print {
  .sidebar, .topbar, .page-nav { display: none !important; }
  .page { display: block !important; padding: 30px; break-before: page; }
  .home-page { break-before: auto; }
  .hero-image { box-shadow: none; }
}
