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

/* ========================================
   CUSTOM CURSOR SYSTEM
   ======================================== */
#custom-cursor {
  pointer-events: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99999;
}

/* Rotating crosshair (default mode) */
.cursor-crosshair {
  position: fixed;
  pointer-events: none;
  transition: opacity 0.2s ease;
  will-change: transform;
}

/* Static pointer (hover mode - just the +) */
.cursor-pointer {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

/* Snap mode container */
.cursor-snap {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, left 0.15s ease, top 0.15s ease, width 0.15s ease, height 0.15s ease;
}

/* Corner brackets */
.cursor-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: #000;
  border-style: solid;
}

.cursor-tl {
  top: -2px;
  left: -2px;
  border-width: 2px 0 0 2px;
}

.cursor-tr {
  top: -2px;
  right: -2px;
  border-width: 2px 2px 0 0;
}

.cursor-bl {
  bottom: -2px;
  left: -2px;
  border-width: 0 0 2px 2px;
}

.cursor-br {
  bottom: -2px;
  right: -2px;
  border-width: 0 2px 2px 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Critical for scroll hijacking */
  background-color: #ffffff;
  font-family: 'Inter', sans-serif;
  color: #000000;
}

/* Container */
#main-container {
  position: relative;
  width: 100%;
  height: 100vh;
}

section {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  /* Slightly faster base transition */
  z-index: 1;
}

section.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

section.fading-out {
  opacity: 0 !important;
}


/* ===========================
   HERO SECTION
   =========================== */

/* Image Motif */
.motif-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90vmin;
  /* Reset to 90vmin per original design for better "motif" feel vs 95 */
  max-width: 1200px;
  height: auto;
  z-index: -1;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.folder-image {
  width: 100%;
  height: auto;
  display: block;
  /* "Fix the folder line motif" - ensuring clean rendering */
  image-rendering: -webkit-optimize-contrast;
  /* Crispness */
}

.folder-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  /* Ensure crisp edges if it's pixel art or specific line art, though regular rendering is fine for png */
}


/* Typography */
.content-wrapper {
  text-align: center;
  position: relative;
  z-index: 2;
}

.hero-title {
  font-family: 'Grift Medium', 'Grift', 'Impact', sans-serif;
  /* Changed to Medium */
  font-size: clamp(3rem, 11vw, 9rem);
  font-weight: 500;
  /* Medium weight */
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 2rem;
}

.hero-subtitle {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  font-weight: 500;
  /* Modern look */
  color: #000000;
  text-transform: uppercase;
  /* Requested ALL CAPS */
  letter-spacing: 0.1em;
  /* Widen spacing for "Modern Sans Serif" caps look */
}


/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.scroll-indicator .line {
  width: 1px;
  height: 60px;
  background: #000;
  box-shadow: none;
}

.scroll-indicator .text {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  /* Increased from 0.8rem */
  font-weight: 500;
  opacity: 0.8;
  letter-spacing: 0.05em;
}


/* ===========================
   SELECTION SECTION
   =========================== */
#selection {
  background-color: #ffffff;
}

.selection-wrapper {
  display: flex;
  flex-direction: row;
  /* Side by side */
  gap: 6vw;
  /* Slightly separated */
  text-align: center;
  justify-content: center;
  align-items: center;
}

.selection-link {
  font-family: 'Grift Medium', 'Grift', 'Impact', sans-serif;
  /* Keeping family but reducing weight appearance */
  font-size: clamp(2rem, 5vw, 4rem);
  /* Slightly smaller to fit side-by-side? Or keep large? keeping scalable */
  font-weight: 300;
  /* Much lighter */
  text-transform: uppercase;
  text-decoration: none;
  color: #000000;
  /* Default GALLERY black */
  transition: color 0.6s ease, opacity 0.6s ease;
  line-height: 1.1;
}

/* Default state: GALLERY black, ESSAY gray */
/* User prompt: "Default state: GALLERY in full black, ESSAY in a lighter gray" */
#link-essay {
  color: #b0b0b0;
  /* Light gray */
}

/* Hover Logic
   On hover over GALLERY: GALLERY black, ESSAY gray (default, but ensure it)
   On hover over ESSAY: ESSAY black, GALLERY gray
*/

/* When wrapper is hovered, logic kicks in based on specific child hover */
.selection-wrapper:hover .selection-link {
  color: #b0b0b0;
  /* Default all to gray when hovering container? No, that's complex. */
}

/* Specific hovers */
.selection-wrapper:hover #link-gallery:hover {
  color: #000000;
}

.selection-wrapper:hover #link-essay:hover {
  color: #000000;
}

/* When hovering essay, make gallery gray */
.selection-wrapper:has(#link-essay:hover) #link-gallery {
  color: #b0b0b0;
}

/* When hovering gallery, make essay gray */
.selection-wrapper:has(#link-gallery:hover) #link-essay {
  color: #b0b0b0;
}

/* Fallback for browsers without :has support (though most have it now) - standard sibling selectors are harder here due to order.
   JS or :has is best. Sticking with :has as it's modern. */

/* ===========================
   TRANSITIONS (FADE ONLY)
   =========================== */
.blur-overlay {
  display: none;
}

/* ===========================
   GALLERY PAGE STYLES
   =========================== */

/* Page Fade In/Out */
body.fade-out {
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* Gallery Header */
.gallery-header {
  padding: 40px 4vw 20px 4vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.gallery-intro {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  margin-bottom: 10px;
  font-weight: 400;
}

.gallery-nav {
  display: flex;
  gap: 40px;
  font-family: "Grift Medium", "Grift", "Impact", sans-serif;
  font-size: 1.8rem;
  text-transform: uppercase;
  font-weight: 500;
}

.gallery-nav .nav-item {
  text-decoration: none;
  color: #ccc;
  /* Inactive Gray */
  transition: color 0.3s ease;
  cursor: pointer;
}

.gallery-nav .nav-item.active {
  color: #000;
}

/* View Toggle */
.view-toggle {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  /* Slightly larger */
  font-weight: 600;
  /* Bolder */
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #ccc;
  /* Default separator color */
  cursor: default;
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.view-toggle span {
  color: #000 !important;
  /* Separator/Label text */
}

/* Label VIEW -> */
.toggle-option {
  color: #ccc;
  text-decoration: none;
  transition: color 0.3s ease, opacity 0.3s ease;
  opacity: 0.5;
  /* Fade out inactive */
}

.toggle-option.active {
  color: #000;
  text-decoration: underline;
  /* Undergraduate active */
  opacity: 1;
}

/* Gallery Container */
.gallery-container {
  width: 100%;
  padding: 0;
}

.gallery-list-view {
  padding: 0 6vw 60px 6vw;
}

/* --- LIST VIEW --- */
.gallery-list-view {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* Paired row container - two entries side by side */
.list-paired-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4vw;
  border-bottom: 1px solid #f0f0f0;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

.list-paired-row:nth-child(1) {
  animation-delay: 0.1s;
}

.list-paired-row:nth-child(2) {
  animation-delay: 0.15s;
}

.list-paired-row:nth-child(3) {
  animation-delay: 0.2s;
}

.list-paired-row:nth-child(4) {
  animation-delay: 0.25s;
}

.list-paired-row:nth-child(5) {
  animation-delay: 0.3s;
}

.list-paired-row:nth-child(6) {
  animation-delay: 0.35s;
}

/* Full width row for entry 11 - Centered with emphasis */
.list-full-row {
  grid-template-columns: 1fr;
  justify-items: center;
  margin-top: 20px;
  padding-top: 20px;
}

/* Base entry styles */
.list-entry {
  display: grid;
  align-items: center;
  padding: 16px 0;
  column-gap: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 0.85rem;
  color: #000;
  text-decoration: none;
}

/* Left entry: Thumb, Day, Title only */
.list-entry-left {
  grid-template-columns: 50px 60px 1fr;
}

/* Right entry: Thumb, Day, Title, Artist, Year */
.list-entry-right {
  grid-template-columns: 50px 60px 1fr 60px 60px;
}

/* Full width entry - Emphasized as conclusion */
.list-entry-full {
  grid-template-columns: 60px 70px 1fr 60px 60px;
}

.list-entry-full .list-thumb {
  width: 60px;
  height: 60px;
}

.list-entry-full .col-title {
  font-weight: 700;
  font-size: 1rem;
}

.list-thumb {
  width: 50px;
  height: 50px;
  background-color: #f5f5f5;
  object-fit: cover;
  display: block;
}

.col-day {
  color: #888;
  font-weight: 400;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.col-title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.9rem;
}

.col-artist {
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.8rem;
}

.col-year {
  color: #888;
  font-weight: 400;
  text-align: right;
  font-size: 0.8rem;
}

/* --- GRID VIEW --- */
.gallery-grid-view {
  display: none;
  width: 100%;
}

.gallery-grid-view.active {
  display: block;
}

.gallery-list-view.hidden {
  display: none;
}

/* Custom Grid Layout: 3 - 3 - 4 - 1 */
/* Edge to Edge, zoomed crops with border */
.custom-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 12px;
  row-gap: 12px;
  height: calc(100vh - 200px);
  min-height: 0;
  width: 100%;
  padding: 0;
  margin-bottom: 80px;
}

.grid-item {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid #000;
  box-sizing: border-box;
  text-decoration: none;
}

.grid-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%);
  transition: filter 0.5s ease, transform 0.5s ease;
}

.grid-item:hover .grid-img {
  filter: grayscale(0%);
}

/* Title overlay on hover - Matches GALLERY/ESSAY style */
.grid-title {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-family: 'Grift Medium', 'Grift', 'Impact', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: 300;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.grid-item:hover .grid-title {
  opacity: 1;
  transform: translateY(0);
}

/* Row 1 (Items 1-3) */
.grid-item:nth-child(1),
.grid-item:nth-child(2),
.grid-item:nth-child(3) {
  grid-column: span 4;
  animation-delay: 0.1s;
}

/* Row 2 (Items 4-6) */
.grid-item:nth-child(4),
.grid-item:nth-child(5),
.grid-item:nth-child(6) {
  grid-column: span 4;
  animation-delay: 0.2s;
}

/* Row 3 (Items 7-10) */
.grid-item:nth-child(7),
.grid-item:nth-child(8),
.grid-item:nth-child(9),
.grid-item:nth-child(10) {
  grid-column: span 3;
  animation-delay: 0.3s;
}

/* Row 4 (Item 11) */
.grid-item:nth-child(11) {
  grid-column: 5 / span 4;
  animation-delay: 0.4s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ESSAY PAGE RIGHT COLUMN ELEMENTS */
.essay-visual-slot {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
}

.essay-scroll-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 12px;
  opacity: 1;
  transition: opacity 0.5s ease;
  z-index: 100;
  pointer-events: none;
}

.essay-scroll-indicator .line {
  width: 1px;
  height: 60px;
  background: #000;
  box-shadow: none;
}

.essay-scroll-indicator .text {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 1.4rem;
  font-weight: 500;
  text-transform: uppercase;
  opacity: 0.8;
  letter-spacing: 0.05em;
  color: #000000;
}

.essay-scroll-indicator.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Essay End-State Artwork List */
.essay-artwork-list {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
  will-change: opacity;
  backface-visibility: hidden;
}

.essay-artwork-list.visible {
  opacity: 1;
  pointer-events: auto;
}

.essay-artwork-item {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #000;
  padding: 6px 0;
  transition: opacity 0.3s ease;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
}

.essay-artwork-item:hover {
  opacity: 0.6;
}

.essay-artwork-item img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  filter: grayscale(100%);
  transition: filter 0.3s ease;
  transform: translate3d(0, 0, 0);
}

.essay-artwork-item:hover img {
  filter: grayscale(0%);
}

.essay-artwork-item span {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* GLOBAL NAVIGATION STRIP */
.global-nav-strip {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 30px;
  /* Reduced height */
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  /* Back Left, Home Right */
  align-items: center;
  padding: 0 4vw;
  z-index: 1000;
}

.nav-strip-btn {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 0.65rem;
  /* Smaller text */
  font-weight: bold;
  text-transform: uppercase;
  text-decoration: none;
  color: #999;
  letter-spacing: 0.05em;
  transition: color 0.3s ease;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.nav-strip-btn:hover {
  color: #000;
}

/* ========================================
   MOBILE RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {

  /* --- BASE MOBILE FIXES --- */
  html,
  body {
    overflow: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide custom cursor on touch devices */
  #custom-cursor {
    display: none !important;
  }

  * {
    cursor: auto !important;
  }

  /* --- GLOBAL NAV STRIP MOBILE --- */
  .global-nav-strip {
    height: 44px;
    padding: 0 16px;
  }

  .nav-strip-btn {
    font-size: 0.75rem;
    padding: 8px 0;
  }

  /* --- GALLERY HEADER MOBILE --- */
  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 60px 16px 20px 16px;
    height: auto;
    min-height: auto;
  }

  .gallery-intro {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .gallery-nav {
    gap: 16px;
    font-size: 1.5rem;
  }

  .nav-item {
    font-size: 1.5rem;
  }

  .view-toggle {
    font-size: 0.75rem;
    gap: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .toggle-option {
    padding: 6px 10px;
  }

  /* --- GALLERY CONTAINER MOBILE --- */
  .gallery-container {
    padding-top: 20px;
  }

  /* --- LIST VIEW MOBILE --- */
  .gallery-list-view {
    padding: 0 16px 80px 16px;
  }

  /* Stack paired rows vertically on mobile */
  .list-paired-row {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-bottom: none;
  }

  /* Full width list entries */
  .list-entry,
  .list-entry-left,
  .list-entry-right,
  .list-entry-full {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    width: 100%;
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f0;
    column-gap: 16px;
  }

  .list-thumb {
    width: 60px;
    height: 60px;
    grid-row: span 2;
  }

  .col-day {
    font-size: 0.7rem;
    grid-column: 2;
  }

  .col-title {
    font-size: 0.9rem;
    grid-column: 2;
    grid-row: 2;
  }

  .col-artist,
  .col-year {
    display: none;
  }

  .list-full-row {
    margin-top: 0;
    padding-top: 0;
  }

  /* --- GRID VIEW MOBILE --- */
  .gallery-grid-view {
    padding: 0 16px;
  }

  .custom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
    gap: 12px;
    height: auto;
    min-height: auto;
    margin-bottom: 80px;
  }

  .grid-item {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    aspect-ratio: 1;
    height: auto;
  }

  /* Center the 11th (last) grid item on mobile */
  .grid-item:nth-child(11) {
    grid-column: 1 / -1 !important;
    max-width: 50%;
    margin: 0 auto;
  }

  .grid-img {
    filter: grayscale(0%);
  }

  .grid-title {
    opacity: 1;
    transform: translateY(0);
    font-size: 0.85rem;
    bottom: 10px;
    left: 10px;
  }

  /* --- ESSAY PAGE MOBILE --- */
  .essay-container {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    padding: 60px 16px 40px 16px;
  }

  .text-column {
    width: 100%;
    height: auto;
    padding-top: 40vh;
    padding-bottom: 20vh;
    order: 1;
  }

  .essay-visual-slot {
    width: 100%;
    height: auto;
    min-height: 0;
    order: 2;
    margin-top: 0;
  }

  .essay-text-wrapper {
    gap: 1.5rem;
  }

  .essay-line {
    font-size: clamp(1.8rem, 8vw, 3rem);
  }

  /* Essay artwork gallery - horizontal swipe on mobile */
  .essay-artwork-list {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    display: flex;
    flex-direction: row;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding: 20px 0;
    width: 100%;
  }

  .essay-artwork-list.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .essay-artwork-item {
    flex-shrink: 0;
    scroll-snap-align: start;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    width: 120px;
  }

  .essay-artwork-item img {
    width: 100px;
    height: 100px;
    filter: grayscale(0%);
  }

  .essay-artwork-item span {
    font-size: 0.7rem;
    text-align: center;
  }

  /* --- SCROLL INDICATOR MOBILE --- */
  .scroll-indicator-container {
    display: none;
  }
}

/* Extra small devices (< 480px) */
@media (max-width: 480px) {
  .gallery-header {
    padding: 56px 12px 16px 12px;
  }

  .gallery-intro {
    font-size: 0.8rem;
  }

  .gallery-list-view,
  .gallery-grid-view {
    padding-left: 12px;
    padding-right: 12px;
  }

  .list-entry,
  .list-entry-left,
  .list-entry-right,
  .list-entry-full {
    grid-template-columns: 50px 1fr;
    column-gap: 12px;
  }

  .list-thumb {
    width: 50px;
    height: 50px;
  }

  .essay-line {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
  }

  .essay-container {
    padding: 56px 12px 30px 12px;
  }
}