/* resume.css — صفحه‌ی رزومه.
   قاعده‌ها: ویژگی‌های منطقی (inline-start/end) تا RTL و LTR با یک کد کار کنند؛
   تنها شیءِ «سنگین» صفحه ترمینال است؛ بقیه فقط تایپوگرافی و خط‌های نازک. */

@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn-var.f6d31671339d.woff2") format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url("../fonts/jetbrains-mono-latin-400-normal.caf0dfde4e44.woff2") format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url("../fonts/jetbrains-mono-latin-700-normal.69002db50656.woff2") format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #f1f3f5;
  --surface: #ffffff;
  --ink: #0f1b26;
  --steel: #53636f;
  --line: #d3d9df;
  --signal: #1c4be0;
  --signal-ink: #ffffff;

  --term-bg: #0b131b;
  --term-bar: #131f2a;
  --term-fg: #d7e3ee;
  --term-dim: #8196a8;
  --term-prompt: #8fb4ff;
  --term-accent: #ffd479;
  --term-edge: #0b131b;

  --font-ui: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-term: 'JetBrains Mono', 'Vazirmatn', ui-monospace, Menlo, Consolas, monospace;

  --rail: 19rem;
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d151c;
    --surface: #131d26;
    --ink: #e6edf3;
    --steel: #9badbb;
    --line: #26343f;
    --signal: #86a8ff;
    --signal-ink: #0d151c;
    --term-bg: #060b10;
    --term-bar: #0f1922;
    --term-edge: #2a3946;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-block-start: 1.5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.85;
  text-rendering: optimizeLegibility;
}
html[lang='en'] body { line-height: 1.7; }

a { color: var(--signal); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; inset-inline-start: 1rem; inset-block-start: -4rem; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; border-radius: 4px;
}
.skip:focus { inset-block-start: 1rem; }

/* ── چیدمان: ریل هویت + ستونِ محتوا ─────────────────── */
.layout { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky; inset-block-start: 0; align-self: start; height: 100vh; overflow-y: auto;
  padding: 2.5rem 2rem; display: flex; flex-direction: column; gap: 1.75rem;
  border-inline-end: 1px solid var(--line);
}
.rail-id { display: flex; flex-direction: column; gap: 1rem; }
.avatar {
  width: 96px; height: 96px; object-fit: cover; border-radius: 50%;
  background: var(--line); border: 1px solid var(--line);
}
.name { margin: 0; font-size: 1.75rem; line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
html[lang='fa'] .name { letter-spacing: 0; }
.role { margin: 0.35rem 0 0; font-weight: 600; line-height: 1.5; }
.where { margin: 0.2rem 0 0; color: var(--steel); font-size: 0.95rem; }

.langs { display: flex; gap: 0.25rem; }
.langs a {
  padding: 0.2rem 0.75rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none;
  color: var(--steel); font-size: 0.9rem; line-height: 1.7;
}
.langs a[aria-current='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.toc a {
  display: block; padding: 0.3rem 0; color: var(--steel); text-decoration: none; font-weight: 500;
  border-inline-start: 2px solid transparent; padding-inline-start: 0.9rem; margin-inline-start: -0.9rem;
}
.toc a:hover { color: var(--ink); }
.toc a[aria-current='true'] { color: var(--ink); border-inline-start-color: var(--signal); font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; align-self: flex-start;
  background: var(--signal); color: var(--signal-ink); text-decoration: none; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: 6px; line-height: 1.5;
}
.btn:hover { filter: brightness(1.08); }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── محتوا ─────────────────────────────────────────── */
.main { padding: 3rem clamp(1.25rem, 4vw, 3.5rem) 4rem; max-width: calc(var(--measure) + 7rem); outline: none; }

.lead {
  margin: 0 0 1.75rem; max-width: 36rem; font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.55; font-weight: 700;
}
html[lang='en'] .lead { letter-spacing: -0.01em; line-height: 1.4; }

/* ترمینال — تنها شیءِ تیره‌ی صفحه */
.term {
  background: var(--term-bg); color: var(--term-fg); border-radius: 10px; overflow: hidden;
  border: 1px solid var(--term-edge); box-shadow: 0 18px 40px -24px rgba(8, 20, 35, 0.55);
  font-family: var(--font-term); font-size: 0.9rem; line-height: 1.65;
}
.term-bar { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.9rem; background: var(--term-bar); }
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 10px; height: 10px; border-radius: 50%; background: #3a4a59; }
.term-title { color: var(--term-dim); font-size: 0.8rem; }
.term-screen {
  height: 22rem; overflow-y: auto; padding: 0.9rem 1rem 0.4rem; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #3a4a59 transparent;
}
.term-screen:focus-visible { outline-offset: -3px; }
.tl { margin: 0 0 0.15rem; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: left; }
/* متنِ فارسی در ترمینال با فونتِ رابط: فونتِ تک‌فاصله فاصله‌ی کلمه‌ها را باز می‌کند */
.tl.fa, .tl .fa { font-family: var(--font-ui); font-size: 0.95em; line-height: 1.8; }
.tl.row > span.fa { text-align: left; }
.tl.cmd { color: var(--term-fg); }
.tl.cmd .ps { color: var(--term-prompt); }
.tl.dim { color: var(--term-dim); }
.tl.err { color: #ff9e9e; }
.tl.ok { color: #9be3c0; }
.tl.head { color: var(--term-fg); font-weight: 700; margin-top: 0.35rem; }
.tl .k { color: var(--term-accent); }
.tl.row { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: 0.25rem 1rem; }
.tl.row > span:first-child { color: var(--term-accent); unicode-bidi: normal; direction: ltr; }
.tl.gap { height: 0.5rem; }

.term-form { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 1rem 0.8rem; }
.term-prompt { color: var(--term-prompt); white-space: nowrap; font-size: 0.9rem; }
.term-input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--term-fg); font: inherit;
  caret-color: #ffb224; padding: 0.2rem 0; outline: none; border-radius: 0;
}
.term-form:focus-within { box-shadow: inset 0 1px 0 rgba(143, 180, 255, 0.35); }

.term-quick { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 1rem 0.9rem; }
.chip {
  font: inherit; font-size: 0.8rem; color: var(--term-fg); background: transparent; cursor: pointer;
  border: 1px solid #2f4152; border-radius: 6px; padding: 0.2rem 0.65rem; line-height: 1.6;
}
.chip:hover { border-color: var(--term-prompt); color: #fff; }
.chip:focus-visible { outline-color: var(--term-prompt); }
.term-hint { margin: 0; padding: 0.55rem 1rem 0.7rem; border-top: 1px solid #1b2a37; color: var(--term-dim); font-family: var(--font-ui); font-size: 0.85rem; line-height: 1.7; }

/* بخش‌ها */
.block { margin-block-start: 4rem; padding-block-start: 1.75rem; border-block-start: 1px solid var(--line); }
.block > h2 { margin: 0 0 1rem; font-size: 1.45rem; font-weight: 800; line-height: 1.4; outline: none; }
.prose { margin: 0 0 1rem; max-width: var(--measure); }
.sub { margin: 2rem 0 0.75rem; font-size: 1.05rem; font-weight: 700; }

.facts { display: grid; gap: 0.6rem; margin: 1.25rem 0 0; max-width: var(--measure); }
.facts div { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; }
.facts dt { color: var(--steel); }
.facts dd { margin: 0; font-weight: 500; }

.principles { margin: 0; padding-inline-start: 1.4rem; max-width: var(--measure); }
.principles li { margin-block: 0.35rem; }
.principles li span { color: var(--steel); }
.quote {
  margin: 2rem 0 0; padding-inline-start: 1.1rem; border-inline-start: 3px solid var(--signal);
  max-width: 38rem; font-size: 1.1rem; line-height: 1.75; font-weight: 500;
}

.timeline { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.timeline li { position: relative; padding-inline-start: 1.6rem; padding-block-end: 1.75rem; border-inline-start: 1px solid var(--line); margin-inline-start: 0.35rem; }
.timeline li:last-child { padding-block-end: 0; }
.timeline li::before {
  content: ''; position: absolute; inset-inline-start: -5px; inset-block-start: 0.65rem; width: 9px; height: 9px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--signal);
}
.when { margin: 0; color: var(--steel); font-size: 0.92rem; }
.timeline h3, .projects h3 { margin: 0.1rem 0 0; font-size: 1.1rem; font-weight: 700; line-height: 1.5; }
.org { margin: 0 0 0.5rem; font-weight: 500; color: var(--steel); }

.projects { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.projects > li { padding-block: 1.1rem; border-block-end: 1px solid var(--line); }
.projects > li:first-child { padding-block-start: 0; }
.projects > li:last-child { border-block-end: 0; }
.projects .prose { margin: 0.2rem 0 0.5rem; }

.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  font-family: var(--font-term); font-size: 0.78rem; line-height: 1.6; padding: 0.05rem 0.55rem; border: 1px solid var(--line);
  border-radius: 4px; color: var(--steel); background: var(--surface);
}
.tags.big li { font-size: 0.85rem; padding: 0.15rem 0.7rem; color: var(--ink); }

.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 2rem 2.5rem; margin-top: 2.25rem; }
.stack-col h3 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; font-size: 1rem; font-weight: 700; }
.stack-col .ico { color: var(--signal); }
.stack-col ul { margin: 0; padding: 0; list-style: none; }
.stack-col li { padding-block: 0.15rem; color: var(--steel); }

.contact { display: grid; gap: 0.5rem; margin: 0; max-width: var(--measure); }
.contact div { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; }
.contact dt { color: var(--steel); }
.contact dd { margin: 0; text-align: start; }

.foot { margin-top: 4rem; color: var(--steel); font-size: 0.9rem; }

/* ── موبایل و تبلت: ریل بالای صفحه می‌رود ─────────────── */
@media (max-width: 62rem) {
  .layout { display: block; }
  .rail {
    position: static; height: auto; overflow: visible; padding: 1.5rem 1.25rem 0; gap: 1rem;
    border-inline-end: 0;
  }
  .rail-id { flex-direction: row; align-items: center; gap: 1rem; }
  .avatar { width: 72px; height: 72px; }
  .name { font-size: 1.5rem; }
  .toc { position: sticky; inset-block-start: 0; z-index: 5; background: var(--paper); margin-inline: -1.25rem; padding-inline: 1.25rem; border-block-end: 1px solid var(--line); }
  .toc ul { flex-direction: row; gap: 1.25rem; overflow-x: auto; scrollbar-width: none; }
  .toc a { border-inline-start: 0; border-block-end: 2px solid transparent; padding: 0.6rem 0; margin: 0; white-space: nowrap; }
  .toc a[aria-current='true'] { border-block-end-color: var(--signal); }
  .main { padding-block-start: 1.75rem; }
  .term-screen { height: 19rem; }
}
@media (max-width: 36rem) {
  .facts div, .contact div { grid-template-columns: 5.5rem 1fr; gap: 0.75rem; }
  .tl.row { grid-template-columns: 1fr; gap: 0; }
  .term { font-size: 0.85rem; }
  .term-prompt { display: none; }
}

@media print {
  .rail .langs, .rail .toc, .term, .skip { display: none; }
  body { background: #fff; color: #000; }
  .layout { display: block; }
  .rail { position: static; height: auto; border: 0; }
}
