:root {
  --cream: #faf7f2;
  --parchment: #f2ece0;
  --clay: #b8784a;
  --earth: #7a4f2e;
  --dark: #1a1008;
  --ink: #0d0804;
  --smoke: #5c4f42;   /* secondary text — darkened for AA contrast (~7:1 on cream) */
  --ash: #c3b9a8;     /* hairlines — slightly stronger for definition */
  --celadon: #4d9478;
  --cobalt: #2d4a72;
  --white-clay: #f5f0e8;
  --panel: #fdfaf6;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;
  --r-lg: 14px; --r-md: 10px; --r-sm: 6px; --r-pill: 999px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── LOADING ─── */
#loadingScreen {
  position: fixed; inset: 0;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  flex-direction: column; gap: 16px;
  transition: opacity 0.4s;
}
#loadingScreen .spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--ash);
  border-top-color: var(--earth);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
#loadingScreen p { font-size: 12px; color: var(--smoke); letter-spacing: 0.15em; text-transform: uppercase; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── STICKY TOP ZONE (reveals on scroll-up) ─── */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--cream);
  transition: transform 0.3s ease;
  will-change: transform;
}
#topbar.nav-hidden { transform: translateY(-100%); }

/* ─── HEADER ─── */
header {
  padding: 20px 48px 16px;
  border-bottom: 1px solid var(--ash);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: var(--cream);
  position: relative; /* anchors the mobile expanding search row */
}
.wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px; font-weight: 400;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--earth); margin-bottom: 5px;
}
h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 38px; font-weight: 400; font-style: italic;
  color: var(--ink); line-height: 1;
}
.header-right { display: flex; gap: 8px; align-items: center; }

/* Even, uniform top-bar controls — search icon, Upload, ··· all share one height & shape */
.icon-btn {
  height: 40px; width: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 19px; line-height: 1;
  border: 1.5px solid var(--ash); background: transparent; color: var(--smoke);
  border-radius: var(--r-md); cursor: pointer; transition: all 0.18s;
}
.icon-btn:hover, .icon-btn.on { border-color: var(--smoke); color: var(--dark); }
#accountBtn { letter-spacing: 0.04em; padding-bottom: 6px; }
.header-right .btn { height: 40px; padding-top: 0; padding-bottom: 0; display: inline-flex; align-items: center; gap: 6px; }
.upload-plus { font-size: 16px; font-weight: 400; line-height: 1; }

/* Account (···) dropdown */
.account { position: relative; }
.account-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--ash);
  border-radius: var(--r-md); min-width: 210px; padding: 6px;
  box-shadow: 0 8px 28px rgba(26,16,8,0.14); z-index: 200;
}
.account-dropdown.open { display: block; }
.acct-section { padding: 8px 8px 10px; }
.acct-label { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--smoke); margin-bottom: 8px; }
.acct-lang { display: flex; gap: 6px; }
.acct-lang-btn {
  flex: 1; font-family: var(--font-body); font-size: 13px;
  padding: 8px 10px; border: 1.5px solid var(--ash); background: transparent;
  color: var(--dark); border-radius: var(--r-sm); cursor: pointer; transition: all 0.15s;
}
.acct-lang-btn:hover:not(.active) { border-color: var(--earth); color: var(--earth); }
.acct-lang-btn.active { background: rgba(122,79,46,0.12); color: var(--earth); border-color: var(--earth); }
.acct-divider { height: 1px; background: var(--ash); margin: 4px 0; opacity: 0.7; }
.acct-item {
  display: block; width: 100%; text-align: left;
  font-family: var(--font-body); font-size: 14px; color: var(--dark);
  padding: 10px 10px; background: none; border: none; border-radius: var(--r-sm);
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.acct-item:hover { background: var(--parchment); color: var(--ink); }
.acct-signout { color: var(--smoke); }
/* Kept visible so its affordance is discoverable, but greyed with a tooltip when unavailable */
.acct-item.is-disabled { color: var(--ash); cursor: not-allowed; }
.acct-item.is-disabled:hover { background: none; color: var(--ash); }

/* ─── BUTTONS ─── */
.btn {
  font-family: var(--font-body);
  font-size: 14px; letter-spacing: 0.01em;
  padding: 11px 20px; border: 1.5px solid var(--earth);
  background: transparent; color: var(--earth);
  cursor: pointer; transition: all 0.18s; white-space: nowrap;
  font-weight: 500; border-radius: var(--r-md);
}
.btn:hover { background: var(--earth); color: var(--cream); }
.btn-dark { background: var(--dark); color: var(--cream); border-color: var(--dark); }
.btn-dark:hover { background: var(--earth); border-color: var(--earth); }
.btn-ghost { border-color: var(--ash); color: var(--smoke); }
.btn-ghost:hover { border-color: var(--smoke); color: var(--dark); background: transparent; }
.btn-danger { border-color: #c0392b; color: #c0392b; }
.btn-danger:hover { background: #c0392b; color: white; }

.manage-back-btn { display: none; }

/* ─── TOP-BAR SEARCH ─── */
/* Desktop: field lives inline in the bar, always visible, widens on focus.
   Mobile: the ⌕ icon toggles it open as a full-width row under the header. */
.header-search { position: relative; flex: 0 0 auto; width: 230px; transition: width 0.2s ease; }
.header-search:focus-within { width: 300px; }
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%; box-sizing: border-box; height: 40px;
  font-family: var(--font-body); font-size: 14px;
  padding: 0 34px;
  border: 1.5px solid var(--ash); background: var(--cream); border-radius: var(--r-md);
  color: var(--dark); outline: none; transition: border-color 0.2s;
}
.search-wrap input:focus { border-color: var(--earth); }
.search-wrap input::placeholder { color: var(--smoke); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--smoke); font-size: 15px; pointer-events: none; }
.search-close {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: none; background: none; color: var(--smoke);
  font-size: 20px; line-height: 1; cursor: pointer; border-radius: var(--r-sm); display: none;
}
.search-close:hover { color: var(--dark); }
#searchToggle { display: none; } /* desktop: field is inline, no icon needed */

/* ─── CONTROL BAR: view toggle + filters pill ─── */
.control-bar {
  padding: 12px 48px; border-bottom: 1px solid var(--ash);
  background: var(--parchment); display: flex; align-items: center; gap: 12px;
}
.control-spacer { flex: 1; }
/* Segmented view toggle */
.seg { display: inline-flex; background: var(--cream); border: 1.5px solid var(--ash); border-radius: var(--r-pill); padding: 3px; }
.seg-btn {
  font-family: var(--font-body); font-size: 13px; letter-spacing: 0.01em;
  padding: 7px 16px; border: none; background: transparent; color: var(--smoke);
  cursor: pointer; border-radius: var(--r-pill); transition: all 0.18s; white-space: nowrap;
}
.seg-btn:hover:not(.active) { color: var(--dark); }
.seg-btn.active { background: var(--dark); color: var(--cream); }
/* Filters pill */
.filters-pill {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  font-family: var(--font-body); font-size: 14px; letter-spacing: 0.01em;
  padding: 8px 16px; border: 1.5px solid var(--ash); background: var(--cream); color: var(--dark);
  border-radius: var(--r-pill); cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.filters-pill:hover, .filters-pill.on { border-color: var(--earth); color: var(--earth); }
.filters-pill.active { border-color: var(--earth); color: var(--earth); background: rgba(122,79,46,0.1); }
.filters-pill-ico { font-size: 13px; line-height: 1; }
.filters-count { font-family: var(--font-mono); font-size: 12px; color: var(--earth); }

.filter-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-label { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dark); font-weight: 400; }
.chip {
  font-family: var(--font-body); font-size: 13px;
  letter-spacing: 0.01em; padding: 7px 14px;
  border: 1.5px solid var(--ash); background: transparent; color: var(--dark);
  cursor: pointer; transition: all 0.15s; border-radius: var(--r-pill);
}
.chip:hover:not(.active) { border-color: var(--earth); color: var(--earth); }
.chip.active { background: rgba(122,79,46,0.12); color: var(--earth); border-color: var(--earth); }

/* ─── FILTERS PANEL: popover (desktop) / sheet (mobile) ─── */
.filters-backdrop { display: none; position: fixed; inset: 0; background: rgba(26,16,8,0.28); z-index: 190; }
.filters-backdrop.open { display: block; }
.filters-panel {
  display: none; position: fixed; z-index: 200;
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--cream); border: 1px solid var(--ash);
  border-radius: var(--r-lg); box-shadow: 0 12px 40px rgba(26,16,8,0.18);
  flex-direction: column; max-height: min(560px, calc(100vh - 90px));
}
.filters-panel.open { display: flex; }
.filters-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--ash); }
.filters-title { font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--ink); }
.filters-clear { font-family: var(--font-body); font-size: 13px; color: var(--earth); background: none; border: none; cursor: pointer; padding: 4px; }
.filters-clear:hover { color: var(--dark); }
.filters-scroll { overflow-y: auto; padding: 6px 18px 4px; -webkit-overflow-scrolling: touch; }
.filters-section { padding: 12px 0; border-bottom: 1px solid var(--ash); }
.filters-section:last-child { border-bottom: none; }
.filters-section .filter-label { display: block; margin-bottom: 10px; }
.filters-section .chip-scroll { display: flex; gap: 6px; flex-wrap: wrap; }
.filters-foot { display: none; }

/* ─── GALLERY GRID ─── */
.gallery {
  padding: 32px 48px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ─── GLAZE CARD ─── */
.glaze-card {
  background: var(--white-clay);
  cursor: pointer; position: relative; overflow: hidden;
  border: 1px solid var(--ash); border-radius: var(--r-lg);
  transition: transform 0.25s, box-shadow 0.25s;
  animation: fadeIn 0.35s ease both;
}
.glaze-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(35,27,18,0.12); z-index: 2; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.card-img-wrap { position: relative; aspect-ratio: 1; overflow: hidden; }
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; display: block; transform: scale(var(--cz,1)); transform-origin: var(--co,50% 50%); }
.glaze-card:hover .card-img-wrap img { transform: scale(calc(var(--cz,1) * 1.03)); }

.card-sample-strip {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; gap: 2px; padding: 2px;
  background: linear-gradient(to top, rgba(26,16,8,0.4), transparent);
}
.strip-thumb {
  width: 32px; height: 32px; object-fit: cover; opacity: 0.8;
  transition: opacity 0.2s;
}
.strip-thumb:hover { opacity: 1; }

.card-meta { padding: 14px 16px 16px; }
.card-number { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; color: var(--earth); text-transform: uppercase; margin-bottom: 4px; font-weight: 400; }
.card-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 500; color: var(--ink);
  line-height: 1.2; margin-bottom: 9px;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.card-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  font-family: var(--font-mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 8px; border: 1.5px solid var(--ash); color: var(--smoke); border-radius: var(--r-sm);
}
.badge.combo { border-color: var(--celadon); color: var(--celadon); }
.badge.accent { border-color: var(--clay); color: var(--clay); }

.clay-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.clay-pip {
  width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.clay-name-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--smoke); letter-spacing: 0.04em;
}
.card-count { font-size: 13px; color: var(--smoke); margin-left: 2px; }
.card-clay { font-size: 12px; color: var(--smoke); margin-left: 2px; }

/* ─── GLAZE COLOR ─── */
.glaze-swatch {
  display: block;
  background-size: cover; background-position: center;
  background-color: var(--ash);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M6,14 C5,5 14,0 22,2 C29,4 30,12 36,8 C41,4 48,11 48,22 C48,32 43,38 40,42 C37,46 28,46 20,44 C12,42 6,44 4,38 C2,32 2,22 3,16 Z' fill='%23000'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M6,14 C5,5 14,0 22,2 C29,4 30,12 36,8 C41,4 48,11 48,22 C48,32 43,38 40,42 C37,46 28,46 20,44 C12,42 6,44 4,38 C2,32 2,22 3,16 Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%;
  position: relative;
}
/* ─── GLAZE FINISH SYSTEM (gradient swatches only) ─── */
/* glossy = sharp diagonal specular streak; matte = soft diffuse top light, no streak */
.glaze-swatch.finish-gloss::after,
.glaze-swatch.finish-matte::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
}
.glaze-swatch.finish-gloss::after {
  background: linear-gradient(131deg, rgba(255,255,255,.5) 0%, rgba(255,255,255,.12) 16%, rgba(255,255,255,0) 40%);
}
.glaze-swatch.finish-matte::after {
  background: linear-gradient(180deg, rgba(255,255,255,.14) 0%, rgba(255,255,255,0) 55%);
}
/* organic speckle / iron flecks / cloud movement via generated fractal-noise (not offset dots) */
.glaze-swatch.fx-speckle::before,
.glaze-swatch.fx-gold::before,
.glaze-swatch.fx-mottle::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
}
.glaze-swatch.fx-speckle::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='170'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.17 0 0 0 0 0.11 0 0 0 0 0.06 0 0 0 18 -13'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E") 0 0 / 52px 52px;
}
.glaze-swatch.fx-gold::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.88 0 0 0 0 0.66 0 0 0 0 0.30 0 0 0 15 -10'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E") 0 0 / 48px 48px;
}
.glaze-swatch.fx-mottle::before {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.015' numOctaves='3' seed='6' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E") 0 0 / 120px 120px;
  mix-blend-mode: soft-light; opacity: .85;
}
/* transparent glazes = checkerboard shows through, under a soft veil */
.glaze-swatch.fx-clear {
  background:
    linear-gradient(rgba(243,239,231,.5), rgba(243,239,231,.5)),
    repeating-conic-gradient(#e9e3d6 0% 25%, #d7cebc 0% 50%);
  background-size: cover, 13px 13px;
}
.glaze-swatch-wrap {
  display: inline-block; flex-shrink: 0;
  filter: drop-shadow(0 0 0.5px rgba(0,0,0,0.55));
}
.glaze-color-wrap {
  position: relative; display: inline-flex; align-items: center;
  cursor: pointer; flex-shrink: 0;
}
.glaze-color-wrap input[type="color"] {
  position: absolute; inset: 0; opacity: 0;
  width: 100%; height: 100%; cursor: pointer; border: none; padding: 0;
}
.warn-link {
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.04em;
  color: var(--smoke); background: none; border: none; cursor: pointer; padding: 0;
  text-decoration: none;
}
.warn-link:hover { text-decoration: underline; text-underline-offset: 2px; }
.warn-link.warn-set { text-decoration: none; text-transform: uppercase; font-weight: 500; color: var(--smoke); }
.warn-wrap { position: relative; }
.warn-menu {
  position: absolute; left: 0; top: 100%; margin-top: 4px;
  background: var(--cream); border: 1px solid var(--ash); z-index: 30;
  min-width: 230px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  display: flex; flex-direction: column;
}
.warn-menu-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; cursor: pointer; list-style: none;
}
.warn-menu-item:hover { background: var(--parchment); }
.warn-menu-item input[type="checkbox"] {
  margin-top: 3px; flex-shrink: 0; accent-color: var(--earth); cursor: pointer; width: 13px; height: 13px;
}
.warn-menu-text { display: flex; flex-direction: column; gap: 3px; }
.warn-menu-name { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--ink); letter-spacing: 0.04em; }
.warn-menu-desc { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--smoke); line-height: 1.5; }
.warn-menu-footer { border-top: 1px solid var(--ash); padding: 8px 13px; }
.warn-menu-footer button {
  font-family: 'DM Mono', monospace; font-size: 12px; color: var(--smoke);
  background: none; border: none; cursor: pointer; padding: 0;
}
.warn-menu-footer button:hover { text-decoration: underline; }

/* ─── SWATCH EDITOR ─── */
#swatchEditorOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,16,8,0.75); z-index: 310;
  align-items: center; justify-content: center;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  padding: 24px 16px;
}
#swatchEditorOverlay.open { display: flex; }
#swatchEditorPanel {
  background: var(--cream); max-width: 540px; width: 100%;
  padding: 32px 36px; position: relative;
  animation: panelIn 0.22s ease;
}
#swatchEditorCanvas {
  position: relative; aspect-ratio: 1; overflow: hidden;
  cursor: grab; background: var(--parchment); border: 1px solid var(--ash);
  user-select: none; -webkit-user-select: none;
}
#swatchEditorCanvas.dragging { cursor: grabbing; }
#swatchEditorImg {
  position: absolute; left: 0; top: 0;
  pointer-events: none; display: block;
}
.swatch-editor-preview.glaze-swatch { display: block; flex-shrink: 0; }
.swatch-photo-thumb {
  width: 58px; height: 58px; flex-shrink: 0;
  border: 2px solid var(--ash); overflow: hidden; cursor: pointer;
  transition: border-color 0.15s;
}
.swatch-photo-thumb.selected { border-color: var(--earth); }
.swatch-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── SKELETON LOADING ─── */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-card {
  background: var(--white-clay);
  cursor: default;
  pointer-events: none;
}
.skeleton-img {
  aspect-ratio: 1;
  background: linear-gradient(90deg, var(--ash) 25%, var(--parchment) 50%, var(--ash) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-meta { padding: 14px 16px 16px; }
.skeleton-line {
  background: linear-gradient(90deg, var(--ash) 25%, var(--parchment) 50%, var(--ash) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 2px;
  margin-bottom: 10px;
}

/* ─── EMPTY STATE ─── */
.empty { grid-column: 1/-1; padding: 80px 0; text-align: center; color: var(--smoke); }
.empty .e-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty p { font-size: 12px; line-height: 1.8; }

/* ─── OVERLAYS ─── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,16,8,0.75);
  z-index: 100; overflow-y: auto;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 32px 16px;
}
.overlay.open { display: flex; align-items: flex-start; justify-content: center; }

.panel {
  background: var(--cream); width: 100%; position: relative;
  animation: panelIn 0.28s ease;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.panel-header {
  padding: 28px 40px 22px;
  border-bottom: 1px solid var(--ash);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.panel-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px; font-weight: 300; font-style: italic; color: var(--ink);
}
.panel-header .sub { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--smoke); letter-spacing: 0.13em; margin-bottom: 5px; }
.close-x { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--smoke); padding: 2px 6px; line-height: 1; }
.close-x:hover { color: var(--dark); }

/* ─── DETAIL PANEL ─── */
#detailPanel { max-width: 960px; }

.detail-body { padding: 28px 40px 40px; }

.detail-clay-filters { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }

.section-head {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--smoke); padding-bottom: 10px;
  border-bottom: 1px solid var(--ash); margin-bottom: 20px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
}

.photo-item { cursor: pointer; display: flex; flex-direction: column; }

/* ─── COMBINE MODE ─── */
.combine-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--cream); border: 1px solid var(--ash);
  border-radius: var(--r-lg); padding: 12px 18px; margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(26,16,8,0.06);
}
.combine-bar-hint { font-family: var(--font-body); font-size: 14.5px; letter-spacing: 0; text-transform: none; color: var(--dark); }
.combine-bar-actions { display: flex; gap: 8px; }
.combine-bar-actions .btn { font-size: 13px; padding: 8px 16px; }
.photo-item.combine-selectable { position: relative; }
.photo-item.combine-selectable img { transition: opacity 0.15s; }
.photo-item.combine-selectable.selected > div:first-child { outline: 3px solid var(--earth); outline-offset: -3px; }
.photo-item.combine-selectable:not(.selected) img { opacity: 0.72; }
/* In combine mode, suppress per-tile actions so a click only ever selects */
#detailPhotoGrid.combine-active .photo-viewfull-btn,
#detailPhotoGrid.combine-active .photo-overflow,
#detailPhotoGrid.combine-active .photo-bottom-row,
#detailPhotoGrid.combine-active .flag-note-box { display: none !important; }
#detailPhotoGrid.combine-active .photo-item img { cursor: pointer !important; }
.combine-check {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--cream); background: rgba(26,16,8,0.42);
  color: var(--cream); font-size: 14px; line-height: 20px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.combine-check.checked { background: var(--earth); border-color: var(--cream); font-weight: 400; }
.combine-check.keeper { background: var(--dark); border-color: var(--cream); }
.combine-keeper-tag {
  position: absolute; bottom: 8px; left: 8px; z-index: 3;
  background: var(--dark); color: var(--cream);
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 7px;
}
#detailCombineBtn.active, #photosCombineBtn.active { background: var(--earth); color: var(--cream); border-color: var(--earth); }
.combine-bar-sticky {
  position: sticky; top: 0; z-index: 30;
  margin: 0 48px 3px;
}
.photo-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  transition: opacity 0.2s;
}
.photo-item:hover img { opacity: 0.88; }
.photo-item-meta { padding: 10px 0 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }

/* ─── SAMPLE META ─── */
.photo-clay-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--smoke); border: 1px solid var(--ash);
  padding: 3px 8px 3px 6px; margin-bottom: 6px;
}
.photo-attr { font-size: 14.5px; color: var(--smoke); margin-top: 3px; line-height: 1.5; }
/* Per-photo note / description — readable serif, not a tiny caption */
.photo-desc {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px; color: var(--earth); font-style: italic;
  line-height: 1.45; margin-top: 5px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}

.detail-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ─── LIGHTBOX ─── */
#lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(10,7,3,0.92);
  z-index: 300; align-items: center; justify-content: center;
  backdrop-filter: blur(8px);
  padding: 0;
}
#lightbox.open { display: flex; }
#lightboxInner {
  display: flex; width: 100%; height: 100vh;
}
#lightboxPhotoWrap {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 40px 32px; min-width: 0; position: relative;
}
#lightboxImgWrap { position: relative; display: flex; min-height: 0; }
#lightboxImg {
  max-width: 100%; max-height: 78vh;
  object-fit: contain;
}
#lightboxBadge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(26,16,8,0.72); color: var(--cream);
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 5px 10px; pointer-events: none;
}
.photo-extra-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(26,16,8,0.62); color: var(--cream);
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 3px 7px; pointer-events: none;
}
#lightboxStrip {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: 100%; flex-shrink: 0;
}
.lb-thumb {
  position: relative; width: 62px; height: 62px; padding: 0;
  border: 2px solid transparent; background: none; cursor: pointer;
  overflow: hidden; transition: border-color 0.15s, opacity 0.15s; opacity: 0.62;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-thumb:hover { opacity: 1; }
.lb-thumb.active { border-color: var(--cream); opacity: 1; }
.lb-thumb-tag {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(184,120,74,0.92); color: var(--cream);
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.04em;
  text-transform: uppercase; text-align: center; padding: 1px 0; line-height: 1.4;
}
#lightboxAdminAdd { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; flex-shrink: 0; }
.lb-add-btn {
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 7px 14px; border: 1px solid rgba(250,247,242,0.5); background: rgba(250,247,242,0.08);
  color: var(--cream); cursor: pointer; transition: all 0.15s;
}
.lb-add-btn:hover { background: var(--cream); color: var(--dark); border-color: var(--cream); }
#lightboxDetails {
  width: 340px; flex-shrink: 0;
  background: var(--cream);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 0 40px;
  display: flex; flex-direction: column;
}
#lightboxDetailsHeader {
  display: flex; justify-content: flex-end;
  padding: 14px 16px 0;
  position: sticky; top: 0; background: var(--cream); z-index: 1;
}
#lightboxDetailsBody { padding: 12px 28px 0; flex: 1; display: flex; flex-direction: column; }
#lightboxDetails .lb-glaze-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 400; font-style: italic;
  color: var(--ink); line-height: 1.15; margin-bottom: 20px;
}
/* Labeled sections */
#lightboxDetails .lb-field { margin-bottom: 18px; }
#lightboxDetails .lb-label {
  font-family: 'DM Mono', monospace; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--clay); margin-bottom: 7px;
}
#lightboxDetails .lb-clay {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 15px; color: var(--dark);
  font-family: 'Cormorant Garamond', serif;
}
#lightboxDetails .lb-clay .clay-pip { width: 12px; height: 12px; }
#lightboxDetails .lb-methods {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
#lightboxDetails .lb-methods li {
  font-family: 'DM Mono', monospace; font-size: 14px;
  color: var(--dark); line-height: 1.45;
  padding-left: 14px; position: relative;
}
#lightboxDetails .lb-methods li::before {
  content: ''; position: absolute; left: 2px; top: 9px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--clay);
}
#lightboxDetails .lb-section { margin-bottom: 14px; }
#lightboxDetails .lb-layer-stack { display: flex; flex-direction: column; gap: 5px; }
#lightboxDetails .lb-layer-row { display: flex; align-items: center; gap: 9px; }
#lightboxDetails .lb-layer-num {
  font-size: 13px; color: var(--smoke); flex-shrink: 0;
  width: 18px; text-align: right;
  font-family: 'DM Mono', monospace; letter-spacing: 0;
}
#lightboxDetails .lb-layer-name { font-size: 15px; color: var(--dark); }
#lightboxDetails .lb-base-hint {
  font-size: 12px; color: var(--ash); text-transform: uppercase;
  letter-spacing: 0.08em; margin-left: 2px;
}
#lightboxDetails .lb-note {
  font-size: 15px; color: var(--earth); font-style: italic;
  font-family: 'Cormorant Garamond', serif; line-height: 1.55;
}
#lightboxDetails .lb-accents-row { display: flex; gap: 6px; flex-wrap: wrap; }
#lightboxDetails .lb-accents-row .badge {
  font-size: 12px; padding: 5px 11px; color: var(--clay);
}
#lightboxDetails .lb-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 20px; }
#lightboxDetails .lb-warnings {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--ash);
  display: flex; flex-direction: column; gap: 7px;
}
.lb-warn-pill {
  display: inline-flex; align-items: center; gap: 0;
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; background: none; border: none;
  cursor: pointer; padding: 0; text-align: left;
}
.lb-warn-pill-glaze { color: var(--smoke); text-transform: none; }
.lb-defect-badge {
  font-size: 12px; background: none; border: none; cursor: pointer;
  padding: 0 0 0 5px; line-height: 1;
}
/* Defect info card */
#defectCard {
  position: fixed; z-index: 400; width: 220px;
  background: var(--cream); border: 1px solid var(--ash);
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}
#defectCard img { width: 100%; height: 130px; object-fit: cover; display: block; }
#defectCardBody { padding: 11px 13px; }
#defectCardTitle {
  font-family: 'Cormorant Garamond', serif; font-size: 18px;
  color: var(--ink); margin-bottom: 5px;
}
#defectCardDesc {
  font-family: 'DM Mono', monospace; font-size: 12px;
  color: var(--smoke); line-height: 1.6;
}
#lightboxClose {
  background: none; border: none; color: var(--smoke);
  font-size: 22px; cursor: pointer; opacity: 0.7; line-height: 1; padding: 0;
}
#lightboxClose:hover { opacity: 1; color: var(--dark); }

/* ─── PASSWORD GATE ─── */
#passwordGate {
  display: none; position: fixed; inset: 0;
  background: rgba(26,16,8,0.85);
  z-index: 400; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
#passwordGate.open { display: flex; }
.gate-box {
  background: var(--cream); padding: 48px;
  max-width: 360px; width: 100%; text-align: center;
  animation: panelIn 0.25s ease;
}
.gate-box h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-style: italic; font-weight: 300;
  margin-bottom: 8px;
}
.gate-box p { font-size: 12px; color: var(--smoke); margin-bottom: 28px; line-height: 1.6; }
.gate-box input {
  width: 100%; font-family: 'DM Mono', monospace; font-size: 13px;
  padding: 12px 16px; border: 1px solid var(--ash);
  background: var(--white-clay); color: var(--dark);
  outline: none; text-align: center; letter-spacing: 0.2em;
  margin-bottom: 12px;
}
.gate-box input:focus { border-color: var(--earth); }
.gate-error { font-size: 12px; color: #c0392b; margin-bottom: 12px; min-height: 16px; }

/* ─── UPLOAD OVERLAY ─── */
#uploadOverlay { padding: 24px 16px; }
#uploadPanel { max-width: 860px; }

.upload-body { padding: 28px 36px 36px; }

.drop-zone {
  border: 2px dashed var(--ash); padding: 48px 24px;
  text-align: center; cursor: pointer; transition: all 0.2s; margin-bottom: 0;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--earth); background: rgba(196,149,106,0.04);
}
.drop-zone .dz-icon { font-size: 36px; margin-bottom: 10px; }
.drop-zone p { font-size: 12px; color: var(--smoke); line-height: 1.7; }
.drop-zone strong { color: var(--earth); }
.drop-zone input { display: none; }

/* ─── GLAZE FILTER CHIPS ─── */
.chip-scroll { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-group.full-row { flex-basis: 100%; }
.layer-section { border-left: 2px solid var(--celadon); padding-left: 14px; }
.photo-layer { font-size: 12px; color: var(--celadon); font-style: italic; margin-bottom: 2px; }

.filter-more-btn {
  font-family: var(--font-body); font-size: 13px;
  letter-spacing: 0.01em;
  background: none; border: none; color: var(--earth);
  cursor: pointer; padding: 4px 0; transition: color 0.15s;
}
.filter-more-btn:hover { color: var(--dark); }
.filter-more-btn.open { color: var(--earth); }

/* Glaze filter row — absolute overlay so it doesn't push gallery content */
#glazeFilterGroup {
  position: absolute; top: 100%; left: 0; width: 100%;
  background: var(--parchment); border-bottom: 1px solid var(--ash);
  padding: 14px 48px; z-index: 30;
  box-shadow: 0 6px 16px rgba(26,16,8,0.08);
  flex-basis: auto !important;
}

/* ─── SORT ─── */
.sort-group { display: flex; gap: 8px; align-items: center; flex-shrink: 0; white-space: nowrap; }
#viewGroup { margin-right: auto; }
#viewGroup { margin-left: 4px; } /* keep the view toggle on the left, near the stats */
.sort-label { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dark); font-weight: 400; flex-shrink: 0; }
.sort-chips { display: flex; gap: 4px; flex-wrap: nowrap; }
.sort-chip {
  font-family: var(--font-body); font-size: 13px;
  letter-spacing: 0.01em; padding: 5px 12px;
  border: 1px solid var(--ash); background: transparent; color: var(--dark);
  cursor: pointer; transition: all 0.15s; white-space: nowrap; border-radius: var(--r-pill);
}
.sort-chip:hover:not(.active) { border-color: var(--earth); color: var(--earth); }
.sort-chip.active { background: rgba(122,79,46,0.12); color: var(--earth); border-color: var(--earth); }

/* ─── GLAZE SEARCH ─── */
.glaze-search-wrap { position: relative; margin-bottom: 10px; }
.glaze-search {
  width: 100%; box-sizing: border-box;
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--ash); background: var(--parchment); border-radius: var(--r-md);
  font-family: var(--font-body); font-size: 14px; letter-spacing: 0.01em;
  color: var(--dark); outline: none;
}
.glaze-search:focus { border-color: var(--dark); }
.glaze-search::placeholder { color: var(--smoke); }
.glaze-search-clear {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 28px; display: none; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--smoke); font-size: 14px; line-height: 1;
}
.glaze-search-clear:hover { color: var(--dark); }
.glaze-search-clear.visible { display: flex; }

/* ─── GLAZE PICKER: swatch grid ─── */
.swatch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 6px; margin-top: 2px;
}
.swatch-cell {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 4px 7px; background: none; border: 1.5px solid transparent;
  border-radius: var(--r-md); cursor: pointer; transition: background 0.14s, border-color 0.14s;
}
.swatch-cell:hover { background: var(--parchment); }
.swatch-cell.on { background: rgba(122,79,46,0.10); border-color: var(--earth); }
.swatch-cell.dim { opacity: 0.4; }
.swatch-cell-img { position: relative; line-height: 0; }
.swatch-cell-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  background: var(--earth); color: var(--cream);
  font-family: var(--font-mono); font-size: 11px; line-height: 18px; text-align: center;
  border-radius: var(--r-pill); border: 1.5px solid var(--cream);
}
.swatch-cell-name {
  font-family: var(--font-body); font-size: 12px; line-height: 1.2;
  color: var(--dark); text-align: center; max-width: 84px;
  overflow-wrap: anywhere;
}
.swatch-cell.on .swatch-cell-name { color: var(--earth); font-weight: 500; }
.swatch-cell.add .add-plus {
  width: 60px; height: 60px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--ash); border-radius: 50%; color: var(--smoke); font-size: 24px;
}
.swatch-cell.add:hover .add-plus { border-color: var(--earth); color: var(--earth); }

/* ─── GLAZE PICKER: ordered combo builder ─── */
.combo-builder {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 12px; margin-bottom: 10px;
  border: 1px dashed var(--ash); border-radius: var(--r-md); background: var(--parchment);
}
.combo-builder.has-items { border-style: solid; }
.combo-empty { font-family: var(--font-body); font-size: 12.5px; color: var(--smoke); font-style: italic; }
.combo-item {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--cream); border: 1px solid var(--ash); border-radius: var(--r-pill);
  padding: 4px 6px 4px 6px;
}
.combo-num {
  flex-shrink: 0; width: 18px; height: 18px; display: grid; place-items: center;
  background: var(--earth); color: var(--cream);
  font-family: var(--font-mono); font-size: 11px; border-radius: 50%;
}
.combo-item .glaze-swatch-wrap { line-height: 0; }
.combo-name { font-family: var(--font-body); font-size: 13px; color: var(--dark); }
.combo-ctrl { display: inline-flex; gap: 1px; margin-left: 1px; }
.combo-move, .combo-x {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--smoke);
  font-size: 13px; line-height: 1; border-radius: var(--r-sm); transition: all 0.14s;
}
.combo-move:hover { color: var(--dark); background: var(--parchment); }
.combo-x { font-size: 17px; }
.combo-x:hover { color: #c0392b; background: rgba(192,57,43,0.08); }
.combo-hint {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--smoke); margin-left: auto; align-self: center;
}

/* ─── OXIDE / ADDITIVE MARK (flat-view tiles) ─── */
.ox-div { color: var(--ash); font-size: 12px; }
.ox-mark {
  display: inline-block; width: 9px; height: 9px; flex-shrink: 0;
  background: var(--earth); border-radius: 50% 50% 50% 0; transform: rotate(45deg);
}

/* ─── REVIEW MODE BANNER ─── */
#reviewBanner {
  display: none;
  background: var(--dark); color: var(--cream);
  padding: 10px 48px;
  font-family: 'DM Mono', monospace; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  align-items: center; justify-content: space-between; gap: 16px;
}
#reviewBanner.active { display: flex; }
.review-banner-left { display: flex; align-items: center; gap: 14px; }
.review-banner-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--clay); flex-shrink: 0;
  animation: reviewPulse 2s ease-in-out infinite;
}
@keyframes reviewPulse { 0%,100% { opacity:1; } 50% { opacity:0.35; } }
.review-banner-actions { display: flex; align-items: center; gap: 12px; }
.review-scope {
  display: inline-flex; border: 1px solid rgba(255,255,255,0.22);
  border-radius: var(--r-pill); overflow: hidden;
}
.review-scope-btn {
  background: none; border: none; cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.08em; color: rgba(255,255,255,0.6);
  padding: 5px 13px; transition: background 0.15s, color 0.15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.review-scope-btn:hover { color: var(--cream); }
.review-scope-btn.active { background: var(--cream); color: var(--dark); }
.review-scope-count {
  min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--clay); color: var(--cream); border-radius: var(--r-pill);
  font-size: 11px; line-height: 1;
}
.review-scope-count:empty { display: none; }
.review-scope-btn.active .review-scope-count { background: var(--clay); color: var(--cream); }
.review-banner-exit {
  background: none; border: 1px solid rgba(255,255,255,0.25); color: var(--cream);
  font-family: 'DM Mono', monospace; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 4px 12px; cursor: pointer;
  transition: border-color 0.15s; border-radius: var(--r-md);
}
.review-banner-exit:hover { border-color: var(--cream); }
@media (max-width: 600px) {
  #reviewBanner { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .review-banner-actions { gap: 8px; }
  .review-scope-btn { padding: 5px 10px; }
}

/* ─── MASS EDIT MODE ─── */
.me-card {
  background: var(--cream); border: 1px solid var(--ash);
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
  animation: fadeIn 0.22s ease both;
}
.me-card:hover { border-color: var(--dark); box-shadow: 0 4px 16px rgba(26,16,8,0.1); }
.me-card.flagged { border-color: #c4622a; border-width: 2px; }
.me-card-img { aspect-ratio: 1; overflow: hidden; background: var(--parchment); position: relative; }
.me-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-card-meta { padding: 10px 12px; }
.me-card-glaze { font-family: 'DM Mono', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--smoke); margin-bottom: 2px; }
.me-card-name { font-size: 13px; font-weight: 500; color: var(--dark); line-height: 1.2; }
.me-card-clay { font-size: 12px; color: var(--smoke); margin-top: 4px; }
.me-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 36px; border-bottom: 1px solid var(--ash);
  background: var(--parchment);
  font-family: 'DM Mono', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
}
.me-nav-counter { color: var(--smoke); }

/* ─── FLAG BUTTON ─── */
.flag-btn {
  background: none; border: none; cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--smoke); padding: 0;
  display: inline-flex; align-items: center; gap: 3px;
  transition: color 0.15s;
}
.flag-btn:hover { color: var(--clay); }
.flag-btn.flagged { color: #c4622a; }
.flag-note-box {
  background: #fdf3ec; border: 1px solid #e8b490;
  padding: 7px 10px; font-size: 12px; color: #7a3a14; margin-top: 6px;
}

/* ─── PHOTO ITEM OVERFLOW MENU ─── */
.photo-overflow { position: absolute; top: 6px; right: 6px; z-index: 5; }
.photo-overflow-trigger {
  background: rgba(26,16,8,0.54); color: var(--cream);
  border: none; cursor: pointer; padding: 5px 9px;
  font-size: 14px; line-height: 1; letter-spacing: 2px;
  opacity: 0; transition: opacity 0.2s;
}
.photo-item:hover .photo-overflow-trigger { opacity: 1; }
.photo-overflow-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--cream); border: 1px solid var(--ash);
  box-shadow: 0 4px 12px rgba(26,16,8,0.12); min-width: 110px; z-index: 10;
}
.photo-overflow-menu button {
  display: block; width: 100%; padding: 9px 14px;
  text-align: left; background: none; border: none;
  font-family: 'DM Mono', monospace; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--dark); cursor: pointer;
}
.photo-overflow-menu button:hover { background: var(--parchment); }
.photo-overflow-menu button.danger { color: #b83232; }
.photo-view-link {
  display: inline-block; padding: 0;
  font-family: 'DM Mono', monospace; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--smoke); background: none; border: none;
  cursor: pointer; text-decoration: none;
}
.photo-view-link:hover { text-decoration: underline; color: var(--dark); }
.photo-bottom-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; padding-top: 8px; padding-bottom: 2px;
  border-top: 1px solid var(--ash);
}

/* ─── CARD COVER ADJUST BUTTON ─── */
/* Gradient reference-colour chip, shown on a By-glaze tile whose cover is a real photo */
.ref-swatches {
  position: absolute; bottom: 8px; right: 8px; z-index: 3;
  display: flex; gap: 4px; pointer-events: none;
}
.ref-swatch {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 1px 5px rgba(26,16,8,0.32);
}

.card-adjust-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(26,16,8,0.54); color: var(--cream);
  border: none; cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 5px 8px; opacity: 0; transition: opacity 0.2s;
}
.glaze-card:hover .card-adjust-btn { opacity: 1; }

/* ─── COVER PHOTO EDITOR ─── */
#coverPhotoEditorOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,16,8,0.75); z-index: 310;
  align-items: center; justify-content: center;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  padding: 24px 16px;
}
#coverPhotoEditorOverlay.open { display: flex; }
#coverPhotoEditorPanel {
  background: var(--cream); max-width: 480px; width: 100%;
  padding: 32px 36px; position: relative;
  animation: panelIn 0.22s ease;
}
#coverPhotoEditorCanvas {
  position: relative; aspect-ratio: 1; overflow: hidden;
  cursor: grab; background: var(--parchment); border: 1px solid var(--ash);
  user-select: none; -webkit-user-select: none;
}
#coverPhotoEditorCanvas.dragging { cursor: grabbing; }
#coverPhotoEditorImg {
  position: absolute; left: 0; top: 0;
  pointer-events: none; display: block;
}

/* ─── EDIT SAMPLE OVERLAY ─── */
#editOverlay { padding: 24px 16px; z-index: 200; }
#editPanel { max-width: 960px; display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.edit-body { display: flex; flex: 1; min-height: 0; }
.edit-col-photo { width: 42%; flex-shrink: 0; padding: 28px 24px 28px 36px; border-right: 1px solid var(--ash); }
.edit-col-fields { flex: 1; overflow-y: auto; padding: 28px 36px 0 28px; display: flex; flex-direction: column; }
.edit-col-fields .field-block:first-child { margin-top: 0; }
.edit-footer { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 18px 0 28px; margin-top: auto; border-top: 1px solid var(--ash); position: sticky; bottom: 0; background: var(--cream); }
/* Delete is destructive but secondary — keep it quiet so Save reads as primary */
#deleteInReviewBtn { border-color: transparent; padding-left: 4px; padding-right: 8px; }
#deleteInReviewBtn:hover { background: transparent; color: #a52f22; text-decoration: underline; }
.edit-img-preview { width: 100%; object-fit: cover; display: block; margin-bottom: 16px; max-height: none; }

/* ─── EDIT: PHOTO MANAGER ─── */
.edit-photos-block { margin-top: 4px; }
.edit-photos-block .field-lbl { margin-bottom: 10px; }
.edit-photo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.edit-photo-thumb { width: 46px; height: 46px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--ash); }
.edit-photo-kinds { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.epk {
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 8px; border: 1px solid var(--ash); background: transparent; color: var(--smoke); cursor: pointer;
  transition: all 0.15s;
}
.epk:hover:not(.active) { border-color: var(--earth); color: var(--earth); }
.epk.active { background: var(--earth); border-color: var(--earth); color: var(--cream); }
.edit-photo-remove {
  flex-shrink: 0; width: 26px; height: 26px; line-height: 1; font-size: 18px;
  border: none; background: none; color: var(--smoke); cursor: pointer;
}
.edit-photo-remove:hover:not(:disabled) { color: #a52f22; }
.edit-photo-remove:disabled { opacity: 0.3; cursor: default; }
.edit-photo-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.edit-photo-add .btn { font-size: 12px; padding: 7px 12px; }

/* ─── MANAGE TABS ─── */
.manage-tabs {
  display: flex; border-bottom: 1px solid var(--ash);
  background: var(--parchment);
}
.manage-tab {
  font-family: 'DM Mono', monospace; font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 14px 28px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; color: var(--smoke); transition: all 0.15s;
}
.manage-tab:hover { color: var(--earth); }
.manage-tab.active { color: var(--dark); border-bottom-color: var(--earth); background: var(--cream); }
.manage-add-row { padding: 16px 0 4px; }

/* TAG STEP */
.tag-step { display: none; }
.tag-step.active { display: block; }

.progress-wrap { display: flex; gap: 3px; margin-bottom: 24px; }
.pdot { height: 3px; flex: 1; background: var(--ash); transition: background 0.2s; }
.pdot.done { background: var(--earth); }
.pdot.current { background: var(--dark); }

.tag-layout { display: flex; gap: 28px; align-items: flex-start; }
.tag-img-col { flex: 0 0 320px; position: sticky; top: 28px; }
.tag-fields-col { flex: 1; min-width: 0; }
.tag-img-wrap { position: relative; margin-bottom: 0; height: 340px; background: var(--parchment); display: flex; align-items: center; justify-content: center; }
.tag-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag-img-fallback { font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--smoke); text-align: center; display: none; }
.tag-img-spinner {
  position: absolute; inset: 0;
  background: rgba(26,16,8,0.35);
  display: none; align-items: center; justify-content: center;
}
.tag-img-spinner.active { display: flex; }
.tag-img-spinner svg { animation: spin 0.9s linear infinite; }
.tag-img-remove {
  position: absolute; top: 8px; right: 8px;
  background: rgba(26,16,8,0.6); color: white;
  border: none; font-size: 16px; cursor: pointer;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
}

.ai-hint {
  background: rgba(122,170,150,0.1); border-left: 3px solid var(--celadon);
  padding: 10px 14px; margin-bottom: 20px;
  font-size: 12px; color: #5a8a76; line-height: 1.6;
  display: flex; gap: 10px;
}
.ai-hint .ai-spinner { animation: spin 1s linear infinite; display: inline-block; }

.field-block { margin-bottom: 26px; }
.field-lbl {
  font-family: var(--font-mono);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--earth); margin-bottom: 9px; display: block;
}
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sel-chip {
  font-family: var(--font-body); font-size: 13px;
  padding: 8px 15px; border: 1.5px solid var(--ash); border-radius: var(--r-pill);
  background: transparent; color: var(--dark);
  cursor: pointer; transition: all 0.14s;
}
.sel-chip:hover:not(.on) { border-color: var(--earth); color: var(--earth); }
.sel-chip.on { background: var(--earth); color: var(--cream); border-color: var(--earth); }
.sel-chip.has-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; }
.sel-chip.has-swatch .glaze-swatch-wrap { line-height: 0; }
.sel-chip.has-swatch .glaze-swatch { width: 18px; height: 18px; }
.sel-chip.has-pip { display: inline-flex; align-items: center; gap: 8px; padding-left: 12px; }
.sel-chip.has-pip .clay-pip { width: 12px; height: 12px; }
.sel-chip.add { border-style: dashed; color: var(--smoke); }
.sel-chip.add:hover { border-color: var(--earth); color: var(--earth); }

.text-input {
  width: 100%; font-family: var(--font-body); font-size: 14px;
  padding: 10px 13px; border: 1px solid var(--ash); border-radius: var(--r-md);
  background: var(--white-clay); color: var(--dark); outline: none;
}
.text-input:focus { border-color: var(--earth); }

.tag-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--ash);
}
.tag-nav-left { font-size: 12px; color: var(--smoke); }

/* ─── MANAGE PANEL ─── */
#managePanel { max-width: 720px; }
.manage-body { padding: 24px 36px 36px; }
.manage-list { display: flex; flex-direction: column; gap: 2px; }
.manage-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; background: var(--white-clay);
  transition: background 0.15s;
}
.manage-item:hover { background: var(--parchment); }
.manage-item img { width: 48px; height: 48px; object-fit: cover; flex-shrink: 0; }
.manage-item-info { flex: 1; }
.manage-item-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; font-weight: 400; color: var(--ink);
}
.manage-item-sub { font-size: 12px; color: var(--smoke); margin-top: 2px; }
.manage-item-actions { display: flex; gap: 14px; align-items: center; }

/* ─── MANAGE: GLAZE GALLERY ─── */
.manage-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.manage-glaze-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}
.manage-glaze-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px;
  padding: 18px 12px 12px; background: var(--white-clay);
  border: 1px solid var(--ash); border-radius: var(--r-md);
  transition: border-color 0.15s, background 0.15s;
}
.manage-glaze-card:hover { border-color: var(--earth); background: var(--parchment); }
.mg-swatch { line-height: 0; margin-bottom: 4px; }
.mg-name {
  font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 400;
  color: var(--ink); line-height: 1.15; overflow-wrap: anywhere;
}
.mg-sub { font-size: 12px; color: var(--smoke); }
.mg-warn { color: #9a4620; white-space: nowrap; }
.mg-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
/* In the narrow cards, pop menus centred so they stay inside the panel */
.manage-glaze-card .warn-menu { left: 50%; right: auto; transform: translateX(-50%); }
.manage-glaze-card .overflow-menu { left: 50%; right: auto; transform: translateX(-50%); }

/* ─── TOAST ─── */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(120px);
  background: var(--dark); color: var(--cream);
  font-size: 12px; padding: 12px 24px; letter-spacing: 0.06em;
  z-index: 500; transition: transform 0.3s ease; white-space: nowrap;
  pointer-events: none;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ─── RESPONSIVE ─── */
@media (max-width: 680px) {
  /* Header — compact but tappable */
  header { padding: 14px 16px 12px; gap: 8px; }
  h1 { font-size: 22px; }
  .wordmark { font-size: 12px; letter-spacing: 0.14em; }
  header > div:first-child { gap: 10px; }
  header > div:first-child img { width: 34px !important; height: 34px !important; }
  .header-right { gap: 6px; }

  /* Search — icon toggles a full-width row under the header */
  #searchToggle { display: inline-flex; }
  .header-search {
    position: absolute; top: 100%; left: 0; right: 0; width: auto;
    display: none; padding: 10px 16px; background: var(--parchment);
    border-bottom: 1px solid var(--ash); z-index: 40;
  }
  .header-search.open { display: block; }
  .header-search:focus-within { width: auto; }
  .header-search .search-close { display: flex; }

  /* Control bar — tighter gutters */
  .control-bar { padding: 10px 16px; gap: 8px; }
  .seg-btn { padding: 7px 14px; }

  /* Filters become a bottom sheet */
  .filters-panel {
    top: auto !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100%; max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: none;
    max-height: 82vh;
  }
  .filters-foot { display: block; padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--ash); }
  .filters-foot .btn { width: 100%; }
  .chip-scroll { flex-wrap: wrap; }
  .chip, .sel-chip { white-space: nowrap; }

  .card-adjust-btn { opacity: 0.8; }

  /* Gallery */
  .gallery { padding: 10px 10px 72px; grid-template-columns: repeat(2, 1fr); gap: 2px; }
  .card-name { font-size: 17px; }
  .card-meta { padding: 10px 10px 12px; }

  /* Overlays — bottom sheet (detail, upload, edit) */
  .overlay { padding: 0; align-items: flex-end; }
  .panel {
    border-radius: 14px 14px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #detailPanel, #uploadPanel, #editPanel { max-width: 100%; }

  /* Upload + Edit: fixed-height sheet — pinned header, one scroll region, pinned action bar.
     (Detail stays a plain scroll sheet; it has no footer to pin.) */
  #uploadPanel, #editPanel {
    height: 92vh; height: 92dvh;
    max-height: 92vh; max-height: 92dvh;
    overflow: hidden;
    display: flex; flex-direction: column;
  }
  #uploadPanel .panel-header, #editPanel .panel-header,
  #massEditNav, #editFlagInfo { flex-shrink: 0; }

  /* Panel chrome */
  .panel-header { padding: 18px 20px 14px; position: sticky; top: 0; background: var(--cream); z-index: 10; }
  .panel-header h2 { font-size: 24px; }
  .panel-header::before {
    content: ''; display: block; width: 36px; height: 4px;
    background: var(--ash); border-radius: 2px;
    margin: 0 auto 14px;
  }

  /* Detail */
  .detail-body { padding: 14px 16px 32px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .detail-clay-filters { gap: 5px; margin-bottom: 16px; }

  /* Upload / Edit — the upload-body is the single scroll region between the
     pinned header and the pinned action bar below. */
  .upload-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px 16px 0; }
  .sel-chip { padding: 10px 14px; font-size: 12px; }
  .tag-layout { flex-direction: column; gap: 0; }
  .tag-img-col { flex: none; width: 100%; position: static; }
  .tag-img-wrap { height: 180px; margin-bottom: 20px; }

  /* Upload action bar — pinned to the bottom of the sheet, full-bleed, safe-area aware */
  .tag-nav {
    position: sticky; bottom: 0; z-index: 5;
    margin: 16px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--cream); border-top: 1px solid var(--ash);
    flex-wrap: wrap; gap: 8px;
  }
  .tag-nav-left { display: none; }              /* header already shows "Photo X of N" */
  .tag-nav > div { flex: 1; flex-wrap: wrap; justify-content: flex-end; }
  #saveNextBtn { flex: 1; }

  /* Edit panel — single column, edit-body is the single scroll region */
  .edit-body { flex: 1; min-height: 0; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .edit-col-photo { width: 100%; padding: 14px 16px 0; border-right: none; }
  .edit-col-fields { padding: 0 16px; overflow-y: visible; }
  .edit-img-preview { max-height: 200px; }
  /* Edit action bar — pinned to the bottom of the sheet */
  .edit-footer {
    position: sticky; bottom: 0; z-index: 5;
    margin: 24px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
  .field-block { margin-bottom: 18px; }

  /* Manage — full-screen page, no backdrop */
  #manageOverlay {
    background: transparent;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    padding: 0; align-items: stretch;
    pointer-events: none;
  }
  #manageOverlay.open { pointer-events: auto; }
  #managePanel {
    border-radius: 0;
    max-height: 100vh; height: 100vh;
    max-width: 100%; width: 100%;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  #managePanel .panel-header::before { display: none; }
  #managePanel .panel-header {
    display: grid; grid-template-columns: auto 1fr auto;
    align-items: center; gap: 12px; padding: 14px 16px;
  }
  #managePanel .panel-header h2 { text-align: center; font-size: 22px; }
  .manage-back-btn {
    display: flex; align-items: center;
    font-family: 'DM Mono', monospace; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.08em;
    background: none; border: none; color: var(--earth);
    cursor: pointer; padding: 4px 0; white-space: nowrap;
  }
  .manage-close-x { display: none; }
  .manage-body { padding: 12px 16px 32px; }
  .manage-tab { padding: 12px 20px; font-size: 13px; }
  .manage-item { padding: 10px 12px; }
  .manage-item-name { font-size: 15px; }

  /* Lightbox — stacked on mobile */
  #lightbox { align-items: flex-end; }
  #lightboxInner { flex-direction: column; height: 100vh; width: 100%; }
  #lightboxPhotoWrap { flex: 0 0 auto; padding: 0; overflow: hidden; gap: 8px; }
  #lightboxImgWrap { width: 100%; }
  #lightboxImg { width: 100%; height: 46vh; object-fit: cover; display: block; }
  #lightboxStrip { padding: 8px 10px; gap: 6px; }
  .lb-thumb { width: 48px; height: 48px; }
  #lightboxDetails {
    width: 100%; flex: 1;
    border-radius: 14px 14px 0 0;
    max-height: 48vh;
  }
  #lightboxDetailsHeader { padding: 12px 16px 0; }
  #lightboxDetailsBody { padding: 8px 20px 0; }
  #lightboxDetails .lb-glaze-name { font-size: 20px; margin-bottom: 10px; }

  /* Toast */
  #toast { font-size: 12px; padding: 10px 18px; bottom: 16px; }
}


/* ─── ACCESSIBILITY: focus-visible + reduced motion ─── */
:focus-visible {
  outline: 2px solid var(--earth);
  outline-offset: 2px;
}
/* Light ring on dark surfaces */
.btn-dark:focus-visible,
#reviewBanner :focus-visible,
.seg-btn.active:focus-visible,
.review-scope-btn.active:focus-visible,
.mobile-filter-toggle.active:focus-visible {
  outline-color: var(--cream);
}
/* Inputs already show a border-color change; give them the ring too */
.search-wrap input:focus-visible,
.glaze-search:focus-visible,
.text-input:focus-visible { outline: 2px solid var(--earth); outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  #topbar { transition: none !important; }
  .review-banner-dot { animation: none !important; }
}
