/* Split it — OverPress Tools · redesign 2026 */

:root {
  --primary: #066aab;
  --primary-dark: #054f80;
  --primary-light: #e6f1f9;
  --primary-tint: rgba(6, 106, 171, 0.06);
  --accent: #ed0a71;
  --accent-dark: #c20860;
  --accent-light: #fde6f1;
  --text: #14161b;
  --text-soft: #4a4a55;
  --text-dim: #8b8b95;
  --border: #eaeaef;
  --border-strong: #d6d6dd;
  --bg: #ffffff;
  --bg-soft: #fafafb;
  --bg-tint: #f4f5f7;
  --success: #00ab6b;
  --warning: #cc7a00;
  --error: #d63637;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 27, 0.04), 0 1px 3px rgba(20, 22, 27, 0.06);
  --shadow: 0 4px 12px rgba(20, 22, 27, 0.05), 0 2px 6px rgba(20, 22, 27, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(20, 22, 27, 0.12), 0 8px 16px -8px rgba(20, 22, 27, 0.08);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

[hidden] { display: none !important; }

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, var(--primary-tint) 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--text);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

button { font-family: inherit; }

.hidden { display: none !important; }

/* ─────────────────────────────── HEADER */

.site-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.back, .header-spacer { width: 44px; height: 44px; }

.back {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-soft);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.back:hover, .back:active {
  background: var(--bg-tint);
  color: var(--text);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  color: var(--text);
}

.brand:hover { color: var(--text); }

.brand-logo {
  height: 24px !important;
  width: auto;
  max-width: 220px;
  display: block;
}

.brand-suffix {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.62rem;
  color: var(--text-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  line-height: 1;
}

@media (min-width: 720px) {
  .brand-logo { height: 28px; }
  .brand-suffix { font-size: 0.66rem; padding: 4px 10px; }
}

/* ─────────────────────────────── STAGE */

.stage {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 18px 80px;
}

@media (min-width: 720px) {
  .stage { padding: 32px 24px 80px; }
}

@media (min-width: 1024px) {
  .stage { max-width: 1440px; padding: 40px 32px 80px; }
}

/* ─────────────────────────────── HERO */

.hero { margin-bottom: 26px; }

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 5px 12px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(2rem, 7vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 10px;
}

.hero .lead {
  font-size: 1.02rem;
  color: var(--text-soft);
  max-width: 540px;
}

/* ─────────────────────────────── DROPZONE */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 24px 32px;
  background: var(--bg);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--primary-tint), transparent 60%);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
  pointer-events: none;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.dropzone:hover::before,
.dropzone.dragover::before { opacity: 1; }

.dropzone-illustration {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  position: relative;
}

.dz-slot {
  background: var(--bg-tint);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  transition: all 0.3s var(--ease);
}

.dz-slot-1, .dz-slot-3 {
  width: 32px;
  height: 42px;
}

.dz-slot-2 {
  width: 40px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-4px);
}

.dropzone:hover .dz-slot-1 { transform: rotate(-6deg) translate(-3px, 2px); }
.dropzone:hover .dz-slot-3 { transform: rotate(6deg) translate(3px, 2px); }
.dropzone:hover .dz-slot-2 { transform: translateY(-7px) scale(1.05); }

.dropzone-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.dz-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.dz-sub {
  color: var(--text-dim);
  font-size: 0.83rem;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}

.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 0 8px;
  text-align: left;
}

.hint strong { color: var(--text-soft); font-weight: 600; }
.hint-icon { flex: 0 0 auto; margin-top: 3px; }
.hint-text { flex: 0 1 auto; min-width: 0; }

@media (min-width: 720px) {
  .hint { justify-content: center; }
  .hint-text { flex: 0 0 auto; }
}

/* ─────────────────────────────── BUTTONS */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 13px 24px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  min-height: 48px;
  width: 100%;
  letter-spacing: 0.01em;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { cursor: not-allowed; opacity: 0.4; }

.btn.primary {
  background: var(--text);
  color: #fff;
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary);
  box-shadow: 0 4px 14px rgba(6, 106, 171, 0.35);
}

.btn.accent {
  background: var(--accent);
  color: #fff;
}

.btn.accent:hover:not(:disabled) {
  background: var(--accent-dark);
  box-shadow: 0 4px 14px rgba(237, 10, 113, 0.35);
}

.btn.accent:disabled { background: var(--border); color: var(--text-dim); opacity: 1; }

.btn.ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border);
}

.btn.ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-soft);
}

/* ─────────────────────────────── WORKSPACE */

#workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Editor card */
.editor-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.editor-frame-wrap {
  width: 100%;
  background: var(--bg-tint);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.editor-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  max-width: 100%;
}

#source-image {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

@media (min-width: 720px) {
  #source-image { max-height: 56vh; }
}

.crop-window {
  position: absolute;
  left: var(--crop-l, 0%);
  top: var(--crop-t, 0%);
  width: var(--crop-w, 100%);
  height: var(--crop-h, 100%);
  cursor: grab;
  outline: 2px solid #fff;
  outline-offset: -2px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.25),
    0 0 0 9999px rgba(20, 22, 27, 0.55);
  transition: left 0.12s var(--ease), top 0.12s var(--ease),
              width 0.12s var(--ease), height 0.12s var(--ease);
}

.crop-window.draggable { cursor: grab; }
.crop-window.fixed { cursor: default; }
.crop-window.dragging {
  cursor: grabbing;
  transition: none;
}

/* Internal grid showing slice divisions */
.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.45) 1px, transparent 1px);
  background-size: calc(100% / var(--cols, 3)) 100%;
  background-position: 0 0;
}

.crop-grid::before,
.crop-grid::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.25);
}

.crop-grid::before {
  left: 0; right: 0;
  top: 33.33%;
  height: 1px;
}

.crop-grid::after {
  left: 0; right: 0;
  top: 66.66%;
  height: 1px;
}

.drag-cue {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.crop-window.draggable:hover .drag-cue,
.crop-window.draggable.show-cue .drag-cue {
  opacity: 1;
}

.drag-cue::before {
  content: '';
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 9 2 12 5 15'/><polyline points='9 5 12 2 15 5'/><polyline points='15 19 12 22 9 19'/><polyline points='19 9 22 12 19 15'/><line x1='2' y1='12' x2='22' y2='12'/><line x1='12' y1='2' x2='12' y2='22'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Editor toolbar (under image) */
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 6px 4px;
  flex-wrap: wrap;
}

.editor-info {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tint);
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
}

.info-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.info-chip.subtle { background: transparent; color: var(--text-dim); padding-left: 0; padding-right: 0; }

/* Status (unified) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 600;
  animation: statusIn 0.25s var(--ease);
  flex-shrink: 0;
}

.status[data-state="success"] { background: rgba(0,171,107,0.1); color: var(--success); }
.status[data-state="warning"] { background: rgba(204,122,0,0.1); color: var(--warning); }
.status[data-state="error"]   { background: rgba(214,54,55,0.1); color: var(--error); }
.status[data-state="info"]    { background: var(--primary-tint); color: var(--primary); }

.status-icon {
  width: 16px; height: 16px;
  display: inline-grid;
  place-items: center;
}

.status-icon svg { width: 100%; height: 100%; }

@keyframes statusIn {
  from { opacity: 0; transform: translateY(-3px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────── SLICE STRIP */

.slice-strip-wrap {
  padding: 4px 2px;
}

.slice-strip-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.slice-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.slice-thumb {
  position: relative;
  flex: 0 0 auto;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-tint);
  border: 1px solid var(--border);
}

.slice-thumb canvas { display: block; }

.slice-thumb .num {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

/* ─────────────────────────────── CONTROLS */

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 2px;
}

.control-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: block;
}

.aspect-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.aspect-option { cursor: pointer; position: relative; }

.aspect-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.aspect-option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-soft);
  padding: 14px 8px;
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.15s var(--ease);
  min-height: 70px;
}

.aspect-option:hover span {
  border-color: var(--border-strong);
  color: var(--text);
}

.aspect-option input:checked + span {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary);
}

.ratio-shape {
  display: block;
  background: currentColor;
  border-radius: 2px;
  opacity: 0.5;
}

.ratio-shape.r-3-4 { width: 18px; height: 24px; }
.ratio-shape.r-4-5 { width: 20px; height: 25px; }
.ratio-shape.r-1-1 { width: 22px; height: 22px; }

/* Counter */
.counter {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 56px;
}

.counter button {
  width: 56px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s var(--ease);
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

.counter button:hover:not(:disabled) { background: var(--bg-tint); }
.counter button:active:not(:disabled) { background: var(--primary-tint); color: var(--primary); }
.counter button:disabled { color: var(--text-dim); cursor: not-allowed; opacity: 0.35; }
.counter button.disabled { color: var(--text-dim); cursor: not-allowed; opacity: 0.35; }

.counter-value {
  flex: 1;
  text-align: center;
  font-family: 'Montserrat', sans-serif;
}

.counter-value strong {
  display: inline;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

.counter-value small {
  display: inline;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.85rem;
  margin-left: 6px;
}

/* Actions */
.control-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#progress-container { display: none; }
#progress-container.active { display: block; margin-bottom: 4px; }

#progress-bar {
  width: 100%;
  height: 6px;
  border: none;
  border-radius: 3px;
  overflow: hidden;
  background: var(--border);
  appearance: none;
}

#progress-bar::-webkit-progress-bar { background: var(--border); border-radius: 3px; }
#progress-bar::-webkit-progress-value { background: var(--accent); border-radius: 3px; transition: width 0.2s; }
#progress-bar::-moz-progress-bar { background: var(--accent); border-radius: 3px; }

/* ─────────────────────────────── FOOTER */

.site-footer {
  padding: 24px 22px 36px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.site-footer a {
  color: var(--text-soft);
  border-bottom: 1px dotted var(--text-dim);
}

.site-footer a:hover { color: var(--primary); border-color: var(--primary); }

/* ─────────────────────────────── JOB TOAST */

.job-toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: #fff;
  padding: 12px 18px 12px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.4s var(--ease);
  max-width: calc(100vw - 32px);
}

.job-toast.show {
  transform: translateX(-50%) translateY(0);
}

.job-toast-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  flex: 0 0 auto;
}

/* ─────────────────────────────── RESPONSIVE */

@media (min-width: 720px) {
  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
    align-items: end;
  }
  .control-actions { grid-column: 1 / -1; flex-direction: row; }
  .control-actions .btn { flex: 1; min-width: 0; }
  .control-actions #progress-container { width: 100%; grid-column: 1 / -1; }
}

@media (min-width: 960px) {
  #workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 460px);
    gap: 32px;
    align-items: start;
  }
  .editor-card { grid-row: span 2; }
  .slice-strip-wrap,
  .controls { grid-column: 2; }
}

@media (min-width: 1280px) {
  #workspace {
    grid-template-columns: minmax(0, 1fr) 520px;
    gap: 40px;
  }
}
