/* ═══════════════════════════════════════════════════════════════
   Miras Design System — Base v2
   Reset · Tipografi · Düzen · Utilities
   ═══════════════════════════════════════════════════════════════ */

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
svg { display: inline-block; max-width: 100%; }
.icon { width: 18px; height: 18px; flex: 0 0 18px; vertical-align: middle; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--brand-500); text-decoration: none; }
a:hover { color: var(--brand-600); }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  color: var(--text);
  letter-spacing: -0.02em;
}

.text-2xs { font-size: var(--text-2xs); }
.text-xs  { font-size: var(--text-xs); }
.text-sm  { font-size: var(--text-sm); }
.text-base{ font-size: var(--text-base); }
.text-md  { font-size: var(--text-md); }
.text-lg  { font-size: var(--text-lg); }
.text-xl  { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.fw-light    { font-weight: var(--fw-light); }
.fw-normal   { font-weight: var(--fw-normal); }
.fw-medium   { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold     { font-weight: var(--fw-bold); }

.muted       { color: var(--text-soft); }
.faint       { color: var(--text-faint); }
.brand       { color: var(--brand-500); }

.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }
.text-warning  { color: var(--amber-500); }
.text-info     { color: var(--info); }
.text-center   { text-align: center; }
.text-left     { text-align: left; }
.text-right    { text-align: right; }

/* Arabic text (Amiri) */
.arabic-text {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.9;
  direction: rtl;
  color: var(--brand-700);
}

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

@media (max-width: 640px) {
  .container { padding-inline: var(--space-md); }
}

/* Grid utilities */
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 640px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 400px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.row { display: grid; gap: var(--space-md); }
.row-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 640px) {
  .row-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 400px) {
  .row-cols-2, .row-cols-3 { grid-template-columns: 1fr; }
}

/* Calculator layout: sidebar + content */
.layout-calc {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 960px) {
  .layout-calc { grid-template-columns: 1fr; gap: var(--space-lg); }
}

/* Flex helpers */
.flex { display: flex; }
.flex-wrap { display: flex; flex-wrap: wrap; }
.items-center { display: flex; align-items: center; }
.justify-between { display: flex; justify-content: space-between; }
.gap-1 { gap: var(--space-2xs); }
.gap-2 { gap: var(--space-xs); }
.gap-3 { gap: var(--space-sm); }
.gap-4 { gap: var(--space-md); }
.gap-5 { gap: var(--space-lg); }
.gap-6 { gap: var(--space-xl); }

/* Spacing */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-2xs); }
.mt-2 { margin-top: var(--space-xs); }
.mt-3 { margin-top: var(--space-sm); }
.mt-4 { margin-top: var(--space-md); }
.mt-5 { margin-top: var(--space-lg); }
.mt-6 { margin-top: var(--space-xl); }
.mt-7 { margin-top: var(--space-2xl); }
.mb-1 { margin-bottom: var(--space-2xs); }
.mb-2 { margin-bottom: var(--space-xs); }
.mb-3 { margin-bottom: var(--space-sm); }
.mb-4 { margin-bottom: var(--space-md); }
.mb-5 { margin-bottom: var(--space-lg); }
.mb-6 { margin-bottom: var(--space-xl); }
.mb-7 { margin-bottom: var(--space-2xl); }
.my-4 { margin-block: var(--space-md); }
.my-5 { margin-block: var(--space-lg); }
.p-1 { padding: var(--space-2xs); }
.p-2 { padding: var(--space-xs); }
.p-3 { padding: var(--space-sm); }
.p-4 { padding: var(--space-md); }
.p-5 { padding: var(--space-lg); }
.p-6 { padding: var(--space-xl); }
.px-2 { padding-inline: var(--space-xs); }
.px-4 { padding-inline: var(--space-md); }
.py-2 { padding-block: var(--space-xs); }
.py-4 { padding-block: var(--space-md); }

.w-full { width: 100%; }
.h-100 { height: 100%; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* ── Visibility ── */
.hidden { display: none !important; }
.d-none { display: none !important; }
.is-visible { display: block !important; }

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

/* ── Skip Link ── */
.skip-link {
  position: absolute; top: -100%; left: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: var(--brand-600); color: var(--text-on-brand);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold); font-size: var(--text-sm);
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: var(--z-tooltip); text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 0; }

/* ── Sticky sidebar ── */
@media (min-width: 961px) {
  .sticky-top { position: sticky; top: calc(var(--header-h) + var(--space-md)); }
}

/* ── Section container ── */
.page { padding-block: var(--space-2xl); }
.page-section { margin-bottom: var(--space-2xl); }

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Touch: min 44x44 for all interactive elements ── */
.btn { min-height: 44px; }
.check { min-height: 44px; padding: var(--space-xs) 0; }
.check .box {
  width: 26px; height: 26px; flex: 0 0 26px;
}
.check .box .icon { width: 16px; height: 16px; }

/* Money inputs: tabular-nums for aligned digits */
input[data-money] {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* KPI values: tabular-nums */
.kpi-value, .stat-value, .hero-stat-value, .guide-stat-value,
.split-amt .val, .step-amt, .bar-val, .legend-val .frac {
  font-variant-numeric: tabular-nums;
}

/* ── Reduced motion: disable ALL animations ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

::selection {
  background: var(--brand-100);
  color: var(--brand-800);
}

/* ── Divider ── */
hr.rule {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

/* ── Section label ── */
.section-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
