/* ============================================================
   AMIR NASEREDINI — PERSONAL SITE
   Design: Clean technical editorial with crisp typographic hierarchy
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;1,9..144,300&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── Variables ───────────────────────────────────────── */
:root {
  --ink:       #0f1014;
  --ink-soft:  #3a3d46;
  --ink-mute:  #858a96;
  --rule:      #dfe0e4;
  --bg:        #f7f6f3;
  --surface:   #ffffff;
  --accent:    #c94a2e;      /* deep terra-cotta red */
  --accent2:   #1a4a6e;     /* navy */
  --tag-bg:    #eceae4;
  --tag-fg:    #4a4740;

  --ff-display: 'Fraunces', Georgia, serif;
  --ff-body:    'DM Sans', sans-serif;
  --ff-mono:    'DM Mono', 'Courier New', monospace;

  --max-w: 860px;
  --side-pad: clamp(1.5rem, 5vw, 3rem);
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────── */
.page-wrapper {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  max-width: 1140px;
  margin: 0 auto;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  padding: 2.5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 2px; }

.sidebar-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rule);
  margin-bottom: 1rem;
}

.sidebar-name {
  font-family: var(--ff-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 0.2rem;
}

.sidebar-title {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1.5rem;
}

.sidebar-divider {
  height: 1px;
  background: var(--rule);
  margin: 0.75rem 0;
}

nav.sidebar-nav { display: flex; flex-direction: column; gap: 0.1rem; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--tag-bg);
  color: var(--ink);
}

.sidebar-nav a .nav-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--rule);
  flex-shrink: 0;
  transition: background 0.15s;
}

.sidebar-nav a.active .nav-dot,
.sidebar-nav a:hover .nav-dot {
  background: var(--accent);
}

.sidebar-links {
  margin-top: auto;
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-link:hover { color: var(--accent); }

.sidebar-link svg {
  width: 13px; height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Main Content ────────────────────────────────────── */
main {
  padding: 3rem var(--side-pad) 5rem;
  max-width: var(--max-w);
}

/* ── Section ─────────────────────────────────────────── */
section {
  margin-bottom: 4rem;
  scroll-margin-top: 2rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1.5px solid var(--rule);
}

.section-label {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.section-title {
  font-family: var(--ff-display);
  font-size: 1.35rem;
  font-weight: 300;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ── Hero / About ────────────────────────────────────── */
.hero {
  padding-top: 1rem;
  margin-bottom: 3.5rem;
}

.hero-eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero-name {
  font-family: var(--ff-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.hero-name strong {
  font-weight: 600;
}

.hero-role {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--ink-mute);
  margin-bottom: 1.5rem;
}

.hero-bio {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-soft);
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  border-radius: 4px;
  transition: all 0.15s;
  border: 1.5px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #ad3d23;
  border-color: #ad3d23;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule);
}

.btn-ghost:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.btn svg {
  width: 13px; height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Interests Tags ──────────────────────────────────── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  background: var(--tag-bg);
  color: var(--tag-fg);
  padding: 0.3rem 0.7rem;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

/* ── Timeline / Experience & Education ───────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0 1.5rem;
  position: relative;
  padding-bottom: 2.25rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: '';
  position: absolute;
  left: 148px;
  top: 8px;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}

.timeline-item:last-child::before { display: none; }

.timeline-date {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  color: var(--ink-mute);
  padding-top: 2px;
  line-height: 1.4;
  text-align: right;
}

.timeline-body { position: relative; padding-left: 1.5rem; }

.timeline-body::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
}

.timeline-org {
  font-family: var(--ff-display);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.timeline-loc {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: var(--ink-mute);
  margin-bottom: 0.2rem;
}

.timeline-role {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent2);
  margin-bottom: 0.6rem;
  font-style: italic;
}

.timeline-details {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.timeline-details li {
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding-left: 1.1rem;
  position: relative;
}

.timeline-details li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--rule);
  font-family: var(--ff-mono);
  font-size: 0.7rem;
}

.timeline-note {
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ── Publications ────────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; gap: 1.5rem; }

.pub-item {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
  position: relative;
  transition: border-color 0.15s;
}

.pub-item:hover { border-color: var(--ink-mute); }

.pub-type {
  font-family: var(--ff-mono);
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.pub-title {
  font-family: var(--ff-display);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.pub-venue {
  font-size: 0.8rem;
  color: var(--ink-mute);
  margin-bottom: 0.5rem;
}

.pub-authors {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.6rem;
}

.pub-authors strong { color: var(--ink); font-weight: 500; }

.pub-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--ff-mono);
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  color: var(--accent2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.pub-link:hover { border-color: var(--accent2); }

.pub-link svg {
  width: 11px; height: 11px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Certifications ──────────────────────────────────── */
.cert-list { display: flex; flex-direction: column; gap: 0.6rem; }

.cert-item {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.cert-item::before {
  content: 'cert';
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  width: 28px;
}

/* ── Awards ──────────────────────────────────────────── */
.awards-list { display: flex; flex-direction: column; gap: 0.75rem; }

.award-item {
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 0 1rem;
  align-items: start;
}

.award-bar {
  width: 4px;
  height: 100%;
  min-height: 16px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 4px;
}

.award-text {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* ── Two-column grid ─────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

/* ── Languages ───────────────────────────────────────── */
.lang-list { display: flex; flex-direction: column; gap: 0.9rem; }

.lang-item { display: flex; flex-direction: column; gap: 0.2rem; }

.lang-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
}

.lang-level {
  font-family: var(--ff-mono);
  font-size: 0.67rem;
  color: var(--ink-mute);
}

.lang-bar {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.lang-fill {
  height: 100%;
  background: var(--accent2);
  border-radius: 2px;
}

/* ── Memberships / Service ───────────────────────────── */
.membership-list { display: flex; flex-direction: column; gap: 0.5rem; }

.membership-item {
  font-size: 0.88rem;
  color: var(--ink-soft);
  padding-left: 1.1rem;
  position: relative;
}

.membership-item::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  top: 2px;
}

/* ── Print button ────────────────────────────────────── */
.print-bar {
  display: none; /* hidden on screen; shown on print intent only via btn */
}

/* ── Scroll progress ─────────────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 999;
  transition: width 0.1s linear;
}

/* ── Back to top ─────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, border-color 0.15s;
  z-index: 99;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

#back-to-top:hover { border-color: var(--ink-soft); }

#back-to-top svg {
  width: 14px; height: 14px;
  stroke: var(--ink-soft);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 820px) {
  .page-wrapper {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
  }

  .sidebar-photo { width: 44px; height: 44px; margin-bottom: 0; }
  .sidebar-name { font-size: 0.95rem; margin-bottom: 0; }
  .sidebar-title { margin-bottom: 0; font-size: 0.62rem; }
  .sidebar-divider { display: none; }
  nav.sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-links { margin-top: 0; padding-top: 0; flex-direction: row; }

  main { padding: 2rem 1.25rem 4rem; }

  .timeline-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .timeline-item::before { display: none; }
  .timeline-date { text-align: left; }
  .timeline-body { padding-left: 0; }
  .timeline-body::before { display: none; }

  .two-col { grid-template-columns: 1fr; }
}

/* ── Print ───────────────────────────────────────────── */
@media print {
  .sidebar { position: static; height: auto; break-inside: avoid; }
  nav.sidebar-nav, .sidebar-links, #back-to-top, #scroll-progress { display: none !important; }
  .page-wrapper { display: block; }
  main { padding: 0; }
  .pub-item { border: none; padding: 0; }
  section { margin-bottom: 1.5rem; }
  body { font-size: 11pt; }
}

/* ── Fade-in on scroll ───────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
