/* ===========================================================================
   Sherin Dehghani — Academic Website
   Modern, responsive design system with light/dark themes.
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

/* ----- Design tokens ----------------------------------------------------- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;

  --max-width: 820px;

  /* Light theme */
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-elevated: #ffffff;
  --text: #1a1a1a;
  --text-soft: #555b63;
  --text-muted: #868e96;
  --border: #e6e8eb;
  --accent: #1772d0;
  --accent-hover: #f09228;
  --accent-soft: rgba(23, 114, 208, 0.08);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
}

:root[data-theme='dark'] {
  --bg: #0f1115;
  --bg-soft: #161a20;
  --bg-elevated: #1a1f27;
  --text: #e8eaed;
  --text-soft: #b4bcc6;
  --text-muted: #8a929d;
  --border: #2a313a;
  --accent: #5aa9f0;
  --accent-hover: #f5b35a;
  --accent-soft: rgba(90, 169, 240, 0.12);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

h1, h2, h3 {
  line-height: 1.25;
  color: var(--text);
}

p {
  color: var(--text-soft);
}

::selection {
  background: var(--accent-soft);
}

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

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

/* ----- Navigation -------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.nav__brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav__brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-soft);
}

.nav__links a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-soft);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  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; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
}

.hamburger .bar {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.hamburger.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open .bar:nth-child(2) { opacity: 0; }
.hamburger.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ----- Layout sections --------------------------------------------------- */
main {
  padding: 8px 0 64px;
}

.section {
  margin-top: 56px;
}

.section__title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ----- Hero -------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: center;
  margin-top: 48px;
}

.hero__name {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.hero__role {
  font-size: 16.5px;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 18px;
}

.hero__bio p {
  margin: 0 0 14px;
}

.hero__photo {
  position: relative;
}

.hero__photo img {
  width: 220px;
  height: 220px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: var(--shadow);
  border: 4px solid var(--bg-elevated);
  transition: transform 0.3s ease;
}

.hero__photo img:hover {
  transform: scale(1.03);
}

/* ----- Social row -------------------------------------------------------- */
.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.social-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.social-btn svg {
  width: 16px;
  height: 16px;
}

/* ----- Research interest pills ------------------------------------------ */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

/* ----- Timeline (experience / education) -------------------------------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.entry:last-child {
  border-bottom: none;
}

.entry__period {
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 2px;
}

.entry__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 2px;
}

.entry__org {
  font-size: 14.5px;
  color: var(--accent);
  margin: 0 0 6px;
}

.entry__desc {
  font-size: 14.5px;
  margin: 0;
}

/* ----- Cards (writing) --------------------------------------------------- */
.card-grid {
  display: grid;
  gap: 16px;
}

.card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}

.card__meta {
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.card__title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.card__excerpt {
  font-size: 14.5px;
  color: var(--text-soft);
  margin: 0;
}

/* ----- Footer ------------------------------------------------------------ */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 72px;
  padding: 28px 0;
}

.footer__inner {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-soft);
}

/* ----- Blog article ------------------------------------------------------ */
.article {
  max-width: 720px;
  margin: 0 auto;
}

.article__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 32px;
}

.article__header {
  margin: 28px 0 32px;
}

.article__title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}

.article__meta {
  font-size: 14px;
  color: var(--text-muted);
}

.article__body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
}

.article__body p {
  color: var(--text);
  margin: 0 0 20px;
}

.article__body h2 {
  font-family: var(--font-sans);
  font-size: 23px;
  margin: 40px 0 12px;
}

.article__body h3 {
  font-family: var(--font-sans);
  font-size: 19px;
  margin: 32px 0 10px;
}

.article__figure {
  margin: 28px 0;
  text-align: center;
}

.article__figure img {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.article__figure figcaption {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
}

.article__lead {
  font-size: 20px;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0 0 28px;
}

.article__body ul,
.article__body ol {
  margin: 0 0 20px;
  padding-left: 24px;
}

.article__body li {
  margin-bottom: 8px;
}

.article__body li::marker {
  color: var(--accent);
}

.article__body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.article__body blockquote {
  margin: 24px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}

/* Callout / key-takeaways box */
.callout {
  font-family: var(--font-sans);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  margin: 32px 0;
}

.callout__title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  margin: 0 0 12px;
}

.callout ul {
  margin: 0;
  padding-left: 20px;
}

.callout li {
  font-size: 15.5px;
  color: var(--text);
  margin-bottom: 8px;
}

.callout li:last-child {
  margin-bottom: 0;
}

/* Author card at the end of an article */
.article__author {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.article__author img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.article__author-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  margin: 0;
}

.article__author-bio {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-soft);
  margin: 2px 0 0;
}

/* ----- Responsive -------------------------------------------------------- */
@media (max-width: 720px) {
  body { font-size: 15.5px; }

  .nav__links {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 16px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }

  .nav__links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav__links a {
    padding: 12px 14px;
    font-size: 16px;
  }

  .hamburger { display: flex; }

  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
    margin-top: 32px;
  }

  .hero__photo { order: -1; }

  .hero__photo img {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .hero__bio { text-align: left; }

  .socials { justify-content: center; }

  .entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .article__title { font-size: 25px; }
  .article__body { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
