/* mrzroot — portfolio */

:root {
  --bg: #07090d;
  --bg-2: #0b0f16;
  --surface: rgba(14, 19, 28, 0.72);
  --surface-2: rgba(20, 27, 39, 0.8);
  --line: rgba(148, 163, 184, 0.12);
  --line-2: rgba(148, 163, 184, 0.24);
  --text: #e7ecf3;
  --muted: #9aa6b8;
  --dim: #657189;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --magenta: #e879f9;
  --magenta-soft: rgba(232, 121, 249, 0.12);
  --green: #4ade80;
  --amber: #fbbf24;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 64px;
  --container: 1160px;
}

html[lang="fa"] {
  --sans: "Vazirmatn", "Geist", ui-sans-serif, system-ui, sans-serif;
}

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

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul, ol { list-style: none; padding: 0; }
kbd { font-family: var(--mono); }

::selection { background: rgba(34, 211, 238, 0.28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

.skip-link {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--cyan);
  color: #031016;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

/* ---------- backdrop ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 75%);
}
.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.7;
}
.glow-a {
  width: 520px; height: 520px;
  inset-block-start: -180px;
  inset-inline-start: 8%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.45), transparent 65%);
}
.glow-b {
  width: 460px; height: 460px;
  inset-block-start: -120px;
  inset-inline-end: 4%;
  background: radial-gradient(circle, rgba(232, 121, 249, 0.32), transparent 65%);
}

.progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
}
.progress span {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
}
[dir="rtl"] .progress span { transform-origin: right center; }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  border-block-end: 1px solid transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.nav.scrolled {
  background: rgba(7, 9, 13, 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-block-end-color: var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--nav-h);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.logo-prompt {
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: linear-gradient(135deg, var(--cyan-soft), var(--magenta-soft));
  color: var(--cyan);
  font-size: 12px;
}
.logo-text::after {
  content: "";
  display: inline-block;
  width: 7px; height: 15px;
  margin-inline-start: 3px;
  vertical-align: -2px;
  background: var(--cyan);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav-links {
  display: flex;
  gap: 4px;
  margin-inline-start: auto;
}
.nav-links a {
  position: relative;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  transition: color 0.2s, background-color 0.2s;
}
.nav-links a:hover { color: var(--text); background: rgba(148, 163, 184, 0.07); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  inset-inline: 12px;
  inset-block-end: 2px;
  height: 1px;
  background: var(--cyan);
}

.nav-actions { display: flex; gap: 8px; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding-inline: 12px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(15, 20, 29, 0.6);
  color: var(--muted);
  font-size: 13px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.chip-btn:hover { color: var(--text); border-color: rgba(34, 211, 238, 0.45); }
.chip-btn svg { width: 15px; height: 15px; }
.chip-btn kbd { font-size: 11px; color: var(--dim); }
.lang-toggle { font-family: var(--mono); font-weight: 600; min-width: 44px; justify-content: center; }
.lang-toggle span { font-family: "Vazirmatn", var(--mono); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding-inline: 20px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 15px;
  transition: transform 0.25s var(--ease), background-color 0.2s, border-color 0.2s, box-shadow 0.25s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: var(--text);
  color: #06080c;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 10px 30px -10px rgba(34, 211, 238, 0.5);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 16px 40px -12px rgba(34, 211, 238, 0.65); }
.btn-arrow { transition: transform 0.25s var(--ease); }
.btn-primary:hover .btn-arrow { transform: translateY(2px); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  min-height: calc(100svh - var(--nav-h));
  padding-block: clamp(40px, 8vh, 96px) clamp(56px, 10vh, 120px);
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-block-end: 28px;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 20, 29, 0.55);
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18);
}
.kicker-sep { color: var(--dim); }
.clock { color: var(--text); font-variant-numeric: tabular-nums; }

.hero h1 {
  font-size: clamp(2.7rem, 6.6vw, 5.2rem);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.045em;
  margin-block-end: 24px;
}
.grad {
  background: linear-gradient(100deg, var(--cyan) 10%, #a5b4fc 50%, var(--magenta) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-lede {
  max-width: 34em;
  font-size: clamp(1.02rem, 1.35vw, 1.15rem);
  color: var(--muted);
  margin-block-end: 36px;
}
.hero-lede strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-block-end: 36px; }
.hero-social { display: flex; gap: 6px; }
.hero-social a {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: var(--dim);
  transition: color 0.2s, background-color 0.2s;
}
.hero-social a:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }
.hero-social svg { width: 19px; height: 19px; }

/* ---------- terminal ---------- */

.terminal {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(14, 19, 28, 0.92), rgba(9, 12, 18, 0.95));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 30px 80px -30px rgba(0, 0, 0, 0.8),
    0 0 80px -40px rgba(34, 211, 238, 0.4);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  text-align: left;
}
.terminal::after {
  content: "";
  position: absolute;
  inset: 40px 0 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 3px);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding-inline: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.term-dots { display: flex; gap: 7px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; background: #2a3242; }
.term-dots i:nth-child(1) { background: #f87171; opacity: 0.75; }
.term-dots i:nth-child(2) { background: #fbbf24; opacity: 0.75; }
.term-dots i:nth-child(3) { background: #4ade80; opacity: 0.75; }
.term-title { flex: 1; text-align: center; color: var(--dim); font-size: 12px; }
.term-hint {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  opacity: 0.7;
}
.term-body {
  height: clamp(340px, 46vh, 420px);
  overflow-y: auto;
  padding: 18px 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: #253042 transparent;
  cursor: text;
}
.term-log p { white-space: pre-wrap; word-break: break-word; min-height: 1.7em; }
.term-log a { color: var(--cyan); text-decoration: underline; text-decoration-color: rgba(34, 211, 238, 0.35); text-underline-offset: 3px; }
.term-log a:hover { text-decoration-color: var(--cyan); }
.term-input { display: flex; gap: 10px; align-items: center; }
.term-input input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--cyan);
  font-family: var(--mono);
  font-size: inherit;
}
.term-input input::placeholder { color: #3c4759; }
.terminal:focus-within { border-color: rgba(34, 211, 238, 0.4); }
.term-input.hidden { visibility: hidden; }

.p { color: var(--cyan); }
.t-dim { color: var(--dim); }
.t-mut { color: var(--muted); }
.t-k { color: var(--magenta); }
.t-s { color: #a7f3d0; }
.t-f { color: #7dd3fc; }
.t-n { color: var(--amber); }
.t-ok { color: var(--green); }
.t-err { color: #fca5a5; }
.caret {
  display: inline-block;
  width: 8px; height: 1.1em;
  vertical-align: -3px;
  background: var(--cyan);
  animation: blink 1.1s steps(1) infinite;
}

/* ---------- sections ---------- */

.section { padding-block: clamp(72px, 11vw, 128px) 0; }
.section-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 18px;
  row-gap: 14px;
  margin-block-end: clamp(32px, 5vw, 52px);
}
.section-index {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--cyan);
  padding: 3px 8px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 6px;
  background: var(--cyan-soft);
  align-self: center;
}
.section-head h2 {
  font-size: clamp(1.9rem, 3.8vw, 2.9rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.section-sub {
  grid-column: 1 / -1;
  max-width: 44em;
  color: var(--muted);
  font-size: 1.02rem;
}

/* about */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
.about-copy p { color: var(--muted); font-size: 1.05rem; }
.about-copy p + p { margin-block-start: 18px; }
.about-copy .about-lead {
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-block-end: 26px;
}
.about-side {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.facts { padding: 8px 22px; }
.facts div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 16px;
  padding-block: 13px;
  border-bottom: 1px dashed var(--line);
  font-size: 14.5px;
}
.facts div:last-child { border-bottom: 0; }
.facts dt { font-family: var(--mono); font-size: 12.5px; color: var(--dim); padding-top: 2px; }
.facts dd { color: var(--text); }
.principles {
  border-top: 1px solid var(--line);
  padding: 18px 22px 20px;
  background: rgba(255, 255, 255, 0.012);
  display: grid;
  gap: 12px;
}
.principles li { display: flex; gap: 14px; font-size: 14.5px; color: var(--muted); }
.principles span { font-family: var(--mono); font-size: 12px; color: var(--magenta); padding-top: 3px; }

/* cards */

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.card {
  --mx: 50%;
  --my: 0%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(420px circle at var(--mx) var(--my), rgba(34, 211, 238, 0.06), transparent 45%),
    var(--surface);
  transition: transform 0.35s var(--ease), border-color 0.3s, background-color 0.3s;
  isolation: isolate;
}
.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(34, 211, 238, 0.7), rgba(232, 121, 249, 0.35) 40%, transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  pointer-events: none;
}
.card:hover { transform: translateY(-3px); }
.card:hover::before, .card:focus-within::before { opacity: 1; }
.card:focus-within { border-color: transparent; }
.card-feature { grid-column: span 2; }
.card-feature h3 { font-size: clamp(1.15rem, 2vw, 1.45rem); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block-end: 6px; }
.card-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
}
.card-tag::before { content: "● "; font-size: 9px; vertical-align: 1px; }
.card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.badge-fork { color: var(--amber); border-color: rgba(251, 191, 36, 0.3); }
.card h3 {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid var(--cyan); outline-offset: 2px; }
.card-tagline { color: var(--text); font-weight: 500; font-size: 15px; }
.card > p:not(.card-tagline) { color: var(--muted); font-size: 14.5px; line-height: 1.65; }
.feature-toc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 20px;
  margin-block-start: 10px;
  counter-reset: toc;
  border-top: 1px dashed var(--line);
}
.feature-toc li {
  counter-increment: toc;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-block: 9px;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
  color: var(--text);
}
.feature-toc li::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--magenta);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 6px; }
.tags li {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.07);
}
.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-block-start: auto;
  padding-block-start: 14px;
  font-size: 13.5px;
  color: var(--dim);
  transition: color 0.2s;
}
.card-cta svg { width: 15px; height: 15px; }
.card-cta .arr { width: 14px; height: 14px; transition: transform 0.3s var(--ease); }
.card:hover .card-cta { color: var(--text); }
.card:hover .card-cta .arr { transform: translate(2px, -2px); }
[dir="rtl"] .arr { transform: scaleX(-1); }
[dir="rtl"] .card:hover .card-cta .arr { transform: scaleX(-1) translate(2px, -2px); }

/* stack */

.stack-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.stack-group {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.stack-group h3 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-block-end: 14px;
  direction: ltr;
  text-align: start;
}
.stack-group ul { display: grid; gap: 8px; }
.stack-group li {
  font-size: 14.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.stack-group li::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 1px;
  background: var(--line-2);
  flex-shrink: 0;
}
.stack-group li.hl { color: var(--text); }
.stack-group li.hl::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

/* contact */

.contact { padding-block-end: clamp(72px, 10vw, 120px); }
.contact-card {
  position: relative;
  padding: clamp(32px, 6vw, 72px);
  border-radius: calc(var(--radius) + 8px);
  border: 1px solid var(--line-2);
  background:
    radial-gradient(600px circle at 0% 0%, rgba(34, 211, 238, 0.1), transparent 55%),
    radial-gradient(600px circle at 100% 100%, rgba(232, 121, 249, 0.09), transparent 55%),
    var(--bg-2);
  overflow: hidden;
}
.contact-card h2 {
  max-width: 16em;
  margin-block: 22px 16px;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: -0.04em;
}
.contact-card > p { max-width: 38em; color: var(--muted); font-size: 1.05rem; }
.contact-primary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-block: 36px 32px;
}
.contact-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--green);
}
.contact-label svg { width: 15px; height: 15px; }
.primary-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.4s var(--ease), color 0.2s;
  padding-bottom: 2px;
}
.primary-link .arr { width: 0.8em; height: 0.8em; color: var(--cyan); transition: transform 0.3s var(--ease); }
.primary-link:hover { color: var(--cyan); background-size: 100% 1px; }
.primary-link:hover .arr { transform: translate(2px, -2px); }
[dir="rtl"] .primary-link .arr { transform: none; }
[dir="rtl"] .primary-link:hover .arr { transform: translate(2px, -2px); }
html[lang="fa"] .contact-label { font-family: var(--sans); font-size: 13.5px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; }
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(15, 20, 29, 0.55);
  font-size: 14.5px;
  transition: border-color 0.2s, transform 0.25s var(--ease);
}
.contact-links a:hover { border-color: rgba(34, 211, 238, 0.45); transform: translateY(-2px); }
.contact-links svg { width: 17px; height: 17px; color: var(--muted); }
.contact-links small { font-family: var(--mono); font-size: 12px; color: var(--dim); }

/* footer */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 28px 40px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--dim);
}
.footer a:hover { color: var(--text); }

/* ---------- palette ---------- */

.palette { position: fixed; inset: 0; z-index: 90; }
.palette[hidden] { display: none; }
.palette-scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 8, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade 0.2s var(--ease);
}
.palette-panel {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  margin: max(10vh, 64px) auto 0;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: rgba(11, 15, 22, 0.97);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: pop 0.25s var(--ease);
}
.palette-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 56px;
  border-bottom: 1px solid var(--line);
}
.palette-search svg { width: 18px; height: 18px; color: var(--dim); flex-shrink: 0; }
.palette-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; }
.palette-search input::placeholder { color: var(--dim); }
.palette-search kbd {
  font-size: 11px;
  color: var(--dim);
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
}
.palette-list { max-height: min(420px, 60vh); overflow-y: auto; padding: 8px; }
.palette-group {
  padding: 10px 10px 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--muted);
  cursor: pointer;
}
.palette-item small { margin-inline-start: auto; font-family: var(--mono); font-size: 11.5px; color: var(--dim); direction: ltr; unicode-bidi: isolate; }
.palette-item .pi-icon { width: 16px; text-align: center; color: var(--dim); font-family: var(--mono); }
.palette-item[aria-selected="true"] { background: rgba(34, 211, 238, 0.09); color: var(--text); }
.palette-item[aria-selected="true"] .pi-icon { color: var(--cyan); }
.palette-empty { padding: 28px; text-align: center; color: var(--dim); font-size: 14px; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }

/* ---------- reveal ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- RTL / Persian ---------- */

html[lang="fa"] body { line-height: 1.85; }
html[lang="fa"] .hero-kicker { font-family: var(--sans); font-size: 13px; }
html[lang="fa"] .hero-kicker .clock { font-family: var(--mono); font-size: 12.5px; }
html[lang="fa"] .facts dt,
html[lang="fa"] .badge-fork,
html[lang="fa"] .palette-group { font-family: var(--sans); letter-spacing: 0; text-transform: none; }
html[lang="fa"] .facts dt { font-size: 13px; padding-top: 0; }
html[lang="fa"] .hero h1,
html[lang="fa"] .section-head h2,
html[lang="fa"] .contact-card h2,
html[lang="fa"] .about-lead { letter-spacing: 0; line-height: 1.3; }
html[lang="fa"] .hero h1 { font-weight: 700; font-size: clamp(2.4rem, 5.8vw, 4.4rem); }
html[lang="fa"] .grad { background: linear-gradient(260deg, var(--cyan) 10%, #a5b4fc 50%, var(--magenta) 90%); -webkit-background-clip: text; background-clip: text; }
html[lang="fa"] .card > p:not(.card-tagline) { line-height: 1.9; }
[dir="rtl"] .card h3, [dir="rtl"] .primary-link, [dir="rtl"] .contact-links small { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .card h3 { text-align: right; }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .stack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-block-start: 32px; }
  .about-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-feature { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  :root { --nav-h: 104px; }
  .nav-inner { flex-wrap: wrap; height: auto; padding-block: 12px 0; row-gap: 6px; }
  .nav-actions { margin-inline-start: auto; }
  .nav-links {
    order: 3;
    width: calc(100% + 2 * clamp(20px, 4vw, 40px));
    margin-inline: calc(-1 * clamp(20px, 4vw, 40px));
    padding-inline: clamp(12px, 4vw, 32px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { flex-shrink: 0; padding-block: 10px 12px; }
  .palette-btn kbd { display: none; }
  .cards { grid-template-columns: 1fr; }
  .stack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .term-body { height: 340px; padding: 16px; }
  .terminal { font-size: 12.5px; }
}

@media (max-width: 420px) {
  .stack-grid { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 92px 1fr; }
  .hero-cta .btn { flex: 1 1 auto; justify-content: center; }
  .card { padding: 20px; }
}

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

@media print {
  .backdrop, .nav, .terminal, .palette, .progress { display: none !important; }
  body { background: #fff; color: #000; }
  .js .reveal { opacity: 1; transform: none; }
}
