/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:      #061e29;
  --accent:  #1d546d;
  --muted:   #5f9598;
  --text:    #f3f4f4;
  --link:    #0099ff;
  --nav-h:   64px;
}

html {
  scroll-behavior: smooth;
}

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

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

a:hover {
  text-decoration: underline;
}

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

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ============================================================
   FADE-IN ANIMATION
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   NAV
   ============================================================ */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background-color: rgba(6, 30, 41, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(29, 84, 109, 0.3);
  z-index: 100;
}

.nav-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

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

.nav-links {
  list-style: none;
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--link);
  transition: width 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Language toggle */
.lang-toggle {
  background: none;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
  margin-left: 24px;
}

.lang-toggle:hover {
  border-color: var(--link);
  color: var(--text);
}

.lang-toggle .lang-option.active {
  color: var(--text);
}

/* ============================================================
   HERO
   ============================================================ */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: var(--nav-h);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero-name {
  font-size: clamp(3rem, 10vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}

.hero-tagline {
  font-size: clamp(0.9rem, 2.5vw, 1.125rem);
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-bio {
  max-width: 640px;
}

.about-bio p {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.85;
  opacity: 0.88;
  margin-bottom: 1.4em;
}

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

.about-bio a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 153, 255, 0.3);
  transition: border-color 0.2s;
}

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

/* ============================================================
   BACKGROUND — timeline, CV download, references
   ============================================================ */
.bg-block {
  margin-bottom: 60px;
}

.bg-block-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 52px;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0 32px;
  padding: 28px 0;
  border-bottom: 1px solid rgba(95, 149, 152, 0.12);
}

.timeline-entry:first-child {
  border-top: 1px solid rgba(95, 149, 152, 0.12);
}

.timeline-year {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding-top: 3px;
  white-space: nowrap;
  line-height: 1.6;
}

.timeline-duration {
  font-weight: 400;
  font-size: 0.7rem;
  opacity: 0.7;
}

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

.timeline-role {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.timeline-org {
  font-size: 0.8125rem;
  color: var(--muted);
}

.timeline-org a {
  color: var(--muted);
  border-bottom: 1px solid rgba(95, 149, 152, 0.3);
  transition: color 0.2s, border-color 0.2s;
}

.timeline-org a:hover {
  color: var(--text);
  border-color: var(--muted);
  text-decoration: none;
}

.timeline-desc {
  font-size: 0.875rem;
  color: rgba(243, 244, 244, 0.55);
  line-height: 1.65;
  margin-top: 4px;
}

/* CV download button */
.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(95, 149, 152, 0.35);
  padding: 12px 24px;
  border-radius: 6px;
  margin-bottom: 64px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.cv-download:hover {
  border-color: var(--muted);
  background: rgba(95, 149, 152, 0.08);
  text-decoration: none;
  color: var(--text);
}

.cv-download-arrow {
  font-size: 1rem;
  transition: transform 0.2s;
}

.cv-download:hover .cv-download-arrow {
  transform: translateY(2px);
}

/* ============================================================
   REFERENCES — horizontal chat message layout
   ============================================================ */
.refs-section {
  padding: 80px 0 100px;
}

.refs-row {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Each card = one message row: [sender column] [bubble] */
.ref-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
}

.ref-card--soon {
  opacity: 0.35;
}

/* Alternate: even cards flip sender to the right */
.ref-card:nth-child(even) {
  flex-direction: row-reverse;
}

.ref-card:nth-child(even) .ref-bubble {
  border-radius: 16px 4px 16px 16px;
}

.ref-card:nth-child(even) .ref-bubble::before {
  display: none;
}

.ref-card:nth-child(even) .ref-bubble::after {
  content: '';
  position: absolute;
  top: 46px;
  right: -9px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 9px solid rgba(29, 84, 109, 0.22);
}

/* Sender column: avatar + name + role stacked */
.ref-sender {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: 140px;
  text-decoration: none;
}

a.ref-sender:hover .ref-name {
  color: var(--link);
}

a.ref-sender:hover {
  text-decoration: none;
}

.ref-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(95, 149, 152, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
}

.ref-sender:hover .ref-avatar {
  transform: scale(1.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.ref-avatar--placeholder {
  background: rgba(95, 149, 152, 0.15);
}

.ref-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  transition: color 0.2s;
  line-height: 1.3;
}

.ref-role {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

/* Speech bubble with tail pointing left */
.ref-bubble {
  background: rgba(29, 84, 109, 0.22);
  border: 1px solid rgba(95, 149, 152, 0.18);
  border-radius: 4px 16px 16px 16px;
  padding: 20px 24px;
  position: relative;
  flex: 1;
}

.ref-bubble::before {
  content: '';
  position: absolute;
  top: 46px;
  left: -9px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 9px solid rgba(29, 84, 109, 0.22);
}

.ref-bubble p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.75;
  font-style: italic;
  margin: 0 0 10px;
}

.ref-bubble p:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .ref-card--soon {
    display: none;
  }
  .ref-sender {
    width: 48px;
  }
  .ref-avatar {
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 600px) {
  .timeline-entry {
    grid-template-columns: 60px 1fr;
    gap: 0 20px;
  }

}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.skill-group {
  padding-right: 40px;
  border-left: 1px solid rgba(95, 149, 152, 0.18);
  padding-left: 32px;
}

.skill-group:first-child {
  border-left: none;
  padding-left: 0;
}

.skill-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skill-list li {
  font-size: 0.9375rem;
  color: rgba(243, 244, 244, 0.75);
  line-height: 1.4;
}

/* ============================================================
   PROJECTS — main page
   ============================================================ */
.projects-section {
  padding: 60px 0 100px;
}

.projects-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 370px 210px;
  gap: 14px;
}

/* First card (Video Games) spans both rows */
.project-card:first-child {
  grid-row: span 2;
}

.project-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  display: block;
  text-decoration: none;
  color: var(--text);
}

.project-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.78) saturate(0.88);
  transition: transform 0.75s ease, filter 0.5s ease;
}

.project-card:hover .project-card-bg {
  transform: scale(1.06);
  filter: brightness(1.0) saturate(1.0);
}

.project-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 30, 41, 0.38);
  transition: background 0.5s;
}

.project-card:hover .project-card-overlay {
  background: rgba(6, 30, 41, 0.1);
}

.project-card-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}

.project-title {
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.55);
  transition: letter-spacing 0.4s ease, opacity 0.3s ease;
}

.project-title::before {
  content: '';
  display: block;
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.55);
  margin: 0 auto 16px;
  transition: width 0.4s ease;
}

.project-card:first-child .project-title {
  font-size: 1.65rem;
}

.project-card:hover .project-title {
  letter-spacing: 0.12em;
}

.project-card:hover .project-title::before {
  width: 48px;
}

/* Video Games — Oxanium Light */
.projects-grid .project-card:nth-child(1) .project-title {
  font-family: 'Oxanium', sans-serif;
  font-weight: 300;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  line-height: 1.3;
}

.projects-grid .project-card:nth-child(1):hover .project-title {
  letter-spacing: 0.18em;
}

/* Films — EB Garamond italic */
.projects-grid .project-card:nth-child(2) .project-title {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 2.6rem;
  text-transform: none;
  letter-spacing: 0.1em;
  line-height: 1;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.7);
}

.projects-grid .project-card:nth-child(2):hover .project-title {
  letter-spacing: 0.16em;
}

/* Photos — gallery / minimal */
.projects-grid .project-card:nth-child(3) .project-title {
  font-family: 'Josefin Sans', sans-serif;
  font-weight: 300;
  font-size: 1.1rem;
  letter-spacing: 0.35em;
}

.projects-grid .project-card:nth-child(3):hover .project-title {
  letter-spacing: 0.48em;
}

/* ============================================================
   SUB-PAGE — shared
   ============================================================ */
.page-hero {
  position: relative;
  height: 55vh;
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  background-size: cover;
  background-position: center;
  margin-top: var(--nav-h);
}

.page-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(6, 30, 41, 1) 0%,
    rgba(6, 30, 41, 0.55) 60%,
    rgba(6, 30, 41, 0.2) 100%
  );
}

.page-hero-content {
  position: relative;
  z-index: 1;
  padding: 40px 0;
  width: 100%;
}

.page-hero-content .container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.page-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.page-subtitle {
  font-size: 1rem;
  color: var(--muted);
}

/* ── Page switcher (films / games / photos) ──────────────── */
.page-switcher {
  position: fixed;
  top: 100px;
  right: 28px;
  z-index: 90;
  display: inline-flex;
  background: rgba(6,30,41,0.82);
  border: 1px solid rgba(95,149,152,0.35);
  border-radius: 30px;
  padding: 4px;
  gap: 2px;
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.page-switcher a {
  padding: 6px 16px;
  border-radius: 24px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(243,244,244,0.6);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}
.page-switcher a:hover {
  color: rgba(243,244,244,0.9);
  text-decoration: none;
}
.page-switcher a.active {
  background: rgba(95,149,152,0.35);
  color: rgba(243,244,244,1);
}

/* ============================================================
   SUB-PAGE — project list
   ============================================================ */
.sub-projects-section {
  padding: 72px 0 100px;
}

.sub-projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.sub-project-card {
  background: var(--accent);
  border: 1px solid rgba(95, 149, 152, 0.18);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s;
}

.sub-project-card:hover {
  transform: translateY(-4px);
  border-color: rgba(95, 149, 152, 0.5);
}

.sub-project-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, rgba(29, 84, 109, 0.8), rgba(6, 30, 41, 0.95));
  overflow: hidden;
}

.sub-project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.sub-project-card:hover .sub-project-thumb img {
  transform: scale(1.04);
}

.sub-project-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.4;
}

.sub-project-info {
  padding: 22px;
}

.sub-project-meta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.sub-project-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.sub-project-desc {
  font-size: 0.875rem;
  color: rgba(243, 244, 244, 0.6);
  line-height: 1.65;
}

.sub-project-card.coming-soon {
  opacity: 0.6;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-soon {
  background: rgba(95, 149, 152, 0.2);
  color: var(--muted);
  border: 1px solid rgba(95, 149, 152, 0.3);
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-layout {
  display: flex;
  align-items: center;
  gap: 48px;
}

.contact-portrait {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid rgba(95, 149, 152, 0.3);
  flex-shrink: 0;
}

.contact-banner {
  width: 350px;
  min-width: 350px;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.contact-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
}

.contact-intro {
  font-size: 1.125rem;
  color: var(--text);
  margin-bottom: 28px;
  opacity: 0.9;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
}

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

.contact-icon {
  display: inline-flex;
  align-items: center;
  width: 20px;
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 30, 41, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
  backdrop-filter: blur(8px);
}

#lightbox.open {
  opacity: 1;
  pointer-events: all;
}

#lightbox img {
  max-width: min(480px, 90vw);
  max-height: 90vh;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.92);
  transition: transform 0.35s ease;
}

#lightbox.open img {
  transform: scale(1);
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  padding: 32px 0;
  border-top: 1px solid rgba(29, 84, 109, 0.4);
}

.footer-text {
  font-size: 0.8125rem;
  color: var(--muted);
  opacity: 0.7;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .projects-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 320px 280px 220px;
  }

  .project-card:first-child {
    grid-row: span 1;
  }
}

@media (max-width: 860px) {
  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 0;
  }
}

@media (max-width: 760px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px 0;
  }

  .skill-group:nth-child(odd) {
    border-left: none;
    padding-left: 0;
  }
}

@media (max-width: 600px) {
  .section {
    padding: 72px 0;
  }

  .nav-links {
    gap: 20px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .skill-group {
    border-left: none;
    padding-left: 0;
  }

  .hero-name {
    font-size: clamp(2.5rem, 14vw, 4rem);
  }

  .sub-projects-grid {
    grid-template-columns: 1fr;
  }

  .contact-layout {
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
  }
  .contact-banner {
    display: none;
  }
}

@media (max-width: 380px) {
  .nav-links {
    gap: 14px;
  }

  .nav-links a {
    font-size: 0.8125rem;
  }
}
