/* ============================================================
   Mazda Farrahi — portfolio
   Minimal academic style, inspired by al-folio
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --text: #1f2328;
  --text-muted: #5b6169;
  --border: #e6e8eb;
  --accent: #a51c30; /* muted academic red-blue alternative kept below */
  --link: #2a5db0;
  --link-hover: #17356e;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --photo-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08);
  --sans: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: var(--sans);
  --max-width: 880px;
}

:root[data-theme="dark"] {
  --bg: #16181d;
  --bg-alt: #1d2026;
  --text: #e7e9ec;
  --text-muted: #9aa1ab;
  --border: #2b2f37;
  --link: #7aa7f0;
  --link-hover: #a7c4f5;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181d;
    --bg-alt: #1d2026;
    --text: #e7e9ec;
    --text-muted: #9aa1ab;
    --border: #2b2f37;
    --link: #7aa7f0;
    --link-hover: #a7c4f5;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

/* ---------- Header / nav ---------- */

header.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

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

.site-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--text);
}

.site-name:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid var(--link);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 5px 9px;
  line-height: 1;
  margin-left: 6px;
}

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

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 24px 16px;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links li {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-links li:last-child {
    border-bottom: none;
  }
}

/* ---------- Hero / about ---------- */

.hero {
  padding: 64px 0 48px;
  display: flex;
  flex-direction: row-reverse;
  gap: 48px;
  align-items: flex-start;
}

.hero img.avatar {
  width: 240px;
  height: 240px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--photo-shadow);
  flex-shrink: 0;
}

.hero h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.hero .tagline {
  color: var(--text-muted);
  font-size: 0.98rem;
  font-style: italic;
  margin: 0 0 18px;
}

.hero p.bio {
  margin: 0 0 18px;
  color: var(--text);
}

.socials {
  display: flex;
  gap: 14px;
}

.socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
}

.socials a:hover {
  color: var(--link);
  border-color: var(--link);
  text-decoration: none;
}

.socials svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

@media (max-width: 640px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 22px;
    padding-top: 40px;
  }
  .hero img.avatar {
    width: 150px;
    height: 150px;
  }
}

/* ---------- Section headings ---------- */

.section-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

section.projects {
  padding: 16px 0 60px;
}

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

.project-grid {
  display: flex;
  flex-direction: column;
}

.project-card {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.project-card:first-child {
  padding-top: 0;
}

.project-card .thumb {
  width: 150px;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--card-shadow);
}

.project-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card h3 {
  font-family: var(--sans);
  font-weight: 700;
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.project-card h3 a {
  color: var(--text);
}

.project-card h3 a:hover {
  color: var(--link);
  text-decoration: none;
}

.project-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

@media (max-width: 640px) {
  .project-card {
    grid-template-columns: 100px 1fr;
    gap: 16px;
  }
  .project-card .thumb {
    width: 100px;
    height: 72px;
  }
}

/* ---------- Project detail pages ---------- */

.project-header {
  padding: 44px 0 8px;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.project-header h1 {
  font-family: var(--serif);
  font-size: 1.9rem;
  margin: 0 0 8px;
}

.project-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 24px;
}

.project-meta a {
  color: var(--text-muted);
  text-decoration: underline;
}

.media-frame {
  margin: 0 0 28px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.media-frame img {
  width: 100%;
}

.video-embed {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  background: #000;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.project-body {
  padding-bottom: 60px;
}

.project-body h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 34px 0 12px;
}

.project-body h2:first-child {
  margin-top: 0;
}

.project-body p {
  margin: 0 0 14px;
}

.project-body ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.project-body li {
  margin-bottom: 6px;
}

.project-body figure {
  margin: 22px 0;
}

.project-body figure img {
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.project-body figcaption {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 20px;
  font-size: 0.95rem;
}

.spec-table th,
.spec-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.spec-table th {
  color: var(--text-muted);
  font-weight: 600;
  width: 45%;
}

.callout {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--link);
  border-radius: 4px;
  padding: 12px 16px;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.92rem;
  color: var(--text);
}

.btn:hover {
  border-color: var(--link);
  color: var(--link);
  text-decoration: none;
}

.btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

/* ---------- Footer ---------- */

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

footer.site-footer .wrap {
  text-align: center;
}
