/* ======================================================
   FARZAD ABDI — Portfolio
   Tesla-inspired minimalism. Engineering meets business.
   ====================================================== */

:root {
  --bg: #ffffff;
  --bg-dark: #0a0a0a;
  --text: #0a0a0a;
  --text-dark: #f5f5f5;
  --muted: #6b6b6b;
  --muted-dark: #888;
  --border: rgba(0, 0, 0, 0.08);
  --border-dark: rgba(255, 255, 255, 0.08);
  --accent: #0a0a0a;
  --max-width: 1440px;
  --gutter: clamp(20px, 5vw, 80px);
  --section-y: clamp(80px, 12vh, 160px);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }

/* ============ NAVIGATION ============ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 20px var(--gutter);
  transition: background 0.3s var(--ease), backdrop-filter 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.nav.is-scrolled {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 var(--border);
}

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

.nav__logo {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--text);
  border-radius: 4px;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text);
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

.nav__logo:hover {
  background: var(--text);
  color: var(--bg);
}

.nav__links {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
}

.nav__links a {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  position: relative;
  padding: 4px 0;
}

.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease);
}

.nav__links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav__lang {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.lang-btn {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  opacity: 0.4;
  transition: opacity 0.2s var(--ease);
}

.lang-btn.is-active { opacity: 1; font-weight: 500; }
.lang-btn:hover { opacity: 0.8; }
.lang-sep { opacity: 0.3; }

@media (max-width: 720px) {
  .nav__links { display: none; }
}

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter);
  background: var(--bg);
}

@media (max-width: 720px) {
  .hero {
    justify-content: flex-start;
    padding-top: 110px;
  }
}

.hero__content {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

.hero__eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.2s forwards;
}

.hero__title {
  font-size: clamp(40px, 10vw, 140px);
  font-weight: 200;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.hero__title span {
  display: block;
  opacity: 0;
  animation: fadeUp 0.9s var(--ease) forwards;
}
.hero__title span:nth-child(1) { animation-delay: 0.3s; }
.hero__title span:nth-child(2) {
  animation-delay: 0.45s;
  color: var(--muted);
}

.hero__subtitle {
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 300;
  max-width: 640px;
  color: var(--muted);
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.6s forwards;
}

.hero__cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.75s forwards;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  border-radius: 999px;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
  background: transparent;
  color: var(--text);
}

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

.btn--ghost:hover {
  background: var(--text);
  color: var(--bg);
}

.hero__scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
  opacity: 0;
  animation: fadeIn 0.8s var(--ease) 1s forwards;
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: var(--muted);
  position: relative;
  overflow: hidden;
}

.hero__scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--text);
  animation: scrollLine 2.2s var(--ease) infinite;
}

@keyframes scrollLine {
  0% { top: -100%; }
  100% { top: 100%; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============ SECTIONS ============ */
.section {
  padding: var(--section-y) var(--gutter);
  position: relative;
}

.section--dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

.section--dark .section__eyebrow,
.section--dark .project__tag,
.section--dark .project__subtitle {
  color: var(--muted-dark);
}

.section__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section__header {
  max-width: var(--max-width);
  margin: 0 auto var(--section-y);
  padding: 0;
}

.section__eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 24px;
}

.section__title {
  font-size: clamp(32px, 5.5vw, 72px);
  font-weight: 200;
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 1100px;
}

.section__label {
  font-size: clamp(28px, 3.6vw, 48px);
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

/* ============ ABOUT ============ */
.about {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(40px, 8vw, 120px);
  align-items: center;
}

.about__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/5;
  border-radius: 4px;
}

.about__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about__lead {
  font-size: clamp(17px, 1.4vw, 21px);
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--text);
}

.about__lead:first-of-type { margin-top: 32px; }

.about__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

.about__facts li {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
}

/* ============ PROJECTS ============ */
.project {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 100px);
  align-items: center;
  max-width: var(--max-width);
  margin: 0 auto var(--section-y);
}

.project:last-child { margin-bottom: 0; }

.project--reverse .project__image { order: 2; }

.project__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  border-radius: 4px;
}

.project__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s var(--ease);
}

.project__image:hover img { transform: scale(1.04); }

/* Dark-background hero (matches JPG bg color, no crop) */
.project__image--dark {
  background: #211f20;
  cursor: pointer;
}

.project__image--dark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project__image--dark:hover img { transform: scale(1.06); }

/* Reliwe — logo fills container, text stays centered */
.project__image--reliwe {
  background: #1d1924;
}

.project__image--reliwe img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Anchor crop to top so top of image stays visible */
.project__image--top img {
  object-position: top;
}

.project__tag {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-bottom: 16px;
}

.project__title {
  font-size: clamp(32px, 4.5vw, 56px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.project__subtitle {
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

.project__desc {
  font-size: clamp(15px, 1.1vw, 17px);
  font-weight: 300;
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 540px;
}

.project__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project__stack li {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid var(--border-dark);
  border-radius: 999px;
}

@media (max-width: 900px) {
  .project,
  .project--reverse {
    grid-template-columns: 1fr;
  }
  .project--reverse .project__image { order: 0; }
}

/* ============ EXPERIENCE / TIMELINE ============ */
.timeline {
  max-width: var(--max-width);
  margin: 0 auto;
}

.timeline__item {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 60px;
  padding: 48px 0;
  border-top: 1px solid var(--border);
  align-items: start;
}

.timeline__item:last-child { border-bottom: 1px solid var(--border); }

.timeline__year {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--muted);
  padding-top: 6px;
}

.timeline__role {
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: 300;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.timeline__company {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.timeline__desc {
  font-size: 16px;
  font-weight: 300;
  line-height: 1.7;
  max-width: 640px;
}

@media (max-width: 720px) {
  .timeline__item { grid-template-columns: 1fr; gap: 12px; }
}

/* ============ SKILLS ============ */
.skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(40px, 6vw, 80px);
  max-width: var(--max-width);
  margin: 0 auto;
}

.skill-group__title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-dark);
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-dark);
}

.skill-group ul {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skill-group li {
  font-size: clamp(16px, 1.2vw, 19px);
  font-weight: 300;
  letter-spacing: -0.005em;
}

@media (max-width: 720px) {
  .skills { grid-template-columns: 1fr; }
}

/* ============ CONTACT ============ */
.section--contact {
  background: var(--bg);
  text-align: center;
}

.contact {
  max-width: 1100px;
  margin: 0 auto;
}

.contact__title {
  font-size: clamp(40px, 7vw, 96px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}

.contact__lead {
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 300;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 64px;
}

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

.contact__card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: left;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.contact__card:hover {
  border-color: var(--text);
  transform: translateY(-4px);
}

.contact__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--muted);
}

.contact__value {
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 300;
}

@media (max-width: 720px) {
  .contact__grid { grid-template-columns: 1fr; }
}

/* ============ FOOTER ============ */
.footer {
  padding: 32px var(--gutter);
  border-top: 1px solid var(--border);
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

@media (max-width: 480px) {
  .footer__inner { flex-direction: column; gap: 8px; }
}

/* ============ REVEAL ANIMATION (intersection observer) ============ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
