/* ===========================================================
   Owen Omidvar — Personal site
   =========================================================== */

:root {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --border: #e6e6ea;
  --text: #16161a;
  --text-muted: #5c5c66;
  --text-faint: #8a8a94;
  --accent: #4f46e5;
  --accent-strong: #3730a3;
  --accent-soft: #eef0ff;
  --shadow: 0 1px 2px rgba(16,16,20,.04), 0 8px 24px rgba(16,16,20,.06);
  --radius: 14px;
  --sidebar-w: 300px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f13;
    --surface: #17171d;
    --border: #27272f;
    --text: #f2f2f5;
    --text-muted: #a5a5b0;
    --text-faint: #75757f;
    --accent: #818cf8;
    --accent-strong: #a5b4fc;
    --accent-soft: #1c1c30;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ---------- Sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 20;
}

.sidebar-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 48px 32px;
}

.profile { text-align: center; margin-bottom: 40px; }

.profile-photo {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 18px;
  border: 3px solid var(--accent-soft);
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.profile-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 10px;
}

.profile-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: .8rem;
  color: var(--text-faint);
  margin: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 32px;
}

.nav-link {
  padding: 10px 14px;
  border-radius: 9px;
  font-size: .92rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background .15s ease, color .15s ease;
}

.nav-link:hover { background: var(--accent-soft); color: var(--text); }

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.social-list {
  display: flex;
  justify-content: center;
  gap: 10px;
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}

.social-list a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.social-list a:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.sidebar-inner .btn-block { margin-top: auto; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.btn-block { width: 100%; }

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

.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow); }

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

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

.sidebar .btn-block {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar .btn-block:hover { background: var(--accent); color: #fff; }

/* ---------- Nav toggle (mobile) ---------- */

.nav-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 30;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 15;
}

.scrim.visible { display: block; }

/* ---------- Language switch ---------- */

.lang-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 30;
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow);
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.lang-btn:hover { color: var(--text); }

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ---------- Content ---------- */

.content {
  /* On wide screens, center the column within the space to the right of the
     sidebar instead of leaving it flush-left with a dead zone on the right.
     Falls back to flush-left (via max()) on narrower desktop widths. */
  margin-left: max(var(--sidebar-w), calc(var(--sidebar-w) / 2 + 50vw - 480px));
  max-width: 960px;
  padding: 0 48px;
}

.section {
  padding: 96px 0;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 32px;
}

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

.hero { padding-top: 120px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 14px;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 20px;
}

.hero-lede {
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 0 32px;
}

.hero-lede a { color: var(--accent); font-weight: 600; }
.hero-lede a:hover { text-decoration: underline; }

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.section-title {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.section-text {
  color: var(--text-muted);
  max-width: 65ch;
  margin: 0 0 16px;
  font-size: 1.02rem;
}

/* ---------- Stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-mono);
}

.stat-label {
  display: block;
  font-size: .78rem;
  color: var(--text-faint);
  margin-top: 4px;
}

/* ---------- Skills ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color .15s ease, transform .15s ease;
}

.skill-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.skill-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

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

/* ---------- Timeline ---------- */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.timeline-item {
  position: relative;
  padding: 22px 0 22px 28px;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child { border-bottom: none; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 30px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.timeline-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.timeline-meta {
  margin: 4px 0 8px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
}

.timeline-text {
  margin: 0;
  color: var(--text-muted);
  font-size: .95rem;
  max-width: 60ch;
}

.timeline-text a { color: var(--accent); font-weight: 600; }
.timeline-text a:hover { text-decoration: underline; }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease;
}

.contact-card:not(.contact-card--static):hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.contact-card svg { color: var(--accent); flex-shrink: 0; }

/* ---------- Contact form ---------- */

.contact-form {
  margin-top: 24px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-row input,
.form-row textarea {
  font-family: var(--font);
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.contact-form .btn {
  align-self: flex-start;
}

.contact-form .btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.form-status {
  margin: 0;
  font-size: .88rem;
  min-height: 1.2em;
}

.form-status.success { color: #16a34a; }
.form-status.error { color: #dc2626; }

.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-faint);
}

/* ---------- Reveal animation ---------- */

.section > * {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal .6s ease forwards;
}
.section > *:nth-child(1) { animation-delay: .02s; }
.section > *:nth-child(2) { animation-delay: .08s; }
.section > *:nth-child(3) { animation-delay: .14s; }
.section > *:nth-child(4) { animation-delay: .2s; }
.section > *:nth-child(5) { animation-delay: .26s; }

@keyframes reveal {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .section > * { animation: none; opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .nav-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open { transform: translateX(0); }

  .content { margin-left: 0; padding: 0 24px; }

  .hero { padding-top: 96px; }
}

@media (max-width: 640px) {
  .skills-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .section { padding: 64px 0; }
}
