/* Parva Rahmati portfolio
   Layout concept: a 1512x982 design artboard anchored to the bottom centre of the
   viewport and scaled with --s (set in main.js) on desktop; fluid layout below 1000px. */

:root {
  --bg: #2a2a2a;
  --fg: #ffffff;
  --fg-soft: #e6e6e6;
  --glass: rgba(255, 255, 255, 0.08);
  --blue: #369eff;
  --red: #ff4659;
  --amber: #fc9b0a;
  --grad: linear-gradient(90deg, var(--amber), var(--red), var(--blue));
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --s: 1;
  color-scheme: dark;
}

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

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px max(40px, env(safe-area-inset-right, 0px)) 24px max(40px, env(safe-area-inset-left, 0px));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.5s ease, visibility 0s;
}

.nav .brand {
  flex: 1 1 0;
  min-width: 0;
  font-weight: 500;
  font-size: 16px;
  white-space: nowrap;
}

.nav ul {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav li a {
  position: relative;
  display: block;
  padding: 8px 12px;
  font-weight: 500;
  font-size: 16px;
  white-space: nowrap;
}

.nav li a[aria-current="page"]::after,
.nav li a[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--grad);
}

/* Hover state (Figma Button / State=Hover): soft amber > red > blue pill */
.nav li a,
.pill a {
  isolation: isolate;
  border-radius: 1000px;
}

.nav li a::before,
.pill a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 1000px;
  background: linear-gradient(to left, rgba(54, 158, 255, 0.24) 0%, rgba(255, 70, 89, 0.24) 49.519%, rgba(252, 155, 10, 0.24) 99.99%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav li a:hover::before,
.nav li a:focus-visible::before,
.pill a:hover::before,
.pill a:focus-visible::before { opacity: 1; }

/* The selected item keeps its underline instead */
.nav li a[aria-current]:hover::before { opacity: 0; }

/* ---------- Home page stage ---------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}

.layer {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1512px;
  height: 982px;
  margin-left: -756px;
  transform: scale(var(--s));
  transform-origin: 50% 100%;
}

.connectors {
  position: absolute;
  z-index: 1;
  left: 510px;
  top: 345px;
  width: 501px;
  height: 401px;
  opacity: 0;
  transition: opacity 0.6s ease 0.15s;
  pointer-events: none;
}

.portrait {
  position: absolute;
  z-index: 2;
  left: 383px;
  bottom: 0;
  width: 646px;
  height: 982px;
  transform-origin: 50% 100%;
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.2, 1), filter 0.7s ease;
  pointer-events: none;
  user-select: none;
}

.view {
  position: absolute;
  z-index: 3;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
  pointer-events: none;
}

[data-view="home"] #home,
[data-view="about"] #about,
[data-view="projects"] #projects,
[data-view="contact"] #contact {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease 0.25s, visibility 0s;
  pointer-events: auto;
}

[data-view="about"] .portrait,
[data-view="contact"] .portrait { filter: blur(9px) brightness(0.96); }
[data-view="projects"] .portrait { transform: translateY(511px); }
[data-view="projects"] .connectors { opacity: 1; }

[data-view="home"] .nav { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }

.no-anim, .no-anim * { transition: none !important; }

/* Hero */

.hero-copy {
  position: absolute;
  left: 427px;
  bottom: 128px;
  width: 657px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 64px;
}

.hero-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.hero-intro h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 100;
  line-height: normal;
  color: rgba(255, 255, 255, 0.65);
}

.hero-intro p {
  margin: 0;
  max-width: 587px;
  font-size: 20px;
  font-weight: 200;
  line-height: normal;
}

.pill {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 24px;
  border-radius: 1000px;
  background: var(--glass);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
}

.pill a {
  position: relative;
  display: block;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
}

/* About */

.about-copy {
  position: absolute;
  left: 283px;
  bottom: 112px;
  width: 946px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.back {
  display: block;
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

.back:hover { transform: translateX(-3px); }
.back img { width: 24px; height: 24px; }

.about-copy h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.about-copy p {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}

.about-copy p:last-child { margin-bottom: 0; }

/* Projects */

.project-cards {
  position: absolute;
  left: 355px;
  top: 286px;
  display: flex;
  align-items: flex-start;
  gap: 202px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 300px;
  min-height: 142px;
  padding: 16px;
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--fg-soft);
  transition: background 0.25s ease, transform 0.25s ease;
}

.card:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-2px); }

.card-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: normal;
}

.card-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
  font-size: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 1000px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-cando { background: #ffeaa4; color: #aa7a00; }
.tag-jobvision { background: #eeeffe; color: #5660f2; }

/* Contact */

.contact-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 111px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  color: var(--fg-soft);
}

.contact-copy h2 { margin: 0; font-size: 24px; font-weight: 700; }

.contact-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  transition: opacity 0.2s ease;
}

.contact-list a:hover { opacity: 0.75; text-decoration: underline; text-underline-offset: 4px; }
.contact-list img { width: 19px; height: 19px; }

/* ---------- Case study pages ---------- */

body.case-page { min-height: 100vh; }

.case-page .nav {
  position: sticky;
  background: rgba(42, 42, 42, 0.6);
}

.case {
  width: 100%;
  max-width: 1116px;
  margin: 0 auto;
  padding: 24px max(20px, env(safe-area-inset-right, 0px)) 120px max(20px, env(safe-area-inset-left, 0px));
  color: var(--fg-soft);
}

.case-head { display: flex; flex-direction: column; gap: 16px; }

.case-head h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 40px);
  font-weight: 700;
  line-height: 1.15;
  text-wrap: balance;
}

.case-head .sub {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 400;
  line-height: 1.3;
}

.case .case-cover { margin: 40px auto; }

.case-body {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 0 40px;
}

.case-body section { display: flex; flex-direction: column; gap: 16px; }
.case-body section.spaced { gap: 24px; }

.case h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); font-weight: 700; line-height: 1.2; text-wrap: balance; }
.case h3 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.25; }
.case h4 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.4; }

.case p, .case li {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.55;
}

.case p + p { margin-top: 12px; }
.case strong { font-weight: 700; }

.case ul, .case ol {
  margin: 0;
  padding-left: 27px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.case .lead p { font-size: 18px; }

.shot {
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 0 auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.case .issue { display: flex; flex-direction: column; gap: 4px; }
.case .issue p { font-weight: 400; }

/* ---------- Tablet and mobile (fluid) ---------- */

@media (max-width: 999px) {
  .layer {
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
    transform: none;
  }

  .portrait {
    left: 50%;
    width: auto;
    height: min(74vh, 150vw);
    height: min(74svh, 150vw);
    max-width: none;
    aspect-ratio: 646 / 982;
    object-fit: fill;
    transform: translateX(-50%);
  }

  [data-view="projects"] .portrait { transform: translate(-50%, 32%); }
  .connectors { display: none; }

  .hero-copy {
    left: 0; right: 0;
    width: auto;
    padding: 0 20px;
    bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 16px));
    gap: 28px;
  }

  .hero-intro p { font-size: 18px; }

  .about-copy {
    left: 0; right: 0;
    width: auto;
    padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
    bottom: max(48px, calc(env(safe-area-inset-bottom, 0px) + 32px));
    gap: 20px;
  }

  .about-copy p { font-size: 15px; line-height: 1.45; }

  .project-cards {
    left: 0; right: 0;
    top: 92px;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  }

  .card { width: 100%; min-height: 0; gap: 20px; }
  .card-title { font-size: 22px; }

  .contact-copy { bottom: max(72px, calc(env(safe-area-inset-bottom, 0px) + 48px)); gap: 28px; padding: 0 20px; }
  .contact-list a { overflow-wrap: anywhere; }

  .nav { padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); gap: 12px; }
  .case-body { padding: 0; }
}

@media (max-width: 560px) {
  .nav .brand-extra { display: none; }
  .nav .brand, .nav li a { font-size: 14px; }
  .nav li a { padding: 8px 10px; }
  .nav ul { gap: 2px; }
  .case { padding-top: 16px; padding-bottom: 80px; }
  .case p, .case li { font-size: 16px; }
  .case h3 { font-size: 20px; }
  .case .case-cover { margin: 28px auto; }
  .case-body { gap: 32px; }
}

@media (max-height: 560px) and (max-width: 999px) {
  .portrait { height: min(62vh, 150vw); height: min(62svh, 150vw); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}
