/* ---------- tokens ---------- */
:root {
  --paper: #efebe3;
  --paper-2: #e4dfd4;
  --ink: #171717;
  --ink-2: #3a3834;
  --night: #121110;
  --night-2: #1c1b19;
  --mute: #7a766d;
  --dim: #a9a397;
  --amber: #ffb900;
  --amber-deep: #e0a200;
  --line: rgba(23, 23, 23, .14);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Vazirmatn", ui-monospace, Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-variation-settings: "wdth" 100;
  font-size: 17px;
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--amber); color: var(--ink); }
.mono { font-family: var(--mono); font-size: .78rem; letter-spacing: .02em; text-transform: lowercase; }

/* film grain so flat colours don't look like a template */
.grain {
  position: fixed; inset: -50%; z-index: 100; pointer-events: none; opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -4%); } 75% { transform: translate(-1%, 3%); }
}

.cursor {
  position: fixed; left: 0; top: 0; z-index: 99; pointer-events: none;
  width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 1.5px rgba(18, 17, 16, .55);
  translate: var(--cx, -100px) var(--cy, -100px);
  scale: var(--cs, 1);
  transition: scale .18s var(--ease-out), opacity .2s, background-color .18s;
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  /* the dot is the pointer: hide the system arrow */
  body.has-cursor, body.has-cursor * { cursor: none !important; }
  body.has-cursor .cursor { opacity: 1; }
  body.has-cursor.cursor-out .cursor { opacity: 0; }
  .cursor.on-link { background: rgba(255, 185, 0, .45); }
}

/* ---------- header ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gutter);
  transition: transform .5s var(--ease-out);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.bar.hide { transform: translateY(-110%); }
.mark {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--amber); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 1.35rem;
  transition: transform .5s var(--ease-spring);
}
.mark { box-shadow: 0 0 0 1.5px var(--ink); }
.mark:hover { transform: rotate(-20deg) scale(1.08); }
.nav {
  display: flex; gap: 4px; padding: 5px;
  background: rgba(18, 17, 16, .72); color: var(--paper);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.1); border-radius: 999px;
}
.nav a { text-decoration: none; padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 500; transition: background .25s, color .25s; }
.nav a i { font-style: normal; font-family: var(--mono); font-size: .62rem; color: var(--dim); margin-right: 6px; vertical-align: 2px; }
.nav a:hover, .nav a.on { background: var(--amber); color: var(--ink); }
.nav a:hover i, .nav a.on i { color: var(--ink); }

/* ---------- shared bits ---------- */
.kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--amber); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(255,185,0,.25); animation: pulse 2.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(255,185,0,0); } }
.links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.links a {
  text-decoration: none; font-size: .88rem; font-weight: 600; padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid var(--amber); color: var(--amber);
  transition: background .25s, color .25s, transform .3s var(--ease-spring);
}
.links a:hover { background: var(--amber); color: var(--ink); transform: translateY(-3px) rotate(-3deg); }
.private { color: var(--dim); border: 1.5px dashed rgba(255,255,255,.25); padding: 7px 13px; border-radius: 999px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 22px 0 0; }
.tags li { padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: var(--paper); text-transform: none; }
.tags li.live { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.tags li.live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--ink); vertical-align: 1px; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* =================================================================
   THE JOURNEY
   ================================================================= */
.journey { position: relative; background: var(--night); color: var(--paper); }

/* --- static layout (no JS / reduced motion) --- */
.journey .viewport { padding: 110px var(--gutter) 60px; }
.journey .ch { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 6vw, 80px); align-items: center; padding: 60px 0; position: relative; }
.journey .ghost { display: none; }
.hud, .hint, .floor { display: none; }

/* --- 3D mode --- */
.is-3d .journey .viewport {
  position: sticky; top: 0; height: 100vh; height: 100svh; padding: 0; overflow: hidden;
  perspective: 1000px; perspective-origin: 50% 45%;
  background:
    radial-gradient(120% 60% at 50% 42%, rgba(255,185,0,.10), transparent 60%),
    var(--night);
}
.is-3d .journey .viewport::after {
  /* vignette + horizon fog */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background:
    radial-gradient(140% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.55)),
    linear-gradient(to bottom, var(--night) 0%, transparent 18%, transparent 80%, rgba(18,17,16,.8) 100%);
}
.is-3d .world {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  transform-style: preserve-3d; will-change: transform;
}
.is-3d .journey .ch {
  position: absolute; left: 0; top: 0; width: min(1120px, 90vw); padding: 0;
  transform-style: preserve-3d; will-change: transform, opacity;
}
.is-3d .journey .ghost {
  display: block; position: absolute; left: 50%; top: 50%; z-index: -1;
  transform: translate3d(-50%, -50%, -700px);
  font-size: clamp(14rem, 38vw, 40rem); font-weight: 900; line-height: .8; letter-spacing: -.06em;
  font-variation-settings: "wdth" 125;
  color: transparent; -webkit-text-stroke: 2px rgba(255,185,0,.22);
  pointer-events: none; user-select: none; white-space: nowrap;
}
.is-3d .card { transform: translateZ(40px); }

/* card content rises in when its chapter is in focus */
.is-3d .card > * { opacity: 0; transform: translateY(26px); transition: opacity .7s var(--ease-out), transform .9s var(--ease-out); }
.is-3d .ch.focus .card > * { opacity: 1; transform: none; }
.is-3d .ch.focus .card > *:nth-child(2) { transition-delay: .06s; }
.is-3d .ch.focus .card > *:nth-child(3) { transition-delay: .12s; }
.is-3d .ch.focus .card > *:nth-child(4) { transition-delay: .18s; }
.is-3d .ch:not(.focus) { pointer-events: none; }

/* chapters alternate sides */
.journey .ch[data-x="1"] .card { order: 2; }
.journey .ch[data-x="1"] .prop { order: 1; }

.journey h2 {
  margin: 0; font-size: clamp(2.3rem, 5.2vw, 4.8rem); line-height: .95; letter-spacing: -.035em; font-weight: 850;
  font-variation-settings: "wdth" 118;
}
.journey .card p:not(.kicker):not(.lede) { font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: var(--dim); max-width: 34ch; margin: 20px 0 0; }

/* intro */
.name { margin: 0; font-weight: 850; line-height: .86; letter-spacing: -.035em; text-transform: uppercase; font-variation-settings: "wdth" 125; font-size: clamp(3.4rem, 10vw, 9.5rem); }
.name .line { display: block; overflow: hidden; padding-bottom: .04em; }
.name .line.small { font-size: .34em; letter-spacing: -.01em; font-weight: 700; margin-top: .25em; font-variation-settings: "wdth" 100; color: var(--dim); }
.lede { max-width: 32ch; font-size: clamp(1.05rem, 1.5vw, 1.3rem); margin: 28px 0 0; color: var(--dim); }
.lede em { font-style: normal; color: var(--paper); background: linear-gradient(transparent 62%, rgba(255,185,0,.45) 62%); }

/* HUD */
.is-3d .hud { display: block; position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.hud::before { content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 100%; background: var(--amber); transform-origin: left; transform: scaleX(var(--p, 0)); }
.hud-year {
  position: absolute; inset-inline-start: var(--gutter); bottom: 28px; overflow: hidden; height: 1em;
  font-size: clamp(2.6rem, 6vw, 5.4rem); font-weight: 900; line-height: 1; letter-spacing: -.04em; font-variation-settings: "wdth" 125;
  color: var(--amber);
}
.hud-now { display: block; }
.hud-now.flip { animation: flip .5s var(--ease-out); }
@keyframes flip { from { transform: translateY(100%); opacity: 0; } }
.rail { position: absolute; inset-inline-end: var(--gutter); top: 50%; transform: translateY(-50%); list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; pointer-events: auto; }
.rail button {
  all: unset; cursor: pointer; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  font-family: var(--mono); font-size: .7rem; color: var(--dim); padding: 3px 0;
}
.rail button span { opacity: 0; transform: translateX(6px); transition: opacity .3s, transform .3s var(--ease-out); }
.rail button i { width: 14px; height: 2px; background: rgba(255,255,255,.3); transition: width .4s var(--ease-out), background .3s; }
.rail button:hover span, .rail .on span { opacity: 1; transform: none; }
.rail .on { color: var(--amber); }
.rail .on i { width: 34px; background: var(--amber); }
.is-3d .hint { display: flex; position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 4; align-items: center; gap: 12px; color: var(--dim); transition: opacity .5s; }
.hint i { width: 1.5px; height: 34px; background: rgba(255,255,255,.18); position: relative; overflow: hidden; }
.hint i::after { content: ""; position: absolute; left: 0; top: -40%; width: 100%; height: 40%; background: var(--amber); animation: drip 1.8s var(--ease-out) infinite; }
@keyframes drip { to { top: 100%; } }
.hint.gone { opacity: 0; }

/* the floor grid rushes past as the camera moves */
.is-3d .floor {
  display: block; position: absolute; left: -100%; right: -100%; top: 58%; height: 140vh;
  transform-origin: 50% 0; transform: rotateX(78deg);
  background:
    linear-gradient(rgba(255,185,0,.28) 2px, transparent 2px) 0 var(--fy, 0px) / 100% 160px,
    linear-gradient(90deg, rgba(255,185,0,.14) 2px, transparent 2px) 50% 0 / 160px 100%;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 25%, #000 60%, transparent 100%);
  opacity: .55;
}
.dust { position: absolute; transform-style: preserve-3d; }
.dust i { position: absolute; width: 4px; height: 4px; border-radius: 1px; background: var(--amber); opacity: .5; }

/* ---------- props ---------- */
.prop { justify-self: center; transform-style: preserve-3d; }
.is-3d .prop { transform: translateZ(140px) rotateY(calc(var(--side, 1) * -16deg)); }
.is-3d .ch[data-x="1"] .prop { --side: -1; }

/* photo */
.photo { margin: 0; width: min(340px, 70vw); position: relative; }
.photo::before { content: ""; position: absolute; inset: 0; background: var(--amber); border-radius: 8px; transform: translate3d(20px, 20px, -60px); }
.photo::after { content: ""; position: absolute; inset: 0; border: 1.5px solid var(--paper); border-radius: 8px; transform: translate3d(-16px, -16px, 50px); }
.photo img { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 52% 50%; border-radius: 8px; filter: grayscale(1) contrast(1.08); transition: filter .8s var(--ease-out); }
.photo:hover img { filter: none; }

/* hardware die */
.cpu { width: 240px; height: 240px; display: grid; place-items: center; }
.cpu .die {
  width: 170px; height: 170px; position: relative; transform-style: preserve-3d;
  background: var(--night-2); border: 2px solid var(--amber); border-radius: 12px;
  display: grid; place-items: center;
  animation: dieSpin 14s linear infinite;
}
.cpu .die::before {
  /* pins */
  content: ""; position: absolute; inset: -26px; z-index: -1; border-radius: 6px; transform: translateZ(-2px);
  background:
    repeating-linear-gradient(90deg, var(--dim) 0 6px, transparent 6px 16px) 50% 0 / 80% 26px no-repeat,
    repeating-linear-gradient(90deg, var(--dim) 0 6px, transparent 6px 16px) 50% 100% / 80% 26px no-repeat,
    repeating-linear-gradient(0deg, var(--dim) 0 6px, transparent 6px 16px) 0 50% / 26px 80% no-repeat,
    repeating-linear-gradient(0deg, var(--dim) 0 6px, transparent 6px 16px) 100% 50% / 26px 80% no-repeat;
}
.cpu .die::after { content: ""; position: absolute; inset: 0; border-radius: 12px; background: #0b0b0a; transform: translateZ(-14px); }
.cpu .die span { width: 70px; height: 70px; display: grid; place-items: center; background: var(--amber); color: var(--ink); border-radius: 8px; font-size: 2.4rem; font-weight: 600; transform: translateZ(22px); box-shadow: 0 0 40px rgba(255,185,0,.45); }
@keyframes dieSpin { from { transform: rotateX(58deg) rotateZ(0deg); } to { transform: rotateX(58deg) rotateZ(360deg); } }

/* code window */
.code { width: min(430px, 82vw); background: var(--night-2); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; box-shadow: 0 40px 80px rgba(0,0,0,.5), 10px 10px 0 var(--amber); overflow: hidden; }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.win-bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.18); }
.win-bar i:first-child { background: var(--amber); }
.win-bar span { margin-left: 10px; color: var(--dim); text-transform: none; }
.code pre { margin: 0; padding: 20px 22px 26px; font-size: .82rem; line-height: 1.7; color: var(--paper); text-transform: none; white-space: pre; overflow: hidden; }
.code b { color: var(--amber); font-weight: 500; }
.code u { text-decoration: none; color: var(--dim); }
.caret { display: inline-block; width: 8px; height: 1.1em; background: var(--amber); vertical-align: -3px; margin-left: 2px; animation: blink 1s steps(2) infinite; }

/* phones */
.mphone {
  width: 236px; height: 480px; border-radius: 38px; background: #0e0e0e; padding: 9px; position: relative;
  transform-style: preserve-3d;
  box-shadow: inset 0 0 0 1.5px #3b3a36, 0 50px 90px rgba(0,0,0,.55);
  animation: sway 7s ease-in-out infinite;
}
.mphone::before, .mphone::after { content: ""; position: absolute; inset: 0; border-radius: 38px; background: #2a2926; transform: translateZ(-7px); }
.mphone::after { transform: translateZ(-14px); background: #1f1e1c; }
@keyframes sway { 0%, 100% { transform: rotateY(-8deg) translateY(0); } 50% { transform: rotateY(8deg) translateY(-12px); } }
.mscreen {
  position: relative; height: 100%; border-radius: 30px; overflow: hidden; background: #f7f4ee; color: var(--ink);
  padding: 40px 14px 14px; display: flex; flex-direction: column; gap: 10px;
}
.mscreen::before { content: ""; position: absolute; top: 12px; left: 50%; width: 74px; height: 20px; margin-left: -37px; border-radius: 12px; background: #000; }
.app-title { font-size: 1.3rem; letter-spacing: -.02em; font-variation-settings: "wdth" 115; }
.sk { border-radius: 16px; }
.hero-sk { height: 120px; background: var(--amber); position: relative; overflow: hidden; }
.hero-sk::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 2.6s ease-in-out infinite; }
@keyframes shimmer { 60%, 100% { transform: translateX(100%); } }
.sk-row { display: flex; align-items: center; gap: 10px; padding: 9px; background: #fff; border-radius: 14px; }
.sk-row i { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--paper-2); }
.sk-row span { flex: 1; height: 9px; border-radius: 6px; background: var(--paper-2); }
.sk-row:nth-child(odd) span { margin-right: 30px; }
.progress { margin-top: auto; height: 10px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 70%; background: var(--ink); border-radius: 6px; transform-origin: left; animation: fillbar 4s var(--ease-out) infinite; }
@keyframes fillbar { 0% { transform: scaleX(0); } 60%, 100% { transform: scaleX(1); } }
.bcard { height: 128px; border-radius: 16px; background: var(--ink); color: var(--paper); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 10px 20px rgba(0,0,0,.2); }
.chipset { width: 34px; height: 26px; border-radius: 6px; background: var(--amber); }
.bcard span { font-size: .8rem; text-transform: none; letter-spacing: .08em; }

/* habit screen */
.app-head { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.app-head small { color: var(--mute); font-size: .66rem; }
.app-head b { font-size: 1.45rem; line-height: 1; letter-spacing: -.02em; font-variation-settings: "wdth" 115; }
.ring { grid-column: 2; grid-row: 1 / 3; width: 46px; height: 46px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--paper-2); stroke-width: 4; }
.ring circle.fill { stroke: var(--amber); stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: 94.25; animation: ring 8s var(--ease-out) infinite; }
@keyframes ring { 0%, 8% { stroke-dashoffset: 94.25; } 55%, 92% { stroke-dashoffset: 18.85; } 100% { stroke-dashoffset: 94.25; } }
.habits { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.habits li { display: flex; align-items: center; gap: 10px; padding: 11px 12px; background: #fff; border-radius: 14px; }
.habits li span { flex: 1; height: 8px; border-radius: 5px; background: var(--paper-2); margin-right: calc(var(--d, 2) * 12px); }
.habits i { flex: none; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid #cfc9bd; position: relative; }
.habits li:not(.todo) i { animation: tick 8s var(--ease-spring) infinite; animation-delay: calc(var(--d) * .45s + .6s); }
.habits li:not(.todo) i::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 4px; height: 9px;
  border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0);
  animation: tickMark 8s var(--ease-spring) infinite; animation-delay: inherit;
}
@keyframes tick { 0%, 4% { background: transparent; border-color: #cfc9bd; transform: scale(1); } 8% { transform: scale(1.25); } 12%, 88% { background: var(--amber); border-color: var(--amber); transform: scale(1); } 94%, 100% { background: transparent; border-color: #cfc9bd; } }
@keyframes tickMark { 0%, 5% { transform: rotate(45deg) scale(0); } 12%, 88% { transform: rotate(45deg) scale(1); } 94%, 100% { transform: rotate(45deg) scale(0); } }
.week { margin-top: auto; display: flex; align-items: flex-end; gap: 7px; height: 70px; padding: 10px 12px; background: var(--ink); border-radius: 16px; }
.week span { flex: 1; height: var(--h); background: #4a4843; border-radius: 4px; transform-origin: bottom; animation: grow 8s var(--ease-out) infinite; }
.week span:nth-child(6) { background: var(--amber); }
.week span:nth-child(2) { animation-delay: .08s; } .week span:nth-child(3) { animation-delay: .16s; }
.week span:nth-child(4) { animation-delay: .24s; } .week span:nth-child(5) { animation-delay: .32s; }
.week span:nth-child(6) { animation-delay: .4s; } .week span:nth-child(7) { animation-delay: .48s; }
@keyframes grow { 0% { transform: scaleY(.1); } 14%, 90% { transform: scaleY(1); } 100% { transform: scaleY(.1); } }

/* browser windows */
.browser { width: min(460px, 84vw); background: var(--paper); color: var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 40px 80px rgba(0,0,0,.5), -10px 10px 0 var(--amber); }
.browser .win-bar { border-bottom: 1px solid var(--line); }
.browser .win-bar i { background: #cfc9bd; }
.browser .win-bar i:first-child { background: var(--amber); }
.url { flex: 1; margin-left: 12px; padding: 5px 12px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2) !important; }
.bbody { display: grid; grid-template-columns: 90px 1fr; gap: 14px; padding: 16px; height: 250px; }
.bbody .side { display: grid; align-content: start; gap: 10px; }
.bbody .side span { height: 10px; border-radius: 6px; background: var(--paper-2); }
.bbody .side span:first-child { background: var(--ink); width: 70%; }
.bbody .grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bbody .grid span { border-radius: 10px; background: var(--paper-2); animation: tile 5s var(--ease-out) infinite; }
.bbody .grid span:nth-child(2) { animation-delay: .5s; } .bbody .grid span:nth-child(4) { animation-delay: 1s; }
.bbody .grid span:nth-child(6) { animation-delay: 1.5s; } .bbody .grid span:nth-child(3) { animation-delay: 2s; }
@keyframes tile { 0%, 100% { background: var(--paper-2); } 20%, 40% { background: var(--amber); } }
.bbody.form { grid-template-columns: 1fr; align-content: center; gap: 14px; padding: 26px 40px; }
.field { height: 40px; border-radius: 10px; border: 1.5px solid #cfc9bd; background: #fff; position: relative; }
.field::after { content: ""; position: absolute; left: 12px; top: 50%; height: 8px; margin-top: -4px; border-radius: 4px; background: var(--ink-2); width: 0; animation: type 6s steps(12) infinite; }
.field:nth-child(2)::after { animation-delay: 1s; } .field:nth-child(3)::after { animation-delay: 2s; }
@keyframes type { 0%, 10% { width: 0; } 35%, 90% { width: 55%; } 100% { width: 0; } }
.field.short { width: 60%; }
.submit { height: 44px; width: 150px; border-radius: 999px; background: var(--ink); justify-self: end; animation: press 6s var(--ease-spring) infinite; }
@keyframes press { 0%, 55% { background: var(--ink); transform: none; } 60% { transform: scale(.94); } 64%, 90% { background: var(--amber); transform: none; } }

/* coin */
.coin { width: 260px; height: 260px; display: grid; place-items: center; }
.disc { width: 220px; height: 220px; position: relative; transform-style: preserve-3d; animation: coin 6s var(--ease-out) infinite; }
.disc::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--amber-deep); }
.face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.face.f { transform: translateZ(8px); background: var(--amber); color: var(--ink); font-family: var(--display); font-size: 3.4rem; font-weight: 900; letter-spacing: -.04em; text-transform: uppercase; font-variation-settings: "wdth" 125; border: 2px solid var(--ink); box-shadow: inset 0 0 0 12px var(--amber), inset 0 0 0 14px var(--ink); }
.face.b { background: var(--ink); color: var(--amber); font-size: 5rem; font-weight: 500; transform: rotateY(180deg) translateZ(8px); border: 2px solid var(--amber); }
@keyframes coin { 0%, 30% { transform: rotateY(0); } 50%, 80% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }

/* outro */
.journey .outro-ch { grid-template-columns: 1fr; text-align: center; justify-items: center; }
.facts { display: flex; justify-content: center; gap: clamp(24px, 7vw, 100px); margin: 10px 0 0; }
.facts div { margin: 0; }
.facts dt { color: var(--dim); }
.facts dd { margin: 4px 0 0; font-size: clamp(4rem, 12vw, 10rem); font-weight: 900; line-height: .9; letter-spacing: -.05em; color: var(--amber); font-variation-settings: "wdth" 125; }
.outro-ch .lede { margin-inline: auto; }

/* =================================================================
   STACK + CONTACT
   ================================================================= */
.section-title { display: flex; align-items: baseline; gap: 16px; margin: 0 0 40px; font-weight: 800; letter-spacing: -.045em; line-height: 1; font-size: clamp(3rem, 10vw, 9rem); text-transform: uppercase; font-variation-settings: "wdth" 125; }
.section-title .mono { font-size: .8rem; color: var(--mute); font-weight: 400; letter-spacing: 0; }
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease-out), transform 1s var(--ease-out); transition-delay: var(--rd, 0s); }
.reveal.in, .no-js .reveal { opacity: 1; transform: none; }

.stack { padding: 140px var(--gutter) 160px; }
.stack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 6vw, 90px); align-items: center; }
.orbit-wrap { position: relative; height: 520px; perspective: 900px; display: grid; place-items: center; }
.orbit { position: absolute; width: 1px; height: 1px; transform-style: preserve-3d; transform: rotateX(-14deg); animation: orbit 26s linear infinite; }
.orbit span {
  position: absolute; left: 0; top: 0; white-space: nowrap; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transform: translate(-50%, -50%) rotateY(calc(var(--n) * 30deg)) translateZ(240px);
  transform: translate(-50%, -50%) rotateY(calc(var(--n) * 30deg)) translateZ(240px) translateY(calc(sin(var(--n) * 60deg) * 80px));
  font-weight: 800; font-size: 1.7rem; letter-spacing: -.02em; font-variation-settings: "wdth" 118;
  padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--paper);
}
.orbit span:nth-child(3n) { background: var(--amber); }
.orbit span:nth-child(4n+1) { background: var(--ink); color: var(--paper); }
@keyframes orbit { to { transform: rotateX(-14deg) rotateY(-360deg); } }
.core { position: relative; width: 150px; height: 150px; border-radius: 50%; background: var(--amber); display: grid; place-items: center; font-size: 4.2rem; font-weight: 500; border: 1.5px solid var(--ink); box-shadow: inset -10px -12px 0 rgba(0,0,0,.08); }
.skill-list { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.skill-list li { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-size: 1.08rem; font-weight: 500; }
.lvl { width: 52px; height: 10px; background: radial-gradient(circle 5px at 5px 5px, var(--ink) 98%, transparent) 0 0 / 21px 10px repeat-x; }
.lvl[data-l="2"] { width: 31px; }
.tools { margin-top: 28px; color: var(--mute); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tools span { color: var(--ink); border: 1.5px solid var(--ink); padding: 5px 11px; border-radius: 8px; text-transform: none; }

.contact { background: var(--amber); padding: clamp(80px, 12vw, 160px) var(--gutter); border-radius: 48px 48px 0 0; overflow: hidden; }
.kicker.dark { color: var(--ink); }
.contact h2 { margin: 0 0 40px; font-size: clamp(3rem, 10vw, 9rem); line-height: .88; letter-spacing: -.05em; text-transform: uppercase; font-weight: 900; font-variation-settings: "wdth" 125; }
.mail {
  display: inline-block; text-decoration: none; word-break: break-all;
  font-size: clamp(1.4rem, 5.4vw, 4.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--ink);
  text-shadow: 1px 1px 0 var(--amber-deep), 2px 2px 0 var(--amber-deep), 3px 3px 0 var(--amber-deep), 4px 4px 0 var(--amber-deep), 5px 5px 0 var(--amber-deep), 6px 6px 0 var(--ink);
  transform: perspective(700px) rotateX(var(--mx, 0deg)) rotateY(var(--my, 0deg));
  transition: transform .5s var(--ease-out), text-shadow .4s var(--ease-out), color .3s;
}
.mail:hover { color: var(--paper); text-shadow: 1px 1px 0 var(--ink), 2px 2px 0 var(--ink), 3px 3px 0 var(--ink), 4px 4px 0 var(--ink), 5px 5px 0 var(--ink), 6px 6px 0 var(--ink), 7px 7px 0 var(--ink), 8px 8px 0 var(--ink), 9px 9px 0 var(--ink), 10px 10px 0 var(--ink); }
.socials { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 50px 0 0; }
.socials a { display: inline-flex; gap: 10px; align-items: center; text-decoration: none; font-weight: 700; font-size: 1.1rem; padding: 14px 22px; border-radius: 999px; background: var(--ink); color: var(--amber); transition: transform .35s var(--ease-spring); }
.socials a i { font-style: normal; transition: transform .35s var(--ease-spring); }
.socials a:hover { transform: translateY(-4px) rotate(-2deg); }
.socials a:hover i { transform: translate(3px, -3px) rotate(45deg); }
.foot { display: flex; justify-content: space-between; gap: 16px; padding: 26px var(--gutter); background: var(--ink); color: var(--paper); text-transform: none; }
.foot a { text-decoration: none; }
.foot .ver { opacity: .5; margin-inline-start: .6em; }
.foot a:hover { color: var(--amber); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .journey .ch { grid-template-columns: 1fr; gap: 26px; }
  .journey .ch .prop { order: -1 !important; }
  .journey .ch .card { order: 0 !important; }
  .is-3d .journey .ch { width: 88vw; }
  .is-3d .prop { transform: translateZ(60px) scale(.62); margin: -70px 0; }
  .is-3d .ch.intro-ch .prop { transform: translateZ(60px) scale(.5); margin: -110px 0 -95px; }
  .code pre { font-size: .72rem; }
  .rail { display: none; }
  .hud-year { bottom: 20px; font-size: 2.4rem; }
  .is-3d .hint { left: auto; inset-inline-end: var(--gutter); transform: none; }
  .stack-grid { grid-template-columns: 1fr; }
  .orbit-wrap { height: 340px; }
  .orbit span { font-size: 1.1rem; transform: translate(-50%, -50%) rotateY(calc(var(--n) * 30deg)) translateZ(140px); transform: translate(-50%, -50%) rotateY(calc(var(--n) * 30deg)) translateZ(140px) translateY(calc(sin(var(--n) * 60deg) * 50px)); }
  .core { width: 110px; height: 110px; font-size: 3rem; }
}
@media (max-width: 560px) {
  .nav a i { display: none; }
  .nav a { padding: 7px 11px; font-size: .84rem; }
  .contact { border-radius: 28px 28px 0 0; }
  .foot { flex-direction: column; }
  .journey h2 { font-size: 2.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .orbit { animation: none; }
}

/* ---------- CV downloads ---------- */
.cv-menu { position: relative; }
.cv-menu summary {
  list-style: none; cursor: pointer; padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  background: var(--amber); color: var(--ink); user-select: none;
}
.cv-menu summary::-webkit-details-marker { display: none; }
.cv-menu summary span { display: inline-block; transition: transform .4s var(--ease-spring); }
.cv-menu[open] summary span { transform: rotate(180deg); }
.cv-pop {
  position: absolute; inset-inline-end: 0; top: calc(100% + 10px); width: 230px; padding: 6px;
  background: var(--night); border: 1px solid rgba(255,255,255,.12); border-radius: 18px;
  display: grid; gap: 4px; box-shadow: 0 20px 40px rgba(0,0,0,.35);
  transform-origin: top right; animation: pop .35s var(--ease-spring);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.94); } }
.cv-pop a { display: grid; padding: 10px 14px; border-radius: 12px; text-decoration: none; transition: background .2s; }
.cv-pop a:hover, .cv-pop a:focus-visible { background: rgba(255,185,0,.14); }
.cv-pop b { font-size: .95rem; }
.cv-pop small { color: var(--dim); font-size: .78rem; }

.cv-cards { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 44px; perspective: 800px; }
.cv-card {
  position: relative; display: grid; gap: 2px; width: min(260px, 100%); padding: 20px 22px 22px; text-decoration: none;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform .45s var(--ease-spring), box-shadow .45s var(--ease-spring);
}
.cv-card.fancy { background: var(--ink); color: var(--paper); box-shadow: 6px 6px 0 var(--paper); }
.cv-card .mono { color: var(--mute); }
.cv-card.fancy .mono, .cv-card.fancy small { color: var(--dim); }
.cv-card b { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; font-variation-settings: "wdth" 115; }
.cv-card small { color: var(--ink-2); font-size: .9rem; }
.cv-card i {
  position: absolute; top: 16px; inset-inline-end: 16px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-style: normal; font-weight: 700;
  background: var(--amber); color: var(--ink); transition: transform .45s var(--ease-spring);
}
.cv-card:hover { transform: translate(-3px, -3px) rotateX(6deg) rotateY(-6deg); box-shadow: 10px 10px 0 var(--ink); }
.cv-card.fancy:hover { box-shadow: 10px 10px 0 var(--paper); }
.cv-card:hover i { transform: translateY(3px) scale(1.1); }
@media (max-width: 560px) { .cv-menu summary { padding: 7px 11px; font-size: .84rem; } }

/* ---------- language switch ---------- */
.lang-switch {
  display: grid; place-items: center; min-width: 38px; font-weight: 700 !important;
  border: 1px solid rgba(255,255,255,.18);
}
.lang-switch:lang(fa) { font-family: "Vazirmatn", var(--display); }

/* =================================================================
   FARSI / RIGHT-TO-LEFT
   Persian letters join, so no negative tracking anywhere, and the
   script needs more line height than the tight Latin display settings.
   ================================================================= */
[dir="rtl"] body { font-family: "Vazirmatn", var(--display); }
[dir="rtl"] body * { letter-spacing: 0 !important; }
[dir="rtl"] .name { line-height: 1.15; font-weight: 900; }
[dir="rtl"] .name .line { padding-bottom: .12em; }
[dir="rtl"] .name .line.small { font-size: .4em; font-weight: 700; margin-top: .1em; }
[dir="rtl"] .journey h2 { line-height: 1.3; font-weight: 900; }
[dir="rtl"] .section-title, [dir="rtl"] .contact h2 { line-height: 1.25; font-weight: 900; }
[dir="rtl"] .hud-year { height: 1.3em; line-height: 1.3; font-size: clamp(2.2rem, 5vw, 4.6rem); }
[dir="rtl"] .ghost { font-weight: 800; }
[dir="rtl"] .facts dd { line-height: 1.1; }
[dir="rtl"] .hud::before { transform-origin: right; }
[dir="rtl"] .rail button span { transform: translateX(-6px); }
[dir="rtl"] .rail button:hover span, [dir="rtl"] .rail .on span { transform: none; }
[dir="rtl"] .is-3d .prop { --side: -1; }
[dir="rtl"] .is-3d .ch[data-x="1"] .prop { --side: 1; }
[dir="rtl"] .photo::before { transform: translate3d(-20px, 20px, -60px); }
[dir="rtl"] .photo::after { transform: translate3d(16px, -16px, 50px); }
[dir="rtl"] .cv-card:hover { transform: translate(3px, -3px) rotateX(6deg) rotateY(6deg); }
[dir="rtl"] .socials a:hover i { transform: translate(-3px, -3px) rotate(-45deg); }
/* things that are Latin by nature stay left-to-right */
[dir="rtl"] .code, [dir="rtl"] .browser .win-bar, [dir="rtl"] .bcard span, [dir="rtl"] .mail,
[dir="rtl"] .orbit, [dir="rtl"] .tools span, [dir="rtl"] .cv-card .mono { direction: ltr; }
[dir="rtl"] .mail { display: inline-block; }
[dir="rtl"] .mono { font-family: "Vazirmatn", var(--display); font-size: .86rem; }
[dir="rtl"] .face.f { font-family: "Vazirmatn", var(--display); font-variation-settings: normal; font-size: 3rem; }
[dir="rtl"] .code .mono, [dir="rtl"] .code pre, [dir="rtl"] .url, [dir="rtl"] .bcard .mono, [dir="rtl"] .cv-card .mono { font-family: var(--mono); font-size: .78rem; }
.cv-menu summary { white-space: nowrap; }
