/* shirt.css - styles for the shirt maker (builds on theme.css) */

.sm-dev {
    display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline;
    border: 1px dashed var(--accent); padding: .55rem .9rem; margin: 1.25rem 0;
    font-family: var(--f-mono); font-size: .72rem; letter-spacing: .06em; color: var(--muted);
}
.sm-dev b { color: var(--accent-hi); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }

.sm-title { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; line-height: .9; margin: 1.25rem 0 .5rem; }
.sm-title em { font-style: normal; color: var(--accent); }
.sm-lede { color: var(--muted); max-width: 40rem; margin-bottom: 1.5rem; }

/* step 1: pick the frame */
.sm-grab { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .sm-grab { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); } }
.sm-video { background: #000; border: 1px solid var(--line-2); aspect-ratio: 16 / 9; width: 100%; }
.sm-video video { width: 100%; height: 100%; display: block; background: #000; }
.sm-scrub { width: 100%; margin: .9rem 0 .4rem; }
.sm-time { font-family: var(--f-mono); font-size: .85rem; color: var(--text); }
.sm-time span { color: var(--faint); }
.sm-step-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 1rem; }
.sm-hint { font-size: .9rem; color: var(--muted); }

.sm-clips { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 1rem; }
.sm-clip-group { background: var(--surface); padding: .8rem 1rem; }
.sm-clip-group h3 { font-size: 1.15rem; margin-bottom: .4rem; }
.sm-clip-group a { display: inline-block; margin: .15rem .6rem .15rem 0; font-family: var(--f-mono); font-size: .78rem; color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.sm-clip-group a:hover { color: var(--accent-hi); border-bottom-color: var(--accent); }

/* step 2: editor */
.sm-editor { display: grid; gap: 1.5rem; grid-template-columns: 1fr; margin-top: 1.5rem; }
@media (min-width: 1000px) { .sm-editor { grid-template-columns: 340px minmax(0, 1fr); align-items: start; } }

.sm-tools { border: 1px solid var(--line-2); background: var(--surface); }
.sm-sec { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
.sm-sec:last-child { border-bottom: 0; }
.sm-sec > .sp-label { display: block; margin-bottom: .7rem; }
.sm-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.sm-chip {
    font-family: var(--f-display); font-weight: 700; font-size: .92rem; letter-spacing: .08em; text-transform: uppercase;
    border: 1px solid var(--line-2); background: transparent; color: var(--text); padding: .38rem .7rem; cursor: pointer; line-height: 1.1;
}
.sm-chip:hover { border-color: var(--accent); }
.sm-chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sm-chip:disabled { opacity: .4; cursor: not-allowed; }
.sm-row { display: flex; align-items: center; gap: .7rem; margin-top: .75rem; }
.sm-row label { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); min-width: 4.2rem; }
.sm-row input[type=range] { flex: 1; }
.sm-row input[type=color] { width: 2.4rem; height: 1.9rem; padding: 0; border: 1px solid var(--line-2); background: none; cursor: pointer; }
.sm-note { font-size: .82rem; color: var(--faint); margin-top: .6rem; line-height: 1.45; }
.sm-btn {
    font-family: var(--f-display); font-weight: 700; font-size: 1rem; letter-spacing: .1em; text-transform: uppercase;
    border: 1px solid var(--line-2); background: transparent; color: var(--text); padding: .6rem 1rem; cursor: pointer; line-height: 1.1;
}
.sm-btn:hover { border-color: var(--accent); color: var(--accent-hi); }
.sm-btn.sm-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sm-btn.sm-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: var(--on-accent); }
.sm-btn.sm-block { display: block; width: 100%; text-align: center; }
.sm-btn:disabled { opacity: .45; cursor: not-allowed; }
.sm-textlist { display: flex; flex-wrap: wrap; gap: .4rem; margin: .6rem 0; }
.sm-textbox { display: none; }
.sm-textbox.is-on { display: block; }
.sm-textbox textarea { width: 100%; min-height: 3.2rem; padding: .5rem .6rem; font-size: 1rem; resize: vertical; }

/* stage: edit canvas + shirt mockup */
.sm-stage { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 760px) { .sm-stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.sm-card { border: 1px solid var(--line-2); background: var(--surface); }
.sm-card-head { display: flex; justify-content: space-between; align-items: baseline; padding: .6rem .9rem; border-bottom: 1px solid var(--line); }
.sm-card-head span { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.sm-checker {
    background-color: #1c1c1a;
    background-image: linear-gradient(45deg, #232321 25%, transparent 25%), linear-gradient(-45deg, #232321 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #232321 75%), linear-gradient(-45deg, transparent 75%, #232321 75%);
    background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.sm-canvas-wrap { padding: .9rem; }
.sm-canvas-wrap canvas { display: block; width: 100%; height: auto; touch-action: none; }
#smEdit { cursor: grab; border: 1px dashed var(--line-2); }
#smEdit.is-drag { cursor: grabbing; }
.sm-swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
.sm-sw { width: 1.9rem; height: 1.9rem; border: 2px solid var(--line-2); cursor: pointer; padding: 0; }
.sm-sw.is-on { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--bg); }
.sm-colorname { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); margin-left: .4rem; letter-spacing: .06em; }

.sm-price { font-family: var(--f-mono); font-size: 1.6rem; color: var(--text); }
.sm-price small { font-size: .7rem; color: var(--faint); letter-spacing: .1em; margin-right: .5rem; text-transform: uppercase; }

/* busy / toast */
.sm-busy { position: fixed; right: 1rem; bottom: 1rem; z-index: 60; background: var(--surface); border: 1px solid var(--accent); padding: .55rem .9rem; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; display: none; }
.sm-busy.is-on { display: block; }
.sm-toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 70; background: var(--surface-2); border-left: 4px solid #e5675c; padding: .7rem 1.1rem; max-width: 90vw; display: none; }
.sm-toast.is-on { display: block; }

/* cut-out overlay */
.sm-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(11, 11, 10, .94); display: none; align-items: center; justify-content: center; padding: 1rem; overflow: auto; }
.sm-overlay.is-on { display: flex; }
.sm-overlay-inner { max-width: 960px; width: 100%; }
.sm-cutwrap { position: relative; display: inline-block; width: 100%; cursor: crosshair; touch-action: none; user-select: none; border: 1px solid var(--line-2); }
.sm-cutwrap img { display: block; width: 100%; height: auto; pointer-events: none; }
#smCutPaint { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.sm-cutbox { position: absolute; border: 2px solid var(--accent); background: rgba(255, 90, 31, .14); display: none; pointer-events: none; }

/* result */
.sm-result { margin-top: 2rem; }
.sm-result pre { background: var(--bg); border: 1px solid var(--line); padding: .9rem; overflow: auto; max-height: 24rem; font-family: var(--f-mono); font-size: .72rem; color: var(--muted); }
.sm-result details summary { cursor: pointer; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 1rem 0 .5rem; }
.sm-hidden { display: none !important; }

/* graphics picker */
.sm-gfxgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; max-height: 15rem; overflow: auto; margin: .7rem 0; padding-right: .2rem; }
.sm-gfxbtn { background: #232321; border: 1px solid var(--line-2); padding: .2rem; cursor: pointer; line-height: 0; }
.sm-gfxbtn:hover, .sm-gfxbtn:focus-visible { border-color: var(--accent); }
.sm-gfxbtn canvas { width: 100%; height: auto; display: block; }
.sm-textbox textarea#smGfxTxt { min-height: 2.6rem; }
/* ── tabs + collapsible toolbar ───────────────────────────────────────────────── */
.sm-tools.has-tabs .sm-sec { display: none; border-bottom: 0; }
.sm-tools.has-tabs .sm-sec.is-active { display: block; }
.sm-tools.has-tabs .sm-sec > .sp-label:first-child { display: none; }   /* the tab already names the section */
.sm-tabbar { display: flex; align-items: stretch; position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.sm-tabbar { overflow-x: auto; scrollbar-width: none; }
.sm-tabbar::-webkit-scrollbar { display: none; }
.sm-tab { flex: 0 0 auto; padding: .8rem .95rem; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer;
    font-family: var(--f-display); font-weight: 700; font-size: .95rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.sm-tab:hover { color: var(--text); }
.sm-tab.is-on { color: var(--text); border-bottom-color: var(--accent); }
.sm-fold { flex: 0 0 auto; margin-left: auto; position: sticky; right: 0; background: var(--surface); border: 0; border-left: 1px solid var(--line); color: var(--muted); padding: 0 .8rem; cursor: pointer; }
.sm-fold svg { transition: transform .15s; }
.sm-tools.is-collapsed .sm-fold svg { transform: rotate(180deg); }
.sm-tools.is-collapsed .sm-sec { display: none !important; }
.sm-tools.is-collapsed .sm-tabbar { border-bottom: 0; }
@media (min-width: 1000px) {
    .sm-editor.tools-collapsed { grid-template-columns: minmax(0, 1fr); }
    .sm-tools { position: sticky; top: .6rem; max-height: calc(100vh - 1.2rem); overflow-y: auto; }
    .sm-editor.tools-collapsed .sm-tools { position: static; max-height: none; overflow: visible; }
    .sm-tabbar { flex-wrap: wrap; overflow: visible; }
    .sm-tab { padding: .65rem .8rem; }
}
@media (max-width: 999px) {
    .sm-editor { padding-bottom: var(--sheet, 0px); }
    .sm-tools { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-height: 46vh; overflow-y: auto; overscroll-behavior: contain;
        border-width: 1px 0 0; box-shadow: 0 -10px 30px rgba(0, 0, 0, .5); padding-bottom: env(safe-area-inset-bottom); }
    .sm-tabbar { position: sticky; top: 0; }
    .sm-tools .sm-sec.is-active { padding: .9rem 1rem 1.2rem; }
}

/* ── 3D preview ───────────────────────────────────────────────────────────────── */
.sm-3d { width: 100%; aspect-ratio: 520 / 600; position: relative; }
.sm-3d canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── clip picker ──────────────────────────────────────────────────────────────── */
.sm-pick-search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.sm-pick-search input { flex: 1; min-width: 0; padding: .6rem .8rem; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); font: inherit; }
.sm-crumbs { display: flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; margin-bottom: 1rem; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .06em; color: var(--faint); }
.sm-crumbs a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.sm-crumbs a:hover { color: var(--accent-hi); border-color: var(--accent); }
.sm-folders, .sm-clipgrid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); margin-bottom: 1.2rem; }
.sm-folder, .sm-clipcard { display: flex; flex-direction: column; text-decoration: none; color: var(--text); border: 1px solid var(--line-2); background: var(--surface); min-width: 0; }
.sm-folder:hover, .sm-clipcard:hover { border-color: var(--accent); }
.sm-folder-art, .sm-clipthumb { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; background: var(--surface-2) center / cover no-repeat; color: var(--faint); overflow: hidden; }
.sm-clipthumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sm-folder-name, .sm-clipname { padding: .5rem .65rem 0; font-weight: 600; font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; }
.sm-clipname { padding-bottom: .55rem; font-family: var(--f-mono); font-weight: 500; font-size: .75rem; }
.sm-folder-n { padding: .1rem .65rem .55rem; font-family: var(--f-mono); font-size: .66rem; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.sm-pager { display: flex; gap: .5rem; margin: .4rem 0 1rem; }
.sm-pager a { text-decoration: none; }
