/* CalCulator — shared styles */
:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #ccfbf1;
  --accent-glow: rgba(15, 118, 110, 0.14);
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --font: "Outfit", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --max: 1120px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  background:
    radial-gradient(1200px 600px at 10% -10%, #99f6e4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #bae6fd 0%, transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  min-height: 100vh;
}

img {
  max-width: 100%;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

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

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(248, 250, 252, 0.85);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--accent), #0ea5e9);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--accent-dark);
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  cursor: pointer;
}

/* Hero / page titles */
.hero {
  padding: 2.75rem 0 1.5rem;
}

.hero h1,
.page-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.lead {
  font-size: 1.1rem;
  color: var(--ink-soft);
  max-width: 42rem;
  margin: 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent-dark);
}

.breadcrumbs li:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  color: #94a3b8;
}

/* Layout */
.calc-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

@media (max-width: 860px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0 0.75rem;
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav {
    flex-wrap: wrap;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1.35rem;
  backdrop-filter: blur(8px);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
}

.field .hint {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  margin-top: 0.25rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  background: var(--surface-solid);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 520px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.15rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-primary {
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  border-color: #cbd5e1;
  background: #fff;
}

.results {
  background: linear-gradient(160deg, #f0fdfa, #ecfeff 60%, #fff);
  border: 1px solid #99f6e4;
  border-radius: var(--radius);
  padding: 1.15rem;
  min-height: 8rem;
}

.results h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

.result-main {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--accent-dark);
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.result-sub {
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}

.result-grid {
  display: grid;
  gap: 0.55rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-top: 1px solid rgba(15, 118, 110, 0.12);
  font-size: 0.95rem;
}

.result-item span:last-child {
  font-weight: 650;
  text-align: right;
}

.result-empty {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge-ok { background: #d1fae5; color: var(--ok); }
.badge-warn { background: #ffedd5; color: var(--warn); }
.badge-bad { background: #fee2e2; color: var(--bad); }

/* Content sections */
.content {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin-bottom: 2rem;
}

.content h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin: 1.75rem 0 0.75rem;
}

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

.content h3 {
  font-size: 1.1rem;
  margin: 1.35rem 0 0.5rem;
}

.content p,
.content li {
  color: var(--ink-soft);
}

.content ul,
.content ol {
  padding-left: 1.2rem;
}

.formula {
  background: #f1f5f9;
  border-left: 4px solid var(--accent);
  padding: 0.9rem 1rem;
  border-radius: 0 12px 12px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.example-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
}

.faq details {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--ink);
}

.faq details p {
  margin: 0.55rem 0 0.2rem;
}

/* Cards / grids — interaction + browse only */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2.5rem;
}

.tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: #99f6e4;
  box-shadow: var(--shadow);
}

.tool-card .icon {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.tool-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.category-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  margin-bottom: 0.35rem;
}

.related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.75rem 0 0;
}

.related a {
  text-decoration: none;
  background: #f1f5f9;
  color: var(--ink-soft);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 550;
}

.related a:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* Ad slots */
.ad-slot {
  min-height: 90px;
  margin: 1.25rem 0;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.5);
}

.ad-slot[data-ready="true"] {
  border: none;
  background: transparent;
  min-height: 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  margin-top: 2rem;
  padding: 2.5rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.site-footer h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 0.35rem;
}

.site-footer a {
  text-decoration: none;
  color: var(--ink-soft);
}

.site-footer a:hover {
  color: var(--accent-dark);
}

.footer-note {
  margin-top: 1.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

th {
  background: #f8fafc;
  font-weight: 650;
}

/* Modes tabs */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.mode-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 550;
  cursor: pointer;
  color: var(--ink-soft);
}

.mode-tab[aria-selected="true"] {
  background: var(--accent-soft);
  border-color: #5eead4;
  color: var(--accent-dark);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .hero h1,
  .page-title {
    animation: rise 0.55s ease both;
  }

  .lead {
    animation: rise 0.55s ease 0.08s both;
  }

  .panel,
  .results {
    animation: rise 0.55s ease 0.12s both;
  }

  .tool-card {
    animation: rise 0.45s ease both;
  }

  .tool-card:nth-child(2) { animation-delay: 0.05s; }
  .tool-card:nth-child(3) { animation-delay: 0.1s; }
  .tool-card:nth-child(4) { animation-delay: 0.15s; }
  .tool-card:nth-child(5) { animation-delay: 0.2s; }
  .tool-card:nth-child(6) { animation-delay: 0.25s; }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
