/* ===========================
   CSS Custom Properties
   =========================== */
:root {
  --color-text: #777;
  --color-text-dark: #333;
  --color-bg: #fff;
  --color-bg-dark: #333;
  --color-accent: #2196f3;
  --color-accent-dark: #1976d2;
  --color-nav-bg: rgba(255, 255, 255, 0.95);
  --color-nav-hover: rgba(0, 0, 0, 0.05);
  --color-btn-bg: #e0e0e0;
  --color-btn-bg-hover: #ccc;
  --color-card-bg: #fff;
  --color-tag-bg: #f0f0f0;
  --color-skill-bar-bg: #e0e0e0;
  --color-modal-backdrop: #fff;
  --color-detail-backdrop: rgba(0, 0, 0, 0.75);
  --font-primary: 'Lato', sans-serif;
  --spacing-sm: 1rem;
  --spacing-md: 2rem;
  --spacing-lg: 4rem;
  --nav-height: 60px;
  --transition-speed: 0.3s;
  --z-nav: 50;
  --z-gallery-modal: 100;
  --z-detail-modal: 200;
  --z-lightbox: 300;
  --portfolio-cols-mobile: 2;
  --portfolio-cols-desktop: 3;
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-primary);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.8;
  overflow-x: hidden;
}

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

a {
  color: var(--color-text);
  text-decoration: underline;
  transition: color var(--transition-speed);
}

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

/* Nav and footer links override */
.nav-links a,
.footer-social a,
.footer-top-btn,
.hero-arrow,
.nav-brand {
  text-decoration: none;
}

/* ===========================
   Layout
   =========================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-sm);
}

.section {
  padding: var(--spacing-md) 0;
  position: relative;
  z-index: 2;
}

.section-title {
  text-align: center;
  color: var(--color-text-dark);
  font-weight: 400;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.section-subtitle {
  text-align: center;
  margin-bottom: var(--spacing-md);
}

/* Portfolio subtitle: left-aligned on mobile, centered on desktop */
.portfolio-subtitle {
  text-align: left;
  font-style: normal;
}

@media (min-width: 768px) {
  .portfolio-subtitle {
    text-align: center;
  }
}

/* Typewriter cursor */
#about-tagline::after {
  content: '|';
  animation: blink 0.7s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ===========================
   Navigation
   =========================== */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  transition: background var(--transition-speed), box-shadow var(--transition-speed);
}

.site-nav.scrolled {
  background: var(--color-nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  gap: 0.25rem;
}

.nav-brand {
  display: none;
}

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--color-text-dark);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  transition: color var(--transition-speed);
}

.nav-links {
  display: none;
  list-style: none;
}

.nav-links.is-open {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--color-nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 0;
}

.nav-links a {
  display: block;
  padding: 0.75rem var(--spacing-sm);
  color: var(--color-text-dark);
  font-size: 0.9rem;
  letter-spacing: 1px;
  transition: background var(--transition-speed);
}

.nav-links a:hover {
  background: var(--color-nav-hover);
}

.nav-links a i {
  margin-right: 0.4rem;
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }

  .nav-links {
    display: flex;
    flex-direction: row;
    gap: 0;
  }

  .nav-links a {
    color: var(--color-text);
    padding: 0.5rem 1rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  .nav-links a:hover {
    background: var(--color-nav-hover);
  }

  .site-nav.scrolled .nav-links a {
    text-shadow: none;
  }
}

/* ===========================
   Hero
   =========================== */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../images/hero/Hec_1.jpg');
  background-attachment: fixed;
  background-position: right;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0.75;
  z-index: 0;
}

.hero-content {
  text-align: center;
  white-space: nowrap;
  position: relative;
  z-index: 2;
}

@media (max-width: 767px) {
  .hero-content {
    margin-top: 25vh;
  }
}

.hero-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #fff;
  padding: 0.75rem 2rem;
  padding-left: calc(2rem + 10px);
  font-weight: 400;
  letter-spacing: 10px;
  animation: fadeIn 1s ease;
  line-height: 1;
}

.hero-title--full {
  display: none;
  font-size: 1.5rem;
}

.hero-title--medium {
  display: none;
  font-size: 1.3rem;
}

.hero-title--small {
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  .hero-title--small { display: none; }
  .hero-title--medium { display: inline; }
}

@media (min-width: 1024px) {
  .hero-title--medium { display: none; }
  .hero-title--full { display: inline; }
}

.hero-arrow {
  position: absolute;
  bottom: 2rem;
  z-index: 2;
  color: #fff;
  background: none;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: color var(--transition-speed);
  animation: arrowBounce 2s ease-in-out infinite;
}

.hero-arrow:hover {
  color: #fff;
}

@media (min-width: 1024px) {
  .hero-arrow {
    color: var(--color-text);
  }

  .hero-arrow:hover {
    color: var(--color-text-dark);
  }
}

@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

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

/* Turn off parallax on touch/small devices */
@media (max-width: 1024px), (hover: none) {
  .hero::before,
  .parallax-divider {
    background-attachment: scroll;
  }
}

/* ===========================
   About Section
   =========================== */
.about-columns {
  max-width: 800px;
  margin: var(--spacing-md) auto;
}

.about-columns p {
  margin-bottom: 1.5rem;
}

/* ===========================
   Parallax Dividers
   =========================== */
.parallax-divider {
  min-height: 140px;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.parallax-divider span {
  font-size: 2.5rem;
  color: #fff;
  letter-spacing: 10px;
  font-weight: 300;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
}

.parallax-portfolio {
  background-image: url('../images/hero/Hec_2.jpg');
}

/* ===========================
   Portfolio Section
   =========================== */
.portfolio-download {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--color-btn-bg);
  color: var(--color-text-dark);
  border: none;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-speed);
}

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

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(var(--portfolio-cols-mobile), 1fr);
  gap: var(--spacing-sm);
}

@media (min-width: 768px) {
  .portfolio-grid {
    grid-template-columns: repeat(var(--portfolio-cols-desktop), 1fr);
    gap: var(--spacing-md);
  }
}

.category-card {
  cursor: pointer;
}

.category-card-img {
  position: relative;
  overflow: hidden;
}

.category-card img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.category-card:hover img {
  transform: scale(1.08);
  filter: brightness(1.15) saturate(1.2);
}

.category-card:hover .category-card-img {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.category-overlay {
  display: none;
}

.category-subtitle {
  color: var(--color-text);
  line-height: 1.6;
  text-align: center;
  padding: 0.75rem 0 0;
}

/* ===========================
   Portfolio Tools
   =========================== */
.portfolio-tools {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-skill-bar-bg);
  text-align: center;
}

.portfolio-tools-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.portfolio-tools-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.portfolio-tool-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 56px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
  backface-visibility: hidden;
}

.portfolio-tool-logo {
  width: 48px;
  height: 48px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
  backface-visibility: hidden;
}

.portfolio-tool-label {
  display: none;
}

@media (min-width: 768px) {
  .portfolio-tools-icons {
    padding-bottom: 1.5rem;
  }

  .portfolio-tool-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0;
    height: 1.2rem;
    margin-top: 0.3rem;
    color: var(--color-text);
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: opacity 0.3s ease;
  }

  .portfolio-tool-item:hover .portfolio-tool-logo {
    transform: scale(1.35);
  }

  .portfolio-tool-item:hover .portfolio-tool-label {
    opacity: 1;
  }

  .portfolio-tools-icons:hover .portfolio-tool-item:not(:hover) {
    transform: scale(0.95);
  }

  .portfolio-tool-item:hover + .portfolio-tool-item,
  .portfolio-tool-item:has(+ .portfolio-tool-item:hover) {
    transform: scale(1.05);
  }
}

/* ===========================
   Footer
   =========================== */
.site-footer {
  background: #000;
  color: #fff;
  text-align: center;
  position: relative;
  z-index: 2;
  padding: var(--spacing-md) var(--spacing-sm) var(--spacing-sm);
}

.footer-top-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.2rem;
  margin-bottom: var(--spacing-sm);
  transition: color 0.3s ease;
}

.footer-top-btn:hover {
  color: #fff;
  animation: arrowBounceUp 1.5s ease-in-out infinite;
}

@keyframes arrowBounceUp {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.footer-brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 6px;
  padding-left: 6px;
  color: #fff;
  margin-bottom: 0.4rem;
}

.footer-tagline {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  margin-bottom: var(--spacing-sm);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: var(--spacing-sm);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 1rem;
  transition: color var(--transition-speed);
}

.footer-links a:hover {
  color: #fff;
}

.footer-links i {
  font-size: 1.2rem;
}

.footer-separator {
  width: 1px;
  height: 1rem;
  background: rgba(255, 255, 255, 0.2);
}

.footer-copy {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.75rem;
  letter-spacing: 1px;
  padding-left: 1px;
}

/* ===========================
   Modal (shared)
   =========================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-gallery-modal);
  overscroll-behavior: contain;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  overflow-y: auto;
  transition: opacity var(--transition-speed), visibility var(--transition-speed);
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-modal-backdrop);
  pointer-events: none;
}

.modal-content {
  position: relative;
  max-width: 1200px;
  width: 100%;
  padding: var(--spacing-lg) var(--spacing-sm) var(--spacing-lg);
  z-index: 1;
}

.modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-dark);
  cursor: pointer;
  z-index: 10;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed);
}

.modal-close:hover {
  color: #000;
}

.modal-title {
  text-align: center;
  font-weight: 400;
  letter-spacing: 3px;
  color: var(--color-text-dark);
  margin-bottom: 0.5rem;
}

.modal-description {
  text-align: center;
  margin-bottom: var(--spacing-md);
  color: var(--color-text);
}

/* ===========================
   Gallery Grid (Level 1 Modal)
   =========================== */
.gallery-grid {
  column-count: 1;
  column-gap: var(--spacing-sm);
  padding-bottom: var(--spacing-lg);
}

@media (min-width: 600px) {
  .gallery-grid {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    column-count: 3;
  }
}

.gallery-item {
  cursor: pointer;
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: var(--spacing-sm);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: opacity var(--transition-speed);
}

.gallery-item:hover img {
  opacity: 0.9;
}

/* ===========================
   Detail Modal (Level 2)
   =========================== */
.modal--detail {
  z-index: var(--z-detail-modal);
  align-items: flex-start;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-sm);
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.modal--detail .modal-backdrop {
  background: var(--color-detail-backdrop);
}

/* Wrapper: nav buttons + card in a row */
.detail-wrapper {
  position: relative;
  z-index: 1;
  max-width: 900px;
  width: fit-content;
}


.detail-card {
  position: relative;
  background: var(--color-card-bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  animation: detailSlideIn var(--transition-speed) ease;
}

@keyframes detailSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Detail close is now outside the card, handled by .detail-close-btn */
.detail-card .modal-close {
  display: none;
}

/* Layout: image on top, text below */
.detail-layout {
  display: flex;
  flex-direction: column;
}

.detail-image-container {
  background: var(--color-card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-image-container img {
  width: 100%;
  cursor: pointer;
}

.detail-extras img {
  cursor: pointer;
}

/* Horizontal layout for portrait images (taller than wide) */
@media (min-width: 768px) {
  .detail-layout--horizontal {
    flex-direction: row;
  }

  .detail-layout--horizontal .detail-image-container {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .detail-layout--horizontal .detail-info {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .detail-card:has(.detail-layout--horizontal) {
    width: 900px;
    max-width: 100%;
  }
}

.detail-info {
  padding: var(--spacing-md);
  overflow: hidden;
  width: 0;
  min-width: 100%;
}

.detail-title {
  font-weight: 700;
  color: var(--color-text-dark);
  letter-spacing: 2px;
  margin-bottom: 0.75rem;
  font-size: 1.2rem;
}

.detail-description {
  margin-bottom: var(--spacing-sm);
  line-height: 1.6;
}

.detail-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--spacing-sm);
}

.tech-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--color-tag-bg);
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  color: var(--color-text-dark);
}

.detail-extras {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: var(--spacing-sm);
}

.detail-extras img {
  width: 100%;
  /* border-radius removed */
}

/* Detail navigation & close — bare icon style */
.detail-nav,
.detail-close-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed), transform var(--transition-speed);
}

.detail-nav:hover,
.detail-close-btn:hover {
  color: #fff;
}

.detail-close-btn:hover {
  transform: scale(1.2);
}

/* Buttons above the card */
.detail-wrapper {
  display: flex;
  flex-direction: column;
}

.detail-nav-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 0.5rem 0;
  order: -1;
}

/* ===========================
   Lightbox (Level 3)
   =========================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  overscroll-behavior: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-speed), visibility var(--transition-speed);
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-image {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  animation: detailSlideIn var(--transition-speed) ease;
}

.lightbox-nav {
  position: fixed;
  top: 1rem;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.lightbox-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0.5rem;
  transition: color var(--transition-speed), transform var(--transition-speed);
}

.lightbox-btn:hover {
  color: #fff;
}

.lightbox-close:hover {
  transform: scale(1.2);
}

/* ===========================
   Body scroll lock
   =========================== */
/* No body scroll lock — all modals use the page scrollbar */
