/* ========================================= */
/* 1. RESET & VARIABLES                      */
/* ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f7f7f8;
  --bg-elevated: #ffffff;
  --text: #18181b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
}

body.dark {
  --bg: #0b0b0f;
  --bg-elevated: #111827;
  --text: #f9fafb;
  --muted: #9ca3af;
  --border: #1f2937;
  --accent: #60a5fa;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  overflow-x: hidden;
}

/* --- NAVBAR STICKY WRAPPER --- */
#navbar {
  position: sticky;
  top: 0;
  z-index: 999;
  width: 100%;
}

/* ========================================= */
/* 2. NAVBAR STYLING                         */
/* ========================================= */
.site-nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 5px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: padding 0.3s ease, box-shadow 0.3s ease;
}

.site-nav.scrolled {
  padding: 5px 32px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.site-nav .logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.28s ease;
}

.site-nav.scrolled .logo img {
  transform: scale(0.78);
}

.site-nav .logo {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  text-decoration: none;
  font-size: 1rem;
  color: var(--muted);
  transition: color 0.25s ease, border-color 0.25s ease;
  padding-bottom: 3px;
  border-bottom: 2px solid transparent;
}

.site-nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.site-nav a:hover:not(.logo) {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#themeToggle {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.8rem;
  margin-left: 6px;
}

/* ========================================= */
/* 3. LAYOUT & TYPOGRAPHY                    */
/* ========================================= */
.page {
  max-width: 1280px; 
  margin: 0 auto;
  padding: 96px 24px 48px; 
}

.section {
  padding: 32px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.section:last-of-type {
  border-bottom: none;
}

.section.narrow {
  max-width: 640px;
}

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.page-title {
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 12px;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 600px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 8px;
  margin-top: 16px;
}

/* ========================================= */
/* 4. CARDS, BUTTONS, FORMS                  */
/* ========================================= */
.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 16px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card h3 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.card p {
  font-size: 0.9rem;
  color: var(--muted);
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.button-row {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.2s;
}

.button:hover {
  opacity: 0.9;
}

.button.primary {
  background: var(--accent);
  color: white;
}

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

.contact-form {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  gap: 6px;
}

.contact-form input,
.contact-form textarea {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font: inherit;
  background: var(--bg-elevated);
  color: var(--text);
}

footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ========================================= */
/* 5. MOBILE / RESPONSIVE GENERAL            */
/* ========================================= */

@media screen and (max-width: 768px) {
  .site-nav {
    flex-direction: column;
    padding: 12px 16px;
    gap: 12px;
  }
  
  .site-nav.scrolled {
    padding: 12px 16px;
  }

  .site-nav .logo img {
    height: 40px;
  }

  .nav-right {
    width: 100%;
    justify-content: space-between;
    gap: 0;
    padding: 0 10px;
  }

  .site-nav a {
    font-size: 0.95rem;
    padding: 8px 4px;
  }

  #themeToggle {
    margin-left: 0;
  }

  .page {
    padding: 140px 20px 40px; 
  }

  .page-title {
    font-size: 1.75rem;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }
  
  .button-row {
    flex-direction: column;
    width: 100%;
  }
  
  .button {
    width: 100%;
  }
}

/* ========================================= */
/* 6. PROJECT SHOWCASE (UPDATED)             */
/* ========================================= */

.showcase-container {
  display: grid;
  grid-template-columns: 380px 1fr; 
  gap: 64px;
  align-items: start;
  
  /* --- CHANGED: Reduced from 32px to 16px to move banner up --- */
  margin-top: 16px; 
  
  min-height: 500px;
}

/* --- Left Side: Project Menu --- */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-select {
  background: var(--bg);
  border: 1px solid var(--border);
  text-align: left;
  padding: 20px 24px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.project-select:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  transform: translateX(4px);
}

/* Active State */
.project-select.active {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-left: 5px solid var(--accent); 
}

.project-select .p-name {
  font-weight: 500;
  font-size: 1rem;
}

.project-select .p-date {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  opacity: 0.5;
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

/* --- Right Side: Preview Card --- */
.project-preview {
  position: relative;
  perspective: 1000px;
  height: 100%;
}

.floating-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15); 
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  opacity: 1;
  transform: translateY(0);
  height: 100%;
  min-height: 450px;
}

.floating-card.switching {
  opacity: 0.5;
  transform: scale(0.98) translateY(10px);
}

/* --- CHANGED: MAIN CARD VISUAL SETTINGS --- */
.card-visual {
  width: 100%;
  
  /* Use Aspect Ratio instead of fixed height */
  aspect-ratio: 16 / 9;
  
  transition: background 0.3s ease;
  background-color: var(--accent);
  
  /* Fixes for Tiling and Positioning */
  background-size: cover;       
  background-position: center top;  
  background-repeat: no-repeat; 
}

.card-content {
  padding: 32px;
}

.card-content h3 {
  font-size: 2rem;
  margin-bottom: 16px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.card-content .eyebrow {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.card-content p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 90%;
}

/* Showcase Mobile Responsive Fixes */
@media screen and (max-width: 900px) {
  .showcase-container {
    grid-template-columns: 1fr; /* Stack layout */
    gap: 32px;
  }

  .project-preview {
    position: relative; 
    top: auto;
    z-index: 1;
    margin-top: 20px; 
    margin-bottom: 0;
  }
  
  .floating-card {
    min-height: auto;
  }
  
  .project-select {
    padding: 16px;
  }
}

/* ========================================= */
/* 7. TERMINAL RIBBON COMPONENT              */
/* ========================================= */
.terminal-ribbon {
  width: 100%;
  max-width: 100%;
  background: #1e1e1e;
  border-radius: 8px;
  border: 1px solid #333;
  
  margin-top: -40px; 
  margin-bottom: 48px;
  
  font-family: 'Fira Code', 'Consolas', monospace;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.terminal-header {
  background: #252526;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #333;
}

.window-controls {
  display: flex;
  gap: 6px;
  margin-right: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-title {
  color: #9ca3af;
  font-size: 0.75rem;
  opacity: 0.8;
}

.terminal-body {
  padding: 16px 16px;
  color: #d4d4d4;
  font-size: 0.9rem;
  min-height: 80px; 
  display: flex;
  align-items: flex-start; 
  line-height: 1.6;
}

.prompt {
  color: var(--accent);
  margin-right: 8px;
  font-weight: bold;
  height: 100%;
}

#typewriter-text {
  color: #a9b7c6;
}

.cursor {
  display: inline-block;
  color: var(--accent);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ========================================= */
/* 8. ABOUT PAGE LAYOUTS (Hero & Bento)      */
/* ========================================= */

/* Hero Split Layout */
.hero-split {
  display: grid;
  grid-template-columns: 1.5fr 1fr; /* Text takes more space */
  gap: 60px;
  align-items: center;
}

.photo-frame {
  position: relative;
}

.photo-frame img {
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
  /* A subtle shadow to lift the image */
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.12);
  filter: grayscale(10%); /* Slight vintage feel */
  transition: filter 0.3s ease, transform 0.3s ease;
}

.photo-frame:hover img {
  filter: grayscale(0%);
  transform: translateY(-5px);
}

/* Bento Grid Layout */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.bento-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s;
}

.bento-card:hover {
  border-color: var(--accent);
}

.bento-icon {
  font-size: 1.5rem;
  margin-bottom: 16px;
  display: inline-block;
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  width: fit-content;
}

.highlight {
  color: var(--accent);
  font-weight: 500;
}

/* About Page Mobile Adjustments */
@media screen and (max-width: 850px) {
  .hero-split {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .photo-frame {
    order: -1; /* Moves photo to top on mobile */
    max-width: 400px;
    margin: 0 auto;
  }
}