/* ============================================================
   JASMIN MISMAR — PORTFOLIO
   Design system: "Process & Precision"
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg:           #ECEEEF;
  --bg-2:         #E4E7E8;
  --surface:      #F8F8F6;
  --surface-2:    #FFFFFF;

  --ink:          #14181C;
  --ink-2:        #49535B;
  --ink-3:        #87909A;

  --line:         #D6DADD;
  --line-strong:  #B6BCC1;

  --accent:       #185C66;   /* process teal  */
  --accent-soft:  #1f6b76;
  --accent-2:     #B5683A;   /* copper / live */

  --shadow:       0 1px 2px rgba(20,24,28,.04), 0 12px 32px rgba(20,24,28,.06);

  --font-display: "Archivo Expanded", "Archivo", system-ui, sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;

  --shell:        1200px;
  --pad:          clamp(20px, 5vw, 64px);
  --r:            14px;
}

[data-theme="dark"] {
  --bg:           #0D1115;
  --bg-2:         #11161B;
  --surface:      #141A20;
  --surface-2:    #192128;

  --ink:          #EAEDEF;
  --ink-2:        #A4AEB6;
  --ink-3:        #69737B;

  --line:         #232E36;
  --line-strong:  #36444E;

  --accent:       #45A8B2;
  --accent-soft:  #5cb8c1;
  --accent-2:     #D38B57;

  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 16px 40px rgba(0,0,0,.35);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background .4s ease, color .4s ease;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

.shell { max-width: var(--shell); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background .4s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  color: #fff; background: var(--accent); border-radius: 9px;
}
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: .01em; }

.nav__links { display: flex; gap: 30px; }
.nav__links a {
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-2);
  position: relative; padding: 4px 0; transition: color .2s ease;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1.5px; width: 0;
  background: var(--accent); transition: width .25s ease;
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after,
.nav__links a.is-active::after { width: 100%; }
.nav__links a.is-active { color: var(--ink); }

.nav__tools { display: flex; align-items: center; gap: 10px; }
.theme-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink-2); transition: border-color .2s, color .2s, background .2s;
}
.theme-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-btn .ico-moon { display: none; }
[data-theme="dark"] .theme-btn .ico-sun { display: none; }
[data-theme="dark"] .theme-btn .ico-moon { display: block; }

.menu-btn { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); position: relative; }
.menu-btn span { position: absolute; left: 10px; width: 18px; height: 1.6px; background: var(--ink); transition: transform .25s ease, opacity .2s ease; }
.menu-btn span:nth-child(1) { top: 14px; }
.menu-btn span:nth-child(2) { bottom: 14px; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(4px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 68px 0 auto 0; z-index: 99;
  background: var(--bg); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 10px var(--pad) 22px;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
  font-family: var(--font-mono); font-size: 15px; color: var(--ink-2);
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.mobile-menu a:last-child { border-bottom: none; }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding-top: clamp(48px, 8vw, 96px); position: relative; }
.hero__grid {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 5vw, 72px);
  align-items: center; padding-bottom: clamp(40px, 6vw, 80px);
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .04em;
  color: var(--ink-2); text-transform: uppercase;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 20%, transparent); }

.hero__name {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(54px, 9vw, 116px); line-height: .92; letter-spacing: -.02em;
  margin: 22px 0 0;
}
.hero__lede {
  max-width: 46ch; margin: 26px 0 0; color: var(--ink-2);
  font-size: clamp(16px, 1.6vw, 18px); line-height: 1.65;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-size: 13.5px; letter-spacing: .01em;
  padding: 13px 22px; border-radius: 11px; transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn--solid { background: var(--accent); color: #fff; }
.btn--solid:hover { background: var(--accent-soft); }
.btn--ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero__meta {
  display: flex; flex-wrap: wrap; gap: 8px 34px; margin-top: 40px;
  padding-top: 24px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 13px; color: var(--ink);
}
.hero__meta li span { display: block; color: var(--ink-3); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 3px; }

/* schematic signature */
.schematic { margin: 0; }
.schematic svg { width: 100%; height: auto; }
.sch-grid { opacity: .55; }
.sch-unit rect, .sch-unit path { fill: var(--surface); stroke: var(--ink); stroke-width: 1.8; }
.sch-unit path { fill: none; }
.sch-label { font-family: var(--font-mono); font-size: 11px; fill: var(--ink); letter-spacing: .04em; }
.sch-tag { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-2); letter-spacing: .06em; }
.sch-tag--live { fill: var(--accent-2); }
.schematic__cap { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-top: 14px; letter-spacing: .03em; }

.flow path {
  stroke-dasharray: 10 250;
  animation: flow 3.2s linear infinite;
}
.flow path:nth-child(2){ animation-delay: .5s; }
.flow path:nth-child(3){ animation-delay: 1s; }
.flow path:nth-child(4){ animation-delay: 1.6s; }
.flow path:nth-child(5){ animation-delay: 2.1s; }
@keyframes flow { to { stroke-dashoffset: -260; } }

.sch-node--live circle { animation: pulse 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes pulse { 0%,100%{ opacity: 1; } 50%{ opacity: .4; } }

@media (prefers-reduced-motion: reduce) {
  .flow path, .sch-node--live circle { animation: none; }
  .flow path { stroke-dasharray: none; }
}

.hero__rule { height: 1px; background: var(--line); margin: 0 var(--pad); }

/* ============================================================
   SECTIONS  +  PROCESS SPINE
   ============================================================ */
.section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
.section__grid {
  display: grid; grid-template-columns: 320px 1fr; gap: clamp(32px, 5vw, 80px);
  align-items: start; position: relative;
}

/* the P&ID spine: a vertical line down the head column with a node */
.section__head { position: relative; }
.section__head::before {
  content: ""; position: absolute; left: -1px; top: 8px; bottom: -120px;
  width: 1px; background: var(--line);
}
.section:last-of-type .section__head::before { display: none; }
.section__head { padding-left: 26px; }
.kicker {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-mono); font-size: 13px; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .06em; margin: 0 0 22px;
  position: relative;
}
.kicker__tag {
  display: inline-grid; place-items: center; min-width: 46px; height: 24px; padding: 0 8px;
  font-size: 11.5px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 6px;
}
/* node on the spine, aligned to the tag */
.kicker::before {
  content: ""; position: absolute; left: -26px; top: 8px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong);
  transition: border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.section.is-active .kicker::before {
  border-color: var(--accent-2); background: var(--accent-2);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-2) 18%, transparent);
}

.section__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(30px, 4vw, 50px); line-height: 1.02; letter-spacing: -.02em;
}

.section__body { padding-top: 4px; }

/* ---- About ---- */
.about .lead { font-size: clamp(18px, 2vw, 22px); line-height: 1.55; color: var(--ink); max-width: 56ch; }
.about p + p { margin-top: 18px; color: var(--ink-2); max-width: 60ch; }
.facts {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0;
  margin-top: 40px; border-top: 1px solid var(--line);
}
.facts > div { padding: 18px 0; border-bottom: 1px solid var(--line); }
.facts > div:nth-child(odd) { padding-right: 24px; }
.facts dt { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 5px; }
.facts dd { margin: 0; font-size: 15px; color: var(--ink); }

/* ---- Timeline (education + experience) ---- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.entry {
  display: grid; grid-template-columns: 168px 1fr; gap: 28px;
  padding: 30px 0; border-top: 1px solid var(--line);
}
.entry:first-child { border-top: none; padding-top: 4px; }
.entry__period { display: flex; flex-direction: column; gap: 4px; }
.entry__year { font-family: var(--font-mono); font-size: 13px; color: var(--ink); letter-spacing: .01em; }
.entry__loc { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.entry__role { font-family: var(--font-display); font-size: clamp(18px, 2vw, 22px); font-weight: 600; letter-spacing: -.01em; }
.entry__org { margin-top: 4px; color: var(--accent); font-weight: 500; font-size: 15px; }
.entry__detail { margin-top: 12px; color: var(--ink-2); max-width: 60ch; }
.bullets { margin-top: 14px; display: flex; flex-direction: column; gap: 9px; }
.bullets li { position: relative; padding-left: 20px; color: var(--ink-2); max-width: 64ch; }
.bullets li::before { content: ""; position: absolute; left: 0; top: 11px; width: 8px; height: 1.5px; background: var(--accent); }

.taglist { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.taglist li {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2);
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 100px; background: var(--surface);
}

/* ---- Project cards ---- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px 24px 24px; overflow: hidden;
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.card::after {
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0;
  background: var(--accent); transition: width .3s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.card:hover::after { width: 100%; }
.card__index { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
.card__title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-top: 8px; letter-spacing: -.01em; }
.card__desc { margin-top: 10px; color: var(--ink-2); font-size: 15px; }
.card__link {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 18px;
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
}
.card__link:hover { color: var(--accent-soft); gap: 10px; transition: gap .2s ease; }

/* ---- Skills ---- */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 40px; }
.skillset__title { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.chiplist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chiplist li { font-size: 13.5px; color: var(--ink); padding: 7px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }

/* ---- Contact ---- */
.contact__intro { margin-top: 20px; color: var(--ink-2); max-width: 40ch; }
.contact__list { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.contact__list li { display: flex; flex-direction: column; gap: 3px; }
.contact__lab { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.contact__list a { color: var(--ink); border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; width: fit-content; transition: color .2s, border-color .2s; }
.contact__list a:hover { color: var(--accent); border-color: var(--accent); }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.field input, .field textarea {
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; width: 100%; transition: border-color .2s, background .2s;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.form__submit { justify-self: start; margin-top: 4px; }
.form__status { font-family: var(--font-mono); font-size: 13px; color: var(--accent); min-height: 18px; }
.form__status.is-error { color: var(--accent-2); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { border-top: 1px solid var(--line); padding: 34px 0; }
.footer__inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; }
.footer__name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.footer__meta { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); }
.footer__year { margin-left: auto; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .nav__links { display: none; }
  .menu-btn { display: block; }
  .hero__grid { grid-template-columns: 1fr; }
  .schematic { max-width: 360px; order: -1; }
  .section__grid { grid-template-columns: 1fr; gap: 26px; }
  .section__head::before { display: none; }
  .section__head { padding-left: 0; }
  .kicker::before { display: none; }
  .cards, .skills { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .entry { grid-template-columns: 1fr; gap: 12px; }
  .facts { grid-template-columns: 1fr; }
  .facts > div:nth-child(odd) { padding-right: 0; }
  .hero__name { font-size: clamp(48px, 16vw, 80px); }
}

/* ============================================================
   PROCESS-STREAM RAIL  (desktop navigation gauge)
   ============================================================ */
.stream {
  position: fixed; z-index: 90;
  left: max(18px, calc((100vw - 1180px) / 2 - 34px));
  top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 30px; padding: 8px 0;
}
.stream__track, .stream__fill {
  position: absolute; left: 5px; width: 2px; border-radius: 2px;
}
.stream__track { top: 8px; bottom: 8px; background: var(--line); }
.stream__fill {
  top: 8px; height: 0;
  background: linear-gradient(var(--accent-soft), var(--accent));
  box-shadow: 0 0 9px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: height .12s linear;
}
.stream__stn { position: relative; display: flex; align-items: center; gap: 12px; height: 12px; }
.stream__dot {
  width: 12px; height: 12px; border-radius: 50%; z-index: 1;
  background: var(--bg); border: 2px solid var(--line-strong);
  transition: border-color .25s, background .25s, box-shadow .25s, transform .2s;
}
.stream__label {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em;
  color: var(--ink-2); white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translateX(-6px); transition: opacity .22s, transform .22s, color .22s;
}
.stream__stn:hover .stream__dot,
.stream__stn:focus-visible .stream__dot { border-color: var(--accent); transform: scale(1.18); }
.stream__stn:hover .stream__label,
.stream__stn:focus-visible .stream__label { opacity: 1; transform: none; }
.stream__stn.is-active .stream__dot {
  border-color: var(--accent-2); background: var(--accent-2);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent-2) 16%, transparent);
}
.stream__stn.is-active .stream__label { opacity: 1; transform: none; color: var(--ink); }
@media (max-width: 1099px) { .stream { display: none; } }

/* ============================================================
   LIVE INSTRUMENT READOUT  (under schematic)
   ============================================================ */
.readout {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 14px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
}
.readout__live { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); letter-spacing: .09em; }
.readout__live i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2);
  animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 45%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.readout__val { display: inline-flex; align-items: baseline; gap: 4px; }
.readout__val b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.readout__val em { font-style: normal; color: var(--ink-3); font-size: 11px; }

/* ============================================================
   SCHEMATIC POWER-UP  (draw-in on load)
   ============================================================ */
.sch-svg .pipes path {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: pipeDraw 1s ease forwards;
}
.sch-svg .pipes path:nth-child(1) { animation-delay: .25s; }
.sch-svg .pipes path:nth-child(2) { animation-delay: .6s; }
.sch-svg .pipes path:nth-child(3) { animation-delay: .95s; }
.sch-svg .pipes path:nth-child(4) { animation-delay: 1.3s; }
@keyframes pipeDraw { to { stroke-dashoffset: 0; } }

.sch-svg .sch-unit, .sch-svg .sch-node { opacity: 0; animation: unitIn .55s ease forwards; }
.sch-svg > g.sch-node:nth-of-type(4) { animation-delay: .3s; }   /* feed  */
.sch-svg > g.sch-unit:nth-of-type(5) { animation-delay: .55s; }  /* R-01  */
.sch-svg > g.sch-unit:nth-of-type(6) { animation-delay: .8s; }   /* C-01  */
.sch-svg > g.sch-unit:nth-of-type(7) { animation-delay: 1.05s; } /* E-01  */
.sch-svg > g.sch-node:nth-of-type(8) { animation-delay: 1.4s; }  /* product */
@keyframes unitIn { from { opacity: 0; } to { opacity: 1; } }

/* fluid starts only after the pipes have drawn */
.flow path { animation: flow 3.2s linear infinite; }
.flow path:nth-child(1) { animation-delay: 1.7s; }
.flow path:nth-child(2) { animation-delay: 2.0s; }
.flow path:nth-child(3) { animation-delay: 2.3s; }
.flow path:nth-child(4) { animation-delay: 2.6s; }

@media (prefers-reduced-motion: reduce) {
  .sch-svg .pipes path { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .sch-svg .sch-unit, .sch-svg .sch-node { opacity: 1; animation: none; }
  .readout__live i { animation: none; }
  .stream__fill { transition: none; }
}
