/* =========================================================================
   Shayan Ekramnia — personal site
   Theme: slate + electric blue, dark-default with light toggle
   ========================================================================= */

:root {
  /* accent (shared across themes) */
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-strong: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.45);

  --radius: 16px;
  --radius-sm: 10px;
  --maxw: 1120px;
  --gut: 24px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.55);
}

/* ---- Dark (default) ---- */
[data-theme="dark"] {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --surface: #111c30;
  --surface-2: #16223a;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #e8edf6;
  --text-soft: #aab6c9;
  --text-dim: #7d8aa0;
  --hero-grid: rgba(148, 163, 184, 0.07);
  --chip-bg: rgba(59, 130, 246, 0.1);
  --chip-text: #cfe0ff;
}

/* ---- Light ---- */
[data-theme="light"] {
  --bg: #f7f9fc;
  --bg-alt: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f1b2d;
  --text-soft: #3f4d63;
  --text-dim: #64748b;
  --hero-grid: rgba(15, 23, 42, 0.05);
  --chip-bg: rgba(37, 99, 235, 0.08);
  --chip-text: #1d4ed8;
  --shadow: 0 18px 50px -22px rgba(15, 23, 42, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut); }

.grad-text {
  background: linear-gradient(120deg, var(--accent-2), var(--accent-strong));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- Skip link / progress ---- */
.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 200;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-strong));
  z-index: 120; transition: width 0.1s linear;
}

/* =========================== NAV =========================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s, padding 0.3s;
}
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px var(--gut);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.nav__monogram {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-strong));
  color: #fff; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.5px;
  box-shadow: 0 6px 18px -6px var(--accent-glow);
}
.nav__name { font-size: 0.98rem; }
.nav__links { display: flex; gap: 4px; }
.nav__links a {
  position: relative; padding: 8px 14px; border-radius: 8px;
  font-size: 0.92rem; color: var(--text-soft); font-weight: 500;
  transition: color 0.2s, background 0.2s;
}
.nav__links a:hover { color: var(--text); background: var(--surface); }
.nav__links a.is-active { color: var(--accent-2); }
.nav__links a.is-active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.nav__actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: grid; place-items: center; transition: border-color 0.2s, transform 0.2s, background 0.3s;
}
.theme-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }
.theme-toggle .ic { width: 19px; height: 19px; }
[data-theme="dark"] .ic--sun { display: block; }
[data-theme="dark"] .ic--moon { display: none; }
[data-theme="light"] .ic--sun { display: none; }
[data-theme="light"] .ic--moon { display: block; }

.nav__burger {
  display: none; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
}
.nav__burger span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.3s var(--ease); }
.nav__burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================== BUTTONS =========================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  transition: transform 0.2s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s, color 0.2s;
}
.btn .ic { width: 18px; height: 18px; }
.btn--sm { padding: 8px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn--lg { padding: 15px 26px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn--primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent-strong));
  color: #fff; box-shadow: 0 12px 28px -12px var(--accent-glow);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -12px var(--accent-glow); }
.btn--outline { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn--outline:hover { border-color: var(--accent); color: var(--accent-2); transform: translateY(-2px); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text-soft); }
.btn--ghost:hover { color: var(--text); border-color: var(--accent); }
.ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* =========================== HERO =========================== */
.hero { position: relative; padding: 150px 0 70px; overflow: hidden; }
.hero__bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero__grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--hero-grid) 1px, transparent 1px),
                    linear-gradient(90deg, var(--hero-grid) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}
.hero__glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.hero__glow--1 { width: 460px; height: 460px; top: -120px; right: -80px; background: radial-gradient(circle, var(--accent-glow), transparent 70%); }
.hero__glow--2 { width: 380px; height: 380px; bottom: -120px; left: -100px; background: radial-gradient(circle, rgba(96,165,250,0.3), transparent 70%); animation: float 9s var(--ease) infinite alternate; }
@keyframes float { to { transform: translate(40px, -30px); } }

.hero__inner {
  position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut);
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 50px; align-items: center;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 9px; font-size: 0.85rem; font-weight: 500;
  color: var(--text-soft); background: var(--surface); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; margin-bottom: 22px;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,0.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }

.hero__title { font-size: clamp(2.6rem, 6vw, 4.3rem); font-weight: 900; letter-spacing: -0.02em; line-height: 1.02; }
.hero__role { font-size: clamp(1.15rem, 2.4vw, 1.6rem); font-weight: 700; margin-top: 8px; color: var(--text); }
.hero__role-sep { color: var(--text-dim); margin: 0 4px; font-weight: 400; }
.hero__tagline { margin-top: 20px; max-width: 540px; color: var(--text-soft); font-size: 1.05rem; }
.hero__tagline strong { color: var(--text); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.hero__socials { display: flex; gap: 12px; margin-top: 28px; }
.hero__socials a {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  transition: transform 0.2s, color 0.2s, border-color 0.2s;
}
.hero__socials svg { width: 20px; height: 20px; fill: currentColor; }
.hero__socials a:hover { transform: translateY(-3px); color: var(--accent-2); border-color: var(--accent); }

/* Portrait */
.hero__portrait { display: flex; justify-content: center; }
.portrait {
  position: relative; width: min(340px, 78vw); aspect-ratio: 1; border-radius: 28px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; position: relative; z-index: 2; }
.portrait img.is-hidden { display: none; }
.portrait__fallback {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
  font-size: 6rem; font-weight: 900; letter-spacing: 2px;
  background: radial-gradient(circle at 30% 25%, rgba(96,165,250,0.25), transparent 60%);
  color: var(--accent-2);
}
.portrait__ring {
  position: absolute; inset: -2px; z-index: 3; border-radius: 28px; pointer-events: none;
  background: linear-gradient(135deg, var(--accent-2), transparent 40%, transparent 60%, var(--accent-strong));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 2px; opacity: 0.7;
}

/* Stats */
.hero__stats {
  position: relative; z-index: 1; max-width: var(--maxw); margin: 60px auto 0; padding: 0 var(--gut);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; text-align: center; transition: transform 0.25s, border-color 0.25s;
}
.stat:hover { transform: translateY(-4px); border-color: var(--accent); }
.stat__num { display: block; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; color: var(--accent-2); font-family: var(--mono); }
.stat__label { font-size: 0.82rem; color: var(--text-dim); }

/* =========================== SECTIONS =========================== */
.section { padding: 90px 0; position: relative; }
.section--alt { background: var(--bg-alt); }
.section__kicker { font-family: var(--mono); font-size: 0.82rem; color: var(--accent-2); letter-spacing: 1px; margin-bottom: 10px; }
.section__title { font-size: clamp(1.7rem, 3.5vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 38px; max-width: 720px; }

/* About */
.about { display: grid; grid-template-columns: 1.6fr 1fr; gap: 40px; align-items: start; }
.about__lead p { color: var(--text-soft); margin-bottom: 16px; font-size: 1.05rem; }
.about__lead strong { color: var(--text); font-weight: 600; }
.about__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.about__card h3 { font-size: 1.05rem; margin-bottom: 16px; }
.kv li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.kv li:last-of-type { border-bottom: none; }
.kv span { color: var(--text-dim); }
.kv strong { text-align: right; font-weight: 600; }
.about__card .btn { margin-top: 18px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.skill-card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.skill-card h3 { font-size: 1.05rem; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.skill-card__dot { width: 9px; height: 9px; border-radius: 3px; background: linear-gradient(135deg, var(--accent-2), var(--accent-strong)); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-size: 0.82rem; padding: 5px 11px; border-radius: 8px;
  background: var(--chip-bg); color: var(--chip-text); border: 1px solid var(--border);
  font-family: var(--mono); font-weight: 500;
}
.chips--mini li { font-size: 0.74rem; padding: 4px 9px; }

/* Timeline */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border-strong); }
.tl { position: relative; padding-bottom: 36px; }
.tl:last-child { padding-bottom: 0; }
.tl__dot {
  position: absolute; left: -34px; top: 5px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.tl__body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 26px; transition: border-color 0.25s, transform 0.25s; }
.tl__body:hover { border-color: var(--border-strong); transform: translateX(3px); }
.tl__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.tl__head h3 { font-size: 1.15rem; font-weight: 700; }
.tl__date { font-family: var(--mono); font-size: 0.82rem; color: var(--accent-2); white-space: nowrap; }
.tl__org { color: var(--text-soft); font-weight: 600; margin: 4px 0 6px; }
.tl__org-sub { color: var(--text-dim); font-weight: 400; }
.tl__note { font-size: 0.85rem; color: var(--text-dim); font-style: italic; margin-bottom: 12px; }
.tl__points { display: grid; gap: 9px; margin-top: 10px; }
.tl__points li { position: relative; padding-left: 20px; color: var(--text-soft); font-size: 0.95rem; }
.tl__points li::before { content: ""; position: absolute; left: 2px; top: 9px; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); opacity: 0.7; }
.tl__points strong { color: var(--text); font-weight: 600; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.project {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px; display: flex; flex-direction: column; gap: 12px;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.project:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.project__top { display: flex; align-items: center; justify-content: space-between; }
.project__tag { font-family: var(--mono); font-size: 0.74rem; color: var(--accent-2); background: var(--chip-bg); padding: 5px 11px; border-radius: 999px; }
.project__link { color: var(--text-dim); transition: color 0.2s, transform 0.2s; }
.project__link:hover { color: var(--accent-2); transform: translateY(-2px); }
.project__link svg { width: 22px; height: 22px; fill: currentColor; }
.project h3 { font-size: 1.18rem; font-weight: 700; }
.project p { color: var(--text-soft); font-size: 0.95rem; }
.project__result { color: var(--text) !important; font-size: 0.9rem !important; padding: 10px 14px; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 8px; }
.project__result strong { color: var(--accent-2); }
.project .chips { margin-top: auto; }

/* Education + awards */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
.edu-col { display: grid; gap: 18px; }
.edu, .awards { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; transition: border-color 0.25s, transform 0.25s; }
.edu:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.edu__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
.edu__head h3 { font-size: 1.08rem; }
.edu__date { font-family: var(--mono); font-size: 0.8rem; color: var(--accent-2); }
.edu__org { color: var(--text-soft); font-weight: 600; margin: 3px 0 8px; font-size: 0.95rem; }
.edu__meta { font-size: 0.9rem; color: var(--text-dim); }
.badge { display: inline-block; font-family: var(--mono); font-size: 0.74rem; padding: 3px 9px; border-radius: 6px; margin-right: 6px; font-weight: 600; }
.badge--gold { background: rgba(234, 179, 8, 0.14); color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
.awards h3 { font-size: 1.08rem; margin-bottom: 16px; }
.awards__list { display: grid; gap: 14px; }
.awards__list li { display: flex; gap: 12px; }
.awards__icon { color: var(--accent-2); font-size: 1rem; line-height: 1.6; }
.awards__list strong { display: block; font-size: 0.95rem; }
.awards__list span { color: var(--text-dim); font-size: 0.86rem; }
.lang li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.95rem; }
.lang li:last-child { border-bottom: none; }
.lang__lvl { color: var(--accent-2); font-family: var(--mono); font-size: 0.82rem; }

/* Contact */
.section--contact { background: var(--bg-alt); }
.contact { text-align: center; max-width: 720px; margin: 0 auto; }
.contact .section__kicker { text-align: center; }
.contact__title { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 900; letter-spacing: -0.02em; margin-bottom: 16px; }
.contact__sub { color: var(--text-soft); font-size: 1.08rem; margin-bottom: 32px; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

/* Footer */
.footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer__inner { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; color: var(--text-dim); font-size: 0.86rem; }

/* =========================== REVEAL ANIMATION =========================== */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* =========================== RESPONSIVE =========================== */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; gap: 38px; }
  .hero__portrait { order: -1; }
  .portrait { width: min(240px, 60vw); }
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
  .about, .edu-grid { grid-template-columns: 1fr; }
  .skills { grid-template-columns: repeat(2, 1fr); }
  .projects { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav__name { display: none; }
  .nav__links {
    position: fixed; inset: 64px 14px auto 14px; flex-direction: column; gap: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 12px; box-shadow: var(--shadow); transform: translateY(-12px); opacity: 0;
    pointer-events: none; transition: 0.25s var(--ease);
  }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 12px 14px; }
  .nav__burger { display: flex; }
  .skills { grid-template-columns: 1fr; }
  .hero__stats { grid-template-columns: 1fr 1fr; }
  .section { padding: 64px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
