/* ---------------------------------------------------------------
   Atelier ledger — design tokens
   Light (default): warm stone/paper ground, ink text, gold + garnet accents
   Dark (system or toggle): the actual workbench — graphite/ink, same accents
   --------------------------------------------------------------- */
:root {
  --bone: #ece6d8;
  --paper: #f6f2e8;
  --ink: #1c1b19;
  --ink-soft: #55504a;
  --gold: #b8934f;
  --gold-deep: #8f6f38;
  --garnet: #7c2530;
  --steel: #8b8577;
  --hairline: #c9c0ab;
  --surface: #ffffff;

  --bg: var(--bone);
  --bg-panel: var(--paper);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --accent: var(--gold);
  --accent-deep: var(--gold-deep);
  --accent-2: var(--garnet);
  --line: var(--hairline);
  --card-bg: var(--surface);
  --header-bg: rgba(246, 242, 232, 0.88);
  --shadow: rgba(28, 27, 25, 0.14);
  --hero-bg: #1c1b19;
  --hero-text: #f2ede1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1b19;
    --bg-panel: #211f1c;
    --text: #ece6d8;
    --text-soft: #b4ac9c;
    --accent: #cba867;
    --accent-deep: #e0bd7d;
    --accent-2: #b1505c;
    --line: #3a3733;
    --card-bg: #262420;
    --header-bg: rgba(28, 27, 25, 0.86);
    --shadow: rgba(0, 0, 0, 0.4);
    --hero-bg: #100f0e;
    --hero-text: #f2ede1;
  }
}

:root[data-theme="dark"] {
  --bg: #1c1b19;
  --bg-panel: #211f1c;
  --text: #ece6d8;
  --text-soft: #b4ac9c;
  --accent: #cba867;
  --accent-deep: #e0bd7d;
  --accent-2: #b1505c;
  --line: #3a3733;
  --card-bg: #262420;
  --header-bg: rgba(28, 27, 25, 0.86);
  --shadow: rgba(0, 0, 0, 0.4);
  --hero-bg: #100f0e;
  --hero-text: #f2ede1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Assistant", sans-serif;
  font-weight: 400;
  line-height: 1.65;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, h3, .logo, .btn, .about-quote {
  font-family: "Frank Ruhl Libre", serif;
}

h1, h2, h3 { text-wrap: balance; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Scroll reveal — used on gallery cards and story tiles */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.hallmark-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 12px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

/* Elements with their own compositing layer (sticky header, scroll-reveal opacity/transform)
   can bleed through the lightbox scrim in some engines despite z-index/hit-testing being
   correct. Hiding all other page content while the lightbox is open removes the ambiguity. */
body.lightbox-open > :not(#lightbox) {
  visibility: hidden;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.logo {
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-left: auto;
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 11px 2px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease;
}

.nav a:hover { color: var(--accent-deep); }

.theme-toggle {
  order: -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent-deep); }
.theme-toggle:focus-visible, a:focus-visible, button:focus-visible, .card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lightbox-content:focus-visible { outline: none; }

.theme-icon-moon { display: none; }
:root[data-theme="dark"] .theme-icon-sun { display: none; }
:root[data-theme="dark"] .theme-icon-moon { display: block; }

/* Hero — a slab of brushed metal */
.hero {
  position: relative;
  overflow: hidden;
  padding: 120px 0 96px;
  text-align: center;
  background: var(--hero-bg);
  color: var(--hero-text);
  background-image:
    repeating-linear-gradient(100deg, rgba(255,255,255,0.025) 0px, rgba(255,255,255,0.025) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse 900px 500px at 50% -10%, rgba(184,147,79,0.22), transparent 65%);
}

.hero-sheen {
  position: absolute;
  inset: -20% -60%;
  background: linear-gradient(75deg, transparent 40%, rgba(203,168,103,0.16) 48%, rgba(255,244,222,0.28) 50%, rgba(203,168,103,0.16) 52%, transparent 60%);
  transform: translateX(-60%);
  animation: sheen-sweep 2.6s 0.3s 1 ease-out;
  pointer-events: none;
}

@keyframes sheen-sweep {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

.hero-inner { position: relative; z-index: 1; }
.hero .hallmark-label { color: var(--accent); }

.hero-title {
  font-size: clamp(2.8rem, 7vw, 4.6rem);
  margin: 0 0 18px;
  letter-spacing: 0.01em;
}

.hero-sub {
  font-size: 1.12rem;
  color: #d9d0bd;
  margin: 0 auto 36px;
  max-width: 46ch;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--hero-bg);
  padding: 14px 34px;
  border-radius: 2px;
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.02em;
  border: 1px solid var(--accent);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn:hover { background: transparent; color: var(--accent); }

.btn-outline {
  background: transparent;
  color: var(--hero-text);
  border: 1px solid var(--hairline);
}
:root[data-theme="dark"] .btn-outline { border-color: #4a463f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-outline { border-color: #4a463f; }
}

.btn-outline:hover { background: var(--accent); border-color: var(--accent); color: var(--hero-bg); }

/* Section heads */
.section-head { text-align: center; margin-bottom: 8px; }
.section-head .hallmark-label { text-align: center; }

.section-title {
  font-size: 2.1rem;
  margin: 0 0 40px;
  position: relative;
}

.section-title::after {
  content: "";
  display: block;
  width: 46px;
  height: 1px;
  background: var(--accent);
  margin: 18px auto 0;
}

/* Gallery */
.gallery-section { padding: 60px 0 110px; }

.filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 48px;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  padding: 12px 20px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover { border-color: var(--accent); color: var(--accent-deep); }

.filter-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  position: relative;
  cursor: pointer;
  background: var(--card-bg);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover { box-shadow: 0 10px 28px var(--shadow); }

.card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-panel);
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.5s ease;
}

.card:hover .card-image img { transform: scale(1.04); }

/* Featured piece — spans a larger tile in the cabinet */
.card--featured {
  grid-column: span 2;
  grid-row: span 2;
}

.card--featured .card-title { font-size: 1.5rem; }
.card--featured .card-desc { font-size: 0.98rem; max-width: 42ch; }

@media (max-width: 700px) {
  .card--featured { grid-column: span 1; grid-row: span 1; }
}

.image-count {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(28, 27, 25, 0.78);
  color: #e7dfc9;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  padding: 3px 8px;
  border: 1px solid rgba(203,168,103,0.5);
  border-radius: 2px;
}

/* Loupe lens — styled as an actual magnifying glass: ring + handle */
.loupe {
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 5px solid var(--accent);
  outline: 2px solid rgba(28,27,25,0.55);
  outline-offset: -2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(255,255,255,0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  background-repeat: no-repeat;
  z-index: 5;
}

.loupe::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 34px;
  background: var(--accent);
  border-radius: 3px;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.card-image.loupe-active .loupe { opacity: 1; }

@media (hover: none) {
  .loupe { display: none; }
}

.hallmark-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  background: rgba(28, 27, 25, 0.78);
  color: #e7dfc9;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border: 1px solid rgba(203,168,103,0.5);
  border-radius: 2px;
}

.card-body {
  padding: 20px 22px 24px;
  border-top: 1px solid var(--line);
}

.card-category,
.card-material {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 8px;
}

.card-title {
  margin: 0 0 8px;
  font-size: 1.18rem;
  font-family: "Frank Ruhl Libre", serif;
}

.card-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.gallery-cta {
  text-align: center;
  margin-top: 54px;
  padding-top: 46px;
  border-top: 1px solid var(--line);
}

.gallery-cta p {
  color: var(--text-soft);
  margin: 0 0 18px;
  font-size: 1rem;
}

.empty-state {
  text-align: center;
  color: var(--text-soft);
  padding: 50px 0;
  grid-column: 1 / -1;
  background: var(--bg);
}

/* Story / process triptych */
.story-section { padding: 90px 0 100px; }

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.story-tile { position: relative; }

.story-tile-index {
  display: block;
  font-family: "Frank Ruhl Libre", serif;
  font-size: 1.5rem;
  color: var(--accent);
  opacity: 0.6;
  line-height: 1;
  margin-bottom: 6px;
}

.story-tile-image {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.story-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.95);
}

.story-tile-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 8px;
}

.story-tile-text {
  color: var(--text-soft);
  font-size: 0.98rem;
  margin: 0;
  max-width: 34ch;
}

@media (max-width: 800px) {
  .story-grid { grid-template-columns: 1fr; gap: 40px; }
  .story-tile-text { max-width: none; }
}

/* About */
.about-section {
  background: var(--bg-panel);
  padding: 100px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.about-inner {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 64px;
  align-items: center;
}

.about-photo { position: relative; }

.about-photo img {
  width: 100%;
  display: block;
  border: 1px solid var(--line);
  filter: saturate(0.94);
}

.about-photo-tag {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(28, 27, 25, 0.78);
  color: #e7dfc9;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border: 1px solid rgba(203,168,103,0.5);
}

.about-quote {
  margin: 0 0 24px;
  padding-right: 20px;
  border-right: 2px solid var(--accent);
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--text);
}

.about-body {
  color: var(--text-soft);
  font-size: 1.02rem;
  max-width: 52ch;
}

/* Footer */
.site-footer {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 80px 0;
}

.footer-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-stamp {
  color: var(--accent);
  margin-bottom: 18px;
  opacity: 0.85;
}

.footer-brand {
  font-family: "Frank Ruhl Libre", serif;
  font-size: 1.7rem;
  margin: 0 0 10px;
}

.footer-sub {
  color: #c7bda6;
  margin: 0 0 30px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(16, 15, 14, 0.94);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.2s ease, visibility 0s linear 0s;
}

/* The content box hugs each image's own aspect ratio (no forced uniform frame) —
   stability comes from the controls below being anchored to the viewport
   (.lightbox itself), not to this box, so they never move between images. */
.lightbox-content {
  display: flex;
  flex-direction: column;
  max-width: 95vw;
  max-height: 95vh;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--line);
  transform: scale(0.98);
  transition: transform 0.2s ease;
}

.lightbox.open .lightbox-content { transform: scale(1); }

.lightbox-media {
  position: relative;
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  display: block;
  max-width: 90vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.lightbox-content img.swapping { opacity: 0; }

/* Nav arrows, close button and counter are anchored to the viewport (.lightbox),
   not to the content box — so they hold their position regardless of whether the
   current image is portrait or landscape. */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #f7f3e8;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)) drop-shadow(0 0 6px rgba(0,0,0,0.35));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s ease;
}

.lightbox-nav svg { width: 22px; height: 22px; }

@media (hover: hover) {
  .lightbox-nav:hover { background: rgba(247,243,232,0.14); }
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox.single-image .lightbox-nav,
.lightbox.single-image .lightbox-counter,
.lightbox-media.single-image .lightbox-dots { display: none; }

.lightbox-counter {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: #f7f3e8;
  letter-spacing: 0.03em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7));
}

.lightbox-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
}

.lightbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
}

.lightbox-dot::after {
  content: "";
  position: absolute;
  inset: -12px;
}

.lightbox-dot.active { background: var(--accent); }

.lightbox-caption { flex: none; padding: 20px 24px; overflow-y: auto; }

.lightbox-caption h3 { margin: 6px 0 6px; }
.lightbox-caption #lightbox-desc { margin: 10px 0 0; color: var(--text-soft); }

.hallmark-tag#lightbox-hallmark {
  position: static;
  display: inline-block;
  background: transparent;
  border-color: var(--line);
  color: var(--accent-deep);
  padding: 3px 8px;
}

.lightbox-material {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--text);
}

.lightbox-unique[hidden] { display: none; }

.lightbox-unique {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 2px;
  margin: 0 0 12px;
}

.btn-inquiry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  padding: 11px 26px;
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-family: "Assistant", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

@media (hover: hover) {
  .btn-inquiry:hover { background: var(--accent); color: var(--hero-bg); }
}

.lightbox-inquiry-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.lightbox-close {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #f7f3e8;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.7)) drop-shadow(0 0 6px rgba(0,0,0,0.35));
  cursor: pointer;
  z-index: 10;
  transition: background 0.2s ease;
}

@media (hover: hover) {
  .lightbox-close:hover { background: rgba(247,243,232,0.14); }
}

@media (max-width: 700px) {
  .lightbox-content img { max-width: 92vw; max-height: 70vh; }
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
  .lightbox-caption { padding: 16px 18px; }
  .btn-inquiry { width: 100%; padding: 13px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-sheen { animation: none; display: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (max-width: 800px) {
  .about-inner { grid-template-columns: 1fr; }
  .nav { gap: 16px; }
  .nav a { font-size: 0.85rem; }
  .header-inner { flex-wrap: wrap; }
}
