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

:root {
  --cream: #faf7f2;
  --warm-white: #fffef9;
  --parchment: #f2ede4;
  --gold: #c9a96e;
  --gold-light: #e8d5b0;
  --gold-dark: #9a7a45;
  --ink: #1a1714;
  --ink-soft: #3d3830;
  --ink-muted: #7a7268;
  --border: rgba(201,169,110,0.25);
  --soft: #e8ddd4;
}

html { scroll-behavior: smooth; }

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  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='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.4;
}

/* NAV */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 20px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(250,247,242,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ink);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s;
}

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

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 40px 0;
  position: relative;
  z-index: 1;
}

/* Gallery page */
.gallery-intro {
  text-align: center;
  margin-bottom: 3rem;
  padding: 60px 0;
}

.gallery-title {
  font-family: "Cormorant Garamond", serif;
  font-weight: 300;
  font-size: 2.4rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.gallery-sub {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2.5rem;
  padding-bottom: 5rem;
}

.gallery-skeleton {
  height: 460px;
  background: linear-gradient(90deg, var(--parchment) 25%, var(--gold-light) 50%, var(--parchment) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 16px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gallery-card {
  background: var(--warm-white);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--gold-light);
  transition: transform 0.25s, box-shadow 0.25s;
  animation: cardFadeUp 0.5s both ease-out;
}

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

.gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(26,23,20,0.14);
}

/* Thumbnail: a fixed-height stage that centers the scaled tag */
.gallery-thumb {
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 260px;
  overflow: hidden;
}

.gallery-card-body {
  padding: 1.4rem 1.5rem 1.5rem;
}

.gallery-card-name {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

.gallery-card-desc {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

.feat-tag {
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--parchment);
  color: var(--ink-muted);
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid var(--gold-light);
}

.feat-tag.font-preview {
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
  background: white;
  color: var(--ink);
  border: 1.5px solid var(--gold);
  padding: 6px 12px;
  font-weight: inherit;
  text-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.btn-select-design {
  width: 100%;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.85rem 1.5rem;
  font-family: "Jost", sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: background 0.2s, transform 0.15s;
}
.btn-select-design:hover { background: var(--ink-soft); transform: translateY(-1px); }
.btn-select-design svg { width: 14px; height: 14px; flex-shrink: 0; }

.gallery-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--ink-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

/* Editor page */
.studio {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 4rem;
  align-items: start;
  padding-bottom: 5rem;
}

.back-to-designs {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.back-to-designs:hover {
  color: var(--gold-dark);
}

.design-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--parchment);
  border: 1px solid var(--gold-light);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1.8rem;
}

.design-badge-name {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
}

.design-badge-change {
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-decoration: none;
  transition: opacity 0.2s;
}
.design-badge-change:hover { opacity: 0.7; }

.form-panel h2 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 300;
  font-size: 2rem;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.form-panel p.sub {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: 2.5rem;
}

.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold);
  color: white;
  font-size: 0.7rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.step-body { flex: 1; }

.step-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
  display: block;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
}

.ampersand {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  color: var(--gold);
  text-align: center;
  padding-top: 0.3rem;
}

input[type="text"],
input[type="date"] {
  width: 100%;
  background: var(--warm-white);
  border: 1px solid var(--gold-light);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-family: "Jost", sans-serif;
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,0.12);
}

input::placeholder { color: #c5b8af; }
.tagline-input { width: 100%; }

.photo-upload-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--warm-white);
  border: 1.5px dashed var(--gold-light);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 300;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  transition: border-color 0.2s, background 0.2s;
}
.photo-upload-label:hover { border-color: var(--gold); background: #fdf8f3; }
.photo-upload-label svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--gold); }

.photo-remove-btn {
  margin-top: 0.5rem;
  background: none;
  border: none;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #b0a09a;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}
.photo-remove-btn:hover { color: var(--gold); }

.cta-section { margin-top: 2rem; }

.btn-download-pdf {
  width: 100%;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 1rem 2rem;
  font-family: "Jost", sans-serif;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}
.btn-download-pdf:hover:not(:disabled) { background: var(--ink-soft); transform: translateY(-1px); }
.btn-download-pdf:active:not(:disabled) { transform: translateY(0); }
.btn-download-pdf:disabled { opacity: 0.6; cursor: wait; }
.btn-download-pdf svg { width: 16px; height: 16px; flex-shrink: 0; }

.dl-note {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 300;
  color: #b0a09a;
  margin-top: 0.8rem;
  letter-spacing: 0.05em;
}

/* Preview panel */
.preview-panel {
  position: sticky;
  top: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-label {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  text-align: center;
}

/* tagWrapper is sized by JS to match the design dimensions */
.tag-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  filter: drop-shadow(0 10px 20px rgba(26, 23, 20, 0.42));
}

/* tag-root is built by tag-renderer.js — just handle the pulse animation here */
.tag-root.updating .tag-field {
  animation: tagPulse 0.3s ease;
}

.preview-meta {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}

.preview-meta span {
  display: inline-block;
  background: var(--parchment);
  padding: 3px 10px;
  border-radius: 20px;
  margin: 2px;
}

@keyframes tagPulse {
  0%   { opacity: 1; }
  40%  { opacity: 0.7; }
  100% { opacity: 1; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 780px) {
  nav { padding: 16px 20px; }
  .nav-links { display: none; }
  
  .studio {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .preview-panel {
    position: static;
    order: -1;
  }
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .back-link {
    position: static;
    transform: none;
    margin-bottom: 1rem;
  }
}

/* Custom dropdown styling */
.custom-select {
  position: relative;
  width: 100%;
  user-select: none;
}

.custom-select-trigger {
  background: var(--warm-white);
  border: 1px solid var(--gold-light);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.custom-select-trigger:hover {
  border-color: var(--gold);
  background: linear-gradient(to bottom, var(--warm-white), #fefaf5);
}

.custom-select-trigger.open {
  border-color: var(--gold);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: #fefaf5;
}

#selectedFontDisplay {
  flex: 1;
  font-size: 0.9rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-arrow {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
  color: var(--gold);
}

.custom-select-trigger.open .dropdown-arrow {
  transform: rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--warm-white);
  border: 1px solid var(--gold);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.custom-select-options.show {
  display: block;
  animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-select-option {
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--gold-light);
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover {
  background: var(--parchment);
}

/* Scrollbar styling for dropdown */
.custom-select-options::-webkit-scrollbar {
  width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
  background: var(--parchment);
  border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 3px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

/* Font selector container */
.font-selector {
  margin-top: 12px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

