/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --bg-elev: #f6f7f9;
  --text: #1a1d21;
  --text-muted: #5b636c;
  --border: #e4e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 14px;
  --maxw: 960px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme='dark'] {
  --bg: #0f1216;
  --bg-elev: #171b21;
  --text: #e8eaed;
  --text-muted: #9aa4af;
  --border: #262c34;
  --accent: #4f8cff;
  --accent-hover: #6ba0ff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

[dir='rtl'] body { text-align: right; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem clamp(1rem, 5vw, 3rem);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  gap: 1.25rem;
  margin-inline-start: auto;
}

.nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.nav a:hover { color: var(--text); }

.header-actions { display: flex; gap: 0.5rem; }

.pill {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.pill:hover { border-color: var(--accent); }
.pill:active { transform: scale(0.96); }

/* ===== Layout ===== */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 5vw, 2rem); }

.section {
  padding: clamp(3rem, 8vw, 5rem) 0;
  border-top: 1px solid var(--border);
}
.section h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
}

.prose { color: var(--text-muted); max-width: 60ch; }

.subhead {
  font-size: 1.05rem;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
}

/* ===== Timeline (experience) ===== */
.timeline { display: flex; flex-direction: column; gap: 1.25rem; }
.timeline-item {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.4rem;
}
.timeline-head h3 { margin: 0; font-size: 1.1rem; }
.timeline-meta { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }
.timeline-item .prose { margin: 0; }

/* ===== Hero ===== */
.hero { padding: clamp(4rem, 12vw, 8rem) 0 clamp(2rem, 6vw, 4rem); }
.hero-inner {
  display: flex;
  align-items: center;
  gap: clamp(2rem, 6vw, 4rem);
  flex-wrap: wrap;
}
.hero-text { flex: 1 1 320px; min-width: 0; }
.hero-photo { flex: 0 0 auto; }
.hero-photo img {
  width: clamp(180px, 30vw, 280px);
  height: clamp(180px, 30vw, 280px);
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  display: block;
}
.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 0.75rem;
}
.hero h1 {
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.hero .lead { font-size: 1.15rem; color: var(--text-muted); max-width: 55ch; }
.hero-cta { display: flex; gap: 0.75rem; margin-top: 2rem; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.88rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }

/* ===== Projects ===== */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.project-card:hover { transform: translateY(-3px); border-color: var(--accent); }

.project-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback {
  display: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
}
.project-thumb.thumb-empty .thumb-fallback { display: block; }

/* Theme-aware monochrome SVG illustrations for project cards */
.project-thumb.thumb-svg {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-elev));
}
.project-thumb.thumb-svg .thumb-icon {
  color: var(--accent);
  width: 40%;
  height: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.project-thumb.thumb-svg .thumb-icon svg {
  width: 100%;
  height: 100%;
}
/* FYURI: the screenshot (if present) sits on top of the SVG fallback */
.project-thumb.thumb-svg img {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.project-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1 1 auto; }
.project-body h3 { margin: 0; font-size: 1.25rem; }
/* Let the description absorb extra height so the tags + links footer aligns
   across cards regardless of how long each description is. */
.project-body .prose { flex: 1 1 auto; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; }
.tags-lg { gap: 0.5rem; }
.tags-lg li { font-size: 0.85rem; padding: 0.35rem 0.85rem; }
.tags li {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.tags li.tag-accent {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.ai-note {
  margin-top: 1rem;
  font-style: italic;
  color: var(--text-muted);
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: 0.9rem;
}

.project-links { display: flex; gap: 0.5rem; margin-top: auto; }

/* ===== Contact ===== */
.contact-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.contact-list a { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; }
.contact-list a:hover { text-decoration: underline; }
.contact-list .contact-plain { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text-muted); }
.ci { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.contact-list .contact-plain .ci { color: var(--accent); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.social-row { display: flex; justify-content: center; gap: 0.75rem; margin-bottom: 1rem; }
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.social-btn svg { width: 20px; height: 20px; fill: currentColor; }
.social-btn:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .nav { display: none; }
}

/* ===== Splash (first-visit intro) ===== */
.splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: var(--bg);
  /* Dissolve out at the end of the sequence, then remove from the flow. */
  animation: splash-out 0.6s ease 1.9s forwards;
}
.splash.is-done { display: none; }
/* Set by an inline head script on repeat visits / reduced motion, before paint. */
.splash-skip .splash { display: none; }
.splash-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  color: var(--accent);
}
.splash-ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
.splash-ring circle {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: splash-draw 1.1s ease 0.15s forwards;
}
.splash-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  opacity: 0;
  transform: scale(0.6);
  animation: splash-pop 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}
.splash-name {
  margin: 0;
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  opacity: 0;
  transform: translateY(8px);
  animation: splash-fade-up 0.6s ease 0.9s forwards;
}

@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-pop {
  0%   { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes splash-fade-up {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes splash-out {
  to { opacity: 0; visibility: hidden; }
}

/* Respect user preference: no motion, no splash. */
@media (prefers-reduced-motion: reduce) {
  .splash { display: none; }
}

