:root {
  --ink: #211f26; --paper: #f4efe4; --paper-2: #ebe4d6; --muted: #6e6862;
  --coral: #ec6b50; --blue: #4b7dd3; --yellow: #e9b943; --mint: #7fb796; --purple: #9a7fd1;
  --gutter: clamp(16px, 5vw, 72px);
  font-family: 'Assistant', sans-serif; color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; overflow-x: clip; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
::selection { background: var(--yellow); }

/* paper grid that drifts with the hero scroll */
body:not(.cv-page)::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(#2b26200d 1px, transparent 1px), linear-gradient(90deg, #2b26200d 1px, transparent 1px);
  background-size: 32px 32px;
}

.site-header { position: absolute; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 22px var(--gutter); }
.mark { font: 900 26px 'Heebo', sans-serif; letter-spacing: -.08em; }
.mark span, .dot { color: var(--coral); }
.site-header nav { display: flex; gap: clamp(14px, 3vw, 40px); font-weight: 800; font-size: 16px; }
.site-header nav a:hover, .site-footer a:hover { color: var(--coral); }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 100svh; display: grid; place-items: center; overflow: hidden; padding: 110px var(--gutter) 0; }
.hero-copy { position: relative; z-index: 2; text-align: center; margin-top: -18vh; }
.kicker { font: 800 15px 'Assistant', sans-serif; color: var(--muted); margin: 0 0 18px; display: inline-flex; align-items: center; gap: 10px; }
.kicker::before { content: ''; width: 10px; height: 10px; background: var(--coral); transform: rotate(14deg); }
.hero h1 { font: 900 clamp(3.6rem, 12vw, 11rem) / 1 'Heebo', sans-serif; letter-spacing: -.07em; margin: 0; white-space: nowrap; }
.hero h1 .ch { display: inline-block; will-change: transform; animation: drop-in .9s cubic-bezier(.2, 1.6, .4, 1) backwards; }
.hero h1 .ch:nth-child(odd) { animation-delay: .08s; }
.hero h1 .ch:nth-child(3n) { animation-delay: .16s; }
.hero h1 .gap { display: inline-block; width: .28em; }
.hero-strip { position: absolute; inset: auto 0 0; width: 100%; height: min(42vh, 330px); }
.scroll-hint { position: absolute; bottom: 22px; left: var(--gutter); width: 26px; height: 42px; border: 3px solid var(--ink); border-radius: 14px; opacity: calc(1 - var(--hp, 0) * 3); }
.scroll-hint span { position: absolute; top: 7px; left: 50%; width: 5px; height: 9px; margin-left: -2.5px; border-radius: 3px; background: var(--coral); animation: hint 1.4s ease-in-out infinite; }

/* ---------- svg typography ---------- */
.svg-label { font: 800 17px 'Heebo', sans-serif; fill: var(--ink); }
.svg-talk { font: 700 15px 'Assistant', sans-serif; fill: var(--ink); }
.svg-chip { font: 700 14px 'Assistant', sans-serif; fill: #fffdf8; }
.hero-strip .svg-chip { fill: var(--ink); font-weight: 800; }
.svg-hand { font: 700 16px 'Assistant', sans-serif; fill: var(--muted); }
.zzz { display: none; }

/* ---------- gantt: vertical scroll drives a sideways plan ---------- */
.gantt { position: relative; height: 900vh; }
.gantt-pin { position: sticky; top: 0; height: 100svh; overflow: hidden; background: var(--ink); color: #fffaf1; }
.gantt-grid { position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(90deg, #ffffff12 1px, transparent 1px); background-size: 120px 100%;
  background-position: calc(var(--gp, 0) * 1400px) 0; }
.gantt-head { position: absolute; top: 0; inset-inline: 0; display: flex; justify-content: space-between; align-items: baseline; padding: 92px var(--gutter) 0; z-index: 3; }
.gantt-title { font: 900 clamp(1.6rem, 3.4vw, 3rem) 'Heebo', sans-serif; letter-spacing: -.05em; }
.gantt-count { font: 700 15px 'Space Mono', monospace; color: #fffaf199; }
.gantt-count b { color: var(--yellow); }
.today { position: absolute; top: 150px; bottom: 30px; left: 50%; width: 0; border-left: 2px dashed var(--coral); z-index: 4; pointer-events: none; }
.today span { position: absolute; top: -26px; transform: translateX(-50%); background: var(--coral); color: #fff; font-weight: 800; font-size: 13px; padding: 2px 10px; border-radius: 20px; }
.gantt-track { position: absolute; top: 0; bottom: 0; right: 0; width: max-content; display: flex; align-items: center; gap: clamp(28px, 5vw, 80px); padding: 120px var(--gutter) 20px; will-change: transform; transform-origin: 50% 100%; }
.task { --tone: var(--blue); position: relative; flex: 0 0 auto; width: min(64vw, 820px); height: min(66svh, 600px); background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: 22px; box-shadow: 10px 10px 0 var(--tone); display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(calc((var(--row) - 1) * 3.5svh)) rotate(calc((var(--p, .5) - .5) * -5deg)); }
.task header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 3px solid var(--ink); background: var(--tone); flex-wrap: wrap; }
.task h2 { font: 900 clamp(1.05rem, 2vw, 1.7rem) 'Heebo', sans-serif; letter-spacing: -.03em; margin: 0; flex: 1; min-width: 0; }
.task .code { font: 700 13px 'Space Mono', monospace; background: var(--ink); color: var(--paper); padding: 3px 9px; border-radius: 8px; }
.task .status { font-weight: 800; font-size: 13px; background: #fffdf8; border: 2px solid var(--ink); border-radius: 30px; padding: 2px 11px; }
.task svg { flex: 1; width: 100%; min-height: 0; }
.task .bar { height: 12px; border-top: 3px solid var(--ink); background: #fffdf8; }
.task .bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--tone); max-width: 97%; }
.tone-coral { --tone: var(--coral); } .tone-yellow { --tone: var(--yellow); } .tone-mint { --tone: var(--mint); }
.tone-blue { --tone: var(--blue); } .tone-purple { --tone: var(--purple); }

/* ---------- power: scroll velocity runs the wheel ---------- */
.power { position: relative; padding: 8vh var(--gutter) 2vh; display: grid; justify-items: center; }
.power svg { width: min(720px, 100%); height: auto; }
.power-note { font: 700 14px 'Space Mono', 'Assistant', monospace; color: var(--muted); margin: 0; }

/* ---------- portfolio ---------- */
.work { padding: 14vh var(--gutter) 16vh; max-width: 1240px; margin: 0 auto; }
.work-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 40px; align-items: end; margin-bottom: 56px; }
.work-head h2 { font: 900 clamp(3rem, 8vw, 7rem) / .95 'Heebo', sans-serif; letter-spacing: -.07em; margin: 0; }
.work-head p { font-size: clamp(18px, 2vw, 23px); font-weight: 600; color: var(--muted); margin: 0; max-width: 520px; }
.jobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 28px; }
.job { background: #fffdf8; border: 3px solid var(--ink); border-radius: 20px; padding: 26px; box-shadow: 8px 8px 0 var(--coral); transition: transform .3s cubic-bezier(.2, 1.6, .4, 1), box-shadow .3s; }
.job:nth-child(3n+2) { box-shadow: 8px 8px 0 var(--blue); }
.job:nth-child(3n) { box-shadow: 8px 8px 0 var(--mint); }
.job:hover { transform: translate(-4px, -4px) rotate(-1deg); box-shadow: 12px 12px 0 var(--yellow); }
.job-meta { display: flex; justify-content: space-between; gap: 12px; font: 700 13px 'Space Mono', 'Assistant', monospace; color: var(--muted); }
.job-org { color: var(--ink); }
.job h3 { font: 900 clamp(1.4rem, 2.4vw, 2rem) / 1.15 'Heebo', sans-serif; letter-spacing: -.03em; margin: 16px 0 10px; }
.job p { font-size: 17px; line-height: 1.6; margin: 0 0 18px; color: #48433f; }
.tags, .skills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-weight: 700; font-size: 14px; border: 2px solid var(--ink); border-radius: 30px; padding: 2px 12px; }
.skills { margin-top: 48px; }
.skills li { font: 800 clamp(16px, 2vw, 22px) 'Heebo', sans-serif; background: var(--ink); color: var(--paper); padding: 8px 18px; border-radius: 40px; }
.skills li:nth-child(even) { background: var(--yellow); color: var(--ink); }

.site-footer { padding-bottom: 76px !important; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 34px var(--gutter); background: var(--ink); color: var(--paper); font-weight: 700; }
.site-footer div { display: flex; gap: 24px; }

.hud { position: fixed; bottom: 16px; left: 16px; z-index: 30; display: flex; align-items: center; gap: 8px; background: #fffdf8; border: 2.5px solid var(--ink); border-radius: 30px; padding: 5px 12px; font-weight: 800; font-size: 13px; box-shadow: 3px 3px 0 var(--ink); }
.hud b { font-family: 'Space Mono', monospace; min-width: 3.2ch; }
.hud i { width: 60px; height: 8px; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.hud em { display: block; height: 100%; width: 0; background: var(--coral); }
.hud.stuck { animation: shake .4s ease-in-out infinite; }

/* ---------- reduced motion: stack the plan ---------- */
.reduced .gantt { height: auto; }
.reduced .gantt-pin { position: relative; height: auto; padding-bottom: 60px; }
.reduced .gantt-head { position: relative; }
.reduced .today { display: none; }
.reduced .gantt-track { position: relative; flex-direction: column; padding-top: 30px; }
.reduced .task { width: min(92vw, 820px); height: auto; transform: none; }
.reduced .task svg { height: auto; aspect-ratio: 600 / 380; }
.reduced .hero h1 .ch { animation: none; }
.reduced .hud, .reduced .scroll-hint span { animation: none; }

@keyframes drop-in { from { transform: translateY(-1.2em) rotate(-25deg); opacity: 0; } }
@keyframes hint { 50% { transform: translateY(12px); opacity: .3; } }
@keyframes shake { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }

@media (max-width: 760px) {
  .site-header nav a:first-child { display: none; }
  .task { width: 86vw; height: min(62svh, 520px); box-shadow: 6px 6px 0 var(--tone); }
  .task header { padding: 10px 12px; gap: 8px; }
  .task .status { font-size: 12px; }
  .work-head { grid-template-columns: 1fr; gap: 16px; }
  .hero-copy { margin-top: -22vh; }
  .hero-strip { height: 40svh; }
  .task { height: auto; }
  .task svg { flex: none; height: auto; aspect-ratio: 600 / 380; }
  .hud span { display: none; }
}

/* ---------- CV page ---------- */
.cv-page { background: #faf9f5; }
.cv-page .site-header { position: relative; }
.cv-main { max-width: 900px; margin: 0 auto; padding: 30px var(--gutter) 90px; }
.cv-topline { display: flex; justify-content: space-between; color: var(--muted); font-weight: 700; font-size: 15px; }
.cv-topline button { background: none; border: 0; border-bottom: 1px solid #a5a09b; padding: 4px 0; color: inherit; cursor: pointer; }
.cv-main h1 { font: 900 clamp(3.2rem, 8vw, 6rem) / 1.1 'Heebo', sans-serif; letter-spacing: -.07em; margin: 30px 0 6px; }
.cv-role { font-size: clamp(20px, 2.6vw, 26px); font-weight: 700; margin: 0 0 40px; color: #565351; }
.cv-main section { display: grid; grid-template-columns: 170px 1fr; gap: 28px; border-top: 1px solid #e2dfd8; padding: 24px 0; }
.cv-main section h2 { font-size: 18px; margin: 0; font-weight: 800; }
.cv-main section p { font-size: 18px; line-height: 1.7; margin: 0; }
.cv-job { display: flex; justify-content: space-between; gap: 20px; font-size: 18px; margin-bottom: 16px; }
.cv-job div { display: flex; flex-direction: column; gap: 3px; }
.cv-job span { color: #66615e; }
.cv-job p { font-size: 16px !important; color: #48433f; }
.cv-links { display: flex; gap: 26px; font-size: 17px; font-weight: 800; margin-top: 30px; }
@media (max-width: 700px) { .cv-main section { grid-template-columns: 1fr; gap: 10px; } }
@media print {
  body.cv-page { background: #fff; }
  .cv-page .site-header, .cv-topline button, .cv-links a[href="/"] { display: none; }
  .cv-main { max-width: none; padding: 0; }
  .cv-main section { break-inside: avoid; }
}

/* year ranges read left-to-right inside RTL text */
.job-period, .cv-job > span { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
