/* 
   styles.css | Portfolio
   Míriam Domínguez Martínez
*/

/*
   RESET
*/
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
/* END RESET */

/* =================
   0. FONTS
   =================
*/

/* Inter */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('font/Inter-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('font/Inter-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('font/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('font/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('font/Inter-Bold.woff2') format('woff2');
}

/* Dancing Script */
@font-face {
  font-family: 'Dancing Script';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('font/DancingScript-Bold.woff2') format('woff2');
}

@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('font/Caveat-Regular.woff2') format('woff2');
}

/* =================
   1. CSS VARIABLES
   =================
*/

:root {
  --bg-outer:       #ffffff;
  --bg-card:        #ffffff;
  --bg-card-inner:  #f5f6f8;
  --bg-nav:         #1e2330;
  --text-primary:   #1a1f2e;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --border:         #e5e7eb;
  --btn-bg:         #1a1f2e;
  --btn-text:       #ffffff;
  --transition:     0.3s ease;

  /* Photo strip bleed */
  --photo-h:  140px;
  --bleed:    80px;

}

body.dark {
  --bg-outer:       #0d1117;
  --bg-card:        #161b27;
  --bg-card-inner:  #1e2535;
  --bg-nav:         #0f1218;
  --text-primary:   #e8eaf0;
  --text-secondary: #8b95a8;
  --text-muted:     #5c6880;
  --border:         #2a3347;
  --btn-bg:         #e8eaf0;
  --btn-text:       #161b27;
}

/* END CSS VARIABLES */


/* =================
   2. BASE
   =================
*/

html, body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

/* I've visually removed the scrollbar but it still works; it's purely aesthetic */ 
html {
  font-family: 'Inter', sans-serif;
  scroll-behavior: smooth;
  scrollbar-width: none;    /* Firefox */
}

html::-webkit-scrollbar {
  display: none;           /* Chrome, Safari, Edge */
}

body {
  background-color: var(--bg-outer);
  min-height: 100vh;
  transition: background-color var(--transition);
}


.project-img,
.avatar,
.modal-img {
  color: transparent; /* hide alt text while image is loading or broken */
  font-size: 0;       /* suppress the broken-image icon in all browsers */
}

/* END BASE */


/* =================
   2b. GRAIN OVERLAY
   Subtle noise texture over the whole page, like Vercel/Linear.
   Pure CSS SVG filter, zero images
   =================
*/

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

body.dark::after {
  opacity: 0.045;
}

/* END GRAIN OVERLAY */

/* =================
   3. NAVBAR
   =================
*/

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition), border-color var(--transition);
}

body.dark .site-nav {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-inner {
  max-width: 740px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 40px;
  height: 48px;
}

.nav-link {
  color: rgba(200, 206, 220, 0.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* END NAVBAR */


/* =================
   4. PAGE LAYOUT
   =================
*/

.page-wrapper {
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
}

.side {
  flex: 1;
  background: var(--bg-outer);
  transition: background-color var(--transition);
  min-width: 0;
}

.center-col {
  width: 100%;
  max-width: 740px;
  flex-shrink: 0;
  background: var(--bg-card);
  position: relative;
  transition: background-color var(--transition);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.07);
  /* NO overflow: hidden - strip must bleed outside */
}

/* END PAGE LAYOUT */


/* =================
   5. THEME TOGGLE
   =================
*/

.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 17px;
  z-index: 10;
  padding: 4px 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.theme-toggle:hover {
  color: var(--text-primary);
}

.icon-sun {
  display: block;
}

.icon-moon {
  display: none;
}

body.dark .icon-sun {
  display: none;
}

body.dark .icon-moon {
  display: block;
}

/* END THEME TOGGLE */


/* =================
   6. HERO
   =================
*/

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 40px 36px;
  text-align: center;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  background: var(--bg-nav); /* fallback shown when img/avatar.jpg is missing */
  /* Hero entry animation */
  animation: heroFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

h1.name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  transition: color var(--transition);
  animation: heroFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.tagline {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 20px;
  transition: color var(--transition);
  animation: heroFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.16s both;
  min-height: 1.4em; /* prevent layout shift during typed text */
}

/* Typed text cursor blink */
.typed-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--text-secondary);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hero-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  animation: heroFadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
}

@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-work {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  transition: background var(--transition), color var(--transition), transform 0.15s;
}

.btn-work:hover {
  transform: translateY(-1px);
}

/* END HERO */


/* =================
   6b. HERO BUTTONS ROW
   =================
*/

/* CV download button - outlined style to complement the filled btn-work */
.btn-cv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 0.15s;
}

.btn-cv:hover {
  background: var(--bg-card-inner);
  color: var(--text-primary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* END HERO BUTTONS ROW */


/* =================
   7. MAIN CONTENT WRAPPER
   =================
*/

.main-content {
  padding: 40px 60px 0;
}

/* END MAIN CONTENT WRAPPER */


/* =================
   8. SHARED SECTION TITLE
   =================
*/

.section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  transition: color var(--transition);
}

#projects,
#about,
#education,
#beyond,
#contact {
  scroll-margin-top: 60px;
}

/* END SHARED SECTION TITLE */


/* =================
   8b. SCROLL REVEAL
   Elements start invisible; JS adds .sr-visible via IntersectionObserver.
   =================
*/

.sr {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.sr.sr-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for child elements */
.sr-delay-1 { transition-delay: 0.07s; }
.sr-delay-2 { transition-delay: 0.14s; }
.sr-delay-3 { transition-delay: 0.21s; }
.sr-delay-4 { transition-delay: 0.28s; }

/* END SCROLL REVEAL */


/* =================
   9. PROJECTS SECTION
   =================
*/

.projects-section {
  margin-bottom: 44px;
}

.projects-intro {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 24px;
  background: var(--bg-card-inner);
  border-radius: 14px;
  padding: 24px 26px;
  transition: color var(--transition), background var(--transition);
}

/* END PROJECTS SECTION */


/* =================
   10. PHOTOS STRIP - NEGATIVE MARGIN BLEED TECHNIQUE
   =================
*/

.photos-strip {
  /* Negative margin bleed - escapes the card on both sides */
  width: calc(100% + var(--bleed) * 2);
  margin-left: calc(var(--bleed) * -1);

  display: flex;
  flex-direction: column; /* rows stack vertically */
  gap: 14px;
  padding: 10px 0;
  overflow: visible;      /* prevent clipping of tilted cards */
  margin-bottom: 32px;
}

/* Each row is a horizontal flex line */
.photos-row {
  display: flex;
  gap: 14px;
  width: 100%;
}

/* Row 2: 2 cards centred under the 3 above (inverted pyramid) */
.photos-row-bottom {
  justify-content: center;
}

/* Row 2 cards match the width of a card in the 3-card row */
.photos-row-bottom .photo-item {
  flex: 0 0 calc((100% - 14px * 2) / 3);
}

/* On strip hover: all cards straighten and lift together */
.photos-strip:hover .photo-item,
.photos-strip:hover .photos-row-bottom .photo-item:nth-child(1),
.photos-strip:hover .photos-row-bottom .photo-item:nth-child(2) {
  transform: rotate(0deg) translateY(0) scale(1.02);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
}

/* END PHOTOS STRIP */


/* =================
   11. PHOTO ITEM
   =================
*/

.photo-item {
  flex: 1;
  min-width: 0;
  height: var(--photo-h);
  border-radius: 14px;
  /* 
    overflow:hidden removed, causes hairline corner artifact when combined
    with transform:rotate(). Clipping is handled by border-radius on .project-img 
  */
  position: relative;
  background: var(--bg-nav);           /* fallback shown when project image is missing */
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.10),
    0 0 0 1.5px rgba(0, 0, 0, 0.15); /* outline-style ring to frame white images */
  will-change: transform;
  transition:
    transform  0.4s cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 0.4s ease;
}

/* Row 1: 3 cards - slight tilt and lift */
.photo-item:nth-child(1) { transform: rotate(-2deg) translateY(4px); }
.photo-item:nth-child(2) { transform: rotate(0deg) translateY(0px); }
.photo-item:nth-child(3) { transform: rotate(2deg) translateY(4px); }

/* Row 2: 2 cards - gentle tilt */
.photos-row-bottom .photo-item:nth-child(1) { transform: rotate(-1deg) translateY(4px); }
.photos-row-bottom .photo-item:nth-child(2) { transform: rotate(1deg)  translateY(4px); }

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px; /* does the actual clipping since container has no overflow:hidden */
}

.project-overlay {
  position: absolute;
  inset: 0;
  border-radius: 14px; /* needed since container no longer has overflow:hidden */
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.photos-strip:hover .project-overlay {
  opacity: 1;
}

.project-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
  pointer-events: none;
}

.photos-strip:hover .project-title {
  opacity: 1;
  transform: translateY(0);
}

.project-view-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease 0.1s, transform 0.2s ease 0.1s;
  pointer-events: none;
}

.photos-strip:hover .project-view-hint {
  opacity: 1;
  transform: translateY(0);
}

/* END PHOTO ITEM */


/* =================
   12. ABOUT ME
   =================
*/

.about-section {
  margin-bottom: 44px;
}

.about-card {
  background: var(--bg-card-inner);
  border-radius: 14px;
  padding: 24px 26px;
  transition: background var(--transition);
}

.about-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  transition: color var(--transition);
}

.about-text + .about-text {
  margin-top: 14px;
}

/* =================
   12b. FLOATING TECH BADGES
   Replace the flat .about-tags with animated floating badges
   =================
*/

.about-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.about-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  transition: background var(--transition), color var(--transition), border-color var(--transition),
              transform 0.3s ease, box-shadow 0.3s ease;
  animation: floatBadge var(--float-dur, 3s) ease-in-out var(--float-delay, 0s) infinite alternate;
}

.about-tag:hover {
  transform: translateY(-3px) scale(1.05) !important;
  animation-play-state: paused;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

@keyframes floatBadge {
  from { transform: translateY(0px); }
  to   { transform: translateY(-5px); }
}

/* Each badge gets a slightly different timing via inline style set by JS */

/* END ABOUT ME */


/* =================
   13. EDUCATION
   =================
*/

.education-section {
  margin-bottom: 44px;
}

.edu-card {
  background: var(--bg-card-inner);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 12px;
  transition: background var(--transition), transform 0.2s ease, box-shadow 0.2s ease;
}

.edu-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.edu-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  transition: color var(--transition);
}

.edu-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  transition: color var(--transition);
}

.edu-location {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  transition: color var(--transition);
}

.edu-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  transition: color var(--transition);
}

/* END EDUCATION */


/* =================
   14. BEYOND THE CODE
   =================
*/

.beyond-section {
  margin-bottom: 44px;
}

.beyond-card {
  background: var(--bg-card-inner);
  border-radius: 14px;
  padding: 24px 26px;
  transition: background var(--transition);
}

.beyond-text {
  font-size: 14px;
  color: var(--text-secondary);
  transition: color var(--transition);
  margin-bottom: 8px;
}

.beyond-text-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.beyond-quote {
  font-style: italic;    
  color: var(--text-secondary);
  margin-top: 25px;
  font-size: 14px;
}


/* =================
   14c. BOOK WIDGET
   =================
*/

.beyond-card-inner {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

/* Book wrapper sits on the right, fixed width */
.book-wrapper {
  flex-shrink: 0;
  width: 108px;
  position: relative;
  /* No perspective here, it interferes with child transforms */
}

.book-link {
  display: block;
  text-decoration: none;
}

body.dark .book-pages {
  background: #c8ccd6;
  box-shadow: 4px 2px 12px rgba(0,0,0,0.40);
}

/* On hover: pages rotate open further than the cover, becoming visible */
.book-wrapper:hover .book-pages {
  transform: perspective(900px) rotateY(14deg);
}

/* Book cover */
.book-cover {
  position: relative;
  z-index: 1;
  width: 108px;
  height: 152px;
  border-radius: 3px 8px 8px 3px;
  background: var(--bg-nav);
  transform-origin: left center;
  transform: perspective(900px) rotateY(-8deg);
  transition: transform 0.5s cubic-bezier(0.34, 1.2, 0.64, 1),
              box-shadow 0.4s ease;
  box-shadow:
    -4px 6px 20px rgba(0,0,0,0.22),
     2px 2px  8px rgba(0,0,0,0.12),
     inset -3px 0 8px rgba(0,0,0,0.18);
  overflow: hidden;
}

.book-wrapper:hover .book-cover {
  transform: perspective(900px) rotateY(-26deg);
  box-shadow:
    -10px 10px 30px rgba(0,0,0,0.28),
      4px  2px  10px rgba(0,0,0,0.12),
      inset -3px 0 8px rgba(0,0,0,0.18);
}

/* Spine shadow line */
.book-cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,0.28), transparent);
  border-radius: 3px 0 0 3px;
  z-index: 1;
}

/* Cover image */
.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px 7px 7px 2px;
}

/* Fallback when no image */
.book-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  text-align: center;
  pointer-events: none;
}

/* END BOOK WIDGET */


/* =================
   14b. LANGUAGE BARS
   =================
*/

.lang-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* Thin separator between the bio text and the language list */
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  transition: border-color var(--transition);
}

.lang-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header row: language name flush left, level badge flush right */
.lang-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lang-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  transition: color var(--transition);
}

.lang-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

/* Full-width track, slightly taller for more presence */
.lang-bar-track {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: background var(--transition);
}

.lang-bar-fill {
  height: 100%;
  width: 0; /* starts at 0, animated by JS via IntersectionObserver */
  border-radius: 999px;
  background: var(--text-primary);
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1), background var(--transition);
}

/* Stagger the animation per bar using nth-child delays */
.lang-item:nth-child(1) .lang-bar-fill { transition-delay: 0s;    }
.lang-item:nth-child(2) .lang-bar-fill { transition-delay: 0.08s; }
.lang-item:nth-child(3) .lang-bar-fill { transition-delay: 0.16s; }
.lang-item:nth-child(4) .lang-bar-fill { transition-delay: 0.24s; }

/* When the bar is visible and animated */
.lang-bar-fill.lang-bar-animated {
  width: var(--lang-target-width);
}

/* END LANGUAGE BARS */


/* =================
   15. CONTACT
   =================
*/

.connect-section {
  margin-bottom: 0;
}

.connect-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  transition: color var(--transition);
}

.newsletter-box {
  background: var(--bg-card-inner);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
  transition: background var(--transition);
}

.newsletter-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: color var(--transition);
}

.newsletter-input::placeholder {
  color: var(--text-muted);
}

.newsletter-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), transform 0.15s;
}

.newsletter-btn:hover {
  transform: translateY(-1px);
}

/* END CONTACT */


/* =================
   16. FOOTER
   =================
*/

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 52px;
  gap: 20px;
}

.signature {
  font-family: 'Dancing Script', cursive;
  font-size: 52px;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
  transition: color var(--transition);
}

.footer-icons {
  display: flex;
  gap: 22px;
  align-items: center;
}

.footer-icon {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  transition: color var(--transition), transform 0.2s ease;
}

.footer-icon:hover {
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* SVG loaded via <img> - size + hover opacity since filter cant use CSS color vars */
.footer-icon-img {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.55;
  transition: opacity var(--transition), filter var(--transition);
}

.footer-icon:hover .footer-icon-img {
  opacity: 1;
}

/* In dark mode, invert the SVG from black to white */
body.dark .footer-icon-img {
  filter: invert(1);
}

.copyright {
  font-size: 12.5px;
  color: var(--text-muted);
  transition: color var(--transition);
}

/* END FOOTER */


/* =================
   17. PROJECT MODAL
   =================
*/

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--bg-card);
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), background var(--transition);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.modal-backdrop.is-open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--bg-card-inner);
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background var(--transition), color var(--transition), transform 0.2s ease;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text-primary);
}

.modal-img-wrap {
  width: 100%;
  height: 200px;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  background: var(--bg-nav); /* fallback shown when project image is missing */
}

.modal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-body {
  padding: 24px 26px 28px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  transition: color var(--transition);
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 18px;
  transition: color var(--transition);
  white-space: pre-wrap; 
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.modal-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--btn-bg);
  color: var(--btn-text);
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition), transform 0.15s;
}

.modal-btn:hover {
  transform: translateY(-1px);
}

/* END PROJECT MODAL */


/* =================
   18. RESPONSIVE
   =================
*/

@media (max-width: 900px) {
  :root {
    --bleed: 60px;
  }
  .main-content {
    padding: 40px 32px 0;
  }
  .nav-inner {
    gap: 2px;
    padding: 0 20px;
  }
  .nav-link {
    font-size: 12px;
    padding: 5px 10px;
  }
}

@media (max-width: 768px) {
  :root {
    --bleed: 0px;
    --photo-h: 120px;
  }

  /* Add padding to photos strip on tablet */
  .photos-strip {
    padding: 0 16px;
    width: calc(100% - 32px);
    margin-left: 0;
  }

  /* All cards: no tilt on tablet */
  .photo-item:nth-child(1),
  .photo-item:nth-child(2),
  .photo-item:nth-child(3),
  .photos-row-bottom .photo-item:nth-child(1),
  .photos-row-bottom .photo-item:nth-child(2) {
    transform: none;
  }

  /* Row 2 cards maintain their width on tablet */
  .photos-row-bottom .photo-item {
    flex: 0 0 calc((100% - 14px * 2) / 3);
  }

  /* Overlay and titles always visible */
  .project-overlay {
    opacity: 1;
  }

  .photo-item:hover .project-overlay {
    opacity: 1;
  }

  .project-title {
    opacity: 1;
    transform: translateY(0);
  }

  .photo-item:hover .project-title {
    opacity: 1;
    transform: translateY(0);
  }

  /* Make "click to learn more" visible and in normal position */
  .project-view-hint {
    opacity: 1;
    transform: translateY(0);
  }

  .photo-item:hover .project-view-hint {
    opacity: 1;
    transform: translateY(0);
  }

  /* Book scene stacks on mobile */
  .book-scene {
    gap: 12px;
  }
  .book-wrapper { width: 90px; }
  .book-cover { width: 90px; height: 126px; }
}

@media (max-width: 600px) {
  :root {
    --photo-h: 180px;
    --bleed: 0px;
  }

  .hero {
    padding: 40px 24px 28px;
  }
  .main-content {
    padding: 32px 20px 0;
  }

  /* Stack photos vertically on mobile */
  .photos-strip {
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
  }

  .photo-item {
    flex: 0 0 auto;
  }

  /* Remove tilt and always show overlay on small screens */
  .photo-item:nth-child(1),
  .photo-item:nth-child(2),
  .photo-item:nth-child(3),
  .photos-row-bottom .photo-item:nth-child(1),
  .photos-row-bottom .photo-item:nth-child(2) {
    transform: none;
  }

  /* Stack rows vertically on mobile - each row becomes a column */
  .photos-row {
    flex-direction: column;
    gap: 16px;
  }

  /* Row 2 cards full width on mobile */
  .photos-row-bottom .photo-item {
    flex: 0 0 auto;
    width: 100%;
  }

  /* Always show project title on mobile */
  .project-overlay {
    opacity: 1;
  }

  .project-title {
    opacity: 1;
    transform: translateY(0);
  }

  /* Make "click to learn more" visible and in normal position */
  .project-view-hint {
    opacity: 1;
    transform: translateY(0);
  }

  /* Remove hover effect on mobile */
  .photos-strip:hover .photo-item {
    transform: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  }

  .nav-inner {
    flex-wrap: wrap;       /* allow links to wrap onto a second line */
    height: auto;
    padding: 6px 12px;
    gap: 2px;
    justify-content: center;
  }
  .nav-link {
    font-size: 11px;
    padding: 5px 9px;
  }

  .modal-backdrop {
    padding: 16px;
  }
  .modal-img-wrap {
    height: 160px;
  }

  .book-wrapper {
    display: none;
  }
}

/* END RESPONSIVE */


/* =================
   18b. SCROLL TO TOP BUTTON
   Appears after scrolling down; same visual language as .btn-cv
   =================
*/

.scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 200;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease,
              background var(--transition), color var(--transition);
}

.scroll-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.scroll-top:hover {
  transform: translateY(-2px);
}

@media (max-width: 600px) {
  .scroll-top {
    bottom: 20px;
    right: 16px;
  }
}

/* END SCROLL TO TOP BUTTON */


/* =================
   19. SPA VIEW TRANSITIONS
   =================
*/

/* Views fade in/out instead of snapping */
.page-wrapper,
.detail-view,
.playground-view {
  transition: opacity 0.25s ease;
}

.view-hidden {
  display: none;
}

.view-fading-out {
  opacity: 0;
  pointer-events: none;
}

/* END SPA VIEW TRANSITIONS */


/* =================
   20. PROJECT DETAIL VIEW
   =================
*/

/* 20.1 - Layout wrapper (reuses .page-wrapper / .center-col) */
.detail-view .center-col {
  padding-bottom: 0;
  /* box-shadow and all sizing identical to main view, no overrides */
}

/* Sides keep the outer background */
.detail-view .side {
  background: var(--bg-outer);
}

/* Body background stays outer so shadow blends naturally */
body.detail-active {
  background-color: var(--bg-outer);
}

/* 20.2 - Scrollable content area */
.detail-content {
  padding: 40px 60px 0;
}

/* 20.3 - Back button */
.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 32px;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 0.15s;
}

.detail-back:hover {
  background: var(--border);
  color: var(--text-primary);
  transform: translateX(-2px);
}

.detail-back-arrow {
  font-size: 15px;
  line-height: 1;
}

/* 20.4 - Image gallery */
.detail-gallery {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
  overflow-x: auto;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* IE/Edge */
  scroll-snap-type: x mandatory;
}

.detail-gallery::-webkit-scrollbar {
  display: none;
}

.detail-gallery-item {
  flex: 0 0 auto;
  width: 100%;
  height: 260px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card-inner); /* fallback when media is missing */
  scroll-snap-align: start;
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* If only one image/video, fill the full width */
.detail-gallery-item:only-child {
  width: 100%;
}

.detail-gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 14px; /* applied directly - fixes overflow:hidden on <video> */
}

/* 20.5 - Project header (title + action buttons) */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.detail-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  line-height: 1.2;
  transition: color var(--transition);
}

/* 20.6 - Action buttons row */
.detail-action-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  border: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 0.15s;
}

.detail-btn:hover {
  transform: translateY(-1px);
}

.detail-btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
}

.detail-btn-secondary {
  background: var(--bg-card-inner);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.detail-btn-secondary:hover {
  color: var(--text-primary);
  background: var(--border);
}

.detail-btn-icon {
  width: 15px;
  height: 15px;
  display: block;
  opacity: 0.7;
  transition: opacity var(--transition), filter var(--transition);
}

body.dark .detail-btn-icon {
  filter: invert(1);
}

/* 20.7 - Section blocks */
.detail-section {
  margin-bottom: 32px;
}

.detail-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  transition: color var(--transition);
}

/* 20.8 - Long description */
.detail-desc {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.8;
  transition: color var(--transition);
  white-space: pre-wrap;
}

/* 20.9 - Features list */
.detail-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-feature-item {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 20px;
  position: relative;
  transition: color var(--transition);
}

.detail-feature-item::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* 20.10 - Tech stack tags */
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition);
}

/* 20.11 - Detail view footer */
.detail-footer {
  padding: 32px 60px 40px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  transition: border-color var(--transition);
}

/* END PROJECT DETAIL VIEW */


/* =================
   21. MODAL ACTIONS ROW
   (Two buttons side by side inside the modal)
   =================
*/

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-btn-detail {
  background: var(--bg-card-inner);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-family: 'Inter', sans-serif;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 0.15s;
}

.modal-btn-detail:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* END MODAL ACTIONS ROW */


/* =================
   22. RESPONSIVE - DETAIL VIEW
   =================
*/

@media (max-width: 900px) {
  .detail-content {
    padding: 32px 32px 0;
  }
  .detail-footer {
    padding: 28px 32px 36px;
  }
}

@media (max-width: 600px) {
  .detail-content {
    padding: 24px 20px 0;
  }
  .detail-footer {
    padding: 24px 20px 32px;
  }
  .detail-title {
    font-size: 22px;
  }
  .detail-header {
    flex-direction: column;
    gap: 16px;
  }
  .detail-gallery-item {
    height: 200px;
  }
}

/* END RESPONSIVE - DETAIL VIEW */

/* =================
   23. PLAYGROUND VIEW
   Infinite draggable canvas, dot-grid background, photos
   scattered around a centred tagline, fade-in on entry.
   =================
*/

/* 23a. Shell */

.playground-view {
  position: fixed;
  inset: 0;
  z-index: 150;
  overflow: hidden;
}

/* 23b. Viewport (draggable surface) */

.playground-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}

.playground-viewport.dragging {
  cursor: grabbing;
}

/* 23c. Infinite canvas, dot-grid exactly like the reference */

.playground-canvas {
  position: absolute;
  width: 4000px;
  height: 3000px;
  will-change: transform;

  /* Warm off-white base */
  background-color: #ffffff;

  /* Small dark dot grid */
  background-image: radial-gradient(
    circle,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px
  );
  background-size: 22px 22px;
}

body.dark .playground-canvas {
  background-color: #11151d;
  background-image: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.12) 1px,
    transparent 1px
  );
}

/* 23d. Back button */

.playground-back {
  position: fixed;
  top: 22px;
  left: 28px;
  z-index: 200;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--text-primary);
  transition: background 0.2s ease;
}

.playground-back:hover {
  background: rgba(255, 255, 255, 0.98);
}

body.dark .playground-back {
  background: rgba(17, 21, 29, 0.85);
  border-color: rgba(255, 255, 255, 0.10);
}

body.dark .playground-back:hover {
  background: rgba(30, 37, 53, 0.98);
}

/* 23e. Centre tagline Inter, consistent with the rest of the portfolio */

.playground-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.playground-title {
  font-family: 'Dancing Script', sans-serif;
  font-size: 48px;
  font-weight: 400;
  font-style: italic;
  color: #4b4949;
  line-height: 1.35;
  letter-spacing: 0.05em;
}

body.dark .playground-title {
  color: var(--text-secondary);
}

.playground-subtitle {
  margin-top: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* 23f. Photo cards, entry animation + drag interactions */

.playground-item {
  position: absolute;
  width: 160px;
  user-select: none;
  pointer-events: auto;
  cursor: grab;
  transform-origin: center center;

  /* Polaroid card */
  background: #ffffff;
  padding: 8px 8px 18px;
  border-radius: 2px;
  box-shadow:
    0  2px  6px  rgba(0, 0, 0, 0.10),
    0  8px  24px rgba(0, 0, 0, 0.10),
    0  0    0 1px rgba(0, 0, 0, 0.04);

  /* Entry: start invisible and small, JS adds .pg-visible */
  opacity: 0;
  scale: 0.6;
  transition:
    opacity 0.45s ease,
    scale   0.55s cubic-bezier(0.34, 1.4, 0.64, 1),
    box-shadow 0.25s ease,
    filter     0.25s ease;
  /* Transform is left free for rotation + drag, only scale/opacity are animated in */
  will-change: transform, opacity;
}

body.dark .playground-item {
  background: #1e2535;
  box-shadow:
    0  2px  6px  rgba(0, 0, 0, 0.30),
    0  8px  24px rgba(0, 0, 0, 0.30),
    0  0    0 1px rgba(255, 255, 255, 0.05);
}

/* 
  JS adds this class staggered, 
  springs into place 
*/
.playground-item.pg-visible {
  opacity: 1;
  scale: 1;
}

/* Pick-up: quick smooth lift before position tracking takes over */
.playground-item.picking-up {
  transition:
    box-shadow 0.18s ease,
    filter     0.18s ease,
    scale      0.18s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* While dragging: no transition so it follows the finger/cursor instantly */
.playground-item.dragging-item {
  cursor: grabbing;
  z-index: 60;
  scale: 1.08;
  filter: brightness(1.04);
  box-shadow:
    0   6px  16px rgba(0, 0, 0, 0.16),
    0  20px  50px rgba(0, 0, 0, 0.20),
    0   0    0 1px rgba(0, 0, 0, 0.06);
  transition:
    box-shadow 0.18s ease,
    filter     0.18s ease,
    scale      0.18s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* Drop: spring back to resting size */
.playground-item.dropping {
  transition:
    scale      0.4s cubic-bezier(0.34, 1.5, 0.64, 1),
    box-shadow 0.3s ease,
    filter     0.3s ease;
}

.playground-item-small {
  width: 160px;
}

.playground-item-wide {
  width: 220px;
}

.playground-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: 1px;
  background: #d4cfc9;  /* Placeholder colour while image loads */
}

body.dark .playground-item img {
  background: #2a3347;
}

/* Polaroid caption, sits in the white space below the photo */
.polaroid-label {
  margin-top: 7px;
  font-family: 'Caveat', cursive;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  color: #535151;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
}

body.dark .polaroid-label {
  color: #8b95a8;
}

/* Hover: gentle lift and glow */
.playground-item:not(.dragging-item):hover {
  z-index: 40;
  scale: 1.05;
  box-shadow:
    0   4px  12px rgba(0, 0, 0, 0.14),
    0  16px  40px rgba(0, 0, 0, 0.16),
    0   0    0 1px rgba(0, 0, 0, 0.05);
  filter: brightness(1.03);
}


/* =================
   24. RESPONSIVE - PLAYGROUND VIEW
   Section to be sorted and checked
   =================
*/


@media (max-width: 480px) {
  #playgroundView {
    padding-top: 60px;      /* Leave space for the Back button */
  }
  
  .playground-item {
    width: 120px;           /* Smaller images on mobile so they don't overload the center */
  }
}
