@font-face {
  font-family: "IRANYekanX";
  src: url("/assets/IRANYekanX-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IRANYekanX";
  src: url("/assets/IRANYekanX-ExtraBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 800 950;
  font-display: swap;
}

:root {
  --ink: #14202b;
  --muted: #68727c;
  --paper: #fffdfa;
  --canvas: #f2f1ed;
  --blue: #163e68;
  --blue-soft: #eaf0f6;
  --gold: #b69a67;
  --gold-soft: #f2ede3;
  --line: #d9d8d3;
  --shadow: 0 20px 60px rgba(20, 32, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "IRANYekanX", Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 2;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 10px clamp(18px, 5vw, 72px);
  border-bottom: 1px solid rgba(20, 32, 43, 0.09);
  background: rgba(255, 253, 250, 0.94);
  backdrop-filter: blur(18px);
}

.brand,
.brand img {
  display: block;
}

.brand img {
  width: 112px;
  height: 52px;
  object-fit: contain;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions span {
  color: var(--muted);
  font-size: 13px;
}

button,
.portal a {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 9px 16px;
  text-decoration: none;
}

main {
  width: min(1420px, 100%);
  margin: 0 auto;
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 28px clamp(18px, 5vw, 72px) 16px;
  padding: clamp(34px, 6vw, 76px);
  border-radius: 18px;
  background: var(--blue);
  color: white;
}

.hero::after {
  position: absolute;
  inset: auto -80px -170px auto;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 0 58px rgba(255, 255, 255, 0.035), 0 0 0 116px rgba(255, 255, 255, 0.025);
  content: "";
}

.eyebrow,
.section-kicker {
  color: #dfc995;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hero h1 {
  max-width: 780px;
  margin: 9px 0 10px;
  font-size: clamp(32px, 5vw, 66px);
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 1.25;
}

.hero h1 span {
  color: #dfc995;
  font-size: 0.54em;
  font-weight: 400;
}

.hero > p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 15px;
}

.party-summary {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr);
  gap: 16px;
  max-width: 780px;
  margin-top: 34px;
}

.party-summary article {
  display: grid;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
}

.party-summary span,
.party-summary small {
  color: rgba(255, 255, 255, 0.63);
  font-size: 11px;
}

.party-summary strong {
  font-size: 20px;
  font-weight: 900;
}

.between {
  align-self: center;
  justify-self: center;
  color: #dfc995;
  font-weight: 800;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 clamp(18px, 5vw, 72px) 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.overview article {
  display: grid;
  padding: 18px 22px;
  border-left: 1px solid var(--line);
}

.overview article:last-child {
  border-left: 0;
}

.overview span,
.overview small {
  color: var(--muted);
  font-size: 11px;
}

.overview strong {
  font-size: 17px;
  font-weight: 900;
}

.document-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 860px);
  justify-content: center;
  align-items: start;
  gap: 24px;
  padding: 0 clamp(18px, 5vw, 72px) 70px;
}

.toc {
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.toc-title {
  margin-bottom: 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 950;
}

.toc nav {
  display: grid;
}

.toc nav a,
.back-top {
  padding: 4px 2px;
  color: #55616c;
  font-size: 11px;
  line-height: 1.7;
  text-decoration: none;
}

.toc nav a:hover {
  color: var(--blue);
}

.back-top {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--blue);
  font-weight: 800;
}

.contract-paper {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.document-title {
  padding: clamp(30px, 6vw, 60px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(140deg, #fffdfa 0%, #f7f3eb 100%);
}

.document-title span {
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.document-title h2 {
  margin: 8px 0 6px;
  color: var(--blue);
  font-size: clamp(22px, 4vw, 34px);
  line-height: 1.5;
}

.document-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.intro-line {
  margin: 0;
  padding: 0 clamp(28px, 6vw, 60px) 14px;
}

.document-title + .intro-line {
  padding-top: 34px;
}

.intro-line.parties {
  margin: 0 clamp(28px, 6vw, 60px) 16px;
  padding: 18px 20px;
  border-right: 3px solid var(--gold);
  background: var(--gold-soft);
}

.intro-line.connector {
  padding-bottom: 2px;
  color: var(--gold);
  font-weight: 900;
}

.contract-section,
.signature {
  padding: 30px clamp(28px, 6vw, 60px);
  scroll-margin-top: 90px;
}

.contract-section + .contract-section,
.signature + .contract-section {
  border-top: 1px solid var(--line);
}

.contract-section h2,
.signature h2 {
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 19px;
  font-weight: 950;
  line-height: 1.75;
}

.contract-section h2::after {
  display: block;
  width: 44px;
  height: 2px;
  margin-top: 7px;
  background: var(--gold);
  content: "";
}

.contract-line {
  margin: 0 0 12px;
  color: #2b343c;
  font-size: 14px;
  line-height: 2.05;
  text-align: justify;
}

.contract-line:last-child {
  margin-bottom: 0;
}

.contract-line.lead {
  color: var(--blue);
  font-weight: 900;
}

.appendix {
  background: #fbf8f1;
}

.appendix .contract-line {
  padding: 3px 0;
  border-bottom: 1px dotted #d7d0c3;
}

.signature {
  border-top: 1px solid var(--line);
  background: var(--blue-soft);
}

.section-kicker {
  color: var(--gold);
}

.signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.signature-grid article {
  display: grid;
  padding: 20px;
  border: 1px solid #bdc9d4;
  border-radius: 9px;
  background: white;
}

.signature-grid span {
  color: var(--muted);
  font-size: 11px;
}

.signature-grid strong {
  margin-bottom: 14px;
  color: var(--blue);
}

.signature-grid p {
  margin: 0;
  font-size: 12px;
}

.signature-space {
  min-height: 100px;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px dashed #bdc9d4;
  color: var(--muted);
  font-size: 11px;
}

footer {
  display: grid;
  justify-items: center;
  padding: 40px 20px 54px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  text-align: center;
}

footer img {
  width: 110px;
}

footer p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

footer a {
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.portal-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--blue);
}

.portal {
  width: min(100%, 580px);
  padding: clamp(36px, 8vw, 72px);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.22);
  text-align: center;
}

.portal img {
  width: 150px;
}

.portal > span {
  display: block;
  margin-top: 18px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.portal h1 {
  margin: 8px 0;
  color: var(--blue);
  font-size: clamp(26px, 5vw, 38px);
}

.portal p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

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

  .toc {
    position: static;
    max-height: none;
  }

  .toc nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 6px;
  }

  .toc nav a {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: white;
  }

  .back-top {
    display: none;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14px;
  }

  .site-header {
    min-height: 64px;
  }

  .brand img {
    width: 88px;
    height: 42px;
  }

  .header-actions span {
    display: none;
  }

  .hero {
    padding: 28px 22px;
    border-radius: 12px;
  }

  .party-summary {
    grid-template-columns: 1fr;
  }

  .between {
    height: 22px;
  }

  .overview {
    grid-template-columns: 1fr 1fr;
  }

  .overview article:nth-child(2) {
    border-left: 0;
  }

  .overview article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .document-title,
  .contract-section,
  .signature {
    padding: 26px 20px;
  }

  .intro-line {
    padding-right: 20px;
    padding-left: 20px;
  }

  .intro-line.parties {
    margin-right: 20px;
    margin-left: 20px;
  }

  .contract-line {
    font-size: 13px;
    text-align: right;
  }

  .signature-grid {
    grid-template-columns: 1fr;
  }
}

@page {
  size: A4;
  margin: 16mm 14mm 18mm;
}

@media print {
  :root {
    --paper: #fff;
    --canvas: #fff;
    --shadow: none;
  }

  body {
    background: white;
    color: black;
    font-size: 10.5pt;
    line-height: 1.85;
  }

  .site-header,
  .overview,
  .toc,
  footer {
    display: none !important;
  }

  main {
    width: auto;
  }

  .hero {
    margin: 0 0 10mm;
    padding: 12mm;
    border-radius: 0;
    background: white;
    color: black;
    border: 1pt solid #163e68;
  }

  .hero::after,
  .eyebrow,
  .hero > p {
    display: none;
  }

  .hero h1 {
    margin: 0 0 6mm;
    color: #163e68;
    font-size: 24pt;
  }

  .hero h1 span {
    color: #b69a67;
  }

  .party-summary {
    margin: 0;
  }

  .party-summary article {
    border-color: #c8c8c8;
    background: white;
  }

  .party-summary span,
  .party-summary small {
    color: #666;
  }

  .party-summary strong,
  .between {
    color: black;
  }

  .document-layout {
    display: block;
    padding: 0;
  }

  .contract-paper {
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .document-title {
    padding: 0 0 9mm;
    border-bottom: 2pt solid #163e68;
    background: white;
  }

  .document-title p {
    display: none;
  }

  .intro-line,
  .contract-section,
  .signature {
    padding-right: 0;
    padding-left: 0;
  }

  .intro-line.parties {
    margin-right: 0;
    margin-left: 0;
    border-right: 2pt solid #b69a67;
  }

  .contract-section,
  .signature {
    padding-top: 7mm;
    padding-bottom: 7mm;
    break-inside: auto;
  }

  .contract-section h2,
  .signature h2 {
    break-after: avoid;
  }

  .contract-line {
    color: black;
    font-size: 10.5pt;
    orphans: 3;
    widows: 3;
  }

  .appendix,
  .signature {
    background: white;
  }

  .signature {
    break-before: page;
  }

  .signature-grid article {
    break-inside: avoid;
  }
}
