/* ============================================================
   Mojtaba Farzaneh — portfolio
   Design concept: engineer's blueprint. Deep navy "drafting paper",
   cyan signal-trace accent, amber copper accent, dotted grid,
   PCB test-point corner brackets, oscilloscope scroll trace.
   ============================================================ */

:root{
  --bg: #0a1626;
  --bg-panel: #0e1e34;
  --bg-panel-2: #0b1930;
  --line: rgba(150,182,216,.16);
  --line-strong: rgba(150,182,216,.30);
  --text: #e7edf6;
  --text-muted: #8ba0bd;
  --text-faint: #5c7290;
  --accent: #5eead4;
  --accent-soft: rgba(94,234,212,.14);
  --accent-warm: #f2a154;
  --accent-warm-soft: rgba(242,161,84,.14);
  --radius: 3px;
  --serif-tighten: -0.01em;
  --shadow: 0 20px 50px -25px rgba(0,0,0,.6);
  color-scheme: dark;
}

[data-theme="day"]{
  --bg: #f3f1ea;
  --bg-panel: #ffffff;
  --bg-panel-2: #ece7db;
  --line: rgba(30,44,60,.14);
  --line-strong: rgba(30,44,60,.28);
  --text: #16232f;
  --text-muted: #55647a;
  --text-faint: #8892a3;
  --accent: #0d8f7e;
  --accent-soft: rgba(13,143,126,.10);
  --accent-warm: #c2661d;
  --accent-warm-soft: rgba(194,102,29,.12);
  --shadow: 0 20px 50px -30px rgba(20,30,40,.25);
  color-scheme: light;
}

*,*::before,*::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *,*::before,*::after{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
  overflow-x: hidden;
}

h1,h2,h3{
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: var(--serif-tighten);
  margin: 0;
  color: var(--text);
}

a{ color: inherit; text-decoration: none; }

.wrap{
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------- background grid + scroll trace ---------- */
.grid-overlay{
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 40%, transparent 85%);
  opacity: .5;
}

#trace{
  position: fixed; top: 0; left: 0; width: 100%; height: 5px;
  z-index: 1000;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
}
#trace-path{
  fill: none;
  stroke: var(--accent);
  stroke-width: .6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  transition: stroke-dashoffset .1s linear;
}

/* ---------- header ---------- */
.site-header{
  position: sticky; top: 5px; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner{
  display: flex; align-items: center; gap: 24px;
  height: 68px;
}
.brand{ display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-mark{
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem; font-weight: 600;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  padding: 4px 7px;
  border-radius: var(--radius);
}
.brand-name{ font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 1.05rem; }

.site-nav{ display: flex; gap: 28px; }
.site-nav a{
  font-size: .92rem; color: var(--text-muted);
  position: relative; padding: 4px 0;
  transition: color .2s ease;
}
.site-nav a::after{
  content:""; position:absolute; left:0; right:100%; bottom:0; height:1px;
  background: var(--accent); transition: right .25s ease;
}
.site-nav a:hover{ color: var(--text); }
.site-nav a:hover::after{ right: 0; }

.header-actions{ display: flex; align-items: center; gap: 16px; }

.switch{
  display: flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace; font-size: .68rem; letter-spacing: .06em;
}
.switch-track{
  width: 34px; height: 18px; border-radius: 20px;
  background: var(--bg-panel-2); border: 1px solid var(--line-strong);
  position: relative; display: inline-block;
  transition: background .25s ease;
}
.switch-thumb{
  position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  transition: transform .25s ease;
}
.switch[aria-pressed="true"] .switch-thumb{ transform: translateX(16px); background: var(--accent-warm); }

.btn{
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .82rem; font-weight: 500; letter-spacing: .01em;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.btn:hover{ transform: translateY(-1px); }
.btn-cv{ color: var(--text); background: var(--bg-panel); }
.btn-cv:hover{ border-color: var(--accent); color: var(--accent); }
.icon-doc{ width: 15px; height: 15px; }

.nav-toggle{ display:none; }

/* ---------- hero ---------- */
.hero{ position: relative; padding: 132px 0 96px; overflow: hidden; }
.hero-grid{
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-areas: "text photo";
  gap: 56px;
  align-items: start;
}
.hero-text{ grid-area: text; max-width: 720px; }

.hero-photo-wrap{ grid-area: photo; justify-self: end; padding-top: 4px; }
.photo-frame{
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--bg-panel-2);
  overflow: hidden;
}
.photo-frame::before, .photo-frame::after{
  content:""; position: absolute; width: 16px; height: 16px;
  border-color: var(--accent); z-index: 2; pointer-events: none;
}
.photo-frame::before{ top: 8px; left: 8px; border-top: 1px solid; border-left: 1px solid; }
.photo-frame::after{ bottom: 8px; right: 8px; border-bottom: 1px solid; border-right: 1px solid; }
.photo-frame img{
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: grayscale(1) contrast(1.06) brightness(1.02);
}
.photo-caption{
  margin: 12px 2px 0; text-align: right;
  font-family: 'IBM Plex Mono', monospace; font-size: .7rem;
  letter-spacing: .08em; color: var(--text-faint);
}
.eyebrow{
  font-family: 'IBM Plex Mono', monospace;
  font-size: .76rem; letter-spacing: .14em;
  color: var(--accent); margin: 0 0 22px;
}
.hero-name{
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  font-weight: 700; line-height: 1.02; margin-bottom: 22px;
}
.hero-role{
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.05rem; color: var(--text-muted);
  margin: 0 0 24px; display: flex; gap: 10px; flex-wrap: wrap;
}
.role-rotate{
  color: var(--accent-warm); font-weight: 600;
  border-bottom: 1px dashed var(--accent-warm);
  padding-bottom: 2px;
}
.hero-desc{
  max-width: 540px; color: var(--text-muted); font-size: 1.04rem;
  margin-bottom: 36px;
}
.hero-cta{ display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 56px; }
.btn-primary{ background: var(--accent); border-color: var(--accent); color: #06201c; font-weight: 600; }
.btn-primary:hover{ background: var(--accent-warm); border-color: var(--accent-warm); color: #241002; }
.btn-ghost{ color: var(--text-muted); }
.btn-ghost:hover{ color: var(--text); border-color: var(--line-strong); }
.btn-large{ padding: 15px 26px; font-size: .9rem; margin-top: 40px; }

.hero-stats{
  display: grid; grid-template-columns: repeat(4, auto);
  gap: 32px; margin: 0; padding-top: 28px; border-top: 1px solid var(--line);
}
.hero-stats dt{
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem; font-weight: 700; color: var(--text);
}
.hero-stats dd{
  margin: 2px 0 0; font-size: .76rem; color: var(--text-faint);
  font-family: 'IBM Plex Mono', monospace;
}

.hero-circuit{
  position: absolute; top: 0; right: -6%; width: 62%; height: 100%;
  color: var(--line-strong);
  z-index: 1;
  pointer-events: none;
}
.hero-circuit .ct{
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 2.4s ease forwards .2s;
}
.hero-circuit .nodes circle{ opacity: 0; animation: fadeIn .6s ease forwards 2.2s; color: var(--accent); }
@keyframes draw{ to{ stroke-dashoffset: 0; } }
@keyframes fadeIn{ to{ opacity: 1; } }

/* ---------- sections ---------- */
.section{ position: relative; z-index: 2; padding: 96px 0; }
.section-alt{ background: color-mix(in srgb, var(--bg-panel) 55%, transparent); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tag{
  font-family: 'IBM Plex Mono', monospace; font-size: .76rem; letter-spacing: .12em;
  color: var(--accent-warm); margin: 0 0 14px;
}
.section-title{ font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 700; margin-bottom: 48px; max-width: 640px; }

.two-col{ display: grid; grid-template-columns: 280px 1fr; gap: 56px; }
.col-label h2{ font-size: 1.9rem; font-weight: 700; }
.lede{ font-size: 1.12rem; color: var(--text); margin: 0 0 20px; }
.col-body p{ color: var(--text-muted); margin: 0 0 18px; max-width: 62ch; }
.about-meta{ list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.about-meta li{ display: flex; gap: 14px; font-family: 'IBM Plex Mono', monospace; font-size: .88rem; }
.about-meta span{ color: var(--text-faint); width: 90px; flex-shrink: 0; }
.about-meta a{ color: var(--accent); border-bottom: 1px solid transparent; }
.about-meta a:hover{ border-color: var(--accent); }

/* ---------- tabs / record ---------- */
.tab-list{ display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 40px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
.tab-btn{
  font-family: 'IBM Plex Mono', monospace; font-size: .82rem;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 10px 16px;
  position: relative; top: 1px;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.tab-btn:hover{ color: var(--text); }
.tab-btn.is-active{ color: var(--accent); border-color: var(--accent); }

.tab-panel{ display: none; }
.tab-panel.is-active{ display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp{ from{ opacity: 0; transform: translateY(6px);} to{ opacity: 1; transform: translateY(0);} }

.timeline{ list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.timeline li{ position: relative; padding: 0 0 34px 28px; }
.timeline li::before{
  content:""; position: absolute; left: -5px; top: 4px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li:last-child{ padding-bottom: 0; }
.tl-date{ font-family: 'IBM Plex Mono', monospace; font-size: .78rem; color: var(--accent-warm); display: block; margin-bottom: 6px; }
.timeline h3{ font-size: 1.12rem; font-weight: 600; margin-bottom: 2px; }
.tl-org{ color: var(--text-faint); font-size: .86rem; margin: 0 0 6px; }
.timeline p:not(.tl-org){ color: var(--text-muted); margin: 0; max-width: 60ch; }

.grid-list{ list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid-list li{ background: var(--bg); padding: 16px 20px; color: var(--text-muted); font-size: .92rem; display: flex; gap: 14px; }
.gl-date{ font-family: 'IBM Plex Mono', monospace; color: var(--accent); font-size: .82rem; flex-shrink: 0; }

.pub-list{ list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.pub-list li{ display: flex; gap: 16px; color: var(--text-muted); font-size: .94rem; max-width: 70ch; }
.pub-list em{ color: var(--text-faint); font-style: italic; }
.pub-more a{ color: var(--accent); font-family: 'IBM Plex Mono', monospace; font-size: .86rem; }
.pub-more a:hover{ text-decoration: underline; }

/* ---------- skills / meters ---------- */
.meter-grid{ display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 40px; margin-bottom: 40px; }
.meter-top{ display: flex; justify-content: space-between; font-size: .92rem; margin-bottom: 8px; }
.meter-top span:first-child{ color: var(--text); font-weight: 500; }
.meter-num{ font-family: 'IBM Plex Mono', monospace; color: var(--text-faint); font-size: .82rem; }
.meter-bar{ height: 6px; background: var(--bg-panel-2); border-radius: 20px; overflow: hidden; border: 1px solid var(--line); }
.meter-bar i{ display: block; height: 100%; width: 0; border-radius: 20px; background: linear-gradient(90deg, var(--accent), var(--accent-warm)); transition: width 1.1s cubic-bezier(.2,.7,.2,1); }
.meter.in-view .meter-bar i{ width: var(--target, 0%); }

.chip-row{ display: flex; flex-wrap: wrap; gap: 10px; }
.chip{
  font-family: 'IBM Plex Mono', monospace; font-size: .78rem;
  border: 1px solid var(--line-strong); border-radius: 20px;
  padding: 7px 14px; color: var(--text-muted);
}

/* ---------- work grid ---------- */
.work-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.work-card{
  background: var(--bg); padding: 30px 26px; position: relative;
  transition: background .2s ease;
}
.work-card:hover{ background: var(--bg-panel); }
.work-card::before, .work-card::after{
  content:""; position: absolute; width: 10px; height: 10px;
  border-color: var(--accent); opacity: 0; transition: opacity .2s ease;
}
.work-card::before{ top: 10px; left: 10px; border-top: 1px solid; border-left: 1px solid; }
.work-card::after{ bottom: 10px; right: 10px; border-bottom: 1px solid; border-right: 1px solid; }
.work-card:hover::before, .work-card:hover::after{ opacity: 1; }
.work-glyph{ width: 34px; height: 34px; margin-bottom: 18px; border: 1px solid var(--line-strong); border-radius: 50%; position: relative; }
.work-glyph::after{ content: ""; position: absolute; inset: 9px; border: 1.4px solid var(--accent); border-radius: 2px; }
.work-card h3{ font-size: 1.08rem; font-weight: 600; margin-bottom: 10px; }
.work-card p{ color: var(--text-muted); font-size: .92rem; margin: 0 0 20px; }
.work-year{ font-family: 'IBM Plex Mono', monospace; font-size: .76rem; color: var(--text-faint); }

/* ---------- contact ---------- */
.contact-lede{ max-width: 56ch; }
.contact-grid{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 8px; }
.contact-card{ background: var(--bg); padding: 24px 22px; display: flex; flex-direction: column; gap: 8px; transition: background .2s ease, color .2s ease; }
.contact-card:not(.is-static):hover{ background: var(--bg-panel); color: var(--accent); }
.cc-label{ font-family: 'IBM Plex Mono', monospace; font-size: .72rem; color: var(--text-faint); letter-spacing: .06em; }
.cc-value{ font-size: .96rem; word-break: break-word; }

/* ---------- footer ---------- */
.site-footer{ border-top: 1px solid var(--line); padding: 32px 0; position: relative; z-index: 2; }
.footer-inner{ display: flex; justify-content: space-between; align-items: center; font-size: .84rem; color: var(--text-faint); font-family: 'IBM Plex Mono', monospace; }
.footer-social{ display: flex; gap: 16px; }
.footer-social a{ color: var(--text-faint); transition: color .2s ease; }
.footer-social a:hover{ color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 900px){
  .two-col{ grid-template-columns: 1fr; gap: 24px; }
  .meter-grid{ grid-template-columns: 1fr; }
  .grid-list{ grid-template-columns: 1fr; }
  .work-grid{ grid-template-columns: repeat(2, 1fr); }
  .contact-grid{ grid-template-columns: repeat(2, 1fr); }
  .hero-circuit{ opacity: .5; }
  .hero-grid{
    grid-template-columns: 1fr;
    grid-template-areas: "photo" "text";
    gap: 32px;
  }
  .hero-photo-wrap{ justify-self: start; width: 200px; }
}
@media (max-width: 640px){
  .site-nav{ display: none; }
  .nav-toggle{
    display: flex; flex-direction: column; gap: 4px;
    background: none; border: none; cursor: pointer; padding: 6px;
  }
  .nav-toggle span{ width: 20px; height: 1.5px; background: var(--text); display: block; }
  .header-actions .switch-label{ display: none; }
  .btn-cv span{ display: none; }
  .hero{ padding: 96px 0 64px; }
  .hero-stats{ grid-template-columns: repeat(2, auto); row-gap: 24px; }
  .work-grid{ grid-template-columns: 1fr; }
  .contact-grid{ grid-template-columns: 1fr; }
  .hero-circuit{ display: none; }
}

.site-nav.is-open{
  display: flex; position: absolute; top: 68px; left: 0; right: 0;
  flex-direction: column; background: var(--bg-panel);
  border-bottom: 1px solid var(--line); padding: 8px 28px 20px;
}
