/* =========================================================================
   Mohsen Salari — personal site
   Quiet, modern, European-minimal. Neutral palette + one restrained accent.
   ========================================================================= */

/* ---- variables ---------------------------------------------------------- */
:root {
  --sans: -apple-system, system-ui, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  /* neutral dark, faint green-neutral undertone only */
  --bg: #0a0a0b;
  --bg-2: #0d0d0e;
  --surface: #0e0e0f;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #ededee;
  --muted: #8b8b90;
  --faint: #5a5a60;
  --accent: #3cb371;              /* used sparingly */
  --accent-soft: rgba(60, 179, 113, 0.12);
  --maxw: 940px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="light"] {
  --bg: #fbfbfa;
  --bg-2: #f3f3f1;
  --surface: #ffffff;
  --line: rgba(0, 0, 0, 0.10);
  --line-2: rgba(0, 0, 0, 0.18);
  --text: #131316;
  --muted: #6a6a70;
  --faint: #9a9aa0;
  --accent: #1f9d5f;
  --accent-soft: rgba(31, 157, 95, 0.10);
}

/* ---- reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; max-width: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-soft); color: var(--text); }

/* ---- layout ------------------------------------------------------------- */
.wrap { width: min(90%, var(--maxw)); margin: 0 auto; }
section { padding: 120px 0; }
section + section { border-top: 1px solid var(--line); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--faint);
}
.section-title {
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 1rem 0 3rem;
  color: var(--text);
}
.section-title .dot { color: var(--accent); }

/* ---- nav ---------------------------------------------------------------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-size: 0.95rem; font-weight: 500; letter-spacing: 0.01em; display: flex; align-items: center; gap: 0.55rem; }
.brand .sig {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  color: var(--muted); border: 1px solid var(--line-2);
  border-radius: 5px; padding: 0.15rem 0.35rem; letter-spacing: 0.05em;
}
.nav-links { display: flex; align-items: center; gap: 1.8rem; }
.nav-links a { font-size: 0.86rem; color: var(--muted); transition: color 0.2s var(--ease); }
.nav-links a:hover { color: var(--text); }
.theme-toggle, .nav-toggle {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 0.95rem; padding: 0.3rem; line-height: 1;
  transition: color 0.2s var(--ease);
}
.theme-toggle:hover, .nav-toggle:hover { color: var(--text); }
.nav-toggle { display: none; }

/* ---- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.88rem; font-weight: 500;
  padding: 0.6rem 1.1rem; border-radius: 8px;
  border: 1px solid transparent;
  transition: opacity 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
  cursor: pointer;
}
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.82; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--muted); }

/* ---- hero --------------------------------------------------------------- */
.hero { padding: 96px 0 100px; border-top: none; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 0.85fr; gap: 64px; align-items: center; }
.hero .eyebrow { margin-bottom: 1.5rem; display: block; }
.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.5rem);
  line-height: 1.08; letter-spacing: -0.03em; font-weight: 500;
}
.hero h1 .grad { color: var(--accent); }
.hero .role { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; margin-top: 1.3rem; letter-spacing: 0.02em; }
.hero p.lead { color: var(--muted); font-size: 1.08rem; max-width: 46ch; margin-top: 1.4rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2.2rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 1.6rem; margin-top: 2.2rem; font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
.hero-meta b { color: var(--text); font-weight: 500; }

.hero-photo { justify-self: center; }
.hero-photo img {
  width: 260px; height: 320px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line-2);
  filter: grayscale(0.15) contrast(1.02);
  transition: filter 0.5s var(--ease);
}
.hero-photo img:hover { filter: grayscale(0); }

/* stat strip — quiet, hairline dividers */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 84px; border-top: 1px solid var(--line); }
.stat { padding: 1.6rem 1.2rem 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .num { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em; color: var(--text); }
.stat .num span { color: var(--text); }
.stat .label { font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }

/* ---- about -------------------------------------------------------------- */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 64px; align-items: start; }
.about-grid p { color: var(--muted); margin-bottom: 1.2rem; font-size: 1.02rem; }
.about-grid p strong { color: var(--text); font-weight: 500; }
.about-card { border-top: 1px solid var(--line); padding-top: 1.4rem; }
.about-card h3 { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 1.2rem; }
.about-list { list-style: none; display: grid; gap: 0; }
.about-list li { display: block; font-size: 0.92rem; color: var(--muted); padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.about-list li strong { color: var(--text); font-weight: 500; }

/* ---- experience timeline ----------------------------------------------- */
.timeline { display: grid; gap: 0; }
.tl-item {
  display: grid; grid-template-columns: 160px 1fr; gap: 40px;
  padding: 2.2rem 0; border-bottom: 1px solid var(--line);
}
.timeline .tl-item:first-child { border-top: 1px solid var(--line); }
.tl-when { font-family: var(--mono); font-size: 0.76rem; color: var(--faint); }
.tl-when .place { display: block; margin-top: 0.4rem; color: var(--muted); }
.tl-role { font-size: 1.1rem; font-weight: 500; letter-spacing: -0.01em; }
.tl-co { color: var(--text); font-weight: 500; transition: color 0.2s var(--ease); }
a.tl-co:hover { color: var(--accent); }
.honor .h-meta a { color: var(--muted); border-bottom: 1px solid var(--line-2); }
.honor .h-meta a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tl-body { color: var(--muted); margin-top: 0.6rem; font-size: 0.96rem; max-width: 60ch; }
.tl-tags { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 1rem; }
.tl-tags span { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.tl-tags span::before { content: ""; }

/* ---- projects ----------------------------------------------------------- */
.proj-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; border-top: 1px solid var(--line); }
.proj {
  padding: 2rem 0; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: opacity 0.25s var(--ease);
}
.proj-grid .proj:nth-child(odd) { padding-right: 2.4rem; border-right: 1px solid var(--line); }
.proj-grid .proj:nth-child(even) { padding-left: 2.4rem; }
.proj.feature { grid-column: 1 / -1; padding-right: 0; border-right: none; }
.proj:hover { opacity: 1; }
.proj-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.3rem; }
.proj-links { display: flex; gap: 1rem; }
.proj-links a { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.proj-links a:hover { color: var(--accent); }
.tag-open { font-family: var(--mono); font-size: 0.7rem; color: var(--faint); letter-spacing: 0.16em; text-transform: uppercase; }
.proj h3 { font-size: 1.18rem; font-weight: 500; letter-spacing: -0.01em; margin: 0.5rem 0 0.2rem; }
.proj p { color: var(--muted); font-size: 0.96rem; margin-top: 0.5rem; flex: 1; max-width: 64ch; }
.proj .stack { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 1.2rem; }
.proj .stack span { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }

/* ---- recognition -------------------------------------------------------- */
.honor { border-top: 1px solid var(--line); padding-top: 2.4rem; }
.honor .h-meta { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); letter-spacing: 0.04em; }
.honor h3 { font-size: 1.2rem; font-weight: 500; letter-spacing: -0.01em; margin: 0.6rem 0 0.6rem; }
.honor p { color: var(--muted); font-size: 0.96rem; max-width: 64ch; }
.honor .h-tags { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 1.2rem; }
.honor .h-tags span { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 2.2rem; }
.gallery .shot { padding: 0; border: none; background: none; cursor: zoom-in; display: block; }
.gallery .shot img {
  width: 100%; height: 200px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line-2);
  filter: grayscale(0.12) brightness(0.94);
  transition: filter 0.35s var(--ease), transform 0.35s var(--ease);
}
.gallery .shot:hover img { filter: none; transform: translateY(-3px); }

.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 5vh 5vw;
  background: rgba(0, 0, 0, 0.9); cursor: zoom-out;
  opacity: 0; transition: opacity 0.25s var(--ease);
}
.lightbox.open { display: flex; opacity: 1; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 10px; border: 1px solid var(--line-2); }

/* ---- skills ------------------------------------------------------------- */
.skill-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.skill-card { padding: 2rem 0; }
.skill-groups .skill-card:not(:last-child) { border-right: 1px solid var(--line); padding-right: 2rem; }
.skill-groups .skill-card + .skill-card { padding-left: 2rem; }
.skill-card h3 { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 1.2rem; }
.chips { display: flex; flex-direction: column; gap: 0.55rem; }
.chips span { font-size: 0.9rem; color: var(--muted); }
.chips span:hover { color: var(--text); }

/* ---- writing ------------------------------------------------------------ */
.posts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.post-row {
  display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 1.5rem;
  padding: 1.7rem 0; border-bottom: 1px solid var(--line);
  transition: opacity 0.2s var(--ease);
}
.post-row:hover { opacity: 1; }
.post-row .date { grid-row: 1; font-family: var(--mono); font-size: 0.74rem; color: var(--faint); }
.post-row h3 { grid-row: 2; font-size: 1.15rem; font-weight: 500; letter-spacing: -0.01em; transition: color 0.2s var(--ease); }
.post-row:hover h3 { color: var(--accent); }
.post-row .excerpt { grid-row: 3; grid-column: 1 / -1; color: var(--muted); font-size: 0.93rem; margin-top: 0.4rem; max-width: 64ch; }
.post-row .ptags { grid-row: 4; grid-column: 1 / -1; margin-top: 0.7rem; font-family: var(--mono); font-size: 0.72rem; color: var(--faint); display: flex; gap: 1rem; flex-wrap: wrap; }
.post-row .arrow { grid-row: 2; align-self: center; color: var(--faint); font-size: 1rem; transition: transform 0.25s var(--ease), color 0.2s var(--ease); }
.post-row:hover .arrow { transform: translateX(4px); color: var(--accent); }
.more-link { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: 2rem; color: var(--text); font-weight: 500; font-size: 0.88rem; }
.more-link:hover { gap: 0.7rem; color: var(--accent); }

/* ---- contact ------------------------------------------------------------ */
.contact .section-title { margin-bottom: 1.2rem; max-width: 16ch; }
.contact p { color: var(--muted); max-width: 52ch; margin-bottom: 2.2rem; font-size: 1.05rem; }
.contact-links { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---- footer ------------------------------------------------------------- */
footer.foot { border-top: 1px solid var(--line); padding: 2.4rem 0; color: var(--faint); font-size: 0.78rem; font-family: var(--mono); }
footer.foot a { color: var(--muted); }
footer.foot a:hover { color: var(--text); }

/* ---- reveal animation (subtle) ----------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---- blog --------------------------------------------------------------- */
.post { width: min(90%, 680px); margin: 0 auto; padding: 64px 0 110px; }
.post .back { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); display: inline-flex; gap: 0.4rem; margin-bottom: 3rem; }
.post .back:hover { color: var(--text); }
.post-head .meta { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); display: flex; gap: 0.8rem; flex-wrap: wrap; }
.post-head h1 { font-size: clamp(1.8rem, 4.2vw, 2.6rem); line-height: 1.12; margin: 1rem 0 0.7rem; letter-spacing: -0.025em; font-weight: 500; }
.post-head .sub { color: var(--muted); font-size: 1.1rem; line-height: 1.6; }
.post-body { margin-top: 3rem; font-size: 1.04rem; }
.post-body h2 { font-size: 1.3rem; font-weight: 500; letter-spacing: -0.01em; margin: 2.6rem 0 1rem; }
.post-body h3 { font-size: 1.08rem; font-weight: 500; margin: 2rem 0 0.7rem; }
.post-body p { color: var(--text); opacity: 0.86; margin-bottom: 1.3rem; }
.post-body ul, .post-body ol { margin: 0 0 1.4rem 1.2rem; color: var(--text); opacity: 0.86; }
.post-body li { margin-bottom: 0.6rem; }
.post-body li::marker { color: var(--faint); }
.post-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--accent-soft); }
.post-body a:hover { border-bottom-color: var(--accent); }
.post-body strong { font-weight: 600; opacity: 1; }
.post-body blockquote {
  border-left: 2px solid var(--line-2); padding: 0.2rem 0 0.2rem 1.3rem;
  margin: 1.8rem 0; color: var(--muted); font-style: normal; font-size: 1.08rem;
}
.post-body code { font-family: var(--mono); font-size: 0.86em; background: var(--bg-2); border: 1px solid var(--line); padding: 0.1em 0.38em; border-radius: 5px; }
.post-body pre {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 1.2rem 1.3rem; overflow-x: auto; margin: 1.6rem 0;
}
.post-body pre code { background: none; border: none; padding: 0; color: var(--text); opacity: 0.92; font-size: 0.84rem; line-height: 1.75; }
.post-body figure { margin: 2rem 0; }
.post-body figure img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.post-body figcaption { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); margin-top: 0.7rem; text-align: center; line-height: 1.5; }
.post-body hr { border: none; border-top: 1px solid var(--line); margin: 2.4rem 0; }
.post-source { margin-top: 2rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 0.9rem; }
.post-source a { color: var(--accent); }
.post-tags { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-top: 3rem; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.post-tags span { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }

.blog-index { width: min(90%, var(--maxw)); margin: 0 auto; padding: 70px 0 110px; }
.blog-index .lead { color: var(--muted); font-size: 1.08rem; max-width: 56ch; margin: 1rem 0 3rem; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 820px) {
  section { padding: 80px 0; }
  .hero { padding: 44px 0 58px; }
  .hero-grid { grid-template-columns: 1fr; gap: 26px; justify-items: center; }
  .hero-grid > * { min-width: 0; }
  .hero-text { text-align: center; }
  .hero-photo { order: -1; justify-self: center; }
  .hero-photo img { width: 196px; height: 236px; }
  .hero .eyebrow { margin-bottom: 1rem; }
  .hero h1 { font-size: clamp(2rem, 8.5vw, 2.7rem); }
  .hero p.lead { font-size: 1rem; margin: 1.1rem auto 0; }
  .hero .role { font-size: 0.8rem; }
  .hero-cta { margin-top: 1.6rem; justify-content: center; }
  .hero-meta { flex-direction: column; align-items: center; gap: 0.5rem; margin-top: 1.6rem; overflow-wrap: anywhere; }
  .stats { margin-top: 52px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .proj-grid, .skill-groups { grid-template-columns: 1fr; }
  .proj-grid .proj:nth-child(odd) { padding-right: 0; border-right: none; }
  .proj-grid .proj:nth-child(even) { padding-left: 0; }
  .skill-groups .skill-card:not(:last-child) { border-right: none; padding-right: 0; }
  .skill-groups .skill-card + .skill-card { padding-left: 0; border-top: 1px solid var(--line); }
  .gallery { gap: 8px; }
  .gallery .shot img { height: 110px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3), .stat:nth-child(4) { border-top: 1px solid var(--line); margin-top: 1px; }
  .stat:nth-child(3) { border-left: none; }
  .tl-item { grid-template-columns: 1fr; gap: 12px; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 60px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 1.2rem 5%; gap: 1.1rem; }
  .nav-toggle { display: block; }
}
