/* ================================================================
   CSS VARIABLES — THEME TOKENS
   Dark mode is the default. Light mode overrides via [data-theme="light"].
   Project accent color is set dynamically via --accent on <html>.
   ================================================================ */
:root {
  /* --- Dark mode palette --- */
  --bg-primary:    #0b1120;
  --bg-card:       #131a2e;
  --text-primary:  #e8e8e8;
  --text-secondary:#7a8ba5;
  --text-muted:    #4a5568;
  --border-subtle: #1e2a40;

  /* --- Fixed accent colors --- */
  --teal:          #01eefd;
  --green:         #39FF14;
  --yellow:        #ffd700;

  /* --- Project colors --- */
  --project-1:     #004aad;
  --project-2:     #ff914d;   /* softened from #ff751f */
  --project-3:     #ff4d4d;   /* softened from #ff3131 */
  --project-4:     #7b8aff;   /* softened from #5170ff */

  /* --- Active accent (overridden by JS) --- */
  --accent:        var(--project-1);

  /* --- Layout --- */
  --topbar-height: 60px;
  --transition:    0.35s cubic-bezier(0.4, 0, 0.2, 1);

  font-family: 'Space Grotesk', sans-serif;
}

/* --- Light mode overrides --- */
[data-theme="light"] {
  --bg-primary:    #f4f4f4;
  --bg-card:       #ffffff;
  --text-primary:  #1a1f36;
  --text-secondary:#5a6275;
  --text-muted:    #9ca3af;
  --border-subtle: #e0e0e0;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: text-decoration 0.15s;
}
a:hover { text-decoration: underline; }

/* ================================================================
   SPLASH SCREEN — Mode selection
   Full-viewport overlay with two clickable cards.
   ================================================================ */
#splash {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;
  background: #0b1120;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mode-card {
  width: 280px;
  height: 180px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: none;
  font-family: inherit;
}
.mode-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

/* Light mode card */
.mode-card--light {
  background: #f0f0f0;
  color: #1a1f36;
}
/* Dark mode card */
.mode-card--dark {
  background: #2a3352;
  color: #ffffff;
  border: 1px solid #3a4565;
}

/* ================================================================
   LAYOUT: APP
   ================================================================ */
#app {
  display: none;            /* shown after splash dismissal */
  min-height: 100vh;
}
#app.visible {
  display: block;
}

/* ================================================================
   THEME TOGGLE — Sun/Moon icon button
   ================================================================ */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

/* ================================================================
   LAYOUT: TOP-BAR
   Sticky header with name row, nav row, project buttons row.
   Scrollable content below.
   ================================================================ */
#topbar-layout {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  width: min(900px, calc(100% - 96px));
  margin: 0 auto;
}

/* --- Sticky header block --- */
.topbar-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-primary);
  padding: 28px 48px 0;
  transition: background var(--transition);
}

/* Row 1: Name (left) + Subtitle (right) */
.topbar-header__row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.topbar__name {
  font-size: 28px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}
.topbar__name:hover {
  color: var(--text-secondary);
}

/* Topbar name row: name + toggle */
.topbar__name-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__subtitle {
  font-size: 22px;
  color: var(--text-secondary);
}

/* Row 2: Navigation links — bordered to separate from project buttons */
.topbar-header__nav {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.topbar__nav-link {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  transition: color 0.2s;
}
.topbar__nav-link:hover,
.topbar__nav-link.active {
  color: var(--text-primary);
}
.topbar__nav-link--resume {
  color: var(--green);
}
.topbar__nav-link--resume:hover {
  color: var(--green);
  text-decoration: underline;
}

/* Resume/CV dropdown inside top nav */
.topbar__resume-dropdown {
  position: relative;
  flex: 1;
}

.topbar__resume-toggle {
  width: 100%;
}

.topbar__resume-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 100%;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  padding: 6px;
  display: none;
  z-index: 60;
}

.topbar__resume-dropdown.open .topbar__resume-menu {
  display: block;
}

.topbar__resume-menu-link {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.topbar__resume-menu-link:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

[data-theme="light"] .topbar__resume-menu-link:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* Row 3: Project buttons (horizontal) */
.topbar-header__projects {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
}

.topbar-proj-btn {
  flex: 1;
  padding: 14px 0;
  border-radius: 40px;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
  opacity: 0.75;
}
.topbar-proj-btn:hover { opacity: 0.9; transform: translateY(-2px); }
.topbar-proj-btn.active { opacity: 1; box-shadow: 0 4px 16px rgba(0,0,0,0.25); }

.topbar-proj-btn--1 { background: var(--project-1); }
.topbar-proj-btn--2 { background: var(--project-2); }
.topbar-proj-btn--3 { background: var(--project-3); }
.topbar-proj-btn--4 { background: var(--project-4); }

/* ================================================================
   CONTENT AREA
   Holds project detail, highlight, or about section. Scrollable.
   ================================================================ */
.topbar-content {
  padding: 36px 48px 80px;
  flex: 1;
}

/* --- Detail/Highlight/About Common Styles --- */
.detail__title {
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 2px;
}

.detail__subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Colored underline below subtitle */
.detail__rule {
  width: 420px;
  max-width: 100%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 20px;
  transition: background var(--transition);
}

.detail__desc {
  font-size: 14px;
  color: #e8e8e8;
  line-height: 1.75;
  max-width: 680px;
  margin-bottom: 28px;
  white-space: pre-wrap;
}
[data-theme="light"] .detail__desc {
  color: var(--text-primary);
}

/* Media: shared spacing */
.detail__media {
  margin: 0 auto 28px;
  transition: border-color var(--transition);
}

/* Actual photos/GIFs: outline hugs rendered media dimensions */
img.detail__media {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 640px);
  max-height: 420px;
  border: 3px dashed var(--accent);
  border-radius: 20px;
}

/* Placeholder when media source is missing */
div.detail__media {
  width: 100%;
  max-width: 520px;
  height: 220px;
  border: 3px dashed var(--accent);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.detail__extra {
  font-size: 14px;
  color: #e8e8e8;
  line-height: 1.75;
  max-width: 680px;
  margin-bottom: 16px;
}
[data-theme="light"] .detail__extra {
  color: var(--text-primary);
}

.detail__link {
  color: var(--teal);
  font-size: 14px;
}

/* --- Comments dropdown --- */
.detail__comments {
  margin-top: 20px;
  margin-bottom: 16px;
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 16px;
  transition: all var(--transition);
}

.detail__comments-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  transition: color var(--transition);
  width: 100%;
  text-align: left;
}
.detail__comments-toggle:hover {
  opacity: 0.8;
}

.detail__comments-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition), padding var(--transition), border var(--transition), background var(--transition);
  padding: 0;
  border-top: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.detail__comments-content.expanded {
  max-height: 1000px;
  padding: 12px;
  border-top: 1px solid var(--accent);
  background: #1a2a3e;
}

/* --- About Section --- */
.about__heading {
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 4px;
}

.about__rule {
  width: 420px;
  max-width: 100%;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 20px;
  transition: background var(--transition);
}

.about__text {
  font-size: 14px;
  color: #e8e8e8;
  line-height: 1.8;
  max-width: 720px;
  margin-bottom: 20px;
}
[data-theme="light"] .about__text {
  color: var(--text-primary);
}

.about__media {
  width: 100%;
  max-width: 520px;
  height: 220px;
  border: 2px dashed var(--text-muted);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 auto 28px;
}

/* ================================================================
   UTILITY & ANIMATION
   ================================================================ */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   IMAGE MODAL — Lightbox for full-resolution images
   ================================================================ */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.image-modal.open {
  opacity: 1;
}
.image-modal.closing {
  opacity: 0;
}

.image-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.image-modal__content {
  position: relative;
  z-index: 2001;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  overflow: hidden;
  animation: modalSlideIn var(--transition) ease-out;
}
@keyframes modalSlideIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.image-modal__img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 90vh;
}

.image-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 2002;
}
.image-modal__close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* ================================================================
   RESPONSIVE — Mobile layout adjustments
   ================================================================ */
@media (max-width: 900px) {
  #topbar-layout { width: 100%; }
  .topbar-header { padding: 16px 20px 0; }
  .topbar-content { padding: 24px 20px 60px; }
  .topbar-header__projects { flex-wrap: wrap; gap: 10px; }
  .topbar-proj-btn { flex: 1 1 45%; }
  .topbar-header__row1 { flex-wrap: wrap; gap: 8px; }
  .topbar__subtitle { font-size: 16px; }
}
