/* ============================================================
   THREAD BY THREAD — Design System
   Aesthetic: Minimal sidebar gallery
   Typography: Cormorant Garamond (headings), Jost (body)
   Palette: Plum/violet + gold on light gray
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Palette */
  --white: #f5f5f5;
  --deep-teal: #7B3FA0;
  --gold: #A07D3A;
  --ink: #33302E;
  --muted: #8A8280;
  --light-border: rgba(94, 58, 110, 0.08);

  /* Typography scale */
  --font-heading: 'Cormorant Garamond', 'Garamond', serif;
  --font-body: 'Jost', sans-serif;

  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.8rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.3vw, 0.9rem);
  --text-base: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem);
  --text-lg: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
  --text-xl: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  --text-2xl: clamp(1.8rem, 1.3rem + 1.5vw, 2.8rem);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 200ms;
  --duration-med: 400ms;
  --duration-slow: 800ms;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 300;
  color: var(--ink);
  background-color: var(--white);
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
}

/* Paper grain texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  opacity: 0.4;
  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)' opacity='1'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  mix-blend-mode: multiply;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Sidebar Navigation --- */
.site-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-xl) var(--space-lg);
  background: transparent;
}

.site-sidebar .nav-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-md);
}

.nav-tagline {
  font-family: var(--font-heading);
  font-size: 0.90rem;
  font-weight: 300;
  font-style: italic;
  color: #6b6360;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}

.site-sidebar .nav-logo {
  height: 95px;
  width: auto;
}

.site-sidebar .nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

.site-sidebar .nav-links > li {
  width: 100%;
}

.site-sidebar .nav-links a {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2a2520;
  transition: color var(--duration-fast) ease;
}

.site-sidebar .nav-links a:hover,
.site-sidebar .nav-links a.active {
  color: var(--deep-teal);
}

/* Filter sub-links under Gallery — hidden by default, shown on gallery page */
.nav-filters {
  list-style: none;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  margin-top: 0.15rem;
  padding-left: 0;
}

.nav-filters.visible {
  display: flex;
}

.site-sidebar .nav-filters .filter-link {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 300;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--muted);
  font-style: italic;
  transition: color var(--duration-fast) ease;
}

.site-sidebar .nav-filters .filter-link:hover {
  color: var(--ink);
}

.site-sidebar .nav-filters .filter-link.active {
  color: var(--deep-teal);
  font-weight: 400;
}

/* Gallery pieces */
.gallery-piece {
  cursor: default;
  overflow: hidden;
  border-radius: 4px;
}

.gallery-piece[data-status="available"] {
  cursor: pointer;
}

.piece-image {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 100;
}

.piece-image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.piece-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity var(--duration-med) ease;
  z-index: 2;
}

.gallery-piece[data-status="available"]:hover .piece-info {
  opacity: 1;
}

.piece-name {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 500;
  color: #fff;
}

.piece-price {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
}

/* Hidden pieces (filtered out) */
.gallery-piece.hidden {
  display: none;
}

.nav-socials {
  margin-top: var(--space-lg);
  display: flex;
  gap: var(--space-md);
}

.nav-socials a {
  font-size: 1.5rem;
  color: var(--deep-teal);
  transition: color var(--duration-fast) ease;
}

.nav-socials a:hover {
  color: var(--gold);
}

/* Mobile-only tagline — hidden on desktop */
.nav-tagline-mobile {
  display: none;
}

/* Hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  background: transparent;
}

.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--duration-med) var(--ease-out-expo),
              opacity var(--duration-fast) ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Push page content to the right of the sidebar */
.site-content {
  margin-left: 320px;
}

/* --- Gallery Grid --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-xs);
  max-width: 1100px;
  margin: 0 auto;
}

/* --- About Page --- */
.about-content {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.about-heading {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 400;
  font-style: italic;
  color: var(--deep-teal);
  text-align: center;
  margin-bottom: var(--space-lg);
  letter-spacing: 0.02em;
}

.about-content p {
  font-size: clamp(1rem, 0.925rem + 0.4vw, 1.15rem);
  line-height: 1.9;
  color: var(--ink);
  margin-bottom: var(--space-md);
}

.about-signature {
  text-align: right;
  font-style: italic;
  margin-top: var(--space-lg);
  line-height: 1.6;
}

.about-signature span {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- Product Modal --- */
.product-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-med) var(--ease-out-expo),
              visibility var(--duration-med);
}

.product-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.modal-container {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: row;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
  transform: scale(0.92) translateY(20px);
  transition: transform var(--duration-slow) var(--ease-out-back);
  overflow: hidden;
}

.product-modal.active .modal-container {
  transform: scale(1) translateY(0);
}

/* Hide scrollbar but allow scroll */
.modal-container::-webkit-scrollbar {
  display: none;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 1.4rem;
  border-radius: 50%;
  z-index: 10;
  transition: background var(--duration-fast) ease,
              transform var(--duration-fast) ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.modal-close:hover {
  background: #fff;
  transform: rotate(90deg);
}

/* Modal Image Gallery */
.modal-gallery {
  width: 50%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: 8px 0 0 8px;
  overflow: hidden;
}

.modal-main-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-sm) 0;
}

.modal-main-image img {
  max-width: 85%;
  max-height: 60vh;
  display: block;
  transition: opacity var(--duration-med) ease;
}

.modal-thumbnails {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px var(--space-sm) var(--space-sm);
}

.modal-thumbnails img {
  width: 78px;
  height: 78px;
  object-fit: cover;
  cursor: pointer;
  border-radius: 3px;
  transition: opacity var(--duration-fast) ease;
}

.modal-thumbnails img:hover {
  opacity: 0.7;
}

/* Modal Details */
.modal-details {
  padding: var(--space-lg) var(--space-md);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.modal-name {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.modal-desc {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-style: italic;
  color: var(--deep-teal);
  line-height: 1.6;
  margin-top: 4px;
  margin-bottom: var(--space-md);
}

.modal-specs {
  padding-top: var(--space-sm);
  border-top: 1px solid var(--light-border);
  margin-bottom: var(--space-sm);
}

.modal-specs p {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 300;
  color: var(--ink);
  line-height: 1.7;
  margin: 0;
}

.modal-specs strong {
  font-weight: 500;
  color: var(--ink);
}

.modal-shipping-repair {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 300;
  color: var(--muted);
  line-height: 1.6;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--light-border);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-lg);
}

.modal-price {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--gold);
}

.modal-buy-btn {
  display: inline-block;
  padding: 12px 36px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--deep-teal);
  background: transparent;
  border: 1px solid var(--deep-teal);
  border-radius: 3px;
  transition: background var(--duration-fast) ease,
              color var(--duration-fast) ease;
}

.modal-buy-btn:hover {
  background: var(--deep-teal);
  color: var(--white);
}

/* Modal responsive */
@media (max-width: 768px) {
  .modal-container {
    width: 95%;
    max-height: 92vh;
    flex-direction: column;
    overflow-y: auto;
  }

  .modal-gallery {
    width: 100%;
    border-radius: 8px 8px 0 0;
  }

  .modal-main-image img {
    max-width: 70%;
    max-height: none;
  }

  .modal-thumbnails img {
    width: 60px;
    height: 60px;
  }

  .modal-details {
    padding: var(--space-sm) var(--space-sm) var(--space-md);
  }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }

}

@media (max-width: 768px) {
  .site-sidebar {
    position: relative;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md) 0;
    gap: 0;
    border-bottom: none;
    box-shadow: none;
  }

  .site-sidebar .nav-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 0;
  }

  .site-sidebar .nav-logo {
    height: 75px;
  }

  .site-sidebar .nav-tagline {
    font-size: 0.95rem;
  }

  .nav-toggle {
    display: flex;
    align-self: center;
  }

  /* Collapsible menu panel — hidden until hamburger opens it */
  .site-sidebar .nav-links,
  .site-sidebar .nav-socials {
    width: 100%;
    flex-basis: 100%;
    display: none;
  }

  .site-sidebar.open .nav-links,
  .site-sidebar.open .nav-socials {
    display: flex;
  }

  .site-sidebar .nav-links {
    flex-direction: column;
    gap: var(--space-sm);
    padding-top: var(--space-md);
  }

  .nav-socials {
    justify-content: center;
    padding-top: var(--space-sm);
    padding-bottom: var(--space-sm);
  }

  .site-content {
    margin-left: 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
    max-width: none;
    padding: var(--space-sm) !important;
  }

  .about-content {
    padding: var(--space-lg) var(--space-sm);
  }

  .piece-info {
    position: relative;
    inset: auto;
    background: none;
    opacity: 1;
    padding: var(--space-xs) 0;
  }

  .piece-name {
    color: var(--ink);
    font-size: var(--text-base);
  }

  .piece-price {
    color: var(--gold);
    font-size: var(--text-sm);
  }

  /* Hide info for previous pieces on mobile too */
  .gallery-piece[data-status="previous"] .piece-info {
    display: none;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    gap: 6px;
  }
}
