@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-DemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IRANSansX";
  src: url("/fonts/IRANSansX-Bold.woff2") format("woff2");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: oklch(18% 0.015 240);
  --muted: oklch(42% 0.015 240);
  --line: color-mix(in oklch, var(--ink) 10%, transparent);
  --paper: oklch(97.5% 0.005 240);
  --paper-warm: oklch(94.5% 0.008 240);
  --surface: oklch(100% 0 0);
  --accent: oklch(45% 0.15 250);
  --accent-dark: oklch(30% 0.12 250);
  --accent-slate: oklch(38% 0.12 235);
  --accent-soft: color-mix(in oklch, var(--accent) 9%, white);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IRANSansX", "IRANSans", system-ui, sans-serif;
  line-height: 1.618;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  margin: auto;
  min-height: 82px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand-logo { width: 42px; height: 38px; object-fit: contain; flex: 0 0 auto; }
.brand-text { font-size: 16px; }
.how-link { color: var(--muted); font-size: 13px; font-weight: 500; text-decoration: none; padding: 8px 0; border-bottom: 2px solid var(--accent); }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(1060px, calc(100% - 40px));
  margin: 76px auto 58px;
  padding: 30px 20px;
  text-align: center;
}
.hero::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(color-mix(in oklch, var(--accent) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklch, var(--accent) 7%, transparent) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 72%);
  content: "";
}
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); font-size: 12px; font-weight: 600; }
.eyebrow span { width: 38px; height: 3px; background: var(--accent); }
.hero h1 { margin: 22px 0 18px; color: var(--ink); font-size: clamp(36px, 5vw, 58px); line-height: 1.25; font-weight: 700; }
.hero h1 em { color: var(--accent-dark); font-style: normal; }
.hero > p { margin: 0 auto; max-width: 680px; color: var(--muted); font-size: 15px; line-height: 2; }

.calculator {
  width: min(1060px, calc(100% - 32px));
  margin: auto;
  padding: clamp(22px, 4vw, 46px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgb(24 50 75 / 0.08);
}
.calc-heading, .results-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.calc-heading > div, .results-title > div, .method > div:first-child { display: flex; align-items: center; gap: 14px; }
.section-index { color: var(--accent); font-size: 11px; font-weight: 700; border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent); padding: 5px 8px; border-radius: 6px; }
h2 { margin: 0; color: var(--ink); font-size: 21px; font-weight: 700; }
.live-badge { display: flex; align-items: center; gap: 7px; color: var(--accent-dark); background: var(--accent-soft); border-radius: 999px; padding: 7px 11px; font-size: 10px; font-weight: 600; }
.live-badge i { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 14%, transparent); }

.tabs { margin: 30px 0; padding: 5px; background: var(--paper-warm); border-radius: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tabs button { border: 1px solid transparent; color: var(--muted); background: transparent; border-radius: 8px; padding: 13px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; transition: .25s ease; }
.tabs button span { font-size: 13px; font-weight: 600; }
.tabs button small { font-size: 10px; }
.tabs button.active { background: white; color: var(--accent-dark); border-color: color-mix(in oklch, var(--accent) 18%, transparent); box-shadow: 0 3px 12px rgb(26 59 91 / 0.08); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { color: var(--ink); font-size: 12px; font-weight: 600; }
.input-wrap { display: flex; flex-direction: row-reverse; align-items: stretch; height: 55px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in oklch, var(--paper) 65%, white); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 10%, transparent); background: white; }
.input-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0 16px; color: var(--ink); font-size: 16px; font-weight: 600; text-align: left; }
.suffix { flex: 0 0 auto; border-left: 1px solid var(--line); display: flex; align-items: center; padding: 0 15px; color: var(--muted); font-size: 10px; background: var(--paper-warm); }
.field-hint { color: var(--muted); font-size: 10px; }

.results { margin-top: 42px; border-top: 1px dashed var(--line); padding-top: 40px; }
.results-title > span { color: var(--muted); font-size: 10px; }
.rate-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-top: 24px; }
.rate-card { min-height: 164px; padding: 23px; background: var(--paper-warm); border: 1px solid var(--line); border-top: 3px solid var(--accent-slate); border-radius: 10px; display: flex; flex-direction: column; justify-content: space-between; }
.rate-card.primary { background: var(--accent-dark); color: white; border-color: var(--accent-dark); position: relative; overflow: hidden; }
.rate-card.banking { background: var(--accent-soft); color: var(--accent-dark); border-color: color-mix(in oklch, var(--accent) 22%, transparent); border-top-color: var(--accent); }
.rate-card.banking p { color: color-mix(in oklch, var(--accent-dark) 70%, white); }
.rate-card.primary::after { content: "%"; position: absolute; left: -13px; bottom: -38px; font: 900 132px Arial; color: rgb(255 255 255 / .055); }
.card-label { font-size: 11px; font-weight: 600; position: relative; z-index: 1; }
.rate-card strong { font-family: inherit; font-size: 38px; font-weight: 700; direction: ltr; text-align: right; position: relative; z-index: 1; }
.rate-card strong small { font-size: 16px; margin-left: 3px; }
.rate-card p { margin: 0; color: var(--muted); font-size: 10px; position: relative; z-index: 1; }
.rate-card.primary p { color: color-mix(in oklch, white 72%, var(--accent)); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 17px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.summary-grid > div { padding: 17px; display: flex; flex-direction: column; gap: 7px; border-left: 1px solid var(--line); }
.summary-grid > div:last-child { border-left: 0; }
.summary-grid span { color: var(--muted); font-size: 10px; }
.summary-grid b { font-family: inherit; font-size: 17px; font-weight: 700; direction: ltr; text-align: right; }
.summary-grid small { color: var(--muted); font-size: 9px; }
.cashflow { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cashflow summary { cursor: pointer; list-style: none; padding: 16px 18px; color: var(--accent-dark); font-size: 11px; font-weight: 600; display: flex; justify-content: space-between; }
.cashflow summary::-webkit-details-marker { display: none; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; min-width: 590px; font-size: 11px; }
th, td { padding: 13px 17px; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--muted); background: var(--paper); font-weight: 600; }
td:nth-child(2) { font-family: inherit; font-size: 12px; font-weight: 600; direction: ltr; text-align: right; }
.positive { color: #147554; }.negative { color: #a4463d; }
.error { margin-top: 30px; padding: 15px; border-radius: 9px; background: #fff2ee; color: #984538; font-size: 11px; }

.method { width: min(1060px, calc(100% - 40px)); margin: 100px auto; }
.method > div:first-child { margin-bottom: 30px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.steps article { padding: 28px 0 10px 30px; }
.steps b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.steps h3 { margin: 18px 0 10px; color: var(--accent-dark); font-size: 14px; font-weight: 600; }
.steps p { margin: 0; color: var(--muted); font-size: 11px; line-height: 2; }
footer { width: min(1180px, calc(100% - 40px)); margin: auto; min-height: 96px; border-top: 1px solid var(--line); display: flex; align-items: center; }
.footer-brand .brand-logo { width: 36px; height: 32px; }
.footer-brand .brand-text { color: var(--muted); font-size: 13px; font-weight: 500; }

@media (max-width: 760px) {
  .topbar { min-height: 70px; }
  .brand-logo { width: 36px; height: 32px; }
  .brand-text { max-width: 210px; font-size: 13px; line-height: 1.5; }
  .hero { margin-top: 48px; padding-inline: 0; }
  .calculator { border-radius: 12px; }
  .form-grid, .rate-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-grid > div { border-bottom: 1px solid var(--line); }
  .tabs button { padding-inline: 6px; }
  .tabs button span { font-size: 12px; }
  .results-title > span { display: none; }
  .steps { grid-template-columns: 1fr; }
  .steps article { padding-left: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 430px) {
  .topbar { width: calc(100% - 24px); }
  .how-link { font-size: 11px; }
  .brand-text { max-width: 165px; font-size: 11px; }
  .hero h1 { font-size: 34px; }
  .calculator { width: calc(100% - 20px); padding: 20px 15px; }
  .calc-heading { align-items: flex-start; }
  .live-badge { margin-top: -2px; }
  .tabs { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-grid > div { border-left: 0; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
