/* ═══════════════════════════════════════════════════════════════
   FISHBACK 2026 — Banner Creator
   Vanilla styles. Reuses tokens from styles.css (:root vars).
   Color palette + Bebas Neue mirror fishback.social exactly so the
   landing experience between the two tools is visually identical.
   ═══════════════════════════════════════════════════════════════ */

/* Bebas Neue — self-hosted basic-Latin subset (8.5KB) lifted from
   fishback.social's font pipeline. Matches their headline typography. */
@font-face {
  font-family: 'Bebas Neue';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/bebas-neue.woff2') format('woff2');
  unicode-range: U+0020-007F;
}

:root {
  /* fishback.social palette — slightly different navy + card-bg from the
     campaign site's main palette. Scoped to this page only via .banner-page
     wrapper so the rest of the site keeps its existing brand. */
  --fb-navy: #00263E;
  --fb-navy-soft: #003a5c;
  --fb-cream-wrapper: #FEF5DC;
  --fb-cream-card: #FEF9E7;
}

.banner-page {
  min-height: 100vh;
  background: var(--fb-cream-wrapper);
  padding: 2rem 0 4rem;
}

.banner-page__header {
  max-width: 760px;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.banner-page__title {
  font-family: 'Bebas Neue', Arial, sans-serif;
  font-weight: 400;
  font-size: clamp(3.5rem, 9vw, 6rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fb-navy);
  margin: 0 0 0.75rem;
}

.banner-page__title-accent {
  color: var(--orange);
}

.banner-page__sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  color: rgba(0, 38, 62, 0.8);
  margin: 0;
}

.banner-page__lede {
  margin-top: 1rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--slate-700);
}

/* ── Tool wrapper ───────────────────────────────────────────── */

.banner-tool {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--fb-cream-wrapper);
  border-radius: 16px;
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .banner-tool { padding: 2rem; }
}

/* ── Template tabs ──────────────────────────────────────────── */

.banner-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.banner-tab {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0.6rem;
  background: var(--cream-white);
  color: var(--navy);
  border: 2px solid var(--slate-200);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.banner-tab:hover { transform: translateY(-1px); border-color: var(--orange); }
.banner-tab:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.banner-tab--active {
  background: var(--navy);
  color: var(--cream-white);
  border-color: var(--navy);
  box-shadow: 0 4px 12px rgba(1, 30, 47, 0.18);
}

.banner-tab__title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.banner-tab__sub {
  font-size: 0.72rem;
  opacity: 0.8;
}

@media (max-width: 600px) {
  .banner-tab__sub { display: none; }
  .banner-tab { padding: 0.7rem 0.4rem; }
}

/* ── Body grid: canvas + controls ──────────────────────────── */

.banner-tool__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .banner-tool__body {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    align-items: start;
  }
}

/* ── Canvas / drop zone ────────────────────────────────────── */

.banner-canvas-wrap {
  width: 100%;
}

.banner-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  /* Empty-state matches fishback.social: cream-tinted card on cream wrapper,
     with a thin dashed navy-at-20%-opacity border. Once a photo loads we
     swap background to black so the photo reads cleanly. */
  background: var(--fb-cream-card);
  border-radius: 22px;
  border: 2px dashed rgba(0, 38, 62, 0.25);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.banner-canvas:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  border-color: var(--orange);
}

.banner-canvas--dragging-over {
  background: rgba(239, 130, 50, 0.08);
  border-color: var(--orange);
  border-style: solid;
}

.banner-canvas--has-photo {
  cursor: grab;
  border-style: solid;
  border-color: var(--slate-200);
  border-width: 1px;
  background: #000;
}

.banner-canvas--grabbing { cursor: grabbing; }

.banner-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.banner-canvas__empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: transparent;
  border: none;
  color: var(--slate-600);
  text-align: center;
  padding: 1.5rem;
  cursor: pointer;
  font-family: inherit;
  /* Click-to-upload affordance is the entire empty state. After a photo is
     loaded the button is display:none so it can't intercept drag/pointer
     events on the canvas. */
}

.banner-canvas__empty:hover .banner-canvas__empty-icon,
.banner-canvas__empty:focus-visible .banner-canvas__empty-icon { color: var(--navy); }
.banner-canvas__empty:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 14px; }

.banner-canvas--has-photo .banner-canvas__empty { display: none; }

.banner-canvas__empty svg {
  width: 64px;
  height: 64px;
  color: rgba(0, 38, 62, 0.55);
  transition: color 0.2s;
  stroke-width: 2;
}

.banner-canvas__empty-title {
  display: block;
  font-family: 'Bebas Neue', Arial, sans-serif;
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fb-navy);
}

.banner-canvas__empty-sub {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.15rem);
  color: rgba(0, 38, 62, 0.65);
}

/* ── Controls panel ────────────────────────────────────────── */

.banner-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.banner-controls__group {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.banner-controls__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.banner-controls__count {
  font-size: 0.85rem;
  color: var(--slate-600);
}

.banner-controls__upload,
.banner-controls__download {
  width: 100%;
  justify-content: center;
}

.banner-controls__hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--slate-600);
}

/* ── Per-control row ───────────────────────────────────────── */

.banner-control {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.banner-control--checkbox {
  grid-template-columns: auto 1fr;
  cursor: pointer;
}

.banner-control--checkbox input { width: 16px; height: 16px; }

.banner-control__label {
  font-weight: 600;
  color: var(--navy);
}

.banner-control__sub {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-600);
}

.banner-control__value {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--slate-700);
  min-width: 3.5em;
  text-align: right;
}

.banner-control input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--slate-200);
  border-radius: 999px;
  outline: none;
}
.banner-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 2px solid var(--cream-white);
  box-shadow: 0 2px 6px rgba(1, 30, 47, 0.18);
}
.banner-control input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 2px solid var(--cream-white);
}

/* ── Template-driven control gating ─────────────────────────
   Controls are shown/hidden by the [data-template] attribute on .banner-tool
   plus the .banner-tool--has-photo state class. Doing this in CSS instead of
   JS-toggling per-element means non-relevant controls are display:none — they
   can't be clicked, can't be tabbed into, can't fire stale events. */

/* Hide ALL conditional groups by default */
.banner-controls__group--cropper,
.banner-controls__group--bars,
.banner-controls__group--download {
  display: none;
}

/* Once a photo is loaded, cropper + download appear for every template */
.banner-tool--has-photo .banner-controls__group--cropper,
.banner-tool--has-photo .banner-controls__group--download {
  display: flex;
}

/* Bar controls only on Anonymous template AND only after photo loaded */
.banner-tool--has-photo[data-template="anonymous"] .banner-controls__group--bars {
  display: flex;
}

/* Bar editor only when a bar is selected */
.banner-bar-editor {
  display: none;
}
.banner-tool--has-bar-selected[data-template="anonymous"] .banner-bar-editor {
  display: flex;
}

/* ── Bar editor (anonymous template) ───────────────────────── */

.banner-bar-editor {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem;
  background: var(--cream-white);
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.banner-control__add-bar { padding: 0.55rem 1rem; font-size: 0.9rem; }
.banner-control__delete-bar { font-size: 0.85rem; color: #c0392b; }

/* ── Privacy footer note ───────────────────────────────────── */

.banner-tool__privacy {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0.85rem 1rem;
  background: rgba(1, 47, 71, 0.05);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--slate-700);
}

.banner-tool__privacy svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--navy);
  margin-top: 1px;
}

.banner-tool__alt {
  margin: 1.5rem auto 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--slate-600);
  max-width: 600px;
}

.banner-tool__alt a {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Ghost button variant (used here only) ─────────────────── */

.btn--ghost {
  background: transparent;
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn--ghost:hover { background: var(--slate-100); border-color: var(--slate-400); }
