/* ==========================================================================
   MAHABADI — Design System / tokens + base layer
   Direction: Industrial Blueprint — engineering-drawing precision.
   Every value used in any component must come from this block.
   ========================================================================== */

:root {
  /* ------------------------------- TYPE -------------------------------- */
  /* one ratio: 1.2 (minor third) for UI density; 15px base */
  --font: 'IRANSansWeb', Tahoma, sans-serif;
  --step--2: 0.75rem;      /* 12.0 */
  --step--1: 0.833rem;     /* 12.5 */
  --step-0: 0.9375rem;     /* 15.0  body */
  --step-1: 1.125rem;      /* 18.0 */
  --step-2: 1.35rem;       /* 21.6 */
  --step-3: 1.62rem;       /* 25.9 */
  --step-4: 1.944rem;      /* 31.1 */
  --step-5: 2.333rem;      /* 37.3 */
  --step-6: 2.8rem;        /* 42.0  hero */

  /* weights — three only */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-bold: 700;

  /* measure — vary by content type, never one column for everything */
  --measure-text: 72ch;
  --measure-tight: 46ch;

  /* ------------------------------ SPACE -------------------------------- */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4.5rem;
  --space-3xl: 7rem;

  /* ------------------------------ COLOUR ------------------------------- */
  --blue: #003049;         /* deep space blue — ink + brand */
  --blue-2: #0a4a6b;       /* hover / raised blue */
  --blue-soft: #e8eff3;    /* blue tint surface */

  --red: #d62828;
  --red-soft: #fbe9e9;

  --orange: #f77f00;       /* fills only — pair with blue text */
  --orange-ink: #b35c00;   /* accessible orange for text */
  --orange-soft: #fdf0e0;

  --gold: #fcbf49;
  --gold-2: #f5b322;
  --gold-soft: #fdf4dc;

  --custard: #eae2b7;
  --custard-2: #f2edd4;

  /* surfaces */
  --base: #fbf9f3;
  --surface: #ffffff;
  --sand: #f6f3e7;
  --sand-2: #fdfcf8;

  /* ink ramp — three levels, no more */
  --ink: #003049;
  --ink-2: #3d5a6c;
  --ink-3: #566f7f;

  /* rules — hairlines are the primary structural device */
  --line: #e4e4da;
  --line-strong: #788a95;

  /* on dark blue */
  --on-blue: #f4f7f9;
  --on-blue-2: #a9c2d0;

  /* feedback */
  --danger: #b4342b;
  --danger-soft: #fbe9e9;
  --ok: #256b46;
  --ok-soft: #e9f5ee;

  /* ------------------------- FORM (radius scale) ----------------------- */
  /* deliberate scale: control / card / panel — never ad-hoc values */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius: var(--radius-md);      /* back-compat alias */
  --radius-pill: 999px;

  /* ------------------------- SHADOW (two + lift) ----------------------- */
  /* contact + ambient. Tables and static panels get none. */
  --shadow-1: 0 1px 2px rgba(0, 48, 73, .05), 0 0 0 1px rgba(0, 48, 73, .05);
  --shadow-2: 0 20px 42px -20px rgba(0, 48, 73, .28), 0 2px 8px rgba(0, 48, 73, .06);
  --shadow-contact: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent);
  --shadow-raised: 0 1px 2px color-mix(in srgb, var(--ink) 6%, transparent),
                   0 12px 28px -20px color-mix(in srgb, var(--ink) 38%, transparent);
  --shadow-lifted: 0 2px 4px color-mix(in srgb, var(--ink) 7%, transparent),
                   0 30px 54px -28px color-mix(in srgb, var(--ink) 44%, transparent);

  /* hairline + surface system */
  --hairline: 1px solid color-mix(in srgb, var(--ink) 9%, transparent);
  --hairline-strong: 1px solid color-mix(in srgb, var(--ink) 16%, transparent);

  /* ------------------------------ MOTION ------------------------------- */
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 520ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* ------------------------------ LAYOUT ------------------------------- */
  --container: 1200px;
  --header-h: 72px;
  --topbar-h: 42px;
  --focus: var(--blue);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.85;
  font-weight: 400;
  color: var(--ink);
  background: var(--base);
  direction: rtl;
  text-align: right;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; transition: color var(--dur) var(--ease); }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
  letter-spacing: -.005em;
  text-wrap: balance;
}

p { margin: 0 0 var(--space-2xs); }
p:last-child { margin-bottom: 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }
.section--blue, .site-footer, .hero { --focus: var(--gold); }

::selection { background: var(--gold); color: var(--blue); }

/* ------------------------------- Layout ------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--space-m); }

.section { padding-block: clamp(var(--space-xl), 6vw, var(--space-2xl)); }
.section--tight { padding-block: clamp(var(--space-l), 4vw, var(--space-xl)); }
.section--tall { padding-block: clamp(var(--space-2xl), 9vw, var(--space-3xl)); }

.section--surface { background: var(--surface); }
.section--sand { background: var(--sand); }
.section--custard { background: var(--custard-2); }
.section--blue { background: var(--blue); color: var(--on-blue-2); }
.section--blue h1, .section--blue h2, .section--blue h3 { color: #fff; }

/* --------------------------- Section heading -------------------------- */
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-m);
  margin-bottom: var(--space-l);
}
.sec-head__text { max-width: 58ch; }

.sec-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--orange-ink);
  margin-bottom: var(--space-3xs);
}
.sec-head__eyebrow::before { content: ""; width: 22px; height: 3px; border-radius: var(--radius-pill); background: var(--orange); flex: none; }

.sec-title { font-size: var(--step-3); font-weight: 700; line-height: 1.4; }
.sec-sub { margin-top: var(--space-3xs); color: var(--ink-2); max-width: 58ch; }

.sec-head--center { flex-direction: column; align-items: center; text-align: center; }
.sec-head--center .sec-head__text { max-width: 64ch; }

/* ------------------------------- Buttons ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: 46px;
  padding: 0 var(--space-m);
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  background: var(--blue);
  color: #fff;
  font-size: var(--step-0);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn svg { width: 19px; height: 19px; flex: none; }

.btn:hover { background: var(--blue-2); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0) scale(.985); box-shadow: none; }
.btn[disabled], .btn:disabled { opacity: .45; pointer-events: none; }

.btn--gold { background: var(--gold); color: var(--blue); }
.btn--gold:hover { background: var(--gold-2); }

.btn--orange { background: var(--orange); color: var(--blue); }
.btn--orange:hover { background: var(--orange-ink); color: #fff; }

.btn--outline { background: transparent; color: var(--blue); border-color: var(--line-strong); }
.btn--outline:hover { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); box-shadow: none; }

.btn--soft { background: var(--sand); color: var(--blue); }
.btn--soft:hover { background: var(--gold-soft); }

.btn--ghost { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .4); }
.btn--ghost:hover { background: #fff; color: var(--blue); border-color: #fff; }

.btn--block { width: 100%; }
.btn--sm { min-height: 38px; padding-inline: var(--space-s); font-size: var(--step--1); }
.btn--sm svg { width: 16px; height: 16px; }
.btn--lg { min-height: 52px; padding-inline: var(--space-l); font-size: var(--step-1); }
.btn--lg svg { width: 21px; height: 21px; }

/* -------------------------------- Chips ------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  min-height: 38px;
  padding: 0 var(--space-s);
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--step--1);
  font-weight: 500;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip svg { width: 16px; height: 16px; }

/* ------------------------------- Badges ------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 4px var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--gold-soft);
  color: var(--blue);
  font-size: var(--step--1);
  font-weight: 500;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge svg { width: 14px; height: 14px; }

/* -------------------------------- Forms ------------------------------- */
.field { margin-bottom: var(--space-s); }
.field__label { display: block; margin-bottom: var(--space-3xs); font-size: var(--step--1); font-weight: 500; color: var(--ink-2); }
.field__label .req { color: var(--red); }

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: var(--space-2xs) var(--space-s);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--step-0);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { min-height: 120px; padding: var(--space-xs) var(--space-s); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

.input-group { position: relative; }
.input-group > svg {
  position: absolute;
  top: 50%;
  right: var(--space-s);
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  pointer-events: none;
}
.input-group .input { padding-right: calc(var(--space-s) + 28px); }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  cursor: pointer;
  font-size: var(--step-0);
  user-select: none;
  min-height: 26px;
}
.checkbox input {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  position: relative;
  flex: none;
  transition: all var(--dur) var(--ease);
}
.checkbox input:checked { background: var(--blue); border-color: var(--blue); }
.checkbox input:checked::after {
  content: "";
  position: absolute;
  inset: 4px 5px 6px;
  border: solid var(--gold);
  border-width: 0 0 2.5px 2.5px;
  transform: rotate(-45deg);
}

/* ------------------------------- Utilities ---------------------------- */
/* default icon size — every component rule overrides this */
.icon { width: 20px; height: 20px; flex: none; }

.text-center { text-align: center; }
.text-muted { color: var(--ink-2); }
.fw-500 { font-weight: 500; }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  right: var(--space-s);
  top: -100px;
  z-index: 500;
  padding: var(--space-2xs) var(--space-s);
  border-radius: var(--radius-pill);
  background: var(--blue);
  color: #fff;
}
.skip-link:focus { top: var(--space-s); }

/* ------------------------- Icon motion (subtle) ----------------------- */
@keyframes ic-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }
@keyframes ic-pop { 0% { transform: scale(1); } 50% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes ic-ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-13deg); } 45% { transform: rotate(11deg); } 70% { transform: rotate(-7deg); } }
@keyframes ic-float { 0%, 100% { transform: translateY(0); } 45% { transform: translateY(-5px); } }

/* ---------------------- Scroll reveal (JS-enhanced) -------------------- */
.reveal { opacity: 1; transform: none; }
html.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
html.js .reveal.is-visible { opacity: 1; transform: none; }

/* ------------------------------- Preloader ---------------------------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  background: var(--blue);
  transition: opacity var(--dur-slow) var(--ease), visibility var(--dur-slow);
}
.preloader__inner { display: grid; justify-items: center; gap: var(--space-m); }

.preloader__logo {
  width: 118px;
  height: 118px;
  border-radius: 30px;
  background: var(--surface);
  display: grid;
  place-items: center;
  padding: var(--space-2xs);
  animation: pre-float 2s var(--ease) infinite;
}
.preloader__logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 22px; }

.preloader__bar { width: 170px; height: 5px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, .18); overflow: hidden; }
.preloader__bar span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--gold); animation: pre-slide 1.15s var(--ease) infinite; }
.preloader__label { font-size: var(--step--1); color: var(--on-blue-2); }

@keyframes pre-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }
@keyframes pre-slide { 0% { transform: translateX(120%); } 100% { transform: translateX(-260%); } }

.preloader.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
html:not(.js) .preloader { display: none; }

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