@charset "UTF-8";
/* ============================================================================
   2DSYS — One Atom Thick
   Design system for 2dsys.com  ·  Graphene & 2D materials · Dr. Maryam Riyahi
   Single stylesheet serving both the RTL (fa) and LTR (en) builds.
   ========================================================================== */

/* ---------------------------------------------------------------- 1. Fonts */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn-arabic.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011,
    U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/spacegrotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plexmono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/plexmono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------- 2. Tokens */

:root,
:root[data-theme="dark"] {
  --color-bg: #030504;
  --color-surface: #090c0a;
  --color-surface-elevated: #101411;
  --color-text: #f2f6f2;
  --color-muted: #929c96;
  --color-line: rgba(242, 246, 242, 0.13);
  --color-line-soft: rgba(242, 246, 242, 0.07);
  --color-accent: #c8ff45;
  --color-accent-soft: #9fda3d;
  --color-photon: #5de4ff;
  --color-error: #ff6b5f;

  /* Accent applied to text and hairlines. On the dark theme it is the brand
     lime itself; on the light theme it darkens so it stays readable. */
  --color-accent-ink: #c8ff45;
  --color-line-strong: rgba(242, 246, 242, 0.3);
  --color-hover: rgba(242, 246, 242, 0.035);
  --color-edge: rgba(242, 246, 242, 0.16);
  --color-veil: rgba(3, 5, 4, 0.72);
  --color-well: #050806;
  --tint-accent: rgba(200, 255, 69, 0.035);
  --color-brand-node: #c8ff45;

  /* consumed by graphene-scene.js */
  --scene-ink: #f2f6f2;
  --scene-accent: #c8ff45;
  --scene-photon: #5de4ff;
  --scene-ink-alpha: 1;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --color-bg: #f3f6f2;
  --color-surface: #eaefe8;
  --color-surface-elevated: #ffffff;
  --color-text: #0a0f0b;
  --color-muted: #566056;
  --color-line: rgba(10, 15, 11, 0.16);
  --color-line-soft: rgba(10, 15, 11, 0.08);
  --color-accent: #c8ff45;
  --color-accent-soft: #b6ef2c;
  --color-photon: #0b6b85;
  --color-error: #c0392f;

  --color-accent-ink: #4c7a0b;
  --color-line-strong: rgba(10, 15, 11, 0.36);
  --color-hover: rgba(10, 15, 11, 0.04);
  --color-edge: rgba(10, 15, 11, 0.18);
  --color-veil: rgba(243, 246, 242, 0.78);
  --color-well: #ffffff;
  --tint-accent: rgba(120, 170, 20, 0.07);
  --color-brand-node: #7fb400;

  --scene-ink: #0a0f0b;
  --scene-accent: #6f9e00;
  --scene-photon: #0b6b85;
  --scene-ink-alpha: 0.5;

  color-scheme: light;
}

:root {
  --font-display: "Space Grotesk", "Vazirmatn", system-ui, sans-serif;
  --font-body: "Inter", "Vazirmatn", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --line-body: 1.62;
  --tracking-display: -0.02em;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 0.5s;
  --dur-2: 0.7s;
  --dur-3: 1s;

  --shell: 1440px;
  --gutter: clamp(20px, 5vw, 72px);
  --header-h: 72px;
  --radius: 2px;

  --step-label: 0.6875rem;
  --step-small: 0.8125rem;
  --step-body: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  --step-lead: clamp(1.0625rem, 1rem + 0.4vw, 1.3125rem);
  --step-h3: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);
  --step-h2: clamp(1.75rem, 1.2rem + 2.6vw, 3.35rem);
  --step-h1: clamp(2.05rem, 0.6rem + 4.4vw, 4.4rem);
  --step-huge: clamp(3rem, 1rem + 9vw, 8rem);
}

html[lang="fa"] {
  --font-display: "Vazirmatn", system-ui, sans-serif;
  --font-body: "Vazirmatn", system-ui, sans-serif;
  --line-body: 1.95;
  --tracking-display: 0;
  --step-h1: clamp(1.7rem, 0.9rem + 3.5vw, 3.5rem);
  --step-h2: clamp(1.5rem, 1.1rem + 2vw, 2.8rem);
}

@media (min-width: 1921px) {
  :root { --shell: 1560px; }
}

/* ---------------------------------------------------------------- 3. Reset */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--step-body);
  line-height: var(--line-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: 1.08; }
p, figure, figcaption, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

::selection { background: var(--color-accent); color: #071006; }

:focus-visible {
  outline: 2px solid var(--color-accent-ink);
  outline-offset: 3px;
  border-radius: var(--radius);
}
:focus:not(:focus-visible) { outline: none; }

/* ------------------------------------------------------------- 4. Utilities */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: -100px;
  z-index: 200;
  padding: 12px 20px;
  background: var(--color-accent);
  color: #071006;
  font-family: var(--font-mono);
  font-size: var(--step-small);
  text-decoration: none;
  transition: inset-block-start 0.2s var(--ease);
}
.skip-link:focus { inset-block-start: 12px; }

.mono {
  font-family: var(--font-mono);
  font-size: var(--step-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
  font-feature-settings: "zero" 1;
}

.lead {
  font-size: var(--step-lead);
  color: var(--color-muted);
  max-width: 62ch;
}
html[lang="fa"] .lead { max-width: 58ch; }

.accent { color: var(--color-accent-ink); }

/* ------------------------------------------------------------ 5. Reveal FX */

/* Elements start visible. The `reveal-on` class — set by a tiny inline script
   and removed again if the main bundle never boots — is what opts them into
   the hidden start state, so a JS failure can never hide the content. */

[data-reveal] {
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
html.reveal-on [data-reveal]:not(.is-in) {
  opacity: 0;
  transform: translateY(18px);
}

.clip-reveal > span { display: block; overflow: hidden; }
.clip-reveal > span > span {
  display: block;
  transition: transform var(--dur-3) var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
html.reveal-on .clip-reveal:not(.is-in) > span > span { transform: translateY(102%); }

/* Bonds drawn on section entry */
.draw-bond { transition: stroke-dashoffset 1.1s var(--ease); transition-delay: var(--reveal-delay, 0ms); }
html.reveal-on [data-draw]:not(.is-in) .draw-bond {
  stroke-dasharray: var(--len, 200);
  stroke-dashoffset: var(--len, 200);
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal], .clip-reveal > span > span, .draw-bond { transition: none; }
}

/* ---------------------------------------------------------------- 6. Header */

.header {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background-color var(--dur-1) var(--ease),
              backdrop-filter var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease);
  border-block-end: 1px solid transparent;
}
.header.is-stuck {
  background: var(--color-veil);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  border-block-end-color: var(--color-line-soft);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding-block: 8px;
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius);
}
.brand__node, .footer__brand .brand__node { fill: var(--color-brand-node); }
.brand svg { width: 104px; height: 28.5px; }
.brand .brand__mark { transition: transform var(--dur-2) var(--ease); transform-origin: 24px 25px; }
.brand:hover .brand__mark { transform: rotate(-12deg); }
@media (prefers-reduced-motion: reduce) {
  .brand:hover .brand__mark { transform: none; }
}

.nav { margin-inline-start: auto; }
.nav__list { display: flex; align-items: center; gap: clamp(4px, 1.1vw, 18px); }
.nav__link {
  position: relative;
  display: block;
  padding: 13px 8px;
  font-size: 0.8125rem;
  color: var(--color-muted);
  text-decoration: none;
  letter-spacing: 0.005em;
  transition: color var(--dur-1) var(--ease);
  white-space: nowrap;
}
.nav__link::after {
  content: "";
  position: absolute;
  inset-block-end: 6px;
  inset-inline-start: 8px;
  width: 0;
  height: 1px;
  background: var(--color-accent-ink);
  transition: width var(--dur-1) var(--ease);
}
.nav__link:hover, .nav__link:focus-visible { color: var(--color-text); }
.nav__link:hover::after { width: calc(100% - 16px); }
.nav__link[aria-current="true"] { color: var(--color-text); }
.nav__link[aria-current="true"]::after {
  width: calc(100% - 16px);
  background: var(--color-accent-ink);
}

.header__end { display: flex; align-items: center; gap: 10px; flex: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  font-family: var(--font-mono);
  font-size: var(--step-label);
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  min-height: 44px;
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.lang-switch:hover { color: var(--color-text); border-color: var(--color-line-strong); }
.lang-switch span { padding-inline: 7px; }
.lang-switch .is-active { color: var(--color-text); }

/* Mobile menu button */
.menu-btn {
  display: none;
  width: 44px; height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}
.menu-btn__bars { display: block; width: 18px; height: 10px; position: relative; }
.menu-btn__bars::before, .menu-btn__bars::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 1.5px;
  background: var(--color-text);
  transition: transform var(--dur-1) var(--ease), top var(--dur-1) var(--ease), opacity 0.2s;
}
.menu-btn__bars::before { top: 0; }
.menu-btn__bars::after { top: 8.5px; }
.menu-btn[aria-expanded="true"] .menu-btn__bars::before { top: 4px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__bars::after { top: 4px; transform: rotate(-45deg); }

/* Fullscreen mobile menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-h) + 24px) var(--gutter) 40px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), visibility var(--dur-1);
}
.mobile-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.mobile-menu__list { display: flex; flex-direction: column; gap: 2px; }
.mobile-menu__link {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 7vw, 2.25rem);
  letter-spacing: var(--tracking-display);
  text-decoration: none;
  border-block-end: 1px solid var(--color-line-soft);
}
.mobile-menu__link i {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-style: normal;
  color: var(--color-accent-ink);
  letter-spacing: 0.1em;
}
.mobile-menu__foot {
  margin-block-start: 36px;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

/* Narrow phones: the logo, language switch and two buttons must still fit
   inside 320px without pushing the document wider than the viewport. */
@media (max-width: 400px) {
  .header__inner { gap: 8px; }
  .header__end { gap: 6px; }
  .brand { padding-block: 11px; }
  .brand svg { width: 84px; height: 23px; }
  .header__end .lang-switch span { padding-inline: 4px; }
  .header__end .lang-switch { padding-inline: 2px; }
}

@media (max-width: 1080px) {
  .nav { display: none; }
  .menu-btn { display: inline-flex; }
  /* With the nav hidden, push the whole control cluster (language, theme,
     menu) to the opposite edge from the logo. */
  .header__end { gap: 8px; margin-inline-start: auto; }
}
@media (min-width: 1081px) {
  .mobile-menu { display: none; }
}

/* ------------------------------------------------------- 7. Scroll progress */

.scroll-rail {
  position: fixed;
  inset-inline-end: 22px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.scroll-rail__track {
  position: relative;
  width: 1px;
  height: 132px;
  background: var(--color-line);
  overflow: hidden;
}
.scroll-rail__fill {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 100%;
  background: var(--color-accent-ink);
  transform: scaleY(var(--p, 0));
  transform-origin: top;
}
.scroll-rail__num {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--color-muted);
}
@media (max-width: 1200px) { .scroll-rail { display: none; } }

/* ------------------------------------------------------------------ 8. Hero */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: calc(var(--header-h) + 48px) 96px;
  isolation: isolate;
  overflow: clip;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--scene-opacity, 1);
  transition: opacity 0.45s linear;
}
.scene__canvas, .scene__fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.scene__fallback { object-fit: cover; opacity: 0.85; }
.scene__canvas { display: none; }
.scene.is-live .scene__canvas { display: block; }
.scene.is-live .scene__fallback { display: none; }

.hero__grid { display: grid; gap: clamp(20px, 3vw, 30px); }

.hero__label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  color: var(--color-accent-ink);
}
.hero__label::before {
  content: "";
  width: 26px; height: 1px;
  background: currentColor;
  flex: none;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--step-h1);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.04;
  max-width: 26ch;
  text-wrap: balance;
}
html[lang="fa"] .hero__title { line-height: 1.5; max-width: 30ch; font-weight: 600; }
.hero__title em { font-style: normal; color: var(--color-muted); }

.hero__desc { max-width: 56ch; color: var(--color-muted); font-size: var(--step-lead); }
html[lang="fa"] .hero__desc { max-width: 52ch; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block-start: 8px; }

.hero__hint {
  position: absolute;
  inset-block-end: 30px;
  inset-inline-start: var(--gutter);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-muted);
}
.hero__hint svg { width: 22px; height: 10px; flex: none; overflow: visible; }
.hero__hint svg line { stroke: var(--color-accent-ink); stroke-width: 1.4; }
.hero__hint .drift { animation: drift 3.6s var(--ease) infinite; }
@keyframes drift {
  0%, 100% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) { .hero__hint .drift { animation: none; } }
@media (max-width: 767px) { .hero__hint { position: static; margin-block-start: 40px; padding-inline: 0; } }

/* --------------------------------------------------------------- 9. Buttons */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--color-text);
  --btn-bd: var(--color-line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 26px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--step-small);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  overflow: hidden;
  /* Own stacking context so the ghost fill can sit behind the label. Without
     it the absolutely-positioned ::before paints over bare text nodes and the
     button reads as empty on hover. */
  isolation: isolate;
  transition: border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease),
              background-color var(--dur-1) var(--ease), transform 0.35s var(--ease);
}
.btn > * { position: relative; z-index: 1; }
.btn__ico { width: 14px; height: 14px; flex: none; }

.btn--primary {
  --btn-bg: var(--color-accent);
  --btn-fg: #071006;
  --btn-bd: var(--color-accent);
  font-weight: 600;
}
.btn--primary:hover { --btn-bg: var(--color-accent-soft); --btn-bd: var(--color-accent-soft); }

.btn--ghost:hover { --btn-bd: var(--color-line-strong); }
.btn--ghost::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-surface-elevated);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--dur-2) var(--ease);
  z-index: -1;
}
.btn--ghost:hover::before { transform: scaleY(1); }

.btn[data-magnetic] { will-change: transform; }
@media (prefers-reduced-motion: reduce) {
  .btn[data-magnetic] { transform: none !important; }
}

/* Inline text link with bond-style underline */
.link {
  position: relative;
  color: var(--color-text);
  text-decoration: none;
  padding-block-end: 2px;
  background-image: linear-gradient(var(--color-accent-ink), var(--color-accent-ink));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.link:hover { background-size: 0% 1px; color: var(--color-accent-ink); }

/* ------------------------------------------------------------- 10. Sections */

.section {
  position: relative;
  padding-block: clamp(84px, 11vw, 168px);
  border-block-start: 1px solid var(--color-line-soft);
}
.section--flush { border-block-start: 0; }

.section__head {
  display: grid;
  gap: clamp(16px, 2vw, 26px);
  margin-block-end: clamp(44px, 6vw, 82px);
}
.section__num {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-muted);
}
.section__num b {
  color: var(--color-accent-ink);
  font-weight: 500;
}
.section__num::after {
  content: "";
  height: 1px;
  flex: 1;
  max-width: 180px;
  background: var(--color-line);
}
.section__title {
  font-family: var(--font-display);
  font-size: var(--step-h2);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  max-width: 20ch;
  text-wrap: balance;
}
html[lang="fa"] .section__title { line-height: 1.5; font-weight: 600; max-width: 24ch; }

/* ------------------------------------------- 11. Fundamental physics (01) */

.physics { display: grid; gap: clamp(28px, 4vw, 44px); }
.physics__intro { max-width: 68ch; color: var(--color-muted); }

.concepts {
  display: grid;
  gap: 1px;
  background: var(--color-line-soft);
  border: 1px solid var(--color-line-soft);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.concept {
  background: var(--color-bg);
  transition: background-color var(--dur-1) var(--ease);
}
.concept[open], .concept:hover { background: var(--color-surface); }

.concept__summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 18px;
  padding: clamp(20px, 2.4vw, 30px);
  min-height: 44px;
}
.concept__summary::-webkit-details-marker { display: none; }
.concept__summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -3px; }

.concept__fig {
  aspect-ratio: 16 / 11;
  width: 100%;
  border: 1px solid var(--color-line-soft);
  background: var(--color-well);
}
.concept__fig svg { width: 100%; height: 100%; }

.concept__row { display: flex; align-items: baseline; gap: 12px; }
.concept__idx { font-family: var(--font-mono); font-size: 0.625rem; color: var(--color-accent-ink); letter-spacing: 0.1em; }
.concept__name {
  font-size: var(--step-h3);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.3;
}
html[lang="fa"] .concept__name { font-weight: 600; }
.concept__sign {
  margin-inline-start: auto;
  width: 13px; height: 13px;
  position: relative;
  flex: none;
  align-self: center;
}
.concept__sign::before, .concept__sign::after {
  content: "";
  position: absolute;
  background: var(--color-muted);
  transition: transform var(--dur-1) var(--ease), background-color var(--dur-1) var(--ease);
}
.concept__sign::before { inset-block-start: 6px; inset-inline: 0; height: 1px; }
.concept__sign::after { inset-inline-start: 6px; inset-block: 0; width: 1px; }
.concept[open] .concept__sign::after { transform: scaleY(0); }
.concept[open] .concept__sign::before { background: var(--color-accent-ink); }

.concept__body {
  padding: 0 clamp(20px, 2.4vw, 30px) clamp(22px, 2.4vw, 30px);
  color: var(--color-muted);
  font-size: var(--step-small);
  line-height: 1.8;
}
html[lang="fa"] .concept__body { line-height: 2.05; }
.concept__body p + p { margin-block-start: 10px; }

/* --------------------------------------------------- 12. Materials (02) */

.materials {
  display: grid;
  gap: clamp(14px, 1.6vw, 20px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.material {
  position: relative;
  display: grid;
  gap: 16px;
  align-content: start;
  padding: clamp(22px, 2.4vw, 30px);
  background: linear-gradient(160deg, var(--color-surface-elevated), var(--color-surface));
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  transform-style: preserve-3d;
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
/* symbolic thickness — the "edge" of a thin flake */
.material::after {
  content: "";
  position: absolute;
  inset-inline: 6px;
  inset-block-end: -4px;
  height: 4px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: linear-gradient(180deg, var(--color-edge), transparent);
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease), inset-block-end var(--dur-2) var(--ease);
}
.material:hover, .material:focus-within {
  transform: perspective(900px) rotateX(3.2deg) translateY(-5px);
  border-color: var(--color-line-strong);
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.9);
}
.material:hover::after, .material:focus-within::after { opacity: 1; inset-block-end: -5px; }
@media (prefers-reduced-motion: reduce) {
  .material:hover, .material:focus-within { transform: none; }
}

.material__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.material__formula {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  padding: 3px 8px;
  border-radius: var(--radius);
}
.material__name {
  font-family: var(--font-display);
  font-size: var(--step-h3);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.2;
}
.material__fig { height: 76px; }
.material__fig svg { width: 100%; height: 100%; overflow: visible; }
.material__desc { color: var(--color-muted); font-size: var(--step-small); line-height: 1.75; }
html[lang="fa"] .material__desc { line-height: 2; }

@media (max-width: 719px) {
  .materials {
    grid-auto-flow: column;
    grid-auto-columns: 79%;
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-block-end: 14px;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scrollbar-width: thin;
    scrollbar-color: var(--color-line) transparent;
    overscroll-behavior-x: contain;
  }
  .material { scroll-snap-align: start; }
}

/* ------------------------------------------------ 13. Applications (03) */

.apps { position: relative; display: grid; gap: 0; }

.app {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: clamp(18px, 3vw, 40px);
  align-items: center;
  padding-block: clamp(24px, 3.2vw, 38px);
  border-block-start: 1px solid var(--color-line-soft);
  transition: background-color var(--dur-2) var(--ease);
}
.app:last-child { border-block-end: 1px solid var(--color-line-soft); }
.app.is-active { background: linear-gradient(90deg, var(--tint-accent), transparent 65%); }
[dir="rtl"] .app.is-active { background: linear-gradient(-90deg, var(--tint-accent), transparent 65%); }

.app__fig { width: 96px; height: 62px; flex: none; }
.app__fig svg { width: 100%; height: 100%; overflow: visible; }
.app__fig .ln { stroke: var(--color-muted); stroke-width: 1.1; fill: none; transition: stroke var(--dur-2) var(--ease); }
.app__fig .nd { fill: var(--color-muted); transition: fill var(--dur-2) var(--ease); }
.app.is-active .app__fig .ln { stroke: var(--color-accent-ink); }
.app.is-active .app__fig .nd { fill: var(--color-accent-ink); }

.app__body { display: grid; gap: 8px; }
.app__title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: var(--step-h3);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.25;
}
html[lang="fa"] .app__title { font-weight: 600; }
.app__title small {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  text-transform: uppercase;
}
.app__desc { color: var(--color-muted); font-size: var(--step-small); line-height: 1.8; max-width: 64ch; }
html[lang="fa"] .app__desc { line-height: 2.05; }

/* photon rail */
.apps__rail {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 47px;
  width: 1px;
  background: var(--color-line-soft);
  overflow: visible;
}
.apps__rail i {
  position: absolute;
  inset-inline-start: -1px;
  inset-block-start: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-photon);
  box-shadow: 0 0 10px 2px rgba(93, 228, 255, 0.55);
  transform: translateY(calc(var(--photon, 0) * 100%));
  will-change: transform;
}
.apps__rail b {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 0;
  display: block;
  height: 100%;
  background: linear-gradient(180deg, rgba(93, 228, 255, 0.5), rgba(200, 255, 69, 0.18));
  transform: scaleY(var(--photon, 0));
  transform-origin: top;
}
@media (max-width: 639px) {
  .app { grid-template-columns: 1fr; gap: 16px; }
  .app__fig { width: 84px; height: 54px; }
  .apps__rail { display: none; }
}

/* --------------------------------------------------- 14. Research (04) */

.matrix {
  display: grid;
  gap: clamp(14px, 1.6vw, 20px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  /* let each domain panel hug its own list instead of stretching to the
     tallest one — the ruled background looks empty when stretched */
  align-items: start;
}

.domain {
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(180deg, var(--color-line-soft) 0 1px, transparent 1px 4px),
    var(--color-surface);
  overflow: hidden;
}
.domain__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px clamp(16px, 2vw, 22px);
  border-block-end: 1px solid var(--color-line);
  background: var(--color-surface-elevated);
}
.domain__head b { color: var(--color-text); font-weight: 500; }
.domain__count { font-family: var(--font-mono); font-size: 0.625rem; color: var(--color-accent-ink); letter-spacing: 0.1em; }

.domain__list { padding: 6px 0; }
.domain__item {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: baseline;
  gap: 10px;
  padding: 11px clamp(16px, 2vw, 22px);
  transition: background-color var(--dur-1) var(--ease);
}
.domain__item:hover { background: var(--color-hover); }
.domain__item i {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.625rem;
  color: var(--color-muted);
  letter-spacing: 0.08em;
}
.domain__item span { font-size: var(--step-small); line-height: 1.5; }
.domain__item span em {
  display: block;
  font-style: normal;
  color: var(--color-muted);
  font-size: 0.75rem;
  margin-block-start: 3px;
}
.domain__item span abbr { text-decoration: none; border-block-end: 1px dotted var(--color-line); }

.research__note {
  margin-block-start: clamp(22px, 3vw, 34px);
  padding-inline-start: 14px;
  border-inline-start: 1px solid var(--color-accent-ink);
  color: var(--color-muted);
  font-size: var(--step-small);
  max-width: 70ch;
}

/* ----------------------------------------------- 15. Publications (05) */

.pubs { display: grid; gap: clamp(14px, 1.6vw, 18px); }

.pub {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(18px, 3vw, 40px);
  padding: clamp(24px, 3vw, 40px);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
              background-color var(--dur-2) var(--ease);
}
.pub:hover, .pub:focus-within {
  transform: translateY(-6px);
  border-color: var(--color-line-strong);
  background: var(--color-surface-elevated);
}
@media (prefers-reduced-motion: reduce) { .pub:hover, .pub:focus-within { transform: none; } }

/* photon trace along the top edge on hover */
.pub::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--color-photon), var(--color-accent), transparent);
  transform: scaleX(0);
  transform-origin: var(--pub-origin, left);
  transition: transform var(--dur-3) var(--ease);
}
[dir="rtl"] .pub { --pub-origin: right; }
.pub:hover::before, .pub:focus-within::before { transform: scaleX(1); }

.pub__idx {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 400;
  line-height: 1;
  color: var(--color-line);
  transition: color var(--dur-2) var(--ease);
  font-feature-settings: "zero" 1;
}
.pub:hover .pub__idx { color: var(--color-accent-ink); }

.pub__body { display: grid; gap: 14px; align-content: start; min-width: 0; }
.pub__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.pub__year {
  font-family: var(--font-mono);
  font-size: var(--step-small);
  color: var(--color-accent-ink);
  letter-spacing: 0.08em;
}
.pub__journal { font-size: var(--step-small); color: var(--color-muted); }
.pub__journal cite { font-style: italic; color: var(--color-text); }

.pub__title {
  font-family: var(--font-display);
  font-size: clamp(1.0625rem, 0.9rem + 0.9vw, 1.6rem);
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: var(--tracking-display);
  color: var(--color-text);
  max-width: 46ch;
}
.pub__authors { font-size: 0.8125rem; color: var(--color-muted); }
.pub__authors b { color: var(--color-text); font-weight: 500; }
.pub__abstract { font-size: var(--step-small); color: var(--color-muted); max-width: 66ch; line-height: 1.8; }
html[lang="fa"] .pub__abstract { line-height: 2.05; }

.pub__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pub__tags li {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 4px 8px;
}
.pub__foot { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-block-start: 4px; }
.pub__doi {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-muted);
  word-break: break-all;
}

.pubs__foot {
  margin-block-start: clamp(26px, 3vw, 40px);
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  justify-content: space-between;
}
.pubs__note { color: var(--color-muted); font-size: var(--step-small); max-width: 52ch; }

@media (max-width: 559px) {
  .pub { grid-template-columns: 1fr; gap: 14px; }
}

/* ------------------------------------------------------- 16. About (06) */

.about {
  display: grid;
  gap: clamp(30px, 5vw, 68px);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 900px) {
  .about { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); }
}

/* Layered "sample" portrait composition — reserved for a real photograph */
.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, var(--color-surface-elevated), var(--color-surface));
  overflow: hidden;
  display: grid;
  place-items: center;
}
.portrait__lattice { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.5; }
.portrait__layers {
  position: relative;
  width: 68%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.portrait__layer {
  position: absolute;
  inset: 0;
  border: 1px solid var(--color-edge);
  border-radius: var(--radius);
  transform: perspective(700px) rotateX(58deg) rotateZ(45deg) translateZ(var(--z, 0px));
  background: color-mix(in srgb, var(--color-text) 5%, transparent);
  transition: transform var(--dur-3) var(--ease);
}
.portrait:hover .portrait__layer { transform: perspective(700px) rotateX(58deg) rotateZ(45deg) translateZ(calc(var(--z, 0px) * 1.55)); }
@media (prefers-reduced-motion: reduce) { .portrait:hover .portrait__layer { transform: perspective(700px) rotateX(58deg) rotateZ(45deg) translateZ(var(--z, 0px)); } }
.portrait__initials {
  position: relative;
  font-family: var(--font-mono);
  font-size: clamp(2.25rem, 7vw, 3.75rem);
  letter-spacing: 0.08em;
  color: var(--color-text);
  mix-blend-mode: normal;
}
.portrait__initials sup {
  font-size: 0.28em;
  vertical-align: super;
  color: var(--color-accent-ink);
  letter-spacing: 0.14em;
}
.portrait__cap {
  position: absolute;
  inset-block-end: 0;
  inset-inline: 0;
  padding: 12px 16px;
  border-block-start: 1px solid var(--color-line);
  background: var(--color-veil);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.about__body { display: grid; gap: clamp(18px, 2.4vw, 26px); }
.about__name {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1rem + 2.2vw, 2.6rem);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.15;
}
html[lang="fa"] .about__name { font-weight: 600; line-height: 1.4; }
.about__name small {
  display: block;
  unicode-bidi: isolate;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-block-start: 10px;
}
.about__roles { display: flex; flex-wrap: wrap; gap: 8px; }
.about__roles li {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-text);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.about__roles li::before { content: "◦ "; color: var(--color-accent-ink); }
.about__text { color: var(--color-muted); max-width: 62ch; }
.about__text p + p { margin-block-start: 14px; }

/* ----------------------------------------------------- 17. Contact (07) */

.contact__title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 1rem + 3.4vw, 4rem);
  font-weight: 500;
  letter-spacing: var(--tracking-display);
  line-height: 1.1;
  max-width: 24ch;
  text-wrap: balance;
}
html[lang="fa"] .contact__title { line-height: 1.45; font-weight: 600; max-width: 22ch; }

.contact__grid {
  margin-block-start: clamp(34px, 5vw, 56px);
  display: grid;
  gap: 1px;
  background: var(--color-line-soft);
  border-block: 1px solid var(--color-line-soft);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.contact__item {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: clamp(20px, 2.6vw, 30px) clamp(16px, 2vw, 26px);
  background: var(--color-bg);
  text-decoration: none;
  min-height: 44px;
  transition: background-color var(--dur-1) var(--ease);
}
.contact__item:hover { background: var(--color-surface); }
.contact__value {
  font-family: var(--font-mono);
  font-size: clamp(0.875rem, 0.8rem + 0.4vw, 1.0625rem);
  color: var(--color-text);
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 8px;
}
.contact__value svg { width: 13px; height: 13px; flex: none; color: var(--color-muted); transition: color var(--dur-1) var(--ease); }
.contact__item:hover .contact__value svg { color: var(--color-accent-ink); }
.contact__cta { margin-block-start: clamp(30px, 4vw, 44px); display: flex; flex-wrap: wrap; gap: 12px; }

/* ------------------------------------------------------------ 18. Footer */

.footer {
  position: relative;
  border-block-start: 1px solid var(--color-line-soft);
  padding-block: clamp(56px, 7vw, 96px) 32px;
  overflow: clip;
}
.footer__lattice {
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 100%;
  width: 100%;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
}
/* dark ink on a light background reads much stronger than light on dark */
:root[data-theme="light"] .footer__lattice { opacity: 0.28; }
.footer__lattice path { transition: opacity 1.4s var(--ease), transform 1.4s var(--ease); }
.footer > * { position: relative; z-index: 1; }

.footer__top {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(24px, 4vw, 48px);
  align-items: flex-start;
  justify-content: space-between;
}
.footer__brand { display: grid; gap: 14px; }
.footer__brand svg { width: 128px; height: 35px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.footer__links a { font-size: var(--step-small); color: var(--color-muted); text-decoration: none; transition: color var(--dur-1) var(--ease); display: inline-flex; align-items: center; min-height: 44px; }
.footer__links a:hover { color: var(--color-text); }

.footer__bottom {
  margin-block-start: clamp(40px, 6vw, 64px);
  padding-block-start: 22px;
  border-block-start: 1px solid var(--color-line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
  justify-content: space-between;
}
.to-top {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding-inline: 4px;
  font-family: var(--font-mono);
  font-size: var(--step-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
  transition: color var(--dur-1) var(--ease);
}
.to-top:hover { color: var(--color-text); }
.to-top svg { width: 11px; height: 13px; }
.to-top:hover svg { animation: nudge 0.7s var(--ease); }
@keyframes nudge { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .to-top:hover svg { animation: none; } }

/* --------------------------------------------------------- 19. 404 page */

.err {
  min-height: 100svh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 22px;
  padding: calc(var(--header-h) + 40px) var(--gutter) 60px;
}
.err__code {
  font-family: var(--font-mono);
  font-size: clamp(3.5rem, 14vw, 8rem);
  line-height: 1;
  color: var(--color-text);
  letter-spacing: 0.02em;
}
.err__code b { color: var(--color-accent-ink); font-weight: 400; }
.err__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ------------------------------------------------------ 20. Shared SVG */

.dg-line { stroke: color-mix(in srgb, var(--color-text) 46%, transparent); stroke-width: 1; fill: none; }
.dg-line--soft { stroke: color-mix(in srgb, var(--color-text) 22%, transparent); }
.dg-line--accent { stroke: var(--color-accent-ink); }
.dg-line--photon { stroke: var(--color-photon); }
.dg-fill { fill: color-mix(in srgb, var(--color-text) 55%, transparent); }
.dg-fill--accent { fill: var(--color-accent-ink); }
.dg-fill--photon { fill: var(--color-photon); }
.dg-text {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--color-muted);
  letter-spacing: 0.06em;
}
.dg-text--accent { fill: var(--color-accent-ink); }

/* Small print / notes */
.note {
  color: var(--color-muted);
  font-size: 0.8125rem;
}


/* ------------------------------------------------------- 21. Theme switch */

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  transition: color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.theme-btn:hover { color: var(--color-text); border-color: var(--color-line-strong); }
.theme-btn__ico {
  width: 19px;
  height: 19px;
  transition: transform var(--dur-2) var(--ease);
}
.theme-btn[aria-pressed="true"] .theme-btn__ico { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .theme-btn__ico { transition: none; }
}

/* The theme flip should not look like a page reload. */
.theme-anim,
.theme-anim *,
.theme-anim *::before,
.theme-anim *::after {
  transition: background-color 0.34s var(--ease), border-color 0.34s var(--ease),
              color 0.34s var(--ease), fill 0.34s var(--ease), stroke 0.34s var(--ease) !important;
}
@media (prefers-reduced-motion: reduce) {
  .theme-anim, .theme-anim * { transition: none !important; }
}


/* ------------------------------------------------------ 22. Design credit */
/* Rendered from CSS only — deliberately kept out of the HTML, so it is not a
   crawlable link and adds nothing to the document text. */

.footer__bottom::after {
  content: "Design by morteza.ir";
  order: 9;
  flex-basis: 100%;
  margin-block-start: 4px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  opacity: 0.55;
}
html[lang="fa"] .footer__bottom::after {
  content: "طراحی توسط morteza.ir";
  font-family: var(--font-body);
  letter-spacing: 0;
  font-size: 0.6875rem;
}
