:root {
  /* DARK (current default) */
  --bg: #0b0b0b;
  --panel: #111315;
  --muted: #9aa3a1;
  --accent: #84e07b;
  --accent-strong: #5fd85a;
  --card: #171819;
  --white: #e8f0e8;
  --danger: #ff6b6b;
  --glass: rgba(255, 255, 255, 0.03);
  --radius: 16px;

  /* theme toggle icon */
  --icon-fill: #e5f2e8;
  --icon-fill-hover: #ffffff;
}

/* LIGHT THEME OVERRIDES */
:root[data-theme="light"] {
  --bg: #f9fafb;
  --panel: #ffffff;
  --muted: #6b7280;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --card: #f3f4f6;
  --white: #020617;
  --danger: #ef4444;
  --glass: rgba(15, 23, 42, 0.03);

  --icon-fill: #0f172a;
  --icon-fill-hover: #111827;
}


* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.nav,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 600;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  padding: 14px 14px 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  padding: 14px;
}

/* theme.css */
.card.selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  margin-top: 6px;
}

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

.btn.alt {
  background: #2b2f31;
  color: var(--white);
}

.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--white);
}

.btn.wide {
  width: 100%;
  margin-bottom: 6px;
}

/* --- LIGHT THEME OVERRIDES FOR BUTTONS --- */
html[data-theme="light"] .btn.ghost {
  border-color: rgba(15, 23, 42, 0.16); /* visible border on white */
  color: #111827;                        /* dark text in light mode */
}

html[data-theme="light"] .btn.alt {
  color: #f9fafb;         /* light text so “Make Print-Ready” is readable */
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}

/* Base chip style – uses theme variables */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .12);  /* good for dark */
  background: var(--glass);
  color: var(--white);
  cursor: pointer;
  font-weight: 500;
}

/* Active chip: green ring in both themes */
.chip.active {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Pending / disabled chips */
.chip.pending,
button.chip.pending {
  background: rgba(255, 255, 255, .06);
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, .16);
  cursor: not-allowed;
  pointer-events: none;
}

/* --- LIGHT THEME OVERRIDES FOR CHIPS --- */
html[data-theme="light"] .chip {
  border-color: rgba(15, 23, 42, 0.12);        /* subtle dark border */
  background: rgba(15, 23, 42, 0.02);          /* very light grey pill */
  color: #111827;                              /* dark text on light bg */
}

html[data-theme="light"] .chip.pending,
html[data-theme="light"] button.chip.pending {
  background: rgba(15, 23, 42, 0.03);
  border-color: rgba(15, 23, 42, 0.18);
}


/* Pending / disabled buttons */
.btn.pending {
  background: #2b2f31;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, .16);
  cursor: not-allowed;
  pointer-events: none;
}


.label {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 6px;
}

.muted {
  color: var(--muted);
}

.strong {
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  /* allow page to grow + scroll */
  min-height: 100dvh;
  overflow: visible;
  align-items: start;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel {
    height: auto;
    max-height: none;
  }
}

.bubble {
  border: 1px solid rgba(255, 255, 255, .08);
  background: var(--glass);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.concepts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.concepts .card {
  padding: 6px;
  cursor: pointer;
}

.concepts img {
  width: 100%;
  height: 140px;
  object-fit: contain;
}

.preview {
  margin-top: 16px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

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

.card.link {
  text-decoration: none;
  color: inherit;
}

textarea,
textarea.card {
  color: var(--white);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 0.8em;
  min-height: 60px;
  max-height: 90px;
  resize: vertical;
}

/* --- LIGHT THEME BORDERS FOR CARDS / PANELS / TEXTAREAS --- */
html[data-theme="light"] .panel,
html[data-theme="light"] .card,
html[data-theme="light"] .bubble,
html[data-theme="light"] textarea,
html[data-theme="light"] textarea.card {
  border-color: rgba(15, 23, 42, 0.08);
}

/* Slightly stronger card/panel shadow in light mode */
html[data-theme="light"] .panel,
html[data-theme="light"] .card {
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
}

#design-size-slider {
  appearance: none;
  width: 80%;
  height: 16px;
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 12px;
  outline: none;
  margin: 0 0 4px 0;
  box-shadow: 0 0 0 2px rgba(132, 224, 123, 0.15);
}

#design-size-slider::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--glass);
  border-radius: 8px;
}

#design-size-slider::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(132, 224, 123, 0.25);
  cursor: pointer;
  margin-top: -7px;
}

#design-size-slider:focus {
  border-color: var(--accent-strong);
}

#design-size-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(132, 224, 123, 0.25);
  cursor: pointer;
}

#design-size-slider::-moz-range-track {
  height: 8px;
  background: var(--glass);
  border-radius: 8px;
}

#design-size-slider::-ms-fill-lower,
#design-size-slider::-ms-fill-upper {
  background: var(--glass);
  border-radius: 8px;
}


#tshirt-options {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
  padding-left: 10px;
}

#tote-options {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
  padding-left: 10px;
}

/* Custom slider for tiger size */
#tiger-size-slider {
  appearance: none;
  width: 80%;
  height: 16px;
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 12px;
  outline: none;
  margin: 0 0 4px 0;
  box-shadow: 0 0 0 2px rgba(132, 224, 123, 0.15);
}

#tiger-size-slider::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--glass);
  border-radius: 8px;
}

#tiger-size-slider::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(132, 224, 123, 0.25);
  cursor: pointer;
  margin-top: -7px;
}

#tiger-size-slider:focus {
  border-color: var(--accent-strong);
}

#tiger-size-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(132, 224, 123, 0.25);
  cursor: pointer;
}

#tiger-size-slider::-moz-range-track {
  height: 8px;
  background: var(--glass);
  border-radius: 8px;
}

#tiger-size-slider::-ms-fill-lower,
#tiger-size-slider::-ms-fill-upper {
  background: var(--glass);
  border-radius: 8px;
}

#clay-options {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
  padding-left: 10px;
}

#painting-options {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
  padding-left: 10px;
}

#toy-options {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding-right: 2px;
  padding-left: 10px;
}

/* Navigation buttons styling */
nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: clamp(44px, 3.5vh, 56px);
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 160ms ease;
}

.nav-link:hover {
  color: #000;
  background: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.nav-link.active {
  background: var(--accent);
  color: #000;
}

/* TOP STICKY HEADER */
.top-wrap {
  position: sticky;
  top: 0;
  z-index: 999;
  width: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
  padding: 8px 20px;
  border-bottom: none;
  backdrop-filter: blur(6px);
}

.divider {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 1px;
  background: #ffffff;
  opacity: 0.06;
}

.greeting-headline {
  font-family: 'Melodrama', serif;
  font-size: clamp(20px, 8vw, 20px);
  font-weight: 700;
  color: #FFFFFF99;
  letter-spacing: 1px;
  margin-right: 10px;
}

#brief {
  min-height: 120px;
  max-height: 240px;
}

#btn-send {
  margin-bottom: 6px;
}

/* --- Clay modifier modal --- */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(2px);
}

.modal__panel {
  position: relative;
  width: min(1100px, 96vw);
  margin: 6vh auto;
  padding: 14px;
  border-radius: var(--radius);
}

.modal__header,
.modal__footer,
.modal__row,
.modal__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.modal__footer {
  justify-content: flex-end;
  margin-top: 10px;
}

.modal__controls {
  margin: 8px 0;
}

.modal__label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sw {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #ffffff22;
  background: #111;
}

.modal__canvasWrap {
  position: relative;
  display: inline-block;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
  border-radius: 10px;
  max-width: 100%;
  margin-top: 8px;
}

#mod-main,
#mod-overlay {
  display: block;
  border-radius: 10px;
  max-width: 100%;
  height: auto;
  background: transparent;
}

/* Backdrop */
#clay-modal.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
}

/* Centered dialog shell */
#clay-modal .modal__dialog {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(960px, 96vw);
  background: #111315;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  /* key */
  overflow: hidden;
  /* contain child scroll */
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}

/* Header + footer fixed; body scrolls */
#clay-modal .modal__header,
#clay-modal .modal__footer {
  padding: 12px 16px;
  background: #0f1113;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

#clay-modal .modal__footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  border-bottom: none;
}

/* Scroll here */
#clay-modal .modal__body {
  padding: 12px 16px;
  overflow: auto;
  /* key */
}

/* Canvas area sizing */
#clay-modal .canvas-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

#clay-modal canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: transparent;
  border-radius: 10px;
}

/* Utility: hide/show */
#clay-modal.hidden {
  display: none;
}

/* Mobile: dialog fills screen */
@media (max-width: 640px) {
  #clay-modal .modal__dialog {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* == Baseline container (keeps your current MacBook look) == */
:root {
  --base-w: 1280px;
  /* your current CSS width target */
  --pad: 24px;
  --pad-lg: 48px;
  /* gentle upscale above 1280px, capped at +12% */
  --scale-lg: clamp(1, (min(100vw, 1800px) - 1280px)/520 + 1, 1.12);
}

/* used by header, main, footer already in base.html via .container */
.container {
  width: min(var(--base-w), 100% - 2*var(--pad));
  margin-inline: auto;
}

/* tasteful breathing room and typographic nudge on big screens */
@media (min-width: 1440px) {
  .container {
    width: min(calc(var(--base-w) + 120px), 100% - 2*var(--pad-lg));
  }

  .panel,
  .card,
  .nav,
  .btn,
  .muted,
  .strong {
    font-size: calc(1rem * var(--scale-lg));
  }

  .panel,
  .card {
    padding: calc(16px * var(--scale-lg));
  }
}

/* Header breathing room and safe wrapping */
.top-wrap header {
  padding-inline: clamp(12px, 4vw, 32px);
}

.top-wrap nav {
  flex-wrap: wrap;
}

/* --- Mobile header tweaks for app pages (signin / studio / gallery / merch) --- */
header.container.nav nav {
  display: flex;
  flex-wrap: nowrap;
  /* force a single row */
  align-items: center;
}

/* Tighten spacing a bit on small screens so everything fits nicely */
@media (max-width: 600px) {
  header.container.nav {
    padding-inline: 12px;
  }

  header.container.nav nav {
    gap: 6px;
    overflow-x: auto;
    /* if it's *really* tight, it scrolls instead of wrapping */
  }

  header.container.nav .nav-link {
    padding-inline: 10px;
    font-size: 0.85rem;
  }
}

/* =========================
   MOBILE HEADER LAYOUT
   ========================= */
@media (max-width: 600px) {

  /* Make header stack vertically: logo on top, nav below */
  header.container.nav {
    display: flex;
    /* in case it isn't explicitly set */
    flex-direction: column;
    /* logo first row, nav second row */
    align-items: center;
    gap: 8px;
    padding-inline: 12px;
  }

  /* Shrink the logo a bit on mobile */
  header.container.nav img {
    max-height: 32px;
    width: auto;
  }

  /* Put all buttons on a single line that can wrap nicely */
  header.container.nav nav {
    display: flex;
    flex-wrap: wrap;
    /* allow nav links to go to next line if needed */
    justify-content: center;
    /* center them under the logo */
    gap: 8px;
    width: 100%;
  }

  header.container.nav .nav-link {
    padding-inline: 10px;
    font-size: 0.85rem;
  }
}

/* Hero image stays centered, doesn’t explode on 4K */
.image-container img {
  max-width: 420px;
}

/* Headline already uses clamp(); keep baseline, add small tweak on narrow viewports */
@media (max-width: 480px) {
  .headline {
    line-height: .9;
    margin-top: 12px;
  }
}

/* Sign-up inputs keep width but don’t jump on ultrawide */
.signup {
  padding: clamp(48px, 8vh, 96px) 0;
}

/* Studio grid */
.grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  /* fixed sidebar width at baseline */
  gap: 24px;
  align-items: start;
}

/* Cards and panels – now theme-aware */
.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 16px;
}

/* Concepts grid is fluid without changing design */
.concepts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.preview {
  height: min(62vh, 720px);
  overflow: hidden;
}

/* Collapse to single column on tablets/phones */
@media (max-width: 1100px) {
  .grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel {
    position: static;
  }

  /* guard against sticky/pos artifacts */
  .preview {
    height: min(54vh, 640px);
  }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card.link {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  z-index: 1000;
}

.modal__dialog {
  max-width: min(920px, 96vw);
  max-height: min(90vh, 100dvh - 40px);
  overflow: auto;
  /* <-- allows scroll */
  background: var(--panel);
  color: var(--white);
  border: 1px solid #ffffff12;
  border-radius: 14px;
  padding: 16px;
}

/* Mobile-only styling for the TAGS modal (and nothing else) */
@media (max-width: 640px) {
  #tags-modal .modal__dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    padding: 16px !important;
  }
}

.modal__body .canvas-wrap {
  max-width: 100%;
}

/* --- Tasteful upscale for Home page hero --- */
.home-hero,
.home-hero .container {
  width: min(90vw, 1600px);
  /* expands beyond 1280px but stops around 1600px */
  transform: scale(calc(1 + (min(100vw, 1600px) - 1280px)/3200));
  transform-origin: center top;
  transition: transform .4s ease;
}

/* keep giant text balanced visually */
.home-hero .headline {
  font-size: clamp(3rem, 8vw, 8rem);
  /* scales between phones and large screens */
  line-height: 0.95;
  text-align: center;
}

/* keep hero image and input centered as it grows */
.home-hero img {
  width: clamp(280px, 40vw, 520px);
  margin-inline: auto;
  display: block;
}

/* === Auth spacing standardization (login ↔ signup) ===
   Set this once to match your SIGN-IN gap.
   If your sign-in page already looks perfect, start with 24px.
   Change only --auth-gap to fine-tune. */
:root {
  --auth-gap: clamp(20px, 4vh, 36px);
}

/* 1) Kill accidental extra space from headings/paragraphs inside auth cards */
.auth-card h1,
.auth-card h2,
.auth-card h3,
.auth-card p,
.auth-card .subtitle {
  margin-bottom: 0;
}

/* 2) Apply ONE controlled gap between the last text and the first field */
:where(.auth-card) :is(h1, h2, h3, p, .subtitle):last-of-type+form {
  margin-top: var(--auth-gap) !important;
  /* used by BOTH sign-in and sign-up */
  padding-top: 0 !important;
}

/* 3) Make sure the form itself doesn’t re-add space on the first row */
.auth-card form .field:first-child,
.auth-card form .form-row:first-child,
.auth-card form .input-group:first-child {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* 4) Guard against global scaling changing this specific gap */
body.route-signup :where(.auth-card) :is(h1, h2, h3, p, .subtitle):last-of-type+form,
body.route-signin :where(.auth-card) :is(h1, h2, h3, p, .subtitle):last-of-type+form {
  transform: none !important;
}

/* T-shirt concept tiles: same sizing as other products */
#concepts-front .card,
#concepts-back .card {
  padding: 6px;
  cursor: pointer;
}

#concepts-front .card img,
#concepts-back .card img {
  width: 100%;
  height: 140px;
  /* match other concept tiles */
  object-fit: contain;
  /* keep aspect, no distortion */
  display: block;
}

.powered-by {
  font-size: 0.85em;
  color: var(--muted);
  opacity: 0.8;
}

/* Merch grid – similar behavior to gallery grid */
.merch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  max-width: 1000px;
  margin: 32px auto;
}

/* Optional: slightly tighter spacing on very small phones */
@media (max-width: 480px) {
  .merch-grid {
    gap: 12px;
  }
}

/* =========================
   MOBILE MERCH LAYOUT
   ========================= */
@media (max-width: 600px) {
  .merch-grid {
    display: flex !important;
    /* override any grid/flex-row */
    flex-direction: column;
    /* stack items vertically */
    gap: 16px;
  }

  .merch-grid>* {
    width: 100%;
    /* each card takes full width */
  }
}

section.panel h2 {
  text-align: center;
  margin-bottom: 24px;
}

.m-card {
  width: 100%;
  max-width: 300px;
}

.page-title {
  font-family: 'Melodrama', serif;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Theme-aware text selection */
html[data-theme="dark"] ::selection {
  background: rgba(132, 224, 123, 0.35); /* soft green */
  color: #ffffff;
}

html[data-theme="light"] ::selection {
  background: rgba(21, 128, 61, 0.20);   /* darker green on light bg */
  color: #111827;
}

/* --- LIGHT THEME TABLE ROW BORDERS (orders / requests / history) --- */
html[data-theme="light"] table th,
html[data-theme="light"] table td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
}