/* =========================================================
   CodeReveal Tools — shared visual system
   A clean, modern interface for every calculator in /tools/
   ========================================================= */

:root {
  --ink: #132238;
  --ink-soft: #607087;
  --ink-muted: #8794a7;
  --paper: #f5f7fb;
  --paper-raised: #ffffff;
  --paper-tint: #eef7f4;
  --line: #dfe6ef;
  --line-strong: #cbd5e1;
  --brass: #12a37f;
  --brass-dark: #087d63;
  --brass-soft: #d9f5ed;
  --ledger-green: #16a275;
  --ledger-red: #db5c61;
  --navy-90: #0b1729;
  --navy-80: #12243e;
  --blue: #3d70e3;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;

  --maxw: 1160px;
  --radius: 12px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(19, 34, 56, .05);
  --shadow-card: 0 18px 50px rgba(19, 34, 56, .10);
  --shadow-hover: 0 22px 55px rgba(19, 34, 56, .14);
  --ease: cubic-bezier(.2, .75, .25, 1);
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  background: var(--paper);
}

body {
  margin: 0;
  width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(18, 163, 127, .055), transparent 23rem),
    var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(19, 34, 56, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 34, 56, .022) 1px, transparent 1px);
  background-size: 42px 42px;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent, #000 28%, #000 72%, transparent);
}

img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
strong { color: var(--ink); }

h1, h2, h3, h4 {
  margin: 0 0 .55em;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.025em;
}

h1 {
  max-width: 18ch;
  font-size: clamp(2.55rem, 6vw, 4.65rem);
  font-weight: 500;
  letter-spacing: -.055em;
}

h2 { font-size: clamp(1.75rem, 3.2vw, 2.65rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; color: var(--ink-soft); }

.container {
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  padding: 0;
}

::selection { color: var(--navy-90); background: #9ee8d6; }

:focus-visible {
  outline: 3px solid rgba(18, 163, 127, .38);
  outline-offset: 3px;
}

.skip-link:focus {
  left: 16px !important;
  top: 12px !important;
  border-radius: 9px;
  box-shadow: var(--shadow-card);
}

/* Header */
.site-header {
  position: relative;
  z-index: 20;
  color: #fff;
  background: rgba(11, 23, 41, .98);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 8px 35px rgba(4, 12, 25, .14);
}

.site-header::after {
  position: absolute;
  right: -8rem;
  bottom: -14rem;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  background: rgba(18, 163, 127, .11);
  content: "";
  filter: blur(2px);
  pointer-events: none;
}

.site-header .container {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 28px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.43rem;
  font-weight: 600;
  letter-spacing: -.035em;
  line-height: 1;
  text-decoration: none;
}

.brand small {
  padding: 5px 7px 4px;
  color: #72dfc3;
  background: rgba(84, 213, 180, .11);
  border: 1px solid rgba(114, 223, 195, .18);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: .54rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.brand-name { 
  display: inline-block; 
  margin-top: 15px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a {
  position: relative;
  padding: 9px 13px;
  border-radius: 9px;
  color: #b8c4d4;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color .2s ease, background .2s ease;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, .075);
}

.main-nav a[aria-current="page"]::after {
  position: absolute;
  right: 13px;
  bottom: 3px;
  left: 13px;
  height: 2px;
  border-radius: 2px;
  background: #4dd0ae;
  content: "";
}

.main-nav .nav-contact {
  margin-left: 6px;
  color: #dffbf4;
  background: rgba(84, 213, 180, .12);
  border: 1px solid rgba(84, 213, 180, .18);
}

.main-nav .nav-contact:hover {
  color: #0b1729;
  background: #61d9ba;
}

.nav-toggle {
  display: none;
  width: 43px;
  height: 43px;
  padding: 0;
  place-items: center;
  background: rgba(255, 255, 255, .065);
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 11px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 19px;
  height: 2px;
  margin: 2px auto;
  background: #d9e3ee;
  border-radius: 99px;
  transition: transform .25s var(--ease), opacity .2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  min-height: 52px;
  gap: 9px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: .72rem;
}

.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .2s ease;
}

.breadcrumb a:hover { color: var(--brass-dark); }
.breadcrumb span[aria-current] { color: var(--ink); }

/* Hero */
.tool-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(50px, 8vw, 92px) 0 clamp(62px, 8vw, 104px);
  color: #fff;
  background:
    radial-gradient(circle at 82% 15%, rgba(61, 112, 227, .30), transparent 24rem),
    radial-gradient(circle at 42% -30%, rgba(129, 140, 248, .20), transparent 26rem),
    radial-gradient(circle at 66% 115%, rgba(18, 163, 127, .30), transparent 30rem),
    linear-gradient(132deg, #0b1729 0%, #102a42 58%, #123f4a 100%);
}

.tool-hero .container::after {
  position: absolute;
  top: 12%;
  right: 3%;
  width: min(27vw, 320px);
  aspect-ratio: 1;
  background-image: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1.5px);
  background-size: 18px 18px;
  content: "";
  opacity: .28;
  pointer-events: none;
  mask-image: radial-gradient(circle, #000, transparent 68%);
}

.tool-hero::before,
.tool-hero::after {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.tool-hero::before {
  top: -12rem;
  right: -4rem;
  width: 34rem;
  height: 34rem;
}

.tool-hero::after {
  right: 15rem;
  bottom: -19rem;
  width: 27rem;
  height: 27rem;
}

.tool-hero .eyebrow,
.section .kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px;
  color: #5bd6b7;
  font-family: var(--font-mono);
  font-size: .69rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.tool-hero .eyebrow { animation: rise-in .55s var(--ease) backwards; }
.tool-hero h1 { animation: rise-in .65s .08s var(--ease) backwards; }
.tool-hero .lede { animation: rise-in .65s .16s var(--ease) backwards; }
.tool-hero .hero-meta { animation: rise-in .65s .24s var(--ease) backwards; }

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

.tool-hero .container {
  position: relative;
  z-index: 1;
}

.tool-hero .eyebrow::before,
.section .kicker::before {
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.tool-hero h1 { color: #fff; }

.tool-hero .lede {
  max-width: 67ch;
  margin-top: 18px;
  color: #c1ccda;
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  line-height: 1.75;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 27px;
  color: #9fb0c3;
  font-size: .8rem;
}

.hero-meta span {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  backdrop-filter: blur(8px);
}

.hero-meta b { color: #e8eef5; font-weight: 600; }

/* Calculator */
.tool-hero + .container,
.tool-hero + section.container {
  position: relative;
  z-index: 5;
}

.ledger {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  margin: clamp(-46px, -4vw, -34px) 0 64px;
  overflow: hidden;
  background: var(--paper-raised);
  border: 1px solid rgba(203, 213, 225, .72);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow .35s var(--ease), transform .35s var(--ease);
  animation: calculator-in .7s .18s var(--ease) backwards;
}

@keyframes calculator-in {
  from { opacity: 0; transform: translateY(25px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ledger:hover {
  box-shadow: 0 28px 80px rgba(19, 34, 56, .15);
  transform: translateY(-2px);
}

.ledger > * { min-width: 0; }

.ledger-inputs {
  padding: clamp(26px, 4vw, 46px);
  background:
    radial-gradient(circle at 100% 0, rgba(18, 163, 127, .055), transparent 16rem),
    #fff;
}

.ledger-inputs h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
  font-family: var(--font-body);
  font-size: .81rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.ledger-inputs h2::before {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  color: var(--brass-dark);
  background: var(--brass-soft);
  content: "↗";
  font-size: .9rem;
}

.field { margin-bottom: 25px; }
.field:last-child { margin-bottom: 0; }

.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--ink-soft);
  font-size: .84rem;
  font-weight: 500;
}

.field label .val {
  color: var(--brass-dark);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}

.field input[type="number"],
.field input[type="text"],
.field input[type="date"],
.field select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  color: var(--ink);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: inset 0 1px 2px rgba(19, 34, 56, .025);
  font-family: var(--font-mono);
  font-size: .96rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.field input[type="number"]:hover,
.field input[type="text"]:hover,
.field input[type="date"]:hover,
.field select:hover { border-color: var(--line-strong); }

.field input:focus,
.field select:focus {
  background: #fff;
  border-color: var(--brass);
  box-shadow: 0 0 0 4px rgba(18, 163, 127, .10);
}

.field input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 8px 0 12px;
  background: linear-gradient(90deg, var(--brass-soft), #dce4ee);
  border-radius: 99px;
  accent-color: var(--brass);
  cursor: pointer;
}

.field input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 1px 5px rgba(19, 34, 56, .28);
  -webkit-appearance: none;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.field-row .field { flex: 1 1 145px; min-width: 0; }

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.radio-group label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 41px;
  padding: 8px 13px;
  color: var(--ink-soft);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: .83rem;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}

.radio-group label:hover {
  color: var(--ink);
  background: var(--paper-tint);
  border-color: #a6dece;
}

.radio-group input { accent-color: var(--brass); }

.ledger-result {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: clamp(32px, 5vw, 52px);
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(61, 112, 227, .34), transparent 20rem),
    radial-gradient(circle at 60% 120%, rgba(129, 140, 248, .22), transparent 17rem),
    radial-gradient(circle at 0 100%, rgba(18, 163, 127, .24), transparent 18rem),
    linear-gradient(145deg, #0d1d33, #122943);
}

.ledger-result::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: rgba(255, 255, 255, .10);
  content: "";
}

.ledger-result::after {
  position: absolute;
  right: -6rem;
  bottom: -8rem;
  width: 18rem;
  height: 18rem;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.ledger-result .entry-no {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  color: #68d9bc;
  font-family: var(--font-mono);
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.seal {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 40px);
  margin: 4px 0 6px;
  overflow-wrap: anywhere;
  color: #fff;
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4.2vw, 2.85rem);
  font-weight: 600;
  letter-spacing: -.05em;
  line-height: 1.15;
  text-shadow: 0 8px 28px rgba(0, 0, 0, .23);
}

.seal-label {
  position: relative;
  z-index: 1;
  margin-bottom: 28px;
  color: #9fb0c3;
  font-size: .8rem;
}

.stat-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-top: 1px solid rgba(255, 255, 255, .10);
  color: #b5c1cf;
  font-size: .82rem;
}

.stat-line span { min-width: 0; }
.stat-line b {
  color: #fff;
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.stat-line.positive b { color: #6de0bd; }
.stat-line.negative b { color: #ff9498; }

.result-note {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  padding-top: 17px;
  color: #8496aa;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: .74rem;
  line-height: 1.6;
}

.stamp {
  position: absolute;
  z-index: 1;
  top: 27px;
  right: 27px;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #6bdcbe;
  background: rgba(107, 220, 190, .06);
  border: 1px solid rgba(107, 220, 190, .35);
  border-radius: 17px;
  font-family: var(--font-mono);
  font-size: .55rem;
  font-weight: 600;
  letter-spacing: .07em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(4deg);
}

/* Charts */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 292px;
  margin: -28px 0 48px;
  padding: 58px 22px 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(56, 189, 248, .10), transparent 16rem),
    linear-gradient(145deg, #fff, #fbfdff);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 15px 40px rgba(19, 34, 56, .08);
}

.chart-wrap::before {
  position: absolute;
  z-index: 2;
  top: 20px;
  left: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  content: "Visual breakdown";
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.chart-wrap::after {
  position: absolute;
  z-index: 2;
  top: 25px;
  right: 22px;
  width: 7px;
  height: 7px;
  background: #28c99d;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(40, 201, 157, .12), 0 0 16px rgba(40, 201, 157, .55);
  content: "";
}

.chart-wrap canvas {
  position: absolute;
  inset: 57px 22px 20px;
  width: calc(100% - 44px) !important;
  height: calc(100% - 77px) !important;
}

/* Content */
.section {
  position: relative;
  padding: clamp(58px, 8vw, 92px) 0;
  border-top: 1px solid var(--line);
}

.section:nth-of-type(even) {
  background: rgba(255, 255, 255, .45);
}

.section .kicker { color: var(--brass-dark); }
.section h2 { max-width: 23ch; margin-bottom: 20px; }

.section .container:has(> .kicker:first-child):has(> .faq-list) {
  text-align: center;
}

.section .container:has(> .kicker:first-child):has(> .faq-list) > h2 {
  margin-right: auto;
  margin-left: auto;
}

.section .container:has(> .kicker:first-child):has(> .faq-list) .faq-list {
  margin-right: auto;
  margin-left: auto;
  text-align: left;
}

.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 30px 0 0;
  padding: 0;
  counter-reset: entry;
}

.steps li {
  position: relative;
  display: grid;
  min-height: 164px;
  padding: 25px 24px 22px 78px;
  overflow: hidden;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow-sm);
  counter-increment: entry;
  transition: transform .25s var(--ease), border-color .25s ease, box-shadow .25s ease;
}

.steps li:hover {
  border-color: #b7d9d0;
  box-shadow: 0 14px 35px rgba(19, 34, 56, .08);
  transform: translateY(-3px);
}

.steps li::after {
  position: absolute;
  right: -40px;
  bottom: -50px;
  width: 120px;
  height: 120px;
  border: 1px solid rgba(18, 163, 127, .1);
  border-radius: 50%;
  content: "";
  transition: transform .4s var(--ease), border-color .4s ease;
}

.steps li:hover::after {
  border-color: rgba(61, 112, 227, .22);
  transform: scale(1.25);
}

.steps li::before {
  position: absolute;
  top: 24px;
  left: 23px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--brass-dark);
  background: var(--brass-soft);
  border-radius: 11px;
  content: counter(entry, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: .73rem;
  font-weight: 600;
}

.steps h3 {
  margin: 0 0 6px;
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: -.01em;
}

.steps p { margin: 0; font-size: .88rem; line-height: 1.65; }

.table-wrap {
  margin: 25px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}

table.data {
  width: 100%;
  overflow: hidden;
  background: #fff;
  border-collapse: collapse;
  font-size: .88rem;
}

table.data caption {
  padding: 13px 16px;
  color: var(--ink-soft);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: .76rem;
  font-weight: 500;
  text-align: left;
}

table.data th,
table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

table.data thead th {
  color: var(--ink-soft);
  background: #f2f6f9;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}

table.data tbody tr { transition: background .2s ease; }
table.data tbody tr:hover { background: #f7fbfa; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num {
  font-family: var(--font-mono);
  text-align: right;
}

.faq-list {
  max-width: 900px;
  margin-top: 27px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.faq-item {
  border-bottom: 1px solid var(--line);
}

.faq-item:last-child { border-bottom: 0; }

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 23px;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: .96rem;
  font-weight: 600;
  list-style: none;
  transition: color .2s ease, background .2s ease;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  display: grid;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--brass-dark);
  background: var(--brass-soft);
  border-radius: 9px;
  content: "+";
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
}

.faq-item[open] summary {
  color: var(--brass-dark);
  background: #fbfdfc;
}

.faq-item[open] summary::after { content: "−"; }

.faq-item .a {
  max-width: 75ch;
  padding: 0 62px 22px 23px;
}

.faq-item .a p { margin: 0; font-size: .91rem; }

.related-grid,
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 17px;
  margin-top: 28px;
}

.related-card,
.tool-card {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 24px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .25s var(--ease), border-color .25s ease, box-shadow .25s ease;
}

.related-card::after,
.tool-card::after {
  position: absolute;
  right: 20px;
  bottom: 19px;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--brass-dark);
  background: var(--brass-soft);
  border-radius: 9px;
  content: "↗";
  font-size: .9rem;
  transition: transform .25s var(--ease);
}

.related-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brass), #38bdf8, #818cf8);
  content: "";
  opacity: .75;
}

.related-card:hover,
.tool-card:hover {
  border-color: #acd9cd;
  box-shadow: var(--shadow-hover);
  transform: translateY(-5px);
}

.related-card:hover::after,
.tool-card:hover::after { transform: translate(3px, -3px); }

.related-card .eyebrow,
.tool-card .tag {
  color: var(--brass-dark);
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.related-card h3,
.tool-card h3 {
  max-width: calc(100% - 36px);
  margin: 11px 0 8px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  letter-spacing: -.015em;
}

.related-card p,
.tool-card p {
  max-width: calc(100% - 27px);
  margin: 0;
  font-size: .84rem;
  line-height: 1.6;
}

.prose {
  max-width: none;
}

.prose .container { max-width: 860px; }
.prose h2 { margin-top: 1.5em; }
.prose h2:first-of-type { margin-top: 0; }
.prose p, .prose li { color: var(--ink-soft); }
.prose p { font-size: 1rem; line-height: 1.82; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .65rem; padding-left: .25rem; }
.prose li::marker { color: var(--brass); }

.seo-guide {
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 18%, rgba(37, 99, 235, .07), transparent 22rem),
    radial-gradient(circle at 92% 88%, rgba(18, 163, 127, .07), transparent 24rem),
    #f8fafd !important;
}

.seo-guide .container { max-width: var(--maxw); }
.seo-guide > .container > p { max-width: 82ch; font-size: .98rem; line-height: 1.82; }

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin: 30px 0 25px;
}

.insight-grid article {
  position: relative;
  min-width: 0;
  padding: 24px 22px 21px;
  overflow: hidden;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.insight-grid article::before {
  display: block;
  width: 34px;
  height: 4px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, var(--brass), #38bdf8);
  border-radius: 99px;
  content: "";
}

.insight-grid article:nth-child(2)::before { background: linear-gradient(90deg, #38bdf8, #818cf8); }
.insight-grid article:nth-child(3)::before { background: linear-gradient(90deg, #818cf8, var(--brass)); }
.insight-grid h3 { margin-bottom: 8px; font-family: var(--font-body); font-size: .98rem; }
.insight-grid p { margin: 0; font-size: .85rem; line-height: 1.65; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 11px 19px;
  color: #fff;
  background: var(--brass);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s ease, transform .2s var(--ease), box-shadow .2s ease;
}

.btn:hover {
  color: #fff;
  background: var(--brass-dark);
  box-shadow: 0 9px 22px rgba(8, 125, 99, .2);
  transform: translateY(-1px);
}

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

/* Footer */
.site-footer {
  position: relative;
  overflow: hidden;
  margin-top: 0;
  padding: 66px 0 25px;
  color: #9cacbd;
  background:
    radial-gradient(circle at 90% 0, rgba(18, 163, 127, .12), transparent 28rem),
    var(--navy-90);
  font-size: .86rem;
}

.site-footer::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(83, 217, 183, .5), transparent);
  content: "";
}

.site-footer .container {
  display: grid;
  grid-template-columns: 1.45fr repeat(4, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 44px);
}

.site-footer .brand { margin-bottom: 17px !important; }

.site-footer .brand {
  gap: 15px;
}

.footer-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 13px;
  filter: drop-shadow(0 7px 16px rgba(37, 99, 235, .28));
}

.footer-intro p {
  max-width: 35ch;
  margin-top: 22px;
  margin-bottom: 0;
  color: #8c9caf;
  font-size: .85rem;
  line-height: 1.75;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 24px;
}

.site-footer .footer-socials a {
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0;
  place-items: center;
  color: #9fb0c3;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 11px;
  font-size: .93rem;
  transition: color .2s ease, background .2s ease, border-color .2s ease, transform .2s var(--ease);
}

.site-footer .footer-socials a:hover {
  color: #fff;
  background: linear-gradient(135deg, rgba(37, 99, 235, .42), rgba(56, 189, 248, .25));
  border-color: rgba(96, 165, 250, .52);
  transform: translateY(-3px);
}

.footer-socials i {
  font-size: 1rem;
  line-height: 1;
}

.site-footer .footer-socials a[aria-label*="YouTube"]:hover {
  color: #fff;
  background: #ff0033;
  border-color: #ff3158;
}

.footer-column > a span {
  display: inline-block;
  margin-left: 3px;
  color: #526b89;
  font-size: .72rem;
}

.site-footer h4 {
  margin-bottom: 16px;
  color: #f1f5f9;
  font-family: var(--font-body);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.site-footer a {
  display: block;
  width: fit-content;
  margin-bottom: 9px;
  color: #9cacbd;
  text-decoration: none;
  transition: color .2s ease, transform .2s ease;
}

.site-footer a:hover { color: #69ddbf; transform: translateX(2px); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  width: min(100% - 40px, var(--maxw));
  margin: 36px auto 0;
  padding: 21px 0 0;
  gap: 9px 24px;
  color: #64758b;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: .73rem;
}

.made-in-india b {
  color: #f87171;
  font-weight: 400;
  text-shadow: 0 0 14px rgba(248, 113, 113, .5);
}

/* Tools index */
.tools-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 19px;
}

.tool-card {
  min-height: 190px;
  padding: 27px;
}

.tool-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brass), #38bdf8 52%, #818cf8);
  content: "";
  opacity: .85;
}

.tool-card:nth-child(3n + 2)::before {
  background: linear-gradient(90deg, #38bdf8, #4f7fe8, #818cf8);
}

.tool-card:nth-child(3n + 3)::before {
  background: linear-gradient(90deg, #818cf8, #38bdf8, var(--brass));
}

.tool-card h3 { margin-top: 14px; font-size: 1.13rem; }

@media (max-width: 900px) {
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .container > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .site-header .container {
    position: relative;
    align-items: center;
    flex-direction: row;
    min-height: 70px;
    padding: 0;
    gap: 16px;
  }

  .nav-toggle {
    display: block;
    margin-left: auto;
  }

  .main-nav {
    position: absolute;
    z-index: 30;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    display: grid;
    width: 100%;
    padding: 10px;
    overflow: hidden;
    background: rgba(11, 23, 41, .985);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 15px;
    box-shadow: 0 22px 55px rgba(3, 10, 22, .38);
    backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-9px) scale(.985);
    transform-origin: top;
    transition: opacity .22s ease, transform .25s var(--ease);
  }

  .main-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .main-nav a {
    width: 100%;
    padding: 13px 14px;
    font-size: .9rem;
  }

  .main-nav a[aria-current="page"]::after {
    top: 50%;
    right: 13px;
    bottom: auto;
    left: auto;
    width: 7px;
    height: 7px;
    transform: translateY(-50%);
  }

  .main-nav .nav-contact {
    justify-content: space-between;
    margin: 6px 0 0;
  }

  body.nav-open { overflow: hidden; }
  .breadcrumb { min-height: 45px; }
  .tool-hero { padding-top: 44px; }
  .tool-hero::before { right: -17rem; }

  .ledger {
    grid-template-columns: 1fr;
    margin-top: -32px;
    border-radius: 18px;
  }

  .ledger-result::before { display: none; }
  .steps { grid-template-columns: 1fr; }
  .insight-grid { grid-template-columns: 1fr; }
  .steps li { min-height: 0; }
  .chart-wrap { margin-top: -30px; }
}

@media (max-width: 580px) {
  body { font-size: 15px; }
  .container, .footer-bottom { width: min(100% - 28px, var(--maxw)); }
  h1 { font-size: clamp(2.35rem, 13vw, 3.25rem); }
  h2 { font-size: 1.75rem; }

  .hero-meta { align-items: flex-start; flex-direction: column; }
  .hero-meta span { width: fit-content; }
  .ledger { margin-bottom: 48px; }
  .ledger-inputs, .ledger-result { padding: 25px 20px; }
  .stamp { top: 20px; right: 20px; width: 52px; height: 52px; }
  .seal { max-width: calc(100% - 30px); font-size: 1.9rem; }
  .field-row { flex-direction: column; gap: 0; }
  .field-row .field { flex-basis: auto; }
  .radio-group { align-items: stretch; flex-direction: column; }
  .radio-group label { width: 100%; }

  .chart-wrap { height: 280px; padding: 54px 15px 15px; }
  .chart-wrap canvas {
    inset: 53px 15px 15px;
    width: calc(100% - 30px) !important;
    height: calc(100% - 68px) !important;
  }
  .chart-wrap::before { top: 18px; left: 15px; }
  .chart-wrap::after { top: 23px; right: 17px; }

  .section { padding: 54px 0; }
  .steps li { padding: 22px 19px 20px 68px; }
  .steps li::before { top: 21px; left: 18px; }
  .faq-item summary { padding: 18px; }
  .faq-item .a { padding: 0 50px 20px 18px; }
  .related-grid, .tools-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 170px; }
  .site-footer .container { grid-template-columns: 1fr; }
  .site-footer .container > div:first-child { grid-column: auto; }
  .footer-bottom { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
