/* card-maker.css
   The card maker shell. Dark only: the light theme and its toggle were removed,
   so there is no `body.dark` scoping any more.
   Modals built in card-maker.js carry their own inline styles and are not themed here. */

/* ===== LT Museum Font Family ===== */

@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-LightItalic.ttf") format("truetype");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-MediumItalic.ttf") format("truetype");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-BoldItalic.ttf") format("truetype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-Black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "LT Museum";
  src: url("./assets/fonts/LTMuseum-BlackItalic.ttf") format("truetype");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

/* ===== Tokens ===== */

:root {
  color-scheme: dark;

  --bg: #0e0f12;
  --surface: #14161b;
  --surface-2: #191c22;
  --surface-3: #21252d;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.20);

  --text: #f1f3f7;
  --muted: #949cab;

  /* Pulled from the logo so the UI and the brand agree. */
  --accent: #f5c518;
  --accent-ink: #1a1400;
  --danger: #e0524a;

  --radius: 10px;
  --radius-lg: 14px;
  --gap: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-family: "LT Museum", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===== Sidebar shell ===== */

#controls {
  width: 430px;
  flex: 0 0 430px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

/* Everything between the header and the save bar scrolls; those two stay put. */
.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 14px 18px;
}

.panel-scroll::-webkit-scrollbar { width: 10px; }
.panel-scroll::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 10px;
  border: 2px solid var(--surface);
}
.panel-scroll::-webkit-scrollbar-thumb:hover { background: #2c313b; }

/* ===== Brand header ===== */

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.app-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.14));
}

.app-wordmark {
  display: block;
  width: 150px;
  height: auto;
}

.app-subtitle {
  margin: 3px 0 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ===== Session strip ===== */

.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.session-status {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-status.is-admin { color: var(--accent); }

.session-bar button {
  flex: 0 0 auto;
  padding: 7px 11px;
  font-size: 12px;
}

/* ===== Quick nav ===== */

.quick-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.quick-nav button {
  padding: 9px 6px;
  font-size: 12px;
  font-weight: 700;
}

/* ===== Controls ===== */

button,
input,
select,
textarea {
  font: inherit;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input:hover,
select:hover,
textarea:hover { border-color: rgba(255, 255, 255, 0.30); }

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.22);
}

textarea {
  min-height: 108px;
  resize: vertical;
  line-height: 1.45;
}

select {
  appearance: none;
  /* Room for the chevron drawn by the background image. */
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

button {
  cursor: pointer;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.08s ease;
}

button:hover {
  background: #2a2f39;
  border-color: rgba(255, 255, 255, 0.32);
}

button:active { transform: translateY(1px); }

button[disabled] {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

input[type="file"] {
  padding: 8px;
  font-size: 12px;
}

input[type="file"]::file-selector-button {
  font: inherit;
  margin-right: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
}

/* ===== Collapsible sections ===== */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  margin-top: 12px;
  overflow: hidden;
}

.panel > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #d7dce5;
  list-style: none;
  user-select: none;
}

.panel > summary::-webkit-details-marker { display: none; }

.panel > summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.panel[open] > summary::before { transform: rotate(45deg); }

.panel > summary:hover { background: rgba(255, 255, 255, 0.04); }

.panel[open] > summary {
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.panel-body {
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

/* ===== Fields ===== */

.field { display: block; }

.field > span,
.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #c2c9d5;
}

.field-row {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}

.field-row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

/* Stat on/off switches read as pills rather than loose checkboxes. */
.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.toggle:hover { border-color: rgba(255, 255, 255, 0.32); }

.toggle:has(input:checked) {
  border-color: var(--accent);
  background: rgba(245, 197, 24, 0.12);
  color: var(--accent);
}

.toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* ===== Effect text toolbar ===== */

.text-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}

.text-tools button {
  padding: 6px 10px;
  font-size: 12px;
  background: var(--surface);
}

/* ===== Steppers and slider rows ===== */

.stepper {
  display: flex;
  align-items: center;
  gap: 7px;
}

.stepper button {
  width: 32px;
  flex: 0 0 32px;
  padding: 0;
  height: 32px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.stepper .value {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 7px 4px;
}

/* These had no styling at all before, so the slider and its number box just
   stacked awkwardly. */
.rangeWithNum {
  display: grid;
  grid-template-columns: 1fr 68px;
  align-items: center;
  gap: 8px;
}

.numBox {
  padding: 6px 7px;
  text-align: center;
  font-size: 12px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  height: 22px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--accent);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: var(--surface-3);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
}

/* ===== Generator slot (card-maker.js injects into this) ===== */

#generatorTopSlot { padding: 12px 14px 0; }

#generatorUiWrap {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

#generatorUiWrap select,
#generatorUiWrap input,
#generatorUiWrap button { max-width: 100%; }

/* ===== Save bar ===== */

.save-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.save-bar button { flex: 1; }

.btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.btn-primary:hover {
  background: #ffd83a;
  border-color: transparent;
}

/* ===== Canvas stage ===== */

#wrap {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(70, 80, 100, 0.20), transparent 32rem),
    #111317;
}

/* card-maker.js applies zoom/pan as a transform here, so the origin must stay. */
#canvasScale { transform-origin: top center; }

canvas {
  display: block;
  margin: 0 auto;
  background: transparent;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ===== Narrow screens ===== */

@media (max-width: 900px) {
  body {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  #controls {
    width: 100%;
    flex: 0 0 auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .panel-scroll {
    overflow: visible;
    max-height: none;
  }

  #wrap {
    height: 70vh;
    padding: 12px;
  }
}

/* ===== Account session row ===== */

.session-bar--admin {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.session-bar--admin .session-status { font-size: 11.5px; }

.session-status.is-user { color: #9fd6a0; }

/* ===== Sign-in dialog (built in account.js) ===== */

.sm-dialog {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.sm-dialog[hidden] { display: none; }

.sm-dialog-panel {
  width: min(400px, 100%);
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55);
}

.sm-dialog-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.sm-dialog-lead {
  margin: 0 0 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.sm-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sm-dialog-error {
  margin: 0;
  padding: 9px 11px;
  border-radius: var(--radius);
  border: 1px solid rgba(224, 82, 74, 0.45);
  background: rgba(224, 82, 74, 0.12);
  color: #ffb3ad;
  font-size: 12.5px;
}

.sm-dialog-error[hidden] { display: none; }

.sm-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.sm-dialog-actions button { flex: 1; }

.sm-dialog-switch {
  width: 100%;
  margin-top: 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  text-decoration: underline;
  padding: 6px;
}

.sm-dialog-switch:hover {
  background: none;
  color: var(--text);
}

/* Home link sits in the quick nav and must match the buttons beside it. */
.quick-nav--4 { grid-template-columns: repeat(4, 1fr); }

.quick-home {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.quick-home:hover {
  background: #2a2f39;
  border-color: rgba(255, 255, 255, 0.32);
}
