/* ==========================================================================
   The Station — the customisation workspace.
   Two columns on desktop: the piece on the left, the controls on the right.
   The preview is sticky, so the garment stays in view while you work.
   ========================================================================== */

.station-shell {
  max-width: 1320px; margin: 0 auto; width: 100%;
  padding: 34px 32px 120px;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 40px; align-items: start;
}

/* --- Masthead -------------------------------------------------------------- */
.station-head { border-bottom: 1px solid var(--border); padding: 30px 32px 26px; }
.station-head-inner {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 18px;
}
.station-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(34px, 5.4vw, 62px); letter-spacing: -1.5px;
  text-transform: uppercase; margin: 6px 0 0; line-height: 0.95;
}
.station-lead {
  color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0; max-width: 440px;
}

/* --- Stage ----------------------------------------------------------------- */
/* The column holds only the preview, pinned under the nav; the summary closes
   the steps instead. So the garment stays in view however far down you are. */
.stage-col { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.stage-wrap { display: flex; flex-direction: column; gap: 14px; }
/* Never taller than the window, or its top would slide out of view. */
.stage { width: min(100%, calc((100vh - 170px) * 6 / 7)); width: min(100%, calc((100svh - 170px) * 6 / 7)); margin-inline: auto; }
.stage.is-cap { width: min(100%, calc((100vh - 170px) * 6 / 5.2)); width: min(100%, calc((100svh - 170px) * 6 / 5.2)); }

/* A mid-grey studio backdrop: dark enough that a white blank stands off it,
   light enough that a black blank (half the catalogue) does not vanish. */
.stage {
  position: relative; border: 1px solid var(--border); border-radius: 24px;
  overflow: hidden; aspect-ratio: 6 / 7;
  background:
    radial-gradient(ellipse 76% 62% at 50% 34%, #b3afa7 0%, #99958d 58%, #7f7b74 100%);
  display: flex; align-items: center; justify-content: center;
}
.stage.is-cap { aspect-ratio: 6 / 5.2; }
.stage-garment { width: 100%; height: 100%; display: block; }
.stage-garment svg { width: 100%; height: 100%; display: block; }

/* The print layer is positioned from PRINT_AREAS, in percentages, so it tracks
   the garment at every stage size. Inside it, the artwork and the text band are
   placed by print-layout.js; the artwork is clamped to the area, so nothing
   needs clipping. */
.stage-print { position: absolute; text-align: center; }

/* Where a design can go, shown quietly. Words and artwork are kept inside it,
   so nothing lands on a shoulder, a sleeve, the collar or a side; the area
   needs no box drawn round it all the time.
   - While designing (the design step open: .station-shell.is-live), four
     small lime corner marks.
   - While something is held, focused from the keyboard or hovered with a
     mouse, and for a moment when the design step opens or the side changes
     (.is-hint, page-station.js): a thin solid outline and the area's name
     (print or embroidery) above it.
   - Before the design step, nothing.
   All of it is drawn with gradients on a layer of its own, 3px outside the
   area: over the 3D canvas WebKit drops the sides of an outline, not these.
   The cart's picture is drawn separately, so none of it reaches the order. */
.stage-print {
  --area-ink: rgba(181, 211, 52, 0.95);
  --area-edge: transparent;
  --area-arm: 12px;
  --area-line: 1.5px;
  transition: background-color 0.2s ease;
}
.stage-print::before {
  content: ''; position: absolute; inset: -3px; pointer-events: none;
  background:
    /* the corner marks */
    linear-gradient(var(--area-ink), var(--area-ink)) left top / var(--area-arm) var(--area-line) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) left top / var(--area-line) var(--area-arm) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) right top / var(--area-arm) var(--area-line) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) right top / var(--area-line) var(--area-arm) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) left bottom / var(--area-arm) var(--area-line) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) left bottom / var(--area-line) var(--area-arm) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) right bottom / var(--area-arm) var(--area-line) no-repeat,
    linear-gradient(var(--area-ink), var(--area-ink)) right bottom / var(--area-line) var(--area-arm) no-repeat,
    /* the outline, clear until the area is in use */
    linear-gradient(var(--area-edge), var(--area-edge)) left top / 100% 1px no-repeat,
    linear-gradient(var(--area-edge), var(--area-edge)) left bottom / 100% 1px no-repeat,
    linear-gradient(var(--area-edge), var(--area-edge)) left top / 1px 100% no-repeat,
    linear-gradient(var(--area-edge), var(--area-edge)) right top / 1px 100% no-repeat;
}
.stage-print::after {
  content: attr(data-area); position: absolute; left: -3px; bottom: calc(100% + 8px);
  font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; white-space: nowrap;
  color: #070707; background: var(--lime); padding: 2px 6px; border-radius: 4px; pointer-events: none;
  opacity: 0; transition: opacity 0.2s ease;
}
/* In use: the outline, a faint tint and the name. */
.stage-print.is-dragging, .stage-print.is-hint { --area-edge: rgba(181, 211, 52, 0.7); background-color: rgba(181, 211, 52, 0.07); }
.stage-print.is-dragging::after, .stage-print.is-hint::after { opacity: 1; }
/* Each on its own: a browser without :has() or :focus-visible skips only its rule. */
.stage-print:has(:focus-visible) { --area-edge: rgba(181, 211, 52, 0.7); background-color: rgba(181, 211, 52, 0.07); }
.stage-print:has(:focus-visible)::after { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .stage-print:hover { --area-edge: rgba(181, 211, 52, 0.7); background-color: rgba(181, 211, 52, 0.07); }
  .stage-print:hover::after { opacity: 1; }
}
/* Before the design step, nothing of the area shows. */
.station-shell:not(.is-live) .stage-print::before,
.station-shell:not(.is-live) .stage-print::after { display: none; }
.station-shell:not(.is-live) .stage-print { background-color: transparent; }
@media (prefers-reduced-motion: reduce) {
  .stage-print, .stage-print::after { transition: none; }
}
.stage-print:empty { display: none; }

/* The centre lines, shown while something dragged sits on one. */
.print-guide { position: absolute; pointer-events: none; opacity: 0; background: var(--lime); z-index: 2; }
.print-guide-x { left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-0.5px); }
.print-guide-y { top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-0.5px); }
.stage-print.snap-x .print-guide-x, .stage-print.snap-y .print-guide-y { opacity: 1; }

.print-art-box {
  position: absolute; touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab; outline: none;
}
/* A margin round the artwork that also grabs it: a small logo is still easy to
   pick up with a finger. */
.print-art-box::before { content: ''; position: absolute; inset: -10px; }
.stage-print.is-dragging .print-art-box { cursor: grabbing; }
.print-art-box:focus-visible { outline: 1.5px solid var(--lime); outline-offset: 1px; }
.print-art {
  width: 100%; height: 100%; object-fit: contain; display: block;
  pointer-events: none; -webkit-user-drag: none;
}
/* The resize handle: small to look at, big to hit. Shown on hover and focus with
   a mouse; always on a touch screen, where there is no hover. */
/* It sits just outside the corner and reaches outward, so it never covers the
   artwork it resizes; on artwork too small to hold both, it steps aside and the
   slider or a pinch does the resizing. */
.art-handle {
  position: absolute; right: -11px; bottom: -11px; width: 14px; height: 14px; z-index: 1;
  border-radius: 50%; background: var(--lime); border: 2px solid #070707;
  cursor: nwse-resize; touch-action: none; opacity: 0; transition: opacity 0.15s ease;
}
.art-handle::before { content: ''; position: absolute; inset: -8px -12px -12px -8px; }
.is-small > .art-handle { display: none; }
/* The handle shows on the thing being worked on (and on hover with a mouse). */
.print-art-box:hover .art-handle, .print-text-box:hover .art-handle,
.is-active > .art-handle, .stage-print.is-dragging .is-active > .art-handle { opacity: 1; }

/* The words: a block sized to its own lines, held and dragged like the artwork.
   Line breaks are kept exactly as typed; type too big for the area shrinks
   (fitTextBlock) rather than wrapping, which is also how it has to be printed. */
.print-text-box {
  position: absolute; width: max-content; z-index: 1;
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab; outline: none;
}
.print-text-box[hidden], .print-art-box[hidden] { display: none; }
.print-text-box::before { content: ''; position: absolute; inset: -8px; }
.stage-print.is-dragging .print-text-box.is-active { cursor: grabbing; }
.print-text {
  font-weight: 700; line-height: 1.12; white-space: pre; margin: 0; text-align: center;
}
/* The small UNREAD. mark under the words (print-layout.js BRAND_MARK). */
.print-mark {
  font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 0.3em; line-height: 1;
  margin: 0.35em 0 0; text-align: center; letter-spacing: 0.02em; white-space: pre;
}
/* What is selected: a thin frame, as in a design app. */
.print-art-box.is-active, .print-text-box.is-active { outline: 1px solid rgba(255, 255, 255, 0.75); outline-offset: 2px; }
.print-text-box:focus-visible, .print-art-box:focus-visible { outline: 1.5px solid var(--lime); outline-offset: 2px; }

.stage-centre {
  border-radius: 9999px; padding: 8px 16px; min-height: 38px;
  border: 1px solid var(--lime); background: transparent; color: var(--lime);
  font: inherit; font-size: 13px; cursor: pointer;
}
.stage-centre:hover { background: var(--lime-fill-soft); }
.move-hint {
  margin: 0; padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6;
  color: var(--fg); background: var(--lime-fill-soft); border: 1px solid rgba(181, 211, 52, 0.35);
}
.move-hint:empty { display: none; }

.stage-empty {
  position: absolute; inset: auto 0 0 0; text-align: center;
  color: hsl(40 6% 16%); font-size: 11px; letter-spacing: 2px;
  text-transform: uppercase; padding-bottom: 18px;
}
.stage-empty[hidden] { display: none !important; }

.stage-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.stage-views { display: flex; gap: 6px; }
/* The pills had no style on this page (it lived only in admin.css). */
.stage-views .filter-pill {
  border-radius: 9999px; padding: 8px 16px; min-height: 38px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; transition: all 0.18s ease;
}
.stage-views .filter-pill:hover { color: var(--fg); }
.stage-views .filter-pill[aria-pressed='true'] {
  background: var(--lime); border-color: var(--lime); color: #070707;
}
.stage-meta { color: var(--muted); font-size: 12px; }

/* --- Steps ----------------------------------------------------------------- */
.steps { display: flex; flex-direction: column; gap: 14px; }

.step {
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface);
  overflow: hidden; transition: border-color 0.25s ease, opacity 0.25s ease;
}
.step.is-locked { opacity: 0.42; pointer-events: none; }
.step.is-open { border-color: hsl(0 0% 26%); }

.step-head {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; background: none; border: none; color: var(--fg);
  cursor: pointer; text-align: left; font-family: var(--font-body);
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  border: 1px solid var(--border-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.step.is-done .step-num { background: var(--lime); border-color: var(--lime); color: #070707; }
.step.is-open .step-num { border-color: var(--lime); color: var(--lime); background: none; }
.step-label {
  font-family: var(--font-display); font-size: 14px; text-transform: uppercase;
  letter-spacing: 0.5px; flex: 1;
}
.step-value { font-size: 13px; color: var(--lime); text-align: right; }
.step-chev { color: var(--muted); font-size: 12px; transition: transform 0.25s ease; }
.step.is-open .step-chev { transform: rotate(180deg); }

.step-body { padding: 0 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.step-body[hidden] { display: none !important; }
.step-hint { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }
.art-hint { margin-top: 10px; }
.link-btn {
  background: none; border: none; padding: 0; margin-left: 4px; font: inherit;
  color: var(--lime); text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

/* --- Choice tiles ---------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile {
  border: 1px solid var(--border); border-radius: 14px; background: #070707;
  padding: 16px; cursor: pointer; text-align: left; color: var(--fg);
  display: flex; flex-direction: column; gap: 6px; min-height: 76px;
  transition: all 0.2s ease; font-family: var(--font-body);
}
.tile:hover { border-color: var(--border-2); }
.tile[aria-pressed='true'] { border-color: var(--lime); background: var(--lime-fill-soft); }
.tile b { font-size: 14px; font-weight: 600; }
.tile span { font-size: 12px; color: var(--muted); line-height: 1.5; }

/* --- Font picker ----------------------------------------------------------- */
.font-list {
  max-height: 264px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: 12px; background: #070707; padding: 6px;
}
.font-group {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); padding: 12px 10px 6px;
}
.font-option {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 9px; border: 1px solid transparent;
  background: none; color: var(--fg); cursor: pointer; text-align: left;
  min-height: 44px; transition: background 0.15s ease;
}
.font-option:hover { background: rgba(255, 255, 255, 0.04); }
.font-option[aria-pressed='true'] { border-color: var(--lime); background: var(--lime-fill-soft); }
.font-option .sample { font-size: 19px; line-height: 1.25; overflow: hidden; }
.font-option .fname { font-size: 11px; color: var(--muted); flex: none; }

/* --- Upload ---------------------------------------------------------------- */
.drop {
  border: 1px dashed var(--border-2); border-radius: 16px; padding: 28px 20px;
  text-align: center; cursor: pointer; transition: all 0.2s ease; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: none; color: var(--fg); font-family: var(--font-body);
}
.drop:hover, .drop.is-over { border-color: var(--lime); background: var(--lime-fill-soft); }
.drop b { font-size: 14px; }
.drop span { font-size: 12px; color: var(--muted); line-height: 1.6; }
.drop-icon { font-size: 22px; color: var(--lime); line-height: 1; }

/* --- Summary --------------------------------------------------------------- */
.station-summary {
  border: 1px solid var(--border); border-radius: 20px; background: var(--surface);
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
}
.summary-line { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; }
.summary-line span:first-child { color: var(--muted); flex: none; }
.summary-line span:last-child { text-align: right; }
.summary-total {
  font-size: 17px; font-weight: 700; border-top: 1px solid var(--border);
  padding-top: 12px; margin-top: 4px;
}
.summary-total span:first-child { color: var(--fg); }

@media (max-width: 1060px) {
  .station-shell { grid-template-columns: 1fr; gap: 26px; }
  .stage-col { position: static; }
  .stage, .stage.is-cap { max-width: 520px; margin: 0 auto; width: 100%; }

  /* While designing, the preview stays pinned under the nav, small enough to
     leave the controls room, so every change shows as it is made. */
  .station-shell.is-live .stage-col { display: contents; }
  .station-shell.is-live .stage-wrap {
    position: sticky; top: var(--nav-h, 64px); z-index: 20;
    background: var(--bg); padding: 8px 0 10px; gap: 8px;
  }
  .station-shell.is-live .stage { width: min(100%, calc(38vh * 6 / 7)); width: min(100%, calc(38svh * 6 / 7)); }
  .station-shell.is-live .stage.is-cap { width: min(100%, calc(30vh * 6 / 5.2)); width: min(100%, calc(30svh * 6 / 5.2)); }
}
@media (max-width: 860px) {
  .station-head { padding: 22px 18px 20px; }
  .station-shell { padding: 22px 18px 100px; }
  .step-body { padding: 0 16px 20px; }
  .step-head { padding: 16px; }
  .tiles { grid-template-columns: 1fr 1fr; }
}

/* --- The 3D garment ----------------------------------------------------------
   station-3d.js draws the garment and the design on it into this layer. The
   drag layer (.stage-print) stays above it, laid exactly over the print area
   while it faces you, so moving and sizing work as before; the garment itself
   now shows the ink, so the layer keeps only its corner marks, frame and handles.
   Turned away from the print, the layer steps aside. A vertical swipe still
   scrolls the page; a sideways one turns the garment. */
.stage-3d { position: absolute; inset: 0; z-index: 0; touch-action: pan-y; }
.stage-3d[hidden] { display: none; }
.stage-3d-canvas { width: 100%; height: 100%; display: block; object-fit: contain; touch-action: pan-y; cursor: grab; }
/* Until the garment is ready (station-3d.js warmUp), the drawing shows alone. */
.stage:not(.is-3d) .stage-3d { visibility: hidden; }
.stage-3d-canvas:active { cursor: grabbing; }
.stage-print { z-index: 1; }
.stage.is-3d .stage-garment { visibility: hidden; }
.stage.is-3d .print-text { color: transparent !important; }
.stage.is-3d .print-mark { color: transparent !important; } /* drawn on the garment, like the words */
.stage.is-3d .print-art { opacity: 0; }
.stage.is-3d .stage-print.is-turned { visibility: hidden; }
.stage-views[data-stage-tools] .filter-pill[aria-pressed='true'] {
  background: transparent; border-color: var(--fg); color: var(--fg);
}
/* The corner marks and the outline (above) are gradients, which WebKit draws
   over the 3D canvas as it does over the drawing: one rule serves both. */

/* "Start a new design": forgets the design kept from earlier (station-draft.js). */
.station-start-over { display: block; margin: 10px auto 0; font-size: 13px; }
.station-start-over[hidden] { display: none; }

/* On a touch screen the stage buttons are finger-sized (44 px), as the rest of the Station. */
@media (pointer: coarse) {
  .stage-views .filter-pill, .stage-centre { min-height: 44px; }
}
