/* PlainCalc — clean finance-utility aesthetic */
:root {
  --bg: #f4f6f8;
  --bg-elevated: #ffffff;
  --ink: #1a2332;
  --ink-muted: #5a6577;
  --ink-faint: #8b95a5;
  --border: #d8dee6;
  --border-strong: #b8c2d0;
  --accent: #0d6e6e;
  --accent-hover: #0a5555;
  --accent-soft: #e6f3f3;
  --accent-ink: #0a4f4f;
  --success: #1b7a3d;
  --success-bg: #e8f6ed;
  --warn: #9a6700;
  --warn-bg: #fff8e6;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(26, 35, 50, 0.05), 0 4px 12px rgba(26, 35, 50, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1120px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* —— Chrome —— */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--accent); }
.logo__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent), #149494);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 800;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
}
.nav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 2rem 1.25rem 5.5rem;
}
.site-footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
}
@media (min-width: 720px) {
  .site-footer__inner { grid-template-columns: 1.2fr 1fr 1fr 0.8fr; }
}
.site-footer h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0.35rem 0; }
.site-footer a { color: var(--ink-muted); text-decoration: none; font-size: 0.92rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer__tag { color: var(--ink-muted); font-size: 0.92rem; margin: 0.4rem 0 0; }
.site-footer__legal {
  max-width: var(--max);
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* —— Layout —— */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem;
}
.hero {
  padding: 1.75rem 0 1rem;
}
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.hero__tag {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--accent-ink);
  font-weight: 600;
}
.hero p { margin: 0; color: var(--ink-muted); max-width: 42rem; }
.breadcrumb {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--ink-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

/* —— Tool cards (hub) —— */
.tool-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 1.5rem 0 2rem;
}
@media (min-width: 640px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .tool-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.tool-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(13, 110, 110, 0.12);
}
.tool-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.tool-card h2 {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.tool-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
  flex: 1;
}
.tool-card__cta {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.35rem;
}

/* —— Calculator shell —— */
.calc-layout {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 880px) {
  .calc-layout {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.panel--sticky {
  position: sticky;
  top: calc(var(--header-h) + 0.75rem);
}
.field {
  margin-bottom: 1rem;
}
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.field .hint {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-faint);
  margin-top: 0.25rem;
}
.field-row {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 520px) {
  .field-row--2 { grid-template-columns: 1fr 1fr; }
  .field-row--3 { grid-template-columns: 1fr 1fr 1fr; }
}
.input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
.input-wrap:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.input-wrap .prefix,
.input-wrap .suffix {
  display: grid;
  place-items: center;
  padding: 0 0.75rem;
  background: var(--bg);
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-right: 1px solid var(--border);
}
.input-wrap .suffix {
  border-right: none;
  border-left: 1px solid var(--border);
}
.input-wrap input,
.input-wrap select {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 1.1rem;
  padding: 0.7rem 0.75rem;
  min-width: 0;
  background: transparent;
  color: var(--ink);
  -moz-appearance: textfield;
}
.input-wrap input::-webkit-outer-spin-button,
.input-wrap input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.75rem 0;
}
.checkbox-field input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: var(--accent);
}
.checkbox-field label { font-weight: 500; margin: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--ink-muted);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

/* —— Results —— */
.results-hero {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.results-hero__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-ink);
  font-weight: 600;
  margin: 0 0 0.25rem;
}
.results-hero__value {
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 0;
  color: var(--accent-ink);
}
.results-hero__sub {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--ink-muted);
}
.breakdown {
  list-style: none;
  margin: 0;
  padding: 0;
}
.breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.breakdown li:last-child { border-bottom: none; }
.breakdown .label { color: var(--ink-muted); }
.breakdown .value { font-weight: 600; }
.breakdown .total {
  font-weight: 700;
  border-top: 2px solid var(--border-strong);
  margin-top: 0.25rem;
  padding-top: 0.75rem;
}
.breakdown .fee .value { color: var(--danger); }
.breakdown .profit .value { color: var(--success); }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
}
.as-of {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0.75rem 0 0;
}
.callout {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  margin: 1rem 0;
}
.callout--warn { background: var(--warn-bg); color: #6b4a00; border: 1px solid #f0d78c; }
.callout--info { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid #b8dede; }
.callout--danger { background: var(--danger-bg); color: #7a1c14; border: 1px solid #f5c2be; }

/* —— FAQ / prose —— */
.prose { max-width: 42rem; }
.prose h2 { margin: 2rem 0 0.75rem; font-size: 1.25rem; letter-spacing: -0.02em; }
.prose h3 { margin: 1.5rem 0 0.5rem; font-size: 1.05rem; }
.prose p, .prose li { color: var(--ink-muted); }
.faq details {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  padding: 0.85rem 1rem;
}
.faq summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  display: inline-block;
  width: 1.25rem;
  color: var(--accent);
  font-weight: 700;
}
.faq details[open] summary::before { content: "−"; }
.faq details p { margin: 0.65rem 0 0; color: var(--ink-muted); font-size: 0.95rem; }

.section-title {
  margin: 2.5rem 0 1rem;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

/* —— Ads —— */
.ad-slot {
  max-width: var(--max);
  margin: 0.75rem auto;
  padding: 0 1.25rem;
}
.ad-slot--header { margin-top: 0.5rem; }
.ad-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-bottom: 0.25rem;
}
.ad-placeholder {
  background: repeating-linear-gradient(
    -45deg,
    #eef1f5,
    #eef1f5 8px,
    #e8ecf1 8px,
    #e8ecf1 16px
  );
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-faint);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  text-align: center;
  padding: 0.5rem;
}
.ad-placeholder--leaderboard { min-height: 90px; }
.ad-placeholder--rectangle { min-height: 250px; }
.ad-placeholder--inline { min-height: 100px; }
.ad-placeholder--sticky { min-height: 50px; }
.ad-slot--incontent { margin: 1.5rem auto; }
.ad-slot--sticky {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  margin: 0;
  padding: 0.4rem 0.75rem calc(0.4rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
@media (max-width: 768px) {
  .ad-slot--sticky { display: block; }
  .ad-slot--sticky.is-dismissed { display: none; }
}
.ad-sticky__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: var(--max);
  margin: 0 auto;
}
.ad-sticky__row .ad-placeholder { flex: 1; }
.ad-dismiss {
  border: none;
  background: var(--bg);
  color: var(--ink-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ad-dismiss:hover { color: var(--ink); }

/* —— Print —— */
@media print {
  .site-header, .site-footer, .ad-slot, .btn-row, .nav, .skip-link { display: none !important; }
  body { background: #fff; }
  .panel { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .panel--sticky { position: static; }
  a { color: inherit; text-decoration: none; }
}
