/* ==========================================================================
   Pejman Shojaee — personal site
   Single shared stylesheet. No build step: edit this file directly.
   Sections: tokens · base · layout · header · hero · components · pages · footer
   ========================================================================== */

/* --- design tokens ------------------------------------------------------ */

:root {
  --bg:          #ffffff;
  --surface:     #f7f9fc;
  --surface-2:   #eef2f8;
  --text:        #0f172a;
  --muted:       #52627a;
  --accent:      #0d6e68;
  --accent-ink:  #0a534e;
  --accent-wash: #e6f4f2;
  --border:      #e2e8f0;
  --shadow-sm:   0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md:   0 4px 16px -4px rgba(15, 23, 42, .10);
  --shadow-lg:   0 18px 48px -18px rgba(15, 23, 42, .28);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --radius:    12px;
  --radius-lg: 18px;
  --wrap:      1080px;
  --measure:   68ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0b1220;
    --surface:     #111a2b;
    --surface-2:   #17233a;
    --text:        #e6edf6;
    --muted:       #9aabc2;
    --accent:      #5eead4;
    --accent-ink:  #99f6e4;
    --accent-wash: #10302f;
    --border:      #1f2c43;
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:   0 4px 16px -4px rgba(0, 0, 0, .5);
    --shadow-lg:   0 18px 48px -18px rgba(0, 0, 0, .7);
  }
}

:root[data-theme="dark"] {
  --bg:          #0b1220;
  --surface:     #111a2b;
  --surface-2:   #17233a;
  --text:        #e6edf6;
  --muted:       #9aabc2;
  --accent:      #5eead4;
  --accent-ink:  #99f6e4;
  --accent-wash: #10302f;
  --border:      #1f2c43;
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md:   0 4px 16px -4px rgba(0, 0, 0, .5);
  --shadow-lg:   0 18px 48px -18px rgba(0, 0, 0, .7);
}

/* --- base --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(1rem, .97rem + .16vw, 1.075rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -.019em;
  margin: 0 0 .5em;
  font-weight: 650;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.4rem, 1.2rem + .9vw, 1.85rem); }
h3 { font-size: 1.14rem; font-weight: 620; }

p  { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-ink); }

img { max-width: 100%; height: auto; display: block; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.25em; }
li { margin-bottom: .35em; }
li::marker { color: var(--muted); }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

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

::selection { background: var(--accent); color: var(--bg); }

.skip-link {
  position: absolute; left: 50%; top: -100px;
  transform: translateX(-50%);
  z-index: 200;
  padding: .7rem 1.2rem;
  background: var(--accent); color: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  transition: top .18s ease;
}
.skip-link:focus { top: 0; color: #fff; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- layout ------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2rem);
}

.section { padding-block: clamp(2.75rem, 6vw, 4.5rem); }
.section--tint { background: var(--surface); border-block: 1px solid var(--border); }
.prose { max-width: var(--measure); }

.section-head { margin-bottom: 2rem; }
.section-head p { color: var(--muted); max-width: var(--measure); margin: 0; }

/* small uppercase eyebrow above a heading */
.eyebrow {
  display: block;
  font-size: .765rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
}

/* --- header / nav ------------------------------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex; align-items: center; gap: 1rem;
  min-height: 4.1rem;
}

.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 680; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
  margin-right: auto;
  font-size: 1.02rem;
}
.brand:hover { color: var(--text); }
.brand__mark {
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font-size: .78rem; font-weight: 700; letter-spacing: .01em;
}

.nav { display: flex; align-items: center; gap: .15rem; }

.nav a {
  display: block;
  padding: .48rem .78rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: .945rem;
  font-weight: 520;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-wash); font-weight: 600; }

.icon-btn {
  display: grid; place-items: center;
  width: 2.3rem; height: 2.3rem;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }

.nav-toggle { display: none; }

/* theme toggle shows sun in dark mode, moon in light mode */
.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 (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 760px) {
  .nav-toggle { display: grid; order: 3; }
  .nav {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .1rem;
    padding: .5rem 0 .9rem;
    border-top: 1px solid var(--border);
    margin-top: -1px;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .65rem .8rem; font-size: 1rem; }
  .site-header .wrap { flex-wrap: wrap; }
}

/* --- buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .62rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit; font-size: .945rem; font-weight: 570;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn svg { width: 1.02rem; height: 1.02rem; flex: none; }

.btn--primary { background: var(--accent); color: var(--bg); }
.btn--primary:hover { background: var(--accent-ink); color: var(--bg); }

.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

/* --- hero --------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(2.5rem, 6vw, 4.75rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(60ch 40ch at 78% -10%, var(--accent-wash), transparent 70%),
    radial-gradient(50ch 34ch at 8% 110%, var(--surface-2), transparent 65%);
  opacity: .85;
  pointer-events: none;
}
.hero > .wrap { position: relative; }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.75rem, 5vw, 3.5rem);
  align-items: center;
}

.hero__portrait {
  width: clamp(150px, 20vw, 224px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
  box-shadow: var(--shadow-lg);
}

.hero h1 { margin-bottom: .35rem; }

.hero__role {
  font-size: clamp(1rem, .95rem + .3vw, 1.2rem);
  font-weight: 560;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero__lede {
  color: var(--muted);
  font-size: 1.06em;
  max-width: 60ch;
  margin-bottom: 1.5rem;
}

.hero__meta {
  display: flex; flex-wrap: wrap; gap: .45rem 1.15rem;
  margin-bottom: 1.5rem;
  font-size: .93rem; color: var(--muted);
}
.hero__meta span { display: inline-flex; align-items: center; gap: .42rem; }
.hero__meta svg { width: 1rem; height: 1rem; color: var(--accent); flex: none; }

@media (max-width: 720px) {
  .hero__grid { grid-template-columns: 1fr; justify-items: start; }
  .hero__portrait { order: -1; }
}

/* --- cards -------------------------------------------------------------- */

.grid { display: grid; gap: 1.15rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: .45rem; }
.card p  { color: var(--muted); font-size: .96rem; margin: 0; }
.card__icon {
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  margin-bottom: .95rem;
  border-radius: 10px;
  background: var(--accent-wash);
  color: var(--accent);
}
.card__icon svg { width: 1.3rem; height: 1.3rem; }

/* --- publications ------------------------------------------------------- */

.pub-year {
  display: flex; align-items: center; gap: 1rem;
  margin: 2.4rem 0 1.1rem;
  font-size: .87rem; font-weight: 680; letter-spacing: .09em;
  color: var(--muted);
}
.pub-year::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.pub-year:first-of-type { margin-top: 0; }

.pub-list { list-style: none; margin: 0; padding: 0; }

.pub {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
}
.pub:last-child { border-bottom: 0; }

.pub__title {
  font-size: 1.03rem; font-weight: 600;
  margin: 0 0 .35rem;
  line-height: 1.4;
}
.pub__authors { color: var(--muted); font-size: .93rem; margin: 0 0 .45rem; }
.pub__authors .me { color: var(--text); font-weight: 650; }
.pub__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .88rem; }
.pub__venue { color: var(--muted); font-style: italic; }

.tag {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .16rem .55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .78rem; font-weight: 550;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
}
a.tag:hover { color: var(--accent); border-color: var(--accent); }
.tag--accent { color: var(--accent); background: var(--accent-wash); border-color: transparent; }

/* --- CV timeline -------------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline > li {
  position: relative;
  padding: 0 0 1.9rem 1.75rem;
  border-left: 2px solid var(--border);
  margin: 0;
}
.timeline > li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline > li::before {
  content: "";
  position: absolute; left: -6px; top: .48rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.tl__when {
  font-size: .82rem; font-weight: 620; letter-spacing: .045em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .18rem;
}
.tl__what  { font-size: 1.06rem; font-weight: 620; margin: 0 0 .1rem; }
.tl__where { color: var(--muted); font-size: .95rem; margin: 0 0 .6rem; }
.timeline ul { margin: .55rem 0 0; padding-left: 1.15em; }
.timeline li li { color: var(--muted); font-size: .96rem; }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; padding: 0; margin: 0 0 1.4rem; list-style: none; }
.chips li { margin: 0; }
.chip {
  display: inline-block;
  padding: .3rem .72rem;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: .89rem;
  color: var(--text);
}

.def-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .5rem 1.5rem;
  margin: 0;
  font-size: .97rem;
}
.def-grid dt { font-weight: 620; }
.def-grid dd { margin: 0; color: var(--muted); }
@media (max-width: 480px) {
  .def-grid { grid-template-columns: 1fr; gap: .1rem 0; }
  .def-grid dd { margin-bottom: .6rem; }
}

/* --- gallery + lightbox ------------------------------------------------- */

.page-banner {
  position: relative;
  min-height: clamp(200px, 34vw, 340px);
  display: grid; align-items: end;
  background: #0b1220;
  overflow: hidden;
}
.page-banner img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .62;
}
.page-banner__inner { position: relative; padding-block: clamp(1.75rem, 4vw, 2.75rem); }
.page-banner h1 { color: #fff; margin-bottom: .3rem; }
.page-banner p  { color: #cbd5e1; max-width: 56ch; margin: 0; }
.page-banner .eyebrow { color: #5eead4; }
.page-banner::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,18,32,.25) 0%, rgba(11,18,32,.88) 100%);
}
.page-banner__inner { z-index: 1; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin: 0; padding: 0;
  list-style: none;
}
.gallery li { margin: 0; }

.shot {
  display: block;
  width: 100%;
  padding: 0; border: 0;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  position: relative;
  line-height: 0;
}
.shot img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .4s cubic-bezier(.2,.7,.3,1), filter .3s ease;
}
.shot:hover img { transform: scale(1.045); filter: brightness(1.06); }
.shot figcaption {
  padding: .7rem .85rem .8rem;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: left;
  background: var(--surface);
}

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: none;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(7, 11, 20, .93);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.lightbox.is-open { display: grid; }
.lightbox img {
  max-width: min(100%, 1400px);
  max-height: 82vh;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.8);
}
.lightbox figcaption {
  margin-top: 1rem;
  color: #cbd5e1;
  text-align: center;
  font-size: .95rem;
  max-width: 62ch;
}
.lightbox figure { margin: 0; display: grid; justify-items: center; }
.lightbox__close {
  position: absolute; top: 1rem; right: 1rem;
  width: 2.6rem; height: 2.6rem;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.4rem; line-height: 1;
  cursor: pointer;
}
.lightbox__close:hover { background: rgba(255,255,255,.24); }

/* --- footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-block: 2.5rem;
  margin-top: auto;
}
.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 1.25rem;
  align-items: center; justify-content: space-between;
}
.site-footer p { margin: 0; color: var(--muted); font-size: .9rem; }

.socials { display: flex; gap: .45rem; }
.socials a {
  display: grid; place-items: center;
  width: 2.35rem; height: 2.35rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  background: var(--bg);
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.socials svg { width: 1.15rem; height: 1.15rem; }

body { min-height: 100vh; display: flex; flex-direction: column; }
main  { flex: 1; }

/* --- error page --------------------------------------------------------- */

.error-page { display: grid; place-items: center; text-align: center; padding-block: clamp(4rem, 14vw, 8rem); }
.error-page .code {
  font-size: clamp(4rem, 14vw, 7rem);
  font-weight: 700; line-height: 1;
  color: var(--accent);
  letter-spacing: -.05em;
  margin-bottom: .5rem;
}

/* --- motion ------------------------------------------------------------- */

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

/* --- print (CV page) ---------------------------------------------------- */

@media print {
  .site-header, .site-footer, .btn-row, .skip-link, .lightbox { display: none !important; }
  body { font-size: 10.5pt; color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
  .section { padding-block: .6rem; }
  .timeline > li { break-inside: avoid; }
  .card { break-inside: avoid; border-color: #ccc; box-shadow: none; }
}
