/* ===========================
   CAP RATE CALCULATOR — STYLES
   =========================== */

:root {
  --navy: #0F4C81;
  --navy-dark: #0a3560;
  --navy-light: #1a5fa0;
  --accent: #0F4C81;
  --green: #16A34A;
  --green-bg: #F0FDF4;
  --green-border: #BBF7D0;
  --yellow: #D97706;
  --yellow-bg: #FFFBEB;
  --yellow-border: #FDE68A;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --red-border: #FECACA;
  --ink: #0F172A;
  --ink-2: #334155;
  --ink-3: #64748B;
  --ink-4: #94A3B8;
  --bg: #FFFFFF;
  --bg-2: #F8FAFC;
  --bg-3: #F1F5F9;
  --border: #E2E8F0;
  --border-2: #CBD5E1;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-2);
  color: var(--ink);
  line-height: 1.6;
}

/* LAYOUT */
.container { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.container--wide { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* HEADER */
.site-header {
  background: var(--navy);
  color: #fff;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
}
.brand-name { font-size: 1rem; font-weight: 600; }
.meta-updated { font-size: 0.78rem; color: rgba(255,255,255,.65); }

/* HERO */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  padding: 40px 0 36px;
}
.hero h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; margin-bottom: 10px; }
.hero .lede { font-size: 1.05rem; color: rgba(255,255,255,.85); max-width: 600px; }

/* CARD */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* TAB BAR */
.tab-bar {
  display: flex;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1;
  min-width: 130px;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
  transition: all .15s ease;
}
.tab-btn[aria-selected="true"] {
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}
.tab-btn:hover:not([aria-selected="true"]) {
  background: var(--bg);
  color: var(--ink);
}

/* TAB PANELS */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* CALC SECTION */
.calc-section { padding: 32px 0; }
.calc-card { padding: 28px; }

/* FORM FIELDS */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}
label .hint {
  font-weight: 400;
  color: var(--ink-3);
  margin-left: 4px;
}
.money-input, .pct-input {
  position: relative;
  display: flex;
  align-items: center;
}
.money-input .prefix, .pct-input .suffix {
  position: absolute;
  font-size: 0.9rem;
  color: var(--ink-3);
  pointer-events: none;
  z-index: 1;
}
.money-input .prefix { left: 12px; }
.pct-input .suffix { right: 12px; }
input[type="text"], input[type="number"], select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  padding: 0 12px;
  transition: border-color .15s;
  appearance: none;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(15,76,129,.12);
}
.money-input input { padding-left: 28px; }
.pct-input input { padding-right: 36px; }

/* SELECT */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 36px;
  cursor: pointer;
}

/* SLIDER */
.slider-field { margin-bottom: 18px; }
.slider-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.slider-value { font-weight: 700; color: var(--navy); font-size: 0.9rem; }
input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  background: linear-gradient(to right, var(--navy) 0%, var(--navy) var(--pct, 25%), var(--border-2) var(--pct, 25%), var(--border-2) 100%);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--navy);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--navy);
  border-radius: 50%;
  border: 2px solid #fff;
  cursor: pointer;
}

/* TWO COLUMN */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

/* RESULTS BOX */
.result-box {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 24px;
  text-align: center;
}
.result-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.result-big {
  font-size: 3rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 16px;
}
.result-big.positive { color: var(--green); }
.result-big.negative { color: var(--red); }

/* VERDICT BADGE */
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
}
.verdict.strong { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.verdict.average { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }
.verdict.below { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

/* RESULT GRID */
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 20px; }
@media (max-width: 500px) { .result-grid { grid-template-columns: 1fr; } }
.result-item { text-align: center; }
.result-item .result-label { margin-bottom: 4px; }
.result-item .result-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
}

/* DIVIDER */
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* NOI BUILDER */
.noi-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--navy);
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 8px;
  transition: all .15s;
}
.noi-toggle-btn:hover { background: var(--navy); color: #fff; }
.noi-toggle-btn .arrow { transition: transform .25s; font-style: normal; }
.noi-toggle-btn.open .arrow { transform: rotate(180deg); }

.noi-builder {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .4s ease, opacity .3s ease;
  margin-top: 0;
}
.noi-builder.open {
  max-height: 1400px;
  opacity: 1;
  margin-top: 20px;
}

.noi-inner {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.noi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 680px) { .noi-grid { grid-template-columns: 1fr; } }

.noi-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-3);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.noi-subtotal {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}
.noi-subtotal .label { color: var(--ink-2); font-weight: 600; }
.noi-subtotal .value { font-weight: 700; color: var(--ink); }

.noi-result {
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.noi-result .label { font-size: 0.9rem; font-weight: 600; }
.noi-result .value { font-size: 1.3rem; font-weight: 800; }

.mortgage-warning {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: #92400E;
  margin-bottom: 16px;
}
.mortgage-warning .icon { flex-shrink: 0; font-size: 1rem; }

/* MANAGEMENT TOGGLE */
.mgmt-toggle-row { display: flex; gap: 8px; margin-bottom: 8px; }
.toggle-pill {
  padding: 6px 12px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .15s;
}
.toggle-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ACCORDION */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 20px;
}
.accordion-header {
  width: 100%;
  background: var(--bg);
  border: none;
  padding: 18px 20px;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .15s;
}
.accordion-header:hover { background: var(--bg-2); }
.accordion-icon { color: var(--ink-3); font-style: normal; transition: transform .25s; }
.accordion-header[aria-expanded="true"] .accordion-icon { transform: rotate(180deg); }
.accordion-body {
  display: none;
  padding: 20px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.accordion-body.open { display: block; }

/* COMPARISON TABLE */
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 16px; }
.compare-table th {
  background: var(--bg-3);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.compare-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table .metric-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy);
}
.leverage-note {
  margin-top: 14px;
  padding: 10px 14px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* MORTGAGE CALC INPUTS */
.mort-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .mort-inputs { grid-template-columns: 1fr 1fr; } }

/* BENCHMARKS PANEL */
.benchmarks-section { padding: 24px 0 40px; }
.benchmarks-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; }
@media (max-width: 640px) { .benchmarks-grid { grid-template-columns: 1fr; } }
.bench-card { padding: 20px; }
.bench-card h3 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-2);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bench-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.bench-table td { padding: 8px 0; border-bottom: 1px solid var(--bg-3); }
.bench-table tr:last-child td { border-bottom: none; }
.bench-table .bench-range { font-weight: 700; color: var(--navy); text-align: right; }

/* DEFINITION CARD */
.definition-card {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.definition-card .formula {
  font-size: 1rem;
  font-family: monospace;
  background: rgba(255,255,255,.12);
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* CONTENT SECTIONS */
.content-section { padding: 48px 0; background: var(--bg); }
.content-section + .content-section { border-top: 1px solid var(--border); }
.content-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}
.content-section p { color: var(--ink-2); margin-bottom: 14px; font-size: 0.97rem; }
.content-section ol, .content-section ul {
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 0.97rem;
}
.content-section li { margin-bottom: 8px; }

.steps-list { padding-left: 0; list-style: none; counter-reset: step; }
.steps-list li {
  counter-increment: step;
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  align-items: flex-start;
}
.steps-list li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
}

/* BENCHMARK STATIC TABLE */
.static-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 12px; }
.static-table th {
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
}
.static-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.static-table tr:nth-child(even) td { background: var(--bg-2); }
.static-table tr:last-child td { border-bottom: none; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* COMPARISON TABLE FOR CAP RATE VS COC */
.concept-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
@media (max-width: 580px) { .concept-compare { grid-template-columns: 1fr; } }
.concept-card {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.concept-card h3 { font-size: 1rem; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.concept-card p { font-size: 0.88rem; color: var(--ink-2); margin-bottom: 0; }

/* EXAMPLE BOX */
.example-box {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
  font-size: 0.9rem;
}
.example-box strong { color: var(--navy); }

/* FAQ */
.faq-section { padding: 48px 0; background: var(--bg-2); }
.faq-section h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 24px; }
.faq-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 16px 20px;
  text-align: left;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-question:hover { background: var(--bg-2); }
.faq-icon { flex-shrink: 0; color: var(--ink-3); font-style: normal; transition: transform .2s; }
.faq-question[aria-expanded="true"] .faq-icon { transform: rotate(180deg); }
.faq-answer {
  display: none;
  padding: 0 20px 16px;
  font-size: 0.9rem;
  color: var(--ink-2);
  line-height: 1.65;
}
.faq-answer.open { display: block; }

/* ACTIONS ROW */
.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
}
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-dark); }
.btn-secondary { background: var(--bg); color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--bg-3); }
.btn-ghost { background: transparent; color: var(--ink-3); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--ink-3); color: var(--ink); }

/* SHARE TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: transform .3s ease;
  z-index: 200;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* AD SLOTS */
.ad-slot {
  border: 1px dashed var(--border-2);
  background: var(--bg);
  color: var(--ink-3);
  font-size: 0.78rem;
  text-align: center;
  padding: 16px;
  min-height: 90px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px 0;
}
.ad-slot.ad-tall { min-height: 250px; }

/* FOOTER */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,.55);
  padding: 32px 0;
  font-size: 0.85rem;
  margin-top: 0;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: rgba(255,255,255,.55); text-decoration: none; }
.footer-links a:hover { color: #fff; }

/* NOSCRIPT */
noscript .noscript-box {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 0.9rem;
  color: var(--ink-2);
}

/* PRINT */
@media print {
  .site-header, .hero, .ad-slot, .actions-row, .faq-section, .site-footer,
  .tab-bar, .accordion, .noi-toggle-btn { display: none !important; }
  body { background: #fff; }
  .print-show { display: block !important; }
  .result-box, .card { box-shadow: none; border: 1px solid #ccc; }
  .content-section { page-break-inside: avoid; }
}

/* UTILITIES */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }

/* RESPONSIVE */
@media (max-width: 720px) {
  .hero h1 { font-size: 1.5rem; }
  .result-big { font-size: 2.4rem; }
  .benchmarks-section { padding: 20px 0 32px; }
  .calc-card { padding: 20px 16px; }
  .content-section h2 { font-size: 1.25rem; }
}
@media (max-width: 480px) {
  .hero { padding: 28px 0 24px; }
  .tab-btn { min-width: 110px; font-size: 0.82rem; padding: 9px 12px; }
}


/* ----- Embed snippet card (homepage section #embed) ----- */
.embed-snippet-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}
.embed-snippet-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #334155;
}
.embed-snippet-text {
  width: 100%;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  resize: vertical;
  box-sizing: border-box;
  color: #0f172a;
}
.btn-copy {
  margin-top: 8px;
  padding: 8px 14px;
  background: #0F4C81;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.btn-copy:hover { filter: brightness(1.15); }
.btn-copy:active { filter: brightness(0.9); }
