/* =========================
   INLINE STYLES FROM HTML
========================= */
.project-layout h2 {
  font-weight: normal;
  text-transform: uppercase;
}

/* =========================
   VARIABLES & RESET
========================= */

/* =========================
   VARIABLES & RESET
========================= */
:root {
  --bg: #ffffff;
  --text: #000000;
  --accent: #0033ff;
  --display-scale-y: 1.3;
  --site-margin: 10px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --font-heading: 14px;
  --font-body: 12px;
  --font-meta: 10px;
}

body.dark {
  --bg: #0a0a0afc;
  --text: #eaeaea;
  --accent: #fffffff4;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  overflow-x: hidden;
}

/* =========================
   TYPOGRAPHY
========================= */
.name {
  font-size: clamp(14px, 2.7vw, 45px);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text);
  line-height: 0.9;
  margin-bottom: 20px;
  margin-left: 0;
  letter-spacing: -0.04em;
  font-family: Helvetica, sans-serif;
  cursor: pointer;
  transition: color 0.2s ease;
  transform: scaleY(1.5);
  transform-origin: left center;
  display: inline-block;
}

.intro {
  margin-bottom: 10px;
  margin-left: 0;
}

.intro p {
  display: block;
  font-size: 10px;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  transform: scaleY(var(--display-scale-y));
  transform-origin: left center;
}

/* Display-style text stretch (exclude metadata/body copy text) */
.project-wrapper>a,
.top-bar .right>a,
.contact-wrapper>a,
.project-layout>h2,
.home-project-shell-label {
  display: inline-block;
  transform: scaleY(var(--display-scale-y));
  transform-origin: left center;
}

body.dark .project-text {
  color: #bbbbbb;
}


/* =========================
   TOP BAR (Header)
========================= */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px var(--site-margin);
  font-size: var(--font-meta);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  z-index: 200000;
}

@media (max-width: 850px) {
  .top-bar {
    font-size: 9px;
    padding: 3px var(--site-margin);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-bar .left,
  .top-bar .right {
    font-size: 9px;
    white-space: nowrap;
  }

  .top-bar .right a,
  .top-bar .right button {
    font-size: 9px;
    padding: 4px 6px;
    white-space: nowrap;
  }

  .top-bar .left .updated {
    font-size: 9px;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-bar .right {
    gap: 8px;
  }
}

.top-bar .left,
.top-bar .right {
  display: flex;
  align-items: center;
}

.top-bar .right {
  gap: 12px;
}

.top-bar .right a,
#dark-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

#dark-toggle:hover {
  opacity: 0.7;
}

#dark-toggle:active {
  transform: scale(0.9);
}

#dark-toggle svg {
  display: block;
}

.updated {
  color: var(--accent);
  text-decoration: underline;
}

/* =========================
   LAYOUT STRUCTURE
========================= */
.split-layout {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
  padding-top: 80px;
  max-width: none;
  width: 100%;
  margin: 0 auto;
}

.static-left {
  width: 100vw;
  max-width: none;
  min-width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: visible;
  padding-left: 10px;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  background: transparent !important;
}

.scrolling-right {
  width: 0;
  flex-grow: 0;
  padding: 0;
  min-height: 100vh;
  z-index: 10;
  position: relative;
  overflow: hidden;
  background: transparent !important;
}

/* =========================
   HOME HERO
========================= */
.home-hero {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, filter 0.3s ease;
}

.home-hero video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: fadeIn 0.5s ease-out;
  opacity: 0.5;
  object-position: center 25%;
  transform: scale(1.1) translateY(-5%);
}

body.project-open .home-hero {
  opacity: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* =========================
   NAVIGATION & PROJECT LIST
========================= */
.mobile-content-inject {
  display: none !important;
}

.projects {
  display: flex;
  flex-direction: column;
  margin-top: var(--space-4);
}

.project-wrapper {
  width: 100%;
  padding-bottom: var(--space-4);
  max-width: 300px;
  cursor: pointer;
  position: relative;
  display: block;
  padding: var(--space-3) 0;
  overflow: visible;
}

.project-wrapper.active .project-popout {
  opacity: 0;
  pointer-events: none;
  display: none;
}

.project-wrapper a {
  font-size: 11px;
  text-decoration: none;
  color: var(--text);
  display: block;
  letter-spacing: 0.02em;
  transition: opacity 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.project-wrapper a::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.project-wrapper a:hover,
.project-wrapper.homepage-active a {
  color: var(--accent);
  text-decoration: underline;
}

.project-text {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  max-width: 400px;
  white-space: normal;
  overflow-wrap: break-word;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin-top 0.25s ease;
  color: #323232;
  font-size: var(--font-body);
  margin-left: 20px;
  pointer-events: none;
}

.project-popout {
  position: fixed;
  top: var(--popout-top, 300px);
  left: 20vw;
  width: 80vw;
  height: 450px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none !important;
  transition: opacity 0.22s ease;
  overflow: hidden;
}

.project-wrapper:hover .project-popout {
  opacity: 1;
}

.project-popout img,
.project-popout video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.2s ease;
}


/* =========================
   PROJECT CONTENT STYLES
========================= */
.project-layout h2 {
  margin-bottom: 20px;
}

.home-project-section .project-layout>h2 {
  cursor: pointer;
}

/* Project Info Grid (Summary/Detail Split) */
.project-info-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

.summary-col p {
  font-size: var(--font-body);
  line-height: 1.6;
  margin-bottom: 0;
}

.detail-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.detail-text {
  font-size: var(--font-body);
  line-height: 1.6;
  max-height: 0;
  /* Hidden by default */
  column-count: 2;
  column-gap: 20px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.detail-text.expanded {
  max-height: none;
  overflow: visible;
}

.toggle-btn {
  margin-top: 8px;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: var(--font-meta);
  color: var(--text);
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.7;
}

.toggle-btn:hover {
  opacity: 1;
}

/* Video Embed (16:9) */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  width: 100%;
  margin-bottom: 20px;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Two Column Grid used in Plattan etc */
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-bottom: 20px;
}

.grid-2-col img {
  width: 100%;
  height: auto;
  display: block;
  min-height: 200px;
  background-color: #f0f0f0;
  object-fit: cover;
}

/* Carousels */
.carousel {
  display: flex;
  overflow-x: auto;
  gap: 10px;
  scroll-snap-type: x mandatory;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
  display: none;
}

.carousel img {
  flex: 0 0 48%;
  width: 48%;
  scroll-snap-align: start;
  object-fit: width;
  min-height: 300px;
  background-color: #ffffff;
}

.project-layout .carousel img {
  width: auto;
  flex: 0 0 auto;
  height: 65vh;
  min-height: 400px;
  max-width: 100%;
  object-fit: contain;
}

.home-project-section .carousel {
  display: flex;
  flex-direction: column;
  overflow: visible;
  scroll-snap-type: none;
}

.home-project-section .carousel img {
  flex: 0 0 auto;
  width: 100%;
  margin-bottom: 10px;
}

/* Photo Stack (Grid) */
.photo-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
}

.photo-stack[data-sort-key="content-field-day"] {
  grid-template-columns: repeat(5, 1fr);
}

.photo-stack[data-sort-key="content-plattan"] {
  grid-template-columns: repeat(3, 1fr);
}

.photo-stack[data-sort-key="content-photography"] {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.photo-stack img {
  width: 100%;
  height: auto;
  display: block;
  margin-bottom: 0;
}

.photo-stack video {
  width: 100%;
  grid-column: span 2;
}



.photo-stack[data-sort-key="content-photography"] img,
.photo-stack[data-sort-key="content-photography"] video {
  --photo-w: 100%;
  --photo-x: 0px;
  width: var(--photo-w);
  max-width: 100%;
  display: block;
  margin: 0;
  height: auto;
  transform: translateX(var(--photo-x));
}

.content-enter {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  width: 100%;
  padding-right: 10px;
}

.content-enter.visible {
  opacity: 1;
  transform: translateX(0);
}

img[data-src],
video[data-src] {
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

img.loaded,
video.loaded {
  opacity: 1;
}

/* =========================
   CV & ABOUT SECTIONS
========================= */
.cv-section {
  margin-top: 40px;
}

.cv-section h3 {
  margin-bottom: 20px;
  font-size: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.cv-grid {
  display: block;
}

.cv-category {
  margin-bottom: 30px;
}

.about-text>p+.cv-category {
  margin-top: 28px;
}

.cv-category h4 {
  margin-bottom: 15px;
  font-size: var(--font-heading);
  padding-bottom: 5px;
  display: inline-block;
}

.cv-category ul {
  list-style: none;
  padding: 0;
}

.cv-category li {
  margin-bottom: 15px;
  font-size: var(--font-body);
  line-height: 1.6;
}

.cv-category[data-category="tools"] li {
  margin-bottom: 2px;
}

.cv-category[data-category="experience"] li {
  margin-bottom: 25px;
}

.cv-category[data-category="experience"] strong {
  display: block;
  font-size: var(--font-body);
  font-weight: 600;
  margin-bottom: 2px;
}

.cv-category[data-category="experience"] span {
  display: block;
  font-size: var(--font-meta);
  color: #888;
  margin-bottom: 8px;
}

.cv-category[data-category="education"] li {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}


.about-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
}

.about-text>p {
  font-size: var(--font-body);
  line-height: 1.6;
  margin-bottom: 2px;
}

.about-image img {
  width: 100%;
  height: auto;
}

/* =========================
   FOOTER
========================= */
.site-bottom {
  position: relative;
  width: 100vw;
  padding: 12px 10px 10px;
  margin-top: 10px;
  opacity: 0.92;
}

.site-bottom .copyright,
.site-bottom .wip-repeat {
  font-size: var(--font-meta);
  line-height: 1.2;
  margin: 0;
  letter-spacing: 0.02em;
}

.site-bottom .copyright {
  color: #8c8c8c;
}

.site-bottom .wip-repeat {
  color: #5f5f5f;
  margin-top: 4px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

/* =========================
   OVERLAYS (CONTACT & LIGHTBOX)
========================= */
/* Contact */
.contact-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

#contact-overlay {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, -15px);
  width: 250px;
  max-width: 90vw;
  background: rgba(255, 255, 255, 0.748);
  backdrop-filter: blur(15px) saturate(180%);
  border-radius: 12px;
  color: var(--text);
  box-shadow: 0 10px 40px -10px rgba(0, 51, 255, 0.15);
  display: flex;
  flex-direction: column;
  padding: 16px;
  margin-top: 10px;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
  z-index: 2000;
  letter-spacing: 0.5px;
}

#contact-overlay::before {
  content: "";
  display: block;
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  height: 15px;
  background: transparent;
}

.contact-wrapper:hover #contact-overlay,
.contact-wrapper.active #contact-overlay,
#contact-overlay:hover {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightbox-img {
  width: 100%;
  height: 100%;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  user-select: none;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.15s linear, transform 0.15s linear;
  cursor: pointer;
}

#lightbox-img.lightbox-switching {
  opacity: 0.9;
  transform: scale(.99);
}

.lightbox-close {
  position: absolute;
  top: 70px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  z-index: 10001;
  transition: color 0.2s;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 50px;
  cursor: pointer;
  padding: 20px;
  z-index: 10001;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-close:hover {
  opacity: 1;
  color: var(--accent);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

/* =========================
   UTILITIES & EDIT MODE
========================= */
.static-left:has(.project-wrapper:not(.active):hover)~.home-hero {
  filter: none;
  opacity: 0.7;
}

.scrolling-right img,
.project-layout img {
  cursor: zoom-in;
}

.home-project-section .hide-on-home,
.mobile-content-inject .hide-on-home {
  display: none !important;
}

/* Edit Mode Controls (Keep if needed) */
.reorder-export-btn {
  background: none;
  border: 1px solid #bdbdbd;
  color: var(--text);
  font: inherit;
  font-size: 9px;
  padding: 4px 8px;
  margin: 8px 0 10px 0;
  cursor: pointer;
}

.photo-stack[data-sort-key] img.reorder-item,
.photo-stack[data-sort-key] video.reorder-item {
  cursor: grab !important;
}

.photo-stack[data-sort-key] .dragging {
  cursor: grabbing !important;
  opacity: 0.55;
}

.photo-stack[data-sort-key] .resize-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.photo-edit-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px 0;
}

.resize-width-label {
  font-size: 9px;
}

.resize-width-slider {
  width: 140px;
}

.photo-stack.edit-freeform {
  position: relative;
  display: block;
  min-height: 1200px;
}

.photo-stack.edit-freeform .photo-free-item {
  position: absolute;
  touch-action: none;
  cursor: move;
  min-width: 14px;
  min-height: 14px;
}

.photo-stack.edit-freeform .photo-free-item.editing {
  outline: 1px dashed #9a9a9a;
  outline-offset: 2px;
}

.photo-stack.edit-freeform .photo-free-item img,
.photo-stack.edit-freeform .photo-free-item video {
  width: 100% !important;
  max-width: none;
  transform: none !important;
  display: block;
  cursor: move !important;
}

.photo-stack.edit-freeform .photo-resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  border: 1px solid #666;
  background: #fff;
  border-radius: 2px;
  cursor: nwse-resize;
  padding: 0;
}

.photo-caption-input {
  position: absolute;
  bottom: -30px;
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  z-index: 10;
  backdrop-filter: blur(5px);
}

/* =========================
   DESKTOP LANDING & LOGIC (min-width: 851px)
========================= */
@media (min-width: 851px) {

  /* GLOBAL TRANSITIONS */
  .static-left,
  .scrolling-right,
  .name,
  .intro,
  .project-wrapper,
  .split-layout {
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  /* DEFAULT LANDING (Centered) */
  .split-layout {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: left;
    min-height: 100vh;
    width: 100vw;
    padding-top: 0 !important;
    margin: 0 !important;
  }

  .static-left {
    height: auto !important;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    top: auto;
    text-align: left;
    padding: 0 var(--site-margin);
    z-index: 50;
  }

  body:not(.project-open) .name,
  body.project-open .name {
    position: fixed;
    top: clamp(52px, 4.5vw, 62px);
    left: var(--site-margin);
    font-size: 30px;
    margin: 0;
    z-index: 200001;
  }

  body:not(.project-open) .static-left,
  body.project-open .static-left {
    padding-top: 70px;
    width: 250px;
    min-width: 200px;
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px) !important;
    padding-left: var(--site-margin);
    margin-left: 0;
    transform: none;
  }

  body:not(.project-open) .intro,
  body.project-open .intro {
    position: fixed;
    top: clamp(88px, 8vw, 112px);
    left: var(--site-margin);
    margin: 0;
    z-index: 200001;
  }

  body:not(.project-open) .intro p,
  body.project-open .intro p {
    font-size: 10px;
    line-height: 1.2;
  }

  body:not(.project-open) .projects {
    margin-top: clamp(86px, 8.5vw, 114px);
  }

  .projects {
    margin-top: var(--space-4);
    width: 100%;
    max-width: 600px;
  }

  .project-wrapper {
    position: relative;
    z-index: 1;
    margin-bottom: 0;
    padding: var(--space-3) 0;
    width: 100%;
  }

  .scrolling-right {
    display: block;
    width: 0;
    opacity: 0;
    position: fixed;
    right: 0;
    top: 80px;
    height: calc(100vh - 80px);
    overflow: hidden;
  }

  /* LANDING POPOUT (Homepage Preview Positioning) */
  body:not(.project-open) .project-popout {
    position: fixed;
    left: 326px !important;
    width: calc(100vw - 366px) !important;
    top: 100px;
    height: 70vh;
    max-height: none;
    margin-top: 0;
    z-index: 999;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  body:not(.project-open) .project-wrapper:hover .project-popout {
    opacity: 1;
  }

  body:not(.project-open) .project-popout img,
  body:not(.project-open) .project-popout video {
    height: 100%;
    object-fit: cover;
  }

  /* PROJECT OPEN STATE (Sidebar) */
  body:not(.project-open) .split-layout,
  body.project-open .split-layout {
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-start;
    padding-top: 80px !important;
    gap: 18px;
    overflow: visible;
  }

  body:not(.project-open) .scrolling-right,
  body.project-open .scrolling-right {
    flex-grow: 1;
    width: auto;
    opacity: 1;
    position: relative;
    top: auto;
    right: auto;
    height: auto;
    overflow-y: visible;
    pointer-events: auto;
    padding-left: var(--site-margin);
    padding-right: var(--site-margin);
  }

  body:not(.project-open) .scrolling-right {
    padding-top: calc(100vh + 20px);
  }

  body:not(.project-open) .home-hero {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    opacity: 1;
    filter: none;
  }

  body.project-open .home-hero {
    display: none;
  }

  body.project-open .name {
    margin: 0;
    letter-spacing: -0.04em;
  }

  body.project-open .intro p {
    opacity: 1;
  }

  body.project-open .projects {
    margin-top: clamp(86px, 8.5vw, 114px);
    border-top: none;
  }

  body.project-open .project-wrapper {
    padding: var(--space-3) 0;
  }

  .home-project-section {
    margin-bottom: var(--space-5);
  }

  .home-project-shell {
    min-height: 180px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding-top: var(--space-3);
  }

  .home-project-shell-label {
    font-size: var(--font-meta);
    letter-spacing: 0.03em;
    color: #6e6e6e;
    text-transform: uppercase;
  }

  /* POPOUT IN SIDEBAR MODE */
  body.project-open .project-popout {
    position: fixed;
    left: 326px !important;
    width: calc(100vw - 366px) !important;
    top: 100px;
    height: 70vh;
    max-height: none;
    margin-top: 0;
    z-index: 999;
    opacity: 0;
  }

  body.project-open .project-wrapper:hover .project-popout {
    opacity: 1;
    margin-top: 0;
  }

  /* Desktop Staggered Logic for Photography */
  .photo-stack[data-sort-key="content-photography"] img:nth-of-type(6n + 1),
  .photo-stack[data-sort-key="content-photography"] video:nth-of-type(6n + 1) {
    --photo-w: 28%;
    --photo-x: 0px;
    align-self: flex-start;
  }

  .photo-stack[data-sort-key="content-photography"] img:nth-of-type(6n + 2),
  .photo-stack[data-sort-key="content-photography"] video:nth-of-type(6n + 2) {
    --photo-w: 28%;
    --photo-x: 0px;
    align-self: flex-end;
  }

  .photo-stack[data-sort-key="content-photography"] img:nth-of-type(6n + 3),
  .photo-stack[data-sort-key="content-photography"] video:nth-of-type(6n + 3) {
    --photo-w: 28%;
    --photo-x: 0px;
    align-self: flex-start;
  }

  .photo-stack[data-sort-key="content-photography"] img:nth-of-type(6n + 4),
  .photo-stack[data-sort-key="content-photography"] video:nth-of-type(6n + 4) {
    --photo-w: 28%;
    --photo-x: 0px;
    align-self: flex-start;
  }

  .photo-stack[data-sort-key="content-photography"] img:nth-of-type(6n + 5),
  .photo-stack[data-sort-key="content-photography"] video:nth-of-type(6n + 5) {
    --photo-w: 28%;
    --photo-x: 0px;
    align-self: flex-end;
  }

  .photo-stack[data-sort-key="content-photography"] img:nth-of-type(6n + 6),
  .photo-stack[data-sort-key="content-photography"] video:nth-of-type(6n + 6) {
    --photo-w: 28%;
    --photo-x: 0px;
    align-self: center;
  }
}

/* =========================
   RESPONSIVE (MOBILE)
========================= */
@media (max-width: 850px) {
  body {
    font-size: 12px;
  }

  .intro p {
    font-size: clamp(9px, 2.5vw, 12px);
    line-height: 1.4;
  }

  .site-bottom .copyright,
  .site-bottom .wip-repeat {
    font-size: clamp(10px, 2.8vw, 13px);
    line-height: 1.2;
  }

  .project-wrapper a {
    font-size: 11px;
  }

  .project-text {
    font-size: 11px;
  }

  .name {
    font-size: clamp(15px, 3.9vw, 24px);
    text-align: left;
    margin-left: 0;
    cursor: pointer;
    margin-bottom: 30px;
  }

  .split-layout {
    flex-direction: column;
    padding-top: 80px;
    gap: 30px;
  }

  .scrolling-right {
    display: none;
  }

  .static-left {
    width: 100%;
    position: relative;
    top: auto;
    height: auto;
    overflow: visible;
    padding-bottom: 60px;
    padding-left: var(--site-margin);
    padding-right: var(--site-margin);
  }

  .lightbox-prev,
  .lightbox-next {
    display: none !important;
  }

  /* Full-Page Navigation Styles */
  .mobile-project-view {
    display: none;
    position: fixed;
    top: 50px;
    left: 0;
    width: 100%;
    height: calc(100vh - 50px);
    background: var(--bg);
    z-index: 300000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 0px;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .mobile-project-view.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
  }

  .mobile-project-content {
    padding: 20px var(--site-margin);
    max-width: none;
  }

  /* Mobile project text styling - single column */
  .mobile-project-content .project-info-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .mobile-project-content .detail-text {
    column-count: 1;
    column-gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .mobile-project-content .detail-text.expanded {
    max-height: none;
    overflow: visible;
  }

  .mobile-project-content .toggle-btn {
    display: inline-block;
    margin-top: 8px;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: var(--font-meta);
    color: var(--text);
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
  }

  .mobile-project-content .toggle-btn:hover {
    opacity: 1;
  }

  .mobile-project-content .grid-2-col {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .mobile-project-content .about-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Simplified project cards for mobile */
  .project-wrapper {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
  }

  body.dark .project-wrapper {
    background: #1a1a1a;
    border-color: #333;
  }

  .project-wrapper:active {
    transform: scale(0.98);
    background: #f5f5f5;
  }

  body.dark .project-wrapper:active {
    background: #2a2a2a;
  }

  .project-wrapper a {
    pointer-events: none; /* Let the wrapper handle clicks */
  }

  .project-text {
    display: none; /* Hide on mobile, use full page instead */
  }

  .home-hero {
    height: 100vh;
  }
}

/* Desktop overrides to restore original functionality */
@media (min-width: 851px) {
  .project-wrapper {
    border: none;
    border-radius: 0;
    padding: var(--space-3) 0;
    margin-bottom: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: block;
    overflow: visible;
    max-width: 300px;
  }

  body.dark .project-wrapper {
    background: transparent;
    border-color: transparent;
  }

  .project-wrapper:active {
    transform: none;
    background: transparent;
  }

  body.dark .project-wrapper:active {
    background: transparent;
  }

  .project-wrapper a {
    pointer-events: auto; /* Restore desktop link functionality */
    font-size: 11px;
    text-decoration: none;
    color: var(--text);
    display: block;
    letter-spacing: 0.02em;
    transition: opacity 0.2s;
    white-space: nowrap;
    cursor: pointer;
  }

  .project-text {
    display: block; /* Restore desktop project text */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    max-width: 400px;
    white-space: normal;
    overflow-wrap: break-word;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin-top 0.25s ease;
    color: #323232;
    font-size: var(--font-body);
    margin-left: 20px;
    pointer-events: none;
  }

  body.dark .project-text {
    color: #bbbbbb;
  }
}