/* Reset and base styles */
html {
  color-scheme: light;
}

html.dark {
  color-scheme: dark;
}

body {
  font-family: Montserrat, system-ui, sans-serif;
}

/* Category styles */
.category {
  padding: 10px;
  margin: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #fff;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.category:hover {
  background-color: #e6e6e6;
  text-decoration: underline;
}

.category.active {
  background-color: #007BFF;
  color: white;
}

/* Container for categories */
.category-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
}

/* Fade-in animation for dynamically loaded images */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation-name: fadeIn;
  animation-duration: 0.5s;
  animation-fill-mode: forwards;
}

/* Subcategory styles: horizontal layout with consistent gap on all screens */
.subcategory {
  display: inline-block;
  padding: 8px 16px;
  margin: 4px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  text-decoration: none;
  color: #495057;
  font-size: 14px;
  transition: all 0.2s ease;
}

.subcategory:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
  color: #212529;
  text-decoration: none !important; /* ensure no underline even if Tailwind base applies */
}

/* New subcategory link styles */
.subcategory-link {
  display: inline-block;
  text-decoration: none;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.4;
}

.subcategory-link:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.subcategory-container {
  margin: 20px 0;
  padding: 0;
}

/* Category card hover effects */
.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.category-card {
  cursor: pointer !important;
  transition: all 0.3s ease;
  pointer-events: auto !important;
  z-index: 10;
  position: relative;
}

/* Ensure category cards are clickable */
.category-card * {
  pointer-events: none;
}

.category-card {
  pointer-events: auto !important;
}
.subcategory-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  margin-top: 16px;
}

.subcategory-container > div,
.subcategory-container .subcategory {
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  border-radius: 0;
  font-size: 1em;
  min-width: 0;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.subcategory-container a {
  text-decoration: none;
  border-bottom: none;
}

/* Individual subcategory underline on hover only */
.subcategory-link {
  text-decoration: none;
  border-bottom: none;
}

.subcategory-link:hover {
  text-decoration: none;
  border-bottom: none;
}

/* Image container styled as gallery grid */
#image-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  justify-content: center;
  align-items: start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  #image-container {
      grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  #image-container {
      grid-template-columns: repeat(1, 1fr);
  }
}

#image-container div {
  width: 100%;
  overflow: hidden;
  border-radius: 0;
  aspect-ratio: 1 / 1;
}

#image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
}

#featured-grid a,
#featured-grid img {
  border-radius: 0 !important;
}

/* —— Homepage lookbook frame + grain (all sizes) —— */
body.is-home {
  position: relative;
  /* Keep content inside the thin frame on small screens */
  padding-left: max(1rem, 3.5vw) !important;
  padding-right: max(1rem, 3.5vw) !important;
}

.site-letterbox {
  display: block;
  pointer-events: none;
  position: fixed;
  inset: 8px;
  z-index: 90;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.03),
    0 0 0 8px transparent;
}

.site-grain {
  display: block;
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 95;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  animation: grain-shift 0.9s steps(2) infinite;
}

.dark .site-letterbox,
html.dark .site-letterbox {
  border-color: rgba(255, 255, 255, 0.1);
}

.dark .site-grain,
html.dark .site-grain {
  opacity: 0.055;
  mix-blend-mode: soft-light;
}

@media (min-width: 768px) {
  body.is-home {
    padding-left: max(1.25rem, 2.5vw) !important;
    padding-right: max(1.25rem, 2.5vw) !important;
  }

  .site-letterbox {
    inset: 14px;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.04),
      0 0 0 14px transparent;
  }

  .site-grain {
    opacity: 0.045;
    background-size: 180px 180px;
    animation-duration: 0.8s;
  }

  .dark .site-letterbox,
  html.dark .site-letterbox {
    border-color: rgba(255, 255, 255, 0.1);
  }

  .dark .site-grain,
  html.dark .site-grain {
    opacity: 0.07;
  }
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -1%); }
  75% { transform: translate(-1%, 2%); }
  100% { transform: translate(0, 0); }
}

/* —— Custom cursor (enabled via body.has-custom-cursor) —— */
.site-cursor {
  display: none;
}

body.has-custom-cursor,
body.has-custom-cursor * {
  cursor: none !important;
}

body.has-custom-cursor .site-cursor {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  will-change: transform;
}

body.has-custom-cursor .site-cursor.is-active {
  opacity: 1;
}

.site-cursor-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #111;
  transform: scale(1);
  transition: transform 0.25s ease, background 0.25s ease;
}

.site-cursor-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(17, 17, 17, 0.45);
  border-radius: 50%;
  transform: scale(0.55);
  opacity: 0.7;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease,
    border-color 0.25s ease;
}

html.dark .site-cursor-dot,
.dark .site-cursor-dot {
  background: #f2f2f2;
}

html.dark .site-cursor-ring,
.dark .site-cursor-ring {
  border-color: rgba(242, 242, 242, 0.5);
}

body.has-custom-cursor .site-cursor.is-hover .site-cursor-dot {
  transform: scale(0.35);
}

body.has-custom-cursor .site-cursor.is-hover .site-cursor-ring {
  transform: scale(1.15);
  opacity: 1;
}

body.has-custom-cursor .site-cursor.is-magnetic .site-cursor-ring {
  transform: scale(1.55);
  border-color: var(--cursor-accent, rgba(17, 17, 17, 0.55));
}

/* —— Sticky VISIONARY + buttery page scroll —— */
html {
  scroll-behavior: smooth;
}

.featured-section {
  position: relative;
}

.visionary-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 1.75rem 0 1.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.96) 55%,
    rgba(255, 255, 255, 0)
  );
  pointer-events: none;
  transition: padding 0.35s ease;
}

.dark .visionary-sticky,
html.dark .visionary-sticky {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.94) 55%,
    rgba(0, 0, 0, 0)
  );
}

.visionary-title {
  margin: 0;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-indent: 0.42em; /* keep optical centering with wide tracking */
  text-transform: uppercase;
  color: #bdbdbd;
  background: none;
  -webkit-text-fill-color: unset;
  transform-origin: center top;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.45s ease,
    letter-spacing 0.45s ease,
    color 0.45s ease;
  will-change: transform, opacity;
}

.visionary-sticky.is-compact {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.visionary-sticky.is-compact .visionary-title {
  transform: scale(0.72);
  opacity: 0.42;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
}

html.dark .visionary-title,
.dark .visionary-title {
  color: #d0d0d0;
}

.featured-item {
  --accent: #bdbdbd;
  opacity: 0;
  transform: translateY(48px) scale(0.96);
  filter: blur(2px);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.7s ease;
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}

.featured-item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.featured-item.is-magnetic {
  z-index: 2;
}

.featured-tile {
  position: relative;
  background: #111;
  transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.featured-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 transparent;
  transition: box-shadow 0.4s ease;
}

.featured-item.is-visible .featured-tile::after {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.featured-tile-img {
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.3s ease;
  will-change: opacity;
}

.featured-tile-img.is-fading {
  opacity: 0;
}

.featured-caption-wrap {
  margin-top: 0.75rem;
  text-align: center;
  transform: translate3d(calc(var(--mx, 0px) * 0.35), calc(var(--my, 0px) * 0.35), 0);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.featured-caption {
  margin: 0;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: color 0.5s ease, text-shadow 0.5s ease;
}

@media (min-width: 768px) {
  .featured-caption {
    font-size: 1rem;
  }
}

.featured-item.is-visible .featured-caption {
  color: color-mix(in srgb, var(--accent) 55%, #111);
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 28%, transparent);
}

html.dark .featured-item.is-visible .featured-caption,
.dark .featured-item.is-visible .featured-caption {
  color: color-mix(in srgb, var(--accent) 65%, #f5f5f5);
}

.featured-accent {
  display: block;
  width: 0;
  height: 1px;
  margin: 0.55rem auto 0;
  background: var(--accent);
  opacity: 0.55;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

.featured-item.is-visible .featured-accent {
  width: 2.25rem;
}

@media (prefers-reduced-motion: reduce) {
  .featured-item {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  .site-grain,
  .site-cursor {
    display: none !important;
  }

  .visionary-title,
  .featured-tile,
  .featured-caption-wrap,
  .featured-accent {
    transition: none !important;
  }

  body.has-custom-cursor,
  body.has-custom-cursor * {
    cursor: auto !important;
  }
}

/* Ensure no underline anywhere inside subcategories container */
#subcategories-container,
#subcategories-container *,
.subcategory-container,
.subcategory-container * {
  text-decoration: none !important;
  border-bottom: 0 !important;
}

/* Featured project intro (homepage deep-link) */
.project-intro {
  max-width: 42rem;
  margin: 2.5rem auto 3rem;
  padding: 0 1rem;
  text-align: center;
  animation: projectIntroIn 0.7s ease-out both;
}

#project-intro[hidden] {
  display: none !important;
}

.project-intro-title {
  margin: 0;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-transform: uppercase;
  color: inherit;
}

.project-intro-rule {
  width: 3rem;
  height: 1px;
  margin: 1.25rem auto 1.35rem;
  background: currentColor;
  opacity: 0.35;
}

.project-intro-caption {
  margin: 0 auto;
  max-width: 34rem;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  font-weight: 300;
  line-height: 1.75;
  letter-spacing: 0.01em;
  color: #525252;
}

.project-caption-link {
  color: inherit;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1.5px;
}

.project-caption-link:hover {
  opacity: 0.7;
}

html.dark .project-intro-caption,
.dark .project-intro-caption {
  color: #d4d4d4;
}

/* —— Theme toggle —— */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: transparent;
  color: inherit;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(0, 0, 0, 0.05);
}

.theme-toggle:active {
  transform: scale(0.96);
}

html.dark .theme-toggle,
.dark .theme-toggle {
  border-color: rgba(255, 255, 255, 0.18);
}

html.dark .theme-toggle:hover,
.dark .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.theme-toggle-icon {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
}

html:not(.dark) .theme-toggle-moon {
  display: block;
}

html.dark .theme-toggle-sun {
  display: block;
}

@keyframes projectIntroIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html.project-view #categories-section,
html.project-view #subcategories-container,
body.project-view #categories-section,
body.project-view #subcategories-container,
html.project-view .categories,
body.project-view .categories {
  display: none !important;
}

html.project-view #image-container,
body.project-view #image-container {
  margin-top: 0.5rem;
}

html.project-view #project-intro,
body.project-view #project-intro {
  display: block !important;
}