/* ==========================================================================
   mfvictor — Personal Site
   Design system: warm-canvas editorial (Claude) + opacity-driven calm (Lovable)
   RTL / Persian first
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Surfaces */
  --canvas:              #f8f5ef;
  --canvas-solid:        #f8f5ef;
  --surface-soft:        #f2eee6;
  --surface-card:        #efe9de;
  --surface-strong:      #e8e0d2;
  --surface-dark:        #181715;
  --surface-dark-elev:   #252320;
  --surface-dark-soft:   #1f1e1b;

  /* Text */
  --ink:                 #1c1c1c;
  --body:                #3d3d3a;
  --muted:               #6c6a64;
  --muted-soft:          #8e8b82;
  --on-dark:             #faf9f5;
  --on-dark-soft:        #a09d96;
  --on-primary:          #ffffff;

  /* Lines */
  --hairline:            #e6dfd8;
  --hairline-soft:       #eceae4;
  --hairline-strong:     rgba(28, 28, 28, .28);

  /* Accent */
  --coral:               #cc785c;
  --coral-active:        #a9583e;
  --coral-soft:          #f4e5dd;
  --teal:                #5db8a6;
  --amber:               #e8a55a;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 24px;
  --r-pill: 9999px;

  /* Spacing */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px;  --s-8: 64px;
  --s-9: 96px;  --s-10: 128px;

  /* Elevation */
  --shadow-inset:
    rgba(255, 255, 255, .18) 0 .5px 0 0 inset,
    rgba(0, 0, 0, .22) 0 0 0 .5px inset,
    rgba(0, 0, 0, .05) 0 1px 2px 0;
  --shadow-focus: rgba(0, 0, 0, .1) 0 4px 12px;
  --shadow-soft: 0 1px 2px rgba(20, 20, 19, .05), 0 4px 16px rgba(20, 20, 19, .04);

  /* Type */
  --font-fa: "Vazirmatn", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Instrument Serif", "Tiempos Headline", Georgia, serif;
  --font-mono: "JetBrains Mono", Menlo, Consolas, ui-monospace, monospace;

  --header-h: 72px;
  --container: 1200px;
}

[data-theme="dark"] {
  --canvas:              #141312;
  --canvas-solid:        #141312;
  --surface-soft:        #1b1a18;
  --surface-card:        #201f1c;
  --surface-strong:      #2a2724;
  --surface-dark:        #0f0e0d;
  --surface-dark-elev:   #1c1b19;
  --surface-dark-soft:   #171614;

  --ink:                 #f7f4ed;
  --body:                rgba(247, 244, 237, .78);
  --muted:               rgba(247, 244, 237, .58);
  --muted-soft:          rgba(247, 244, 237, .42);

  --hairline:            rgba(247, 244, 237, .13);
  --hairline-soft:       rgba(247, 244, 237, .08);
  --hairline-strong:     rgba(247, 244, 237, .3);

  --coral:               #e08e70;
  --coral-active:        #cc785c;
  --coral-soft:          rgba(224, 142, 112, .13);

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .25);
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font-fa);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .35s ease, color .35s ease;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.02em;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
  transition: color .2s ease, opacity .2s ease;
}

img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: var(--coral); color: #fff; }

/* Latin fragments keep the serif editorial voice */
.lat {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -.01em;
  direction: ltr;
  unicode-bidi: isolate;
}
.mono {
  font-family: var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
  font-size: .9em;
}

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

.section {
  padding-block: var(--s-9);
  position: relative;
}
.section--tight { padding-block: var(--s-8); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  flex-wrap: wrap;
}
.section-head__text { max-width: 640px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  margin-bottom: var(--s-3);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--hairline-strong);
  display: block;
}

.h-display {
  font-size: clamp(33px, 4.8vw, 50px);
  line-height: 1.18;
  letter-spacing: -.035em;
  font-weight: 700;
}
.h-section {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.25;
  letter-spacing: -.03em;
}
.h-card {
  font-size: 20px;
  line-height: 1.5;
  letter-spacing: -.015em;
  font-weight: 600;
}
.lead {
  font-size: 18px;
  line-height: 1.9;
  color: var(--muted);
}
.small { font-size: 14px; line-height: 1.7; color: var(--muted); }

.rule {
  height: 1px;
  background: var(--hairline);
  border: 0;
  margin: 0;
}

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 11px 22px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: none;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease,
              border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }

.btn--primary {
  background: var(--coral);
  color: var(--on-primary);
  box-shadow: var(--shadow-inset);
}
.btn--primary:hover { background: var(--coral-active); }

.btn--ink {
  background: var(--ink);
  color: var(--canvas);
  box-shadow: var(--shadow-inset);
}
.btn--ink:hover { opacity: .86; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn--ghost:hover { background: var(--surface-card); }

.btn--on-dark {
  background: var(--surface-dark-elev);
  color: var(--on-dark);
  border-color: rgba(250, 249, 245, .12);
}
.btn--on-dark:hover { background: #2f2d29; }

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

.btn--sm { min-height: 38px; padding: 8px 16px; font-size: 14px; }

.btn-icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.btn-icon:hover { background: var(--surface-card); }
.btn-icon svg { width: 18px; height: 18px; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--coral);
  font-weight: 500;
  font-size: 15px;
}
.link-arrow svg { width: 15px; height: 15px; transition: transform .25s ease; }
.link-arrow:hover svg { transform: translateX(-4px); }

/* ---------- 5. Badges & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 5px 13px;
  border-radius: var(--r-pill);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.6;
}
.badge--coral { background: var(--coral-soft); border-color: transparent; color: var(--coral-active); }
[data-theme="dark"] .badge--coral { color: var(--coral); }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--teal);
  flex: none;
  box-shadow: 0 0 0 3px rgba(93, 184, 166, .18);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: transparent;
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.7;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.chip:hover { background: var(--surface-card); color: var(--ink); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* Brand mark */
.mark {
  width: 20px;
  height: 20px;
  flex: none;
  fill: var(--coral);
}
.mark--sm { width: 13px; height: 13px; }

/* ---------- 6. Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--canvas) 85%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease;
}
.header.is-scrolled { border-bottom-color: var(--hairline); }

.nav {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}
.brand__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--surface-card);
  display: grid; place-items: center;
}
.brand__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand__name { direction: ltr; }
.brand__dot { color: var(--coral); }

.nav__links { display: flex; align-items: center; gap: 2px; }
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color .2s ease, background-color .2s ease;
}
.nav__link svg { width: 16px; height: 16px; flex: none; opacity: .7; }
.nav__link:hover { color: var(--ink); background: var(--surface-card); }
.nav__link.is-active { color: var(--ink); font-weight: 600; }
.nav__link.is-active svg { color: var(--coral); opacity: 1; }

.nav__actions { display: flex; align-items: center; gap: var(--s-2); }

/* One icon at a time, handed over like a sunrise/sunset.
   transform axes are physical, so +X is really "right" even in this RTL page. */
.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle__icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  will-change: transform, opacity;
}
/* Resting states: the waiting icon parks at the bottom-left, ready to rise. */
.theme-toggle__sun { opacity: 0; transform: translate3d(-42%, 62%, 0) rotate(-38deg) scale(.55); }
.theme-toggle__moon { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle__sun { opacity: 1; transform: none; }
[data-theme="dark"] .theme-toggle__moon { opacity: 0; transform: translate3d(-42%, 62%, 0) rotate(-38deg) scale(.55); }
/* The hand-off itself. */
.theme-toggle__icon.is-setting { animation: theme-set .44s cubic-bezier(.4, 0, .6, 1) forwards; }
.theme-toggle__icon.is-rising { animation: theme-rise .44s cubic-bezier(.2, .8, .3, 1) forwards; }
@keyframes theme-set {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translate3d(42%, 62%, 0) rotate(38deg) scale(.55); }
}
@keyframes theme-rise {
  from { opacity: 0; transform: translate3d(-42%, 62%, 0) rotate(-38deg) scale(.55); }
  to { opacity: 1; transform: none; }
}

/* ---- Glass tab bar: on phones the navigation moves to the bottom ---- */
.tabbar { display: none; }
.tabbar__link.is-active { background: var(--coral); color: #fff; }

@media (max-width: 860px) {
  .nav__links { display: none; }
  .tabbar {
    display: block;
    position: fixed;
    z-index: 70;
    inset-inline: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar__inner {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 3px;
    padding: 7px;
    border-radius: 23px;
    background: color-mix(in srgb, var(--canvas) 70%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--hairline);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .16);
  }
  .tabbar__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 3px;
    border-radius: 16px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--muted);
    min-height: 52px;
    text-align: center;
  }
  .tabbar__link svg { width: 20px; height: 20px; flex: none; }
  body { padding-bottom: 96px; }
}

/* ---------- 7. Hero ---------- */
.hero {
  padding-block: clamp(48px, 8vw, 96px) clamp(56px, 8vw, 104px);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset-inline-end: -10%;
  top: -22%;
  width: 62vw;
  height: 62vw;
  max-width: 760px;
  max-height: 760px;
  background:
    radial-gradient(circle at 30% 30%, rgba(204, 120, 92, .16), transparent 62%),
    radial-gradient(circle at 70% 65%, rgba(93, 184, 166, .12), transparent 60%);
  filter: blur(14px);
  pointer-events: none;
  z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }

.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero__title {
  margin-top: var(--s-4);
  margin-bottom: var(--s-5);
}
.hero__title .accent { color: var(--coral); }
.hero__text { max-width: 600px; }
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, 4vw, 48px);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--hairline);
}
.stat__num {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -.02em;
  direction: ltr;
}
.stat__label { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

/* Code window */
.code-card {
  background: var(--surface-dark);
  border-radius: var(--r-xl);
  padding: 14px;
  box-shadow: 0 24px 60px rgba(24, 23, 21, .16);
  direction: ltr;
}
.code-card__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 12px;
}
.code-card__bar i {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #37342f;
  display: block;
}
.code-card__bar i:first-child { background: #cc785c; }
.code-card__bar i:nth-child(2) { background: #e8a55a; }
.code-card__bar i:nth-child(3) { background: #5db8a6; }
.code-card__file {
  margin-inline-start: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--on-dark-soft);
}
.code-card__body {
  background: var(--surface-dark-soft);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  overflow-x: auto;
}
.code-card pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.85;
  color: #d9d5cc;
  white-space: pre;
}
.tok-kw { color: #cc785c; }
.tok-fn { color: #e8a55a; }
.tok-str { color: #5db8a6; }
.tok-com { color: #6f6b63; font-style: italic; }
.tok-num { color: #b79bd8; }
.code-card__foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 8px 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--on-dark-soft);
}

/* ---------- 8. Skills ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5);
}

.skill-card {
  background: var(--surface-card);
  border-radius: var(--r-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: transform .3s ease, box-shadow .3s ease;
}
.skill-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.skill-card__icon {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  background: var(--canvas);
  color: var(--coral);
  margin-bottom: var(--s-2);
}
.skill-card__icon svg { width: 22px; height: 22px; }
.skill-card p { font-size: 15px; color: var(--muted); }
.skill-card .chip-row { margin-top: auto; padding-top: var(--s-4); }
.skill-card .chip { border-color: transparent; background: var(--canvas); }

.tools {
  margin-top: var(--s-6);
  padding: 26px 32px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
}
.tools__label {
  font-size: 13px;
  color: var(--muted-soft);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- 9. Services (what I do) ---------- */
.service-list {
  display: grid;
  border-top: 1px solid var(--hairline);
}
.service-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-4);
  padding: 24px 10px;
  border-bottom: 1px solid var(--hairline);
  transition: background-color .25s ease, padding-inline .25s ease;
}
.service-item:hover { background: var(--surface-soft); padding-inline: 20px; }
.service-item__icon {
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  display: grid; place-items: center;
  color: var(--coral);
  flex: none;
}
.service-item__icon svg { width: 21px; height: 21px; }
.service-item__title {
  font-size: clamp(17px, 2.2vw, 21px);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-bottom: 5px;
}
.service-item__desc {
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.85;
  max-width: 640px;
}
.service-item__num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted-soft);
  flex: none;
}

/* ---------- 10. Socials ---------- */
.social-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
}
.social-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: 26px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: transparent;
  overflow: hidden;
  transition: border-color .25s ease, transform .25s ease, background-color .25s ease;
}
.social-card:hover {
  transform: translateY(-3px);
  border-color: var(--hairline-strong);
  background: var(--surface-card);
}
.social-card__icon {
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  background: var(--surface-card);
  color: var(--ink);
  transition: background-color .25s ease, color .25s ease;
}
.social-card:hover .social-card__icon { background: var(--ink); color: var(--canvas); }
.social-card__icon svg { width: 19px; height: 19px; }
.social-card__name { font-size: 16px; font-weight: 600; color: var(--ink); }
.social-card__handle {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  direction: ltr;
  text-align: start;
}
.social-card__arrow {
  position: absolute;
  top: 24px;
  inset-inline-start: 24px;
  color: var(--muted-soft);
  transition: transform .25s ease, color .25s ease;
}
.social-card__arrow svg { width: 15px; height: 15px; }
.social-card:hover .social-card__arrow { color: var(--coral); transform: translate(-3px, -3px); }

/* ---------- 11. Articles ---------- */
.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
}

.article-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: transparent;
  overflow: hidden;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--hairline-strong);
  box-shadow: var(--shadow-soft);
}
.article-card__cover {
  height: 168px;
  position: relative;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
}
.article-card__cover svg.pattern { width: 100%; height: 100%; }
.article-card__tag {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}
.article-card__body {
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1;
}
.article-card__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 12.5px;
  color: var(--muted-soft);
}
.article-card__meta i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; display: block; }
.article-card__title {
  font-size: 18.5px;
  font-weight: 600;
  line-height: 1.65;
  color: var(--ink);
  letter-spacing: -.015em;
}
.article-card:hover .article-card__title { color: var(--coral); }
.article-card__excerpt { font-size: 14.5px; color: var(--muted); }
.article-card__foot {
  margin-top: auto;
  padding-top: var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Featured article */
.article-featured {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: var(--s-6);
  transition: border-color .25s ease, box-shadow .25s ease;
}
.article-featured:hover { border-color: var(--hairline-strong); box-shadow: var(--shadow-soft); }
.article-featured__cover { min-height: 300px; position: relative; }
.article-featured__body {
  padding: clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-4);
}
.article-featured__title {
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.5;
  letter-spacing: -.025em;
}

/* Cover patterns */
.cover--a { background: linear-gradient(135deg, #efe9de, #e3d9c8); }
.cover--b { background: linear-gradient(135deg, #181715, #2c2a26); }
.cover--c { background: linear-gradient(135deg, #f4e5dd, #e9c7b6); }
.cover--d { background: linear-gradient(135deg, #e4efeb, #cbe3dc); }
[data-theme="dark"] .cover--a { background: linear-gradient(135deg, #2a2724, #201f1c); }
[data-theme="dark"] .cover--c { background: linear-gradient(135deg, #33241e, #241a16); }
[data-theme="dark"] .cover--d { background: linear-gradient(135deg, #1b2a27, #16211f); }

.cover-glyph {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .18em;
  color: rgba(28, 28, 28, .34);
  direction: ltr;
}
.cover--b .cover-glyph { color: rgba(250, 249, 245, .4); }
[data-theme="dark"] .cover-glyph { color: rgba(247, 244, 237, .3); }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}
.filter-btn {
  padding: 8px 17px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  min-height: 40px;
  transition: background-color .2s ease, color .2s ease;
}
.filter-btn:hover { color: var(--ink); background: var(--surface-card); }
.filter-btn.is-active { background: var(--surface-strong); color: var(--ink); }
[data-theme="dark"] .filter-btn.is-active { background: var(--surface-strong); }

.is-hidden { display: none !important; }

.empty-state {
  padding: var(--s-8) var(--s-5);
  text-align: center;
  border: 1px dashed var(--hairline);
  border-radius: var(--r-lg);
  color: var(--muted);
}

/* ---------- 12. Page hero (inner pages) ---------- */
.page-hero {
  padding-block: clamp(48px, 7vw, 80px) var(--s-7);
  border-bottom: 1px solid var(--hairline);
}
.page-hero__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--s-5);
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  color: var(--muted-soft);
  margin-bottom: var(--s-3);
}
.breadcrumb a:hover { color: var(--ink); }

/* ---------- 13. CTA band ---------- */
.cta-band {
  position: relative;
  background: var(--surface-dark);
  border-radius: var(--r-2xl);
  padding: clamp(40px, 6vw, 72px);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s-6);
}
.cta-band::after {
  content: "";
  position: absolute;
  inset-inline-start: -60px;
  bottom: -90px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(204, 120, 92, .3), transparent 66%);
  pointer-events: none;
}
.cta-band > * { position: relative; z-index: 1; }
.cta-band h2 { color: var(--on-dark); }
.cta-band p { color: var(--on-dark-soft); margin-top: var(--s-3); max-width: 460px; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

/* ---------- 14. Footer ---------- */
.footer {
  background: var(--surface-soft);
  color: var(--muted);
  margin-top: var(--s-9);
  border-top: 1px solid var(--hairline);
  padding-top: var(--s-8);
}
.footer__top {
  display: grid;
  grid-template-columns: 1.7fr 1fr 1fr 1fr;
  gap: var(--s-6);
  padding-bottom: var(--s-7);
}
.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--s-3);
}
.footer__about { font-size: 14px; max-width: 340px; line-height: 2.05; }
.footer__col h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--s-4);
}
.footer__col li { margin-bottom: 13px; }
.footer__col a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--muted);
  transition: color .2s ease;
}
.footer__col a svg { width: 16px; height: 16px; flex: none; opacity: .65; }
.footer__col a:hover { color: var(--coral); }
.footer__col a:hover svg { opacity: 1; }
.footer__tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: var(--coral);
  color: #fff;
}

/* Circular social buttons, used on the dark availability card */
.footer__socials { display: flex; gap: var(--s-2); margin-top: var(--s-5); }
.footer__socials a {
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(250, 249, 245, .14);
  display: grid;
  place-items: center;
  color: var(--on-dark-soft);
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.footer__socials a:hover { background: var(--surface-dark-elev); color: var(--on-dark); border-color: rgba(250, 249, 245, .3); }
.footer__socials svg { width: 17px; height: 17px; }

.footer__bottom {
  border-top: 1px solid var(--hairline);
  padding-block: var(--s-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  font-size: 13px;
}
.footer__bottom a:hover { color: var(--coral); }
.to-top {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  cursor: pointer;
  background: var(--canvas);
  color: var(--muted);
  font-size: 13px;
  min-height: 40px;
}
.to-top:hover { color: var(--ink); border-color: var(--hairline-strong); }
.to-top svg { width: 14px; height: 14px; }

/* ---------- 15. Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: var(--s-6);
  align-items: start;
}

.form-card {
  background: var(--surface-card);
  border-radius: var(--r-xl);
  padding: clamp(26px, 3.5vw, 44px);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--s-4); }
.field label { font-size: 14px; font-weight: 500; color: var(--ink); }
.field label .req { color: var(--coral); }
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 15px;
  font-size: 15px;
  color: var(--ink);
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
  min-height: 46px;
}
.field textarea { min-height: 148px; resize: vertical; line-height: 1.9; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c6a64' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 16px;
  padding-inline-start: 42px;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--muted-soft); }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--hairline-strong);
  box-shadow: var(--shadow-focus);
}
.field__error {
  font-size: 12.5px;
  color: #c64545;
  display: none;
}
.field.has-error input,
.field.has-error textarea,
.field.has-error select { border-color: #c64545; }
.field.has-error .field__error { display: block; }

.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-top: var(--s-5);
}

.form-success {
  display: none;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: rgba(93, 184, 166, .14);
  color: var(--ink);
  font-size: 14.5px;
  margin-bottom: var(--s-4);
}
.form-success.is-visible { display: flex; }
.form-success svg { width: 19px; height: 19px; color: var(--teal); flex: none; margin-top: 3px; }

.info-card {
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  margin-bottom: var(--s-3);
  transition: border-color .2s ease, background-color .2s ease;
}
.info-card:hover { border-color: var(--hairline-strong); background: var(--surface-card); }
.info-card__icon {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--surface-card);
  color: var(--coral);
  display: grid;
  place-items: center;
}
.info-card:hover .info-card__icon { background: var(--canvas); }
.info-card__icon svg { width: 18px; height: 18px; }
.info-card__label { font-size: 13px; color: var(--muted-soft); }
.info-card__value { font-size: 15.5px; font-weight: 500; color: var(--ink); word-break: break-word; }
.info-card__value.ltr { direction: ltr; text-align: start; font-family: var(--font-mono); font-size: 14px; }

.availability {
  border-radius: var(--r-lg);
  padding: 24px;
  background: var(--surface-dark);
  color: var(--on-dark-soft);
  margin-top: var(--s-4);
}
.availability h4 { color: var(--on-dark); font-size: 16px; margin-bottom: var(--s-2); }
/* .dot sets width/height, so the row must be a flex container or the dot
   collapses to a sliver as an inline box. */
.availability__row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--on-dark);
  font-size: 15.5px;
  font-weight: 500;
  margin-bottom: var(--s-3);
}
.availability p { font-size: 14px; line-height: 1.9; }

/* FAQ */
.faq { max-width: 800px; margin-inline-start: 0; margin-inline-end: auto; }
.faq-item { border-bottom: 1px solid var(--hairline); }
.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: 22px 4px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: start;
  font-size: 16.5px;
  font-weight: 500;
  color: var(--ink);
  min-height: 56px;
}
.faq-q svg { width: 17px; height: 17px; flex: none; color: var(--muted); transition: transform .25s ease; }
.faq-item.is-open .faq-q svg { transform: rotate(45deg); color: var(--coral); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease;
}
.faq-a p { padding: 0 4px 22px; font-size: 15px; color: var(--muted); }

/* Newsletter */
.newsletter {
  background: var(--surface-card);
  border-radius: var(--r-2xl);
  padding: clamp(32px, 5vw, 56px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-6);
  align-items: center;
}
.newsletter > * { min-width: 0; }
.newsletter form { display: flex; gap: var(--s-2); flex-wrap: wrap; min-width: 0; }
.newsletter input {
  flex: 1 1 240px;
  min-width: 0;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 15px;
  min-height: 46px;
}
.newsletter input:focus { outline: none; border-color: var(--hairline-strong); box-shadow: var(--shadow-focus); }

/* ---------- 16. Reveal ----------
   Progressive enhancement: content stays visible when JS is unavailable.
   The `js` class is added to <html> by an inline script in each page head. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s cubic-bezier(.22, 1, .36, 1), transform .7s cubic-bezier(.22, 1, .36, 1);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- 17. Responsive ---------- */
@media (max-width: 1024px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__text { max-width: none; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .social-grid { grid-template-columns: repeat(2, 1fr); }
  .article-grid { grid-template-columns: repeat(2, 1fr); }
  .article-featured { grid-template-columns: 1fr; }
  .article-featured__cover { min-height: 220px; }
  .contact-grid { grid-template-columns: 1fr; }
  .footer__top { grid-template-columns: 1fr 1fr; row-gap: var(--s-7); }
  .newsletter { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .cta-band { grid-template-columns: 1fr; }
  .page-hero__grid { grid-template-columns: 1fr; align-items: start; }
}

@media (max-width: 640px) {
  :root { --header-h: 64px; }
  .container { padding-inline: 20px; }
  .section { padding-block: var(--s-8); }
  .grid-3, .grid-2, .article-grid, .social-grid, .form-row { grid-template-columns: 1fr; }
  .tools { flex-direction: column; align-items: flex-start; padding: 22px; }
  .hero__actions .btn { flex: 1 1 100%; }
  .footer__top { grid-template-columns: 1fr; }
  .footer__bottom { justify-content: center; text-align: center; }
  .footer__top { row-gap: var(--s-6); }
  .skill-card { padding: 26px; }
  .newsletter { padding: 26px 20px; }
  .newsletter form { flex-direction: column; align-items: stretch; }
  .newsletter input { flex: none; width: 100%; }
  .newsletter form .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tabbar { transition: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- 18. Learning box ---------- */
.tools + .tools { margin-top: var(--s-4); }
.tools__label .accent { color: var(--coral); }

/* ---------- 19. Projects ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
}
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: var(--s-5);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), box-shadow .3s ease, border-color .3s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-soft);
  border-color: var(--hairline-strong);
}
.project-card__thumb {
  width: 70px; height: 70px;
  border-radius: 19px;
  overflow: hidden;
  flex: none;
  margin-bottom: var(--s-4);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .12);
}
.project-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-card__title {
  font-size: 17.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -.015em;
}
.project-card__desc { font-size: 14px; color: var(--muted); line-height: 1.9; flex: 1; }
.project-card__foot { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-4); }

/* ---------- 20. Article page ---------- */
.prose {
  max-width: 740px;
  margin-inline-start: 0;
  margin-inline-end: auto;
  font-size: 16.5px;
  line-height: 2.15;
  color: var(--body);
}
.prose > * + * { margin-top: var(--s-5); }
.prose h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.025em;
  line-height: 1.4;
  margin-top: var(--s-7);
}
.prose h3 {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin-top: var(--s-6);
}
.prose ul, .prose ol { padding-inline-start: 0; }
.prose li {
  position: relative;
  padding-inline-start: 22px;
  margin-bottom: 12px;
}
.prose ul li::before {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  top: 15px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--coral);
}
.prose ol { counter-reset: n; }
.prose ol li { counter-increment: n; }
.prose ol li::before {
  content: counter(n) ".";
  position: absolute;
  inset-inline-start: 0;
  color: var(--coral);
  font-family: var(--font-mono);
  font-size: 13px;
  top: 4px;
}
.prose blockquote {
  border-inline-start: 3px solid var(--coral);
  background: var(--surface-soft);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 16px;
}
.prose pre {
  background: var(--surface-dark);
  color: #e8e3d8;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.9;
}
.prose code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  direction: ltr;
  display: inline-block;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose img { width: 100%; border-radius: var(--r-lg); display: block; }
.prose hr { border: 0; border-top: 1px solid var(--hairline); margin-block: var(--s-6); }

.article-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
  font-size: 13.5px;
  color: var(--muted);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: var(--s-6);
}
.article-author {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  color: var(--ink);
}
.article-author img {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
}
.article-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: var(--s-6);
  display: grid;
  place-items: center;
}
.article-cover .cover-glyph { font-size: clamp(15px, 2.4vw, 22px); }
.share-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--hairline);
}

@media (max-width: 1024px) {
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .project-grid { grid-template-columns: 1fr; }
  .service-item { grid-template-columns: 1fr auto; gap: var(--s-3); padding: 20px 6px; }
  .service-item__icon { display: none; }
  .prose pre { padding: var(--s-4); font-size: 12.5px; }
}

/* ============================================================
   21. Backend-driven additions
   Article blocks · terminal page · magic star · in-progress badge
   ============================================================ */

/* ---------- "in progress" badge (ML / AI wording) ---------- */
.wip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  color: var(--coral-active);
  background: var(--coral-soft);
  border: 1px solid rgba(204, 120, 92, .22);
  vertical-align: middle;
  white-space: nowrap;
}
[data-theme="dark"] .wip-badge {
  color: var(--coral);
  background: rgba(224, 142, 112, .12);
  border-color: rgba(224, 142, 112, .28);
}
.tools__label .wip-badge { margin-inline-start: 6px; }

/* ---------- image covers ---------- */
.article-card__cover--img,
.article-cover--img { padding: 0; overflow: hidden; }
.article-card__cover--img img,
.article-cover--img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.footer__icon-img { border-radius: 5px; opacity: .85; }

/* ---------- prose: small text ---------- */
.prose .prose-small {
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--muted);
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--hairline);
}

/* ---------- circled headings ---------- */
.prose .circle-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--s-6) 0 var(--s-3);
  font-family: var(--font-fa);
  font-size: 19.5px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--ink);
}
.circle-head__num {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: var(--coral-active);
  background: var(--coral-soft);
  border: 1px solid rgba(204, 120, 92, .28);
}
[data-theme="dark"] .circle-head__num {
  color: var(--coral);
  background: rgba(224, 142, 112, .13);
  border-color: rgba(224, 142, 112, .3);
}

/* ---------- code field with copy button ---------- */
.code-field {
  margin: var(--s-5) 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-dark);
  overflow: hidden;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, .05));
}
.code-field__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px 14px;
  background: var(--surface-dark-elev);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.code-field__file {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--on-dark-soft);
}
.code-field__copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-fa);
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  color: var(--on-dark-soft);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}
.code-field__copy:hover { color: var(--on-dark); background: rgba(255, 255, 255, .1); }
.code-field__copy svg { width: 14px; height: 14px; }
.code-field__copy.is-copied { color: var(--teal); border-color: rgba(93, 184, 166, .4); }
.code-field__body {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
}
.code-field__body code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--on-dark);
  white-space: pre;
  background: none;
  padding: 0;
}

/* ---------- pull quote ---------- */
.prose .pull-quote {
  position: relative;
  margin: var(--s-6) 0;
  padding: var(--s-5) var(--s-6) var(--s-5) var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface-soft);
  border-inline-start: 3px solid var(--coral);
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.85;
  color: var(--ink);
}
.prose .pull-quote::before {
  content: "”";
  position: absolute;
  inset-inline-start: 14px;
  top: 2px;
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1;
  color: var(--coral);
  opacity: .32;
}

/* ---------- summary buttons ---------- */
.summary-box {
  margin: var(--s-6) 0;
  padding: var(--s-5);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-xl);
  background: var(--surface-soft);
}
.summary-box__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: var(--s-3);
}
.summary-box__row { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ============================================================
   Terminal page
   ============================================================ */
.term-page {
  padding: calc(var(--header-h) + var(--s-7)) 0 var(--s-8);
  position: relative;
  overflow: hidden;
}
.term-head { text-align: center; margin-bottom: var(--s-6); }
.term-head .badge { margin: 0 auto var(--s-3); }
.term-head__title { margin: 0 0 var(--s-3); }
.term-head__lead { margin: 0 auto; max-width: 560px; }

.term {
  max-width: 820px;
  margin: 0 auto;
  border-radius: var(--r-2xl);
  overflow: hidden;
  background: var(--surface-dark);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, .55);
}
.term__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-dark-elev);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.term__bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  flex: none;
}
.term__bar i:first-child { background: #e05a4e; }
.term__bar i:nth-child(2) { background: var(--amber); }
.term__bar i:nth-child(3) { background: var(--teal); }
.term__file {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--on-dark-soft);
  margin-inline-start: 6px;
}
.term__live {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--on-dark-soft);
}
.term__live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  animation: term-pulse 1.9s ease-in-out infinite;
}
@keyframes term-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.term__screen {
  padding: 18px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(204, 120, 92, .12), transparent 60%),
    var(--surface-dark);
}
.term__out {
  min-height: 210px;
  max-height: 340px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.95;
  color: var(--on-dark);
  direction: rtl;
}
.term__line { padding: 2px 0; word-break: break-word; }
.term__line--sys { color: var(--on-dark-soft); }
.term__line--ok { color: var(--teal); }
.term__line--err { color: #ef8b7d; }
.term__line--echo { display: flex; gap: 8px; align-items: baseline; direction: ltr; }
.term__echo-prompt { color: var(--coral); flex: none; }

.term__help { margin: 6px 0 4px; display: grid; gap: 4px; }
.term__help-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  color: var(--on-dark-soft);
}
.term__help-row code {
  flex: none;
  min-width: 74px;
  color: var(--coral);
  background: rgba(204, 120, 92, .12);
  border-radius: var(--r-xs);
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  direction: ltr;
}

.term__form {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  direction: ltr;
}
.term__prompt {
  flex: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--coral);
}
.term__prompt b { color: var(--on-dark-soft); font-weight: 400; }
.term__input {
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--on-dark);
  caret-color: var(--coral);
}
.term__input::placeholder { color: rgba(160, 157, 150, .5); }
.term__caret {
  flex: none;
  width: 8px;
  height: 17px;
  background: var(--coral);
  animation: term-caret 1.05s steps(1) infinite;
}
@keyframes term-caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- shortcut help under the terminal ---------- */
.term-help {
  max-width: 820px;
  margin: var(--s-5) auto 0;
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  background: var(--surface-soft);
}
.term-help__label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 10px;
}
.term-help__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 20px;
}
.term-help__list li {
  display: flex;
  align-items: baseline;
  gap: 9px;
  min-width: 0;
}
.term-help__code {
  flex: none;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--r-xs);
  color: var(--coral-active);
  background: var(--coral-soft);
  border: 1px solid rgba(204, 120, 92, .2);
  cursor: pointer;
  direction: ltr;
  transition: background .16s ease, color .16s ease;
}
.term-help__code:hover { background: var(--coral); color: #fff; }
[data-theme="dark"] .term-help__code {
  color: var(--coral);
  background: rgba(224, 142, 112, .12);
  border-color: rgba(224, 142, 112, .26);
}
.term-help__text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
  min-width: 0;
}
.term-help__hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted-soft);
  line-height: 1.85;
}

/* ---------- magic: a polar star crossing the screen ---------- */
.magic-star {
  position: fixed;
  top: 38%;
  left: 0;                 /* physical on purpose: RTL must not flip this */
  margin-left: -140px;
  width: 54px;
  height: 54px;
  color: var(--coral);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  will-change: transform, opacity;
}
.magic-star svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 22px rgba(204, 120, 92, .75));
}
.magic-star__trail {
  position: absolute;
  top: 50%;
  right: 100%;             /* sits behind the star as it travels right */
  width: 190px;
  height: 2px;
  transform: translateY(-50%);
  border-radius: 2px;
  background: linear-gradient(to left, currentColor, transparent);
  opacity: .45;
}
.magic-star.is-flying { animation: magic-fly 2.6s cubic-bezier(.36, 0, .5, 1) forwards; }
@keyframes magic-fly {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg) scale(.45); }
  12%  { opacity: 1; }
  50%  { transform: translate3d(50vw, -70px, 0) rotate(200deg) scale(1.2); }
  88%  { opacity: 1; }
  100% { opacity: 0; transform: translate3d(calc(100vw + 260px), 40px, 0) rotate(400deg) scale(.5); }
}

@media (max-width: 860px) {
  .term-help__list { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .term-page { padding-top: calc(var(--header-h) + var(--s-5)); }
  .term__screen { padding: 14px; }
  .term__out { min-height: 180px; font-size: 12.5px; }
  .term__prompt { font-size: 11.5px; }
  .prose .pull-quote { font-size: 18.5px; padding: var(--s-4); }
}
@media (prefers-reduced-motion: reduce) {
  .term__caret, .term__live .dot { animation: none; }
  .magic-star.is-flying { animation-duration: 1.6s; }
}


/* ============================================================
   22. Header music button + soft navigation
   ============================================================ */
.music-btn { position: relative; }
.music-btn__on { display: none; }
.music-btn.is-playing .music-btn__on { display: block; }
.music-btn.is-playing .music-btn__off { display: none; }
.music-btn.is-playing { color: var(--coral); border-color: rgba(204, 120, 92, .45); }
.music-btn__ring {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1px solid rgba(204, 120, 92, .55);
  opacity: 0;
  pointer-events: none;
}
.music-btn.is-playing .music-btn__ring { animation: music-pulse 1.9s ease-out infinite; }
@keyframes music-pulse {
  0%   { opacity: .75; transform: scale(.85); }
  70%  { opacity: 0;   transform: scale(1.3); }
  100% { opacity: 0;   transform: scale(1.3); }
}

/* --- navigation progress line: replaces the browser's loading spinner ---
   Sits above the sticky header (z-index 60) and the mobile tabbar (70).
   The inner bar is anchored with a PHYSICAL right, so in this RTL document it
   grows from the right edge towards the left, which reads naturally in Farsi. */
.nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.nav-progress.is-active { opacity: 1; }
.nav-progress__bar {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 0;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(to left, var(--coral), var(--amber) 55%, var(--coral));
  box-shadow: 0 0 12px rgba(204, 120, 92, .7), 0 0 4px rgba(204, 120, 92, .9);
  transition: width .24s cubic-bezier(.2, .6, .3, 1);
}
.nav-progress.is-done .nav-progress__bar { transition: width .18s ease-out; }

@media (max-width: 640px) {
  .nav-progress { height: 2.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-progress__bar { transition: width .1s linear; }
  .music-btn.is-playing .music-btn__ring { animation: none; }
}

/* ---------- 24. Files page: cards + password sheet ---------- */
.file-card .article-card__tag { display: inline-flex; align-items: center; gap: 5px; }
.file-card .article-card__tag svg { width: 12px; height: 12px; flex: none; }
/* A real button, not a text link: fills on hover, the arrow dips down. */
.file-dl {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease,
              transform .16s ease, box-shadow .22s ease;
}
.file-dl svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform .26s cubic-bezier(.2, .8, .3, 1);
}
.file-dl:hover {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--coral) 26%, transparent);
}
.file-dl:hover svg { transform: translateY(3px); }
.file-dl:active { transform: translateY(1px) scale(.985); }
.file-dl:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.file-dl.is-busy { opacity: .6; pointer-events: none; }
.file-dl.is-locked svg { transform: none; }

/* The sheet speaks the same language as the floating mobile tab bar:
   a glass pill, inset from the edges, sitting at the bottom. */
.pass-sheet { position: fixed; inset: 0; z-index: 120; display: none; }
.pass-sheet.is-open { display: block; }
/* Hard guarantee: a closed sheet can never sit in the page flow, even if
   this stylesheet is missing or stale. */
.pass-sheet[hidden] { display: none; }
.pass-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 11, 10, .4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: pass-fade .22s ease both;
}
.pass-sheet__inner {
  position: absolute;
  inset-inline: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  margin-inline: auto;
  max-width: 460px;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 23px;
  background: color-mix(in srgb, var(--canvas) 80%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--hairline);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
  animation: pass-rise .3s cubic-bezier(.2, .8, .3, 1) both;
}
.pass-sheet__close {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.pass-sheet__close svg { width: 14px; height: 14px; }
.pass-sheet__close:hover { color: var(--ink); background: var(--surface-card); }
.pass-sheet__head { display: flex; align-items: center; gap: 11px; padding-inline-end: 34px; }
.pass-sheet__icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--coral-soft);
  color: var(--coral);
}
.pass-sheet__icon svg { width: 18px; height: 18px; }
.pass-sheet__title { display: block; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.pass-sheet__name { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pass-sheet__row { display: flex; gap: 8px; }
.pass-sheet__input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding-inline: 14px;
  border-radius: 15px;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: .08em;
}
.pass-sheet__input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-soft);
}
.pass-sheet__go {
  height: 46px;
  padding-inline: 20px;
  border: 0;
  border-radius: 15px;
  background: var(--coral);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.pass-sheet__go:hover { background: var(--coral-active); }
.pass-sheet__msg { min-height: 17px; margin: 0; font-size: 12.5px; color: var(--muted); }
.pass-sheet__msg.is-error { color: #c0533b; }
.pass-sheet__msg.is-ok { color: #2f8d78; }
.pass-sheet.is-shake .pass-sheet__inner { animation: pass-shake .34s ease both; }
@keyframes pass-rise {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes pass-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pass-shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}
@media (max-width: 860px) {
  /* Lift it above the tab bar so both stay reachable. */
  .pass-sheet__inner { bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .pass-sheet__inner, .pass-sheet__backdrop { animation-duration: .01ms; }
}

/* ---------- 25. Mobile polish: tap feedback, code card, password sheet ---------- */

/* 1a. No blue flash on tap. The native highlight square is removed and
   replaced by our own :active transforms, so touch still feels responsive. */
html { -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, label, summary,
[role="button"], [tabindex] { -webkit-tap-highlight-color: transparent; }
button, [role="button"], .btn, .btn-icon, .chip, .tabbar__item, .file-dl,
.pass-sheet__close, .pass-sheet__go { -webkit-touch-callout: none; }
.tabbar__item { transition: transform .16s ease, background-color .2s ease, color .2s ease; }
.tabbar__item:active { transform: scale(.94); }
.btn-icon:active { transform: scale(.93); }
.chip:active { transform: scale(.97); }
.file-dl:active, .pass-sheet__go:active { transform: translateY(1px) scale(.985); }

/* 1b. Nothing may push the layout sideways on a narrow screen. */
.hero__text, .hero__grid > * { min-width: 0; }
.hero__title, .lead { overflow-wrap: break-word; }
.code-card, .code-card__body { min-width: 0; }
.code-card__body {
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  /* The code font follows the screen width, so the window never needs a
     sideways drag on a phone. */
  .code-card { padding: 11px; }
  .code-card__bar { padding: 3px 6px 10px; }
  .code-card__body { padding: 15px 13px; }
  .code-card pre { font-size: clamp(9px, 2.5vw, 13px); line-height: 1.8; }
  .code-card__foot { padding: 11px 6px 3px; }
  .code-card__file { font-size: 10.5px; }
  /* Buttons keep their natural width instead of stretching edge to edge. */
  .hero__actions { gap: 10px; }
  .hero__actions .btn { flex: 0 1 auto; }
  .btn { padding: 11px 18px; font-size: 14.5px; }
  .btn--sm { padding: 8px 14px; font-size: 13.5px; }
}

/* 3. Password sheet: the close button used to sit on the same side as the
   lock icon and overlapped it on narrow screens. Opposite corner now. */
.pass-sheet__close {
  inset-inline-start: auto;
  inset-inline-end: 12px;
  width: 34px;
  height: 34px;
}
.pass-sheet__head { padding-inline-end: 48px; padding-inline-start: 0; }
/* The hint text is Persian: a monospace family has no glyphs for it, so the
   browser fell back to an unstyled system font. */
.pass-sheet__input::placeholder {
  font-family: var(--font-fa);
  font-size: 13.5px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted-soft);
  opacity: 1;
}
.pass-sheet__input:placeholder-shown {
  font-family: var(--font-fa);
  letter-spacing: 0;
}

@media (max-width: 640px) {
  .pass-sheet__inner { padding: 18px 16px 16px; }
  .pass-sheet__head { padding-inline-end: 46px; }
  .pass-sheet__row { gap: 7px; }
  .pass-sheet__go { padding-inline: 17px; }
  .pass-sheet__close { top: 13px; }
}
