/* ==========================================================
   Pezhman Piramoun — portfolio
   Palette B: Fintech navy · Playfair Display + Source Sans 3
   ========================================================== */

:root {
  --bg: #F6F7FA;
  --surface: #FFFFFF;
  --surface-alt: #EEF1F7;
  --text: #0E1424;
  --muted: #4A5368;
  --line: #DDE2EC;
  --accent: #1E3A8A;
  --accent-hover: #172E6E;
  --accent-soft: #E3E9F8;
  --accent-text: #1E3A8A;
  --on-accent: #FFFFFF;
  --shadow: 0 1px 2px rgba(14, 20, 36, .05), 0 12px 32px -12px rgba(14, 20, 36, .18);
  --radius: 14px;
  --font-head: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1080px;
  --header-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0B1020;
  --surface: #121A2E;
  --surface-alt: #172038;
  --text: #E6E9F2;
  --muted: #A3ACC2;
  --line: #24304D;
  --accent: #8FA8F0;
  --accent-hover: #A9BDF5;
  --accent-soft: #1A2547;
  --accent-text: #A9BDF5;
  --on-accent: #0B1020;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0; color: var(--text); }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; }

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

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 1rem; color: var(--on-accent); }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: 1rem; }
.brand { font-family: var(--font-head); font-weight: 600; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: .01em; }
.brand span { color: var(--accent-text); }
.nav-actions { display: flex; align-items: center; gap: .25rem; }

.nav-links {
  list-style: none;
  position: absolute; top: var(--header-h); left: 0; right: 0;
  display: none; flex-direction: column; gap: .25rem;
  padding: .75rem 1.25rem 1.25rem;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.nav-links.is-open { display: flex; }
.nav-links a {
  display: block; padding: .55rem .75rem; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--text); background: var(--surface-alt); }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-alt); }
.icon-btn .icon { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

@media (min-width: 860px) {
  .menu-toggle { display: none; }
  .nav-links {
    position: static; display: flex; flex-direction: row; gap: .1rem;
    padding: 0; background: none; border: 0;
  }
  .nav-links a { padding: .4rem .7rem; font-size: .97rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.35rem; border-radius: 10px;
  font: 600 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--accent); transition: background-color .2s, color .2s, transform .2s, border-color .2s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--accent-text); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-text); }
.btn:active { transform: translateY(1px); }

/* ---------- Sections ---------- */
section { padding: 4.5rem 0; }
.section-alt { background: var(--surface-alt); }
.section-head { margin-bottom: 2.5rem; max-width: 640px; }
.eyebrow {
  display: inline-block; margin-bottom: .6rem;
  font-size: .8rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text);
}
.section-head h2 { font-size: clamp(1.9rem, 4vw, 2.5rem); }
.section-head p { margin-top: .8rem; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: 3rem 0 4.5rem; }
.hero-grid { display: grid; gap: 2.75rem; align-items: center; }
.hero-photo { position: relative; max-width: 300px; margin: 0 auto; width: calc(100% - 12px); }
.hero-photo::before {
  content: ""; position: absolute; inset: 12px -12px -12px 12px;
  border: 1.5px solid var(--accent); border-radius: 24px; opacity: .5;
}
.hero-photo img {
  position: relative; width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 24px; box-shadow: var(--shadow); background: var(--surface-alt);
}
.hero-copy h1 { font-size: clamp(2.5rem, 7vw, 4rem); letter-spacing: -.01em; }
.hero-title { margin: .9rem 0 1.1rem; font-size: 1.15rem; font-weight: 600; color: var(--accent-text); }
.hero-lead { font-size: 1.15rem; color: var(--muted); max-width: 34rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.75rem; color: var(--muted); font-size: .95rem; list-style: none; }
.hero-meta li { display: inline-flex; align-items: center; gap: .4rem; }

@media (min-width: 860px) {
  .hero { padding: 5rem 0 6rem; }
  .hero-grid { grid-template-columns: 1.25fr .9fr; gap: 4rem; }
  .hero-photo { order: 2; max-width: 380px; }
  .hero-photo::before { inset: 18px -18px -18px 18px; }
}

/* ---------- About ---------- */
.about-grid { display: grid; gap: 2.5rem; align-items: start; }
.about-photo img { width: 100%; max-width: 340px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); }
.about-text p { font-size: 1.1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-top: 2rem; list-style: none; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.fact strong { display: block; font-family: var(--font-head); font-size: 1.5rem; color: var(--accent-text); line-height: 1.2; }
.fact span { font-size: .93rem; color: var(--muted); }
@media (min-width: 860px) { .about-grid { grid-template-columns: 300px 1fr; gap: 4rem; } }

/* ---------- Timeline ---------- */
.timeline { position: relative; list-style: none; padding-left: 1.75rem; }
.timeline::before { content: ""; position: absolute; left: 5px; top: .5rem; bottom: .5rem; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 2.5rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: calc(-1.75rem + 0px); top: .45rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2.5px solid var(--accent);
}
.section-alt .tl-item::before { background: var(--surface-alt); }
.tl-item.is-current::before { background: var(--accent); }
.tl-date { font-size: .9rem; font-weight: 600; color: var(--accent-text); letter-spacing: .02em; }
.tl-item h3 { font-size: 1.35rem; margin-top: .2rem; }
.tl-org { color: var(--muted); margin: .2rem 0 .7rem; }
.tl-item ul { padding-left: 1.1rem; }
.tl-item li { margin-bottom: .35rem; }
.tl-item li::marker { color: var(--accent); }
.tl-earlier { margin-top: 2.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line); }
.tl-earlier h3 { font-size: 1.15rem; margin-bottom: .9rem; }
.tl-earlier ul { list-style: none; display: grid; gap: .8rem; }
.tl-earlier li span { display: block; font-size: .9rem; color: var(--muted); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.skill-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.4rem; }
.skill-card h3 { font-family: var(--font-body); font-size: 1.02rem; font-weight: 700; margin-bottom: .8rem; }
.tags { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; }
.tags li {
  font-size: .88rem; padding: .28rem .7rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 500;
}

/* ---------- Projects ---------- */
.projects-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.project {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem; transition: transform .25s ease, box-shadow .25s ease, border-color .25s;
}
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.project-context { font-size: .85rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.project h3 { font-size: 1.35rem; margin: .45rem 0 .7rem; }
.project p { color: var(--muted); flex: 1; }
.project .tags { margin-top: .6rem; }
.project-featured { border: 1.5px solid var(--accent); }
.pf-main, .pf-side { display: flex; flex-direction: column; }
.project-featured .badge {
  align-self: flex-start; margin-bottom: .8rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: .25rem .65rem; border-radius: 6px; background: var(--accent); color: var(--on-accent);
}
@media (min-width: 860px) {
  .projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-grid .project:last-child:nth-child(even) { grid-column: 1 / -1; }
  .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.05fr 1fr; gap: 0 2.75rem; align-items: start; }
}

.project-link { display: inline-flex; align-items: center; gap: .4rem; margin-top: .25rem; font-weight: 600; text-decoration: none; }
.project-link:hover { text-decoration: underline; }
.project-link .icon { width: 16px; height: 16px; }
.highlights { list-style: none; display: grid; gap: .6rem; margin: 1.25rem 0 .5rem; }
.highlights li { position: relative; padding-left: 1.25rem; color: var(--muted); font-size: .98rem; }
.highlights li::before { content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
@media (min-width: 860px) { .project-featured .highlights { margin-top: 0; } }

/* ---------- Education ---------- */
.edu-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.edu-card { display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.edu-card .icon-wrap { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.edu-card h3 { font-size: 1.2rem; }
.edu-card p { margin: .25rem 0 0; color: var(--muted); }

/* ---------- References ---------- */
.ref-card {
  max-width: 720px; margin: 0 auto; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2.5rem 1.75rem;
}
.ref-card blockquote { margin: 0 0 1.5rem; font-family: var(--font-head); font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.4; font-style: italic; }
.ref-card p { color: var(--muted); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; gap: 2.5rem; }
.contact-list { list-style: none; display: grid; gap: .9rem; margin-top: 1.5rem; }
.contact-list a {
  display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); text-decoration: none; transition: border-color .2s, transform .2s;
}
.contact-list a:hover { border-color: var(--accent); transform: translateX(3px); }
.contact-list .icon { width: 22px; height: 22px; color: var(--accent-text); }
.contact-list small { display: block; color: var(--muted); font-size: .85rem; }

.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .95rem; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: .7rem .85rem;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hp { position: absolute; left: -9999px; }
.form-status { min-height: 1.4em; margin: 0; font-size: .95rem; color: var(--muted); }
.form-status.ok { color: #1F7A4D; }
.form-status.err { color: #B42318; }
:root[data-theme="dark"] .form-status.ok { color: #6FD3A0; }
:root[data-theme="dark"] .form-status.err { color: #F59B93; }
@media (min-width: 860px) { .contact-grid { grid-template-columns: .9fr 1.1fr; gap: 4rem; } }

/* ---------- Footer ---------- */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.socials { display: flex; gap: .35rem; list-style: none; }
.socials a { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: var(--muted); }
.socials a:hover { background: var(--surface-alt); color: var(--accent-text); }
.socials .icon { width: 19px; height: 19px; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

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

/* ==========================================================
   Résumé page
   ========================================================== */
.resume { max-width: 820px; margin: 2.5rem auto 4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem 1.5rem; }
.resume-head { border-bottom: 2px solid var(--accent); padding-bottom: 1.25rem; margin-bottom: 1.5rem; }
.resume-head h1 { font-size: clamp(2rem, 5vw, 2.6rem); }
.resume-head .role { margin: .4rem 0 .6rem; font-weight: 600; color: var(--accent-text); }
.resume-head .contact-line { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; color: var(--muted); font-size: .95rem; }
.resume h2 { font-size: 1.3rem; margin: 2rem 0 .9rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
.resume-job { margin-bottom: 1.5rem; }
.resume-job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .2rem 1rem; }
.resume-job h3 { font-family: var(--font-body); font-size: 1.08rem; font-weight: 700; }
.resume-job .when { color: var(--muted); font-size: .93rem; }
.resume-job .where { color: var(--muted); margin: .1rem 0 .5rem; font-size: .97rem; }
.resume ul { padding-left: 1.15rem; }
.resume li { margin-bottom: .3rem; }
.resume li::marker { color: var(--accent); }
.resume-skills { display: grid; gap: .55rem; }
.resume-skills div { display: grid; gap: .1rem; }
.resume-skills dt { font-weight: 700; }
.resume-skills dd { margin: 0; color: var(--muted); }
@media (min-width: 700px) {
  .resume { padding: 3rem 3.25rem; }
  .resume-skills div { grid-template-columns: 210px 1fr; gap: 1rem; }
}

@media print {
  .site-header, .site-footer, .skip-link, .resume-back { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .resume { border: 0; margin: 0; padding: 0; max-width: none; }
}
