/* Calcula — Australian financial calculators
   Single stylesheet. System fonts only. Mobile-first. */

:root {
  --accent: #2563EB;
  --accent-dark: #1D4ED8;
  --accent-soft: #EFF4FF;
  --text: #0F172A;
  --text-muted: #475569;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --bg: #FFFFFF;
  --bg-soft: #F8FAFC;
  --bg-card: #FFFFFF;
  --success: #059669;
  --warning: #B45309;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --radius: 10px;
  --radius-lg: 14px;
  --max: 960px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--text); margin: 0 0 0.6em; }
h1 { font-size: 2rem; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; margin-top: 1.3em; }
p { margin: 0 0 1em; color: var(--text); }
small { color: var(--text-muted); }

/* ------------ Layout ------------- */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px; max-width: var(--max); margin: 0 auto;
}
.brand {
  font-weight: 700; font-size: 1.25rem; letter-spacing: -0.01em;
  color: var(--text);
}
.brand .dot { color: var(--accent); }
.brand:hover { text-decoration: none; }

.nav {
  display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.92rem;
}
.nav a {
  color: var(--text-muted); padding: 6px 4px; white-space: nowrap;
}
.nav a:hover, .nav a[aria-current="page"] {
  color: var(--accent); text-decoration: none;
}
.nav-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 0.9rem;
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
    padding: 8px 0;
  }
  .nav.open { display: flex; }
  .site-header .inner { flex-wrap: wrap; }
  .nav a { padding: 10px 4px; }
}

main { padding: 28px 0 56px; }

/* ------------ Hero / intro ------------- */
.intro {
  max-width: 720px;
  color: var(--text-muted);
  font-size: 1.05rem;
  margin: 0 0 24px;
}

/* ------------ Calculator card ------------- */
.calc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin: 12px 0 24px;
}

.calc h2:first-child { margin-top: 0; }

.field {
  display: flex; flex-direction: column; margin-bottom: 16px;
}
.field label {
  font-weight: 600; font-size: 0.92rem; margin-bottom: 6px; color: var(--text);
}
.field .hint {
  font-size: 0.82rem; color: var(--text-muted); margin-top: 4px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="tel"],
.field select {
  width: 100%;
  font: inherit; font-size: 1rem;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 600px) {
  .row, .row-3 { grid-template-columns: 1fr; }
}

/* Toggle group (segmented control) */
.toggle-group {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  flex-wrap: wrap;
}
.toggle-group input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-group label {
  padding: 8px 14px; cursor: pointer; font-size: 0.9rem;
  border-radius: 7px; color: var(--text-muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.toggle-group input:checked + label {
  background: var(--bg);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 0.95rem; font-weight: 600;
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; transition: all .15s;
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--bg); color: var(--text); border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-link {
  background: none; padding: 6px 0; color: var(--accent); border: none;
  text-decoration: underline; cursor: pointer; font-weight: 500;
}

/* ------------ Results card ------------- */
.results {
  background: var(--accent-soft);
  border: 1px solid #DBEAFE;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin: 0 0 24px;
}
.results h2 { margin-top: 0; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.metric .label {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-bottom: 6px; font-weight: 600;
}
.metric .value {
  font-size: 1.4rem; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
}
.metric .sub {
  font-size: 0.82rem; color: var(--text-muted); margin-top: 4px;
}
.metric.primary {
  background: var(--accent);
  border-color: var(--accent);
}
.metric.primary .label { color: rgba(255,255,255,0.85); }
.metric.primary .value, .metric.primary .sub { color: #fff; }

.summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.summary-card strong { color: var(--text); }
.summary-card .recommendation {
  display: inline-block; margin-top: 6px;
  background: var(--accent); color: #fff;
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600;
}

/* ------------ Tables ------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.92rem;
  background: var(--bg);
}
table.data th, table.data td {
  text-align: right; padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  background: var(--bg-soft); font-weight: 600;
  position: sticky; top: 0;
}
table.data tbody tr:hover { background: var(--bg-soft); }

details.schedule {
  margin-top: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}
details.schedule summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600;
  color: var(--accent); user-select: none;
  list-style: none;
}
details.schedule summary::-webkit-details-marker { display: none; }
details.schedule summary::after {
  content: " ▾"; font-size: 0.85em;
}
details.schedule[open] summary::after { content: " ▴"; }
details.schedule .table-wrap { padding: 0 8px 12px; max-height: 460px; overflow: auto; }

/* ------------ Debt rows ------------- */
.debts {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 14px;
}
.debt-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 1fr auto;
  gap: 8px; align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.debt-row .field { margin-bottom: 0; }
.debt-row .field label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); margin-bottom: 4px;
}
.debt-row .field input {
  padding: 9px 10px; font-size: 0.95rem;
}
.debt-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.3rem;
  padding: 6px 8px; border-radius: 6px;
}
.debt-remove:hover { background: #FEE2E2; color: #B91C1C; }
@media (max-width: 700px) {
  .debt-row { grid-template-columns: 1fr 1fr; }
  .debt-remove { grid-column: 2; justify-self: end; }
}

/* ------------ Sections ------------- */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.section h2:first-child { margin-top: 0; }
.section ul { padding-left: 20px; margin: 0 0 0.5em; }
.section li { margin-bottom: 6px; }

.faq details {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}
.faq details:last-child { border-bottom: 1px solid var(--border); }
.faq summary {
  cursor: pointer; font-weight: 600; color: var(--text);
  padding: 0; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding-top: 10px; color: var(--text-muted); }

/* ------------ AdSense placeholder ------------- */
.ad-slot {
  display: block;
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 22px 16px;
  margin: 22px 0;
  min-height: 90px;
}

/* ------------ Footer ------------- */
.site-footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 28px 0 36px;
  margin-top: 24px;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.site-footer .container { display: grid; gap: 16px; }
.site-footer .footer-nav {
  display: flex; flex-wrap: wrap; gap: 12px 20px;
}
.site-footer .disclaimer {
  font-size: 0.85rem; line-height: 1.55;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ------------ Homepage ------------- */
.hero {
  text-align: left;
  padding: 24px 0 8px;
}
.hero h1 { font-size: 2.4rem; max-width: 18ch; }
.hero p { font-size: 1.1rem; color: var(--text-muted); max-width: 52ch; }

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0 12px;
}
.calc-card {
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.calc-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.calc-card h2 {
  margin: 0 0 6px; font-size: 1.1rem; color: var(--text);
}
.calc-card p {
  font-size: 0.92rem; color: var(--text-muted); margin-bottom: 10px; flex: 1;
}
.calc-card .arrow {
  color: var(--accent); font-weight: 600; font-size: 0.92rem;
}

/* Print-friendly */
@media print {
  .site-header, .site-footer, .ad-slot, .nav-toggle { display: none; }
  .calc, .results, .section { box-shadow: none; border-color: #ccc; }
}

/* ───────────────────────── Articles ─────────────────────────────────────── */

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.article-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.article-card:hover {
  border-color: #2563EB;
  transform: translateY(-2px);
}
.article-card h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.35;
  color: #0f172a;
}
.article-card p {
  margin: 0;
  color: #475569;
  font-size: 0.95rem;
}
.article-card .article-link {
  margin-top: auto;
  color: #2563EB;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Article detail page */
.article {
  max-width: 720px;
}
.article-meta {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0 0 0.5rem;
}
.article-meta a {
  color: #64748b;
  text-decoration: none;
}
.article-meta a:hover { color: #2563EB; }

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
}
.article-tags .tag {
  font-size: 0.78rem;
  background: #f1f5f9;
  color: #334155;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #1f2937;
}
.article-body h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.4rem;
  color: #0f172a;
}
.article-body h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.15rem;
  color: #0f172a;
}
.article-body p { margin: 0 0 1rem; }
.article-body ul, .article-body ol { margin: 0 0 1.25rem 1.25rem; }
.article-body li { margin-bottom: 0.4rem; }
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.95rem;
}
.article-body th, .article-body td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}
.article-body th {
  background: #f8fafc;
  font-weight: 600;
}
.article-body blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid #2563EB;
  background: #f8fafc;
  color: #334155;
  font-size: 0.98rem;
}
.article-body code {
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}
.article-body a {
  color: #2563EB;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.disclaimer-inline {
  margin: 1.5rem 0 1rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #475569;
  font-size: 0.9rem;
}

.article-back {
  margin-top: 2rem;
}
.article-back a {
  color: #2563EB;
  text-decoration: none;
  font-weight: 600;
}
