/* ======================================================
   Sticker Maker — warm paper theme
   ====================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:            #FBF8F2;
  --bg-surface:    #FFFFFF;
  --bg-sunken:     #F1ECE3;
  --bg-elevated:   #FFFFFF;

  --text:          #1E1A15;
  --text-secondary:#5F574D;
  --text-tertiary: #948B7F;

  --accent:        #E5602B;
  --accent-hover:  #C94E1F;
  --accent-soft:   #FDEDE4;

  --border:        #E4DCCF;
  --border-strong: #CFC4B2;

  --error:         #B4432D;

  --radius:        14px;
  --radius-sm:     8px;
  --radius-pill:   999px;
  --shadow-card:   0 1px 2px rgba(30,26,21,.06), 0 8px 24px rgba(30,26,21,.08);
  --gutter:        20px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Figtree', -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  padding: 0 var(--gutter);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Bricolage Grotesque', 'Figtree', sans-serif;
  letter-spacing: -0.02em;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==================== Site Header ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--gutter);
  margin-inline: calc(var(--gutter) * -1);
  padding-left: calc(var(--gutter) * 2);
  padding-right: calc(var(--gutter) * 2);
}

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

.brand-mark {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 1.5px var(--accent);
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Bricolage Grotesque', 'Figtree', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--text); }

.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s;
}
.nav-cta:hover { background: var(--accent-hover); color: #fff !important; }

/* ==================== Hero = Tool ==================== */
.tool-area {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.hero-tool {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  align-items: center;
  padding-block: 56px 32px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 12px;
}

.hero-tool h1 {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.08;
  margin-bottom: 16px;
  text-wrap: balance;
}

.hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 440px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.hero-hint {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ==================== Sample Strip ==================== */
.sample-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sample-label {
  font-size: 13px;
  color: var(--text-tertiary);
}

.sample {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-sunken);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.sample:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.sample:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sample img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==================== Canvas ==================== */
.hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-wrap {
  position: relative;
  background-color: var(--bg-sunken);
  background-image:
    linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%),
    linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  width: 100%;
  max-width: 700px;
}
.canvas-wrap.drag {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  background-color: var(--accent-soft);
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.canvas-drop-hint {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 14px;
  pointer-events: none;
}
.canvas-wrap.drag .canvas-drop-hint {
  display: flex;
}

/* ==================== Status ==================== */
.status {
  min-height: 20px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 10px;
}
.status-error { color: var(--error); }

/* ==================== Tool Panel ==================== */
.tool-panel {
  max-width: 700px;
  margin: 0 auto;
  padding-block: 8px 24px;
}

.tool-panel-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ==================== Style Pickers ==================== */
.style-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.style-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.style-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Sticker type pills */
#stickerTypeRow .style-swatch {
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  width: auto;
}
#stickerTypeRow .style-swatch:hover {
  border-color: var(--border-strong);
  background: var(--bg-sunken);
}
#stickerTypeRow .style-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#stickerTypeRow .style-swatch.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
#stickerTypeRow .style-swatch .swatch-inner {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
}
#stickerTypeRow .style-swatch .swatch-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
#stickerTypeRow .style-swatch.active .swatch-label {
  color: #fff;
}

/* Sticker type swatch previews */
.swatch-inner.swatch-torn   { background: #EEDCAE; border: 2px solid #f5f5f0; }
.swatch-inner.swatch-clean  { background: #F5F5F0; border: 2px solid #fff; }
.swatch-inner.swatch-deckle { background: #EEDCAE; border: 2px dotted #f5f5f0; }
.swatch-inner.swatch-stamp  { background: #EEDCAE; border: 2px dashed #f5f5f0; }
.swatch-inner.swatch-washi  { background: rgba(238,220,174,0.62); }
.swatch-inner.swatch-vinyl  { background: #B8D8F0; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }

/* Paper color circles */
#paperColorRow .style-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  padding: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
#paperColorRow .style-swatch:hover {
  box-shadow: 0 0 0 1px var(--border-strong);
  transform: scale(1.08);
}
#paperColorRow .style-swatch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#paperColorRow .style-swatch.active {
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--accent);
}
#paperColorRow .style-swatch .swatch-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: none;
}
#paperColorRow .style-swatch .swatch-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ==================== Buttons ==================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: default; }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--bg-sunken); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-upload:hover { background: var(--accent-hover); }
.btn-upload:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-lg {
  height: 56px;
  font-size: 17px;
}

/* ==================== Controls Row ==================== */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* ==================== Shadow Toggle Switch ==================== */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toggle-switch input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 38px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform 0.2s;
}

.toggle-switch input[type="checkbox"]:checked {
  background: var(--accent);
}

.toggle-switch input[type="checkbox"]:checked::before {
  transform: translateX(16px);
}

.toggle-switch input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==================== Fine-tune Sliders ==================== */
.fine-tune-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.fine-tune-toggle:hover { color: var(--text); }
.fine-tune-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.toggle-icon {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-tertiary);
}

.slider-group {
  display: none;
  width: 100%;
  max-width: 600px;
}
.slider-group.open {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 32px;
}

.slider-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 6px;
  align-items: center;
}

.slider-val {
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: right;
}

.slider-group input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: var(--accent);
  height: 44px;
  padding-block: 12px;
}

/* ==================== Ad Containers ==================== */
.ad-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.ad-inline {
  max-width: 728px;
  margin-block: 40px;
}

.ad-bottom {
  max-width: 728px;
  padding: 16px 0;
}

.ad-rail {
  display: none;
}

.ad-placeholder {
  width: 100%;
  min-height: 90px;
  background: var(--bg-sunken);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.ad-rail .ad-placeholder {
  min-height: 250px;
  width: 300px;
}

/* ==================== How It Works ==================== */
.how-it-works {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 0;
  border-top: 1px solid var(--border);
}

.how-it-works h2 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.step {
  text-align: center;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-family: 'Bricolage Grotesque', sans-serif;
}

.step h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.step p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==================== Sticker Types Guide ==================== */
.types-guide {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 0 48px;
}

.types-guide h2 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 24px;
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.type-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.type-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.type-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==================== Footer ==================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 40px;
  margin-top: 16px;
}

.footer-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
}

.footer-brand p {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 10px;
  line-height: 1.5;
}

.footer-brand .brand {
  margin-bottom: 4px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.footer-col a {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: none;
}
.footer-col a:hover { color: var(--text); }

/* ==================== Legal Pages ==================== */
.legal-page {
  max-width: 65ch;
  margin: 0 auto;
  padding: 48px 0 64px;
}

.legal-page h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.legal-updated {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}

.legal-page h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 8px;
}

.legal-page p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.legal-page ul {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
  padding-left: 24px;
}

.legal-page li {
  margin-bottom: 6px;
}

/* ==================== Wide Desktop: Ad Rail ==================== */
@media (min-width: 1280px) {
  .ad-rail {
    display: flex;
    position: absolute;
    right: -340px;
    top: 56px;
    position: sticky;
    top: 88px;
    flex-shrink: 0;
    width: 300px;
  }

  .tool-area {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
  }

  .hero-tool {
    grid-column: 1;
  }
  .tool-panel {
    grid-column: 1;
  }
  .ad-rail {
    grid-column: 2;
    grid-row: 1 / 3;
    position: sticky;
    top: 88px;
    align-self: start;
  }
}

/* ==================== Tablet ==================== */
@media (max-width: 900px) {
  .hero-tool {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-block: 32px 16px;
  }

  .hero-stage {
    order: -1;
  }

  .hero-copy {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-sub {
    max-width: 520px;
  }

  .hero-actions {
    justify-content: center;
  }

  .sample-strip {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  :root {
    --gutter: 14px;
  }

  .steps {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .type-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary {
    justify-content: center;
    order: -1;
    width: 100%;
  }

  .btn-secondary {
    justify-content: center;
    width: 100%;
  }

  .slider-group.open {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .style-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 4px 0;
    max-width: 100%;
    scrollbar-width: none;
  }
  .style-row::-webkit-scrollbar { display: none; }

  #stickerTypeRow .style-swatch { flex-shrink: 0; }
  #paperColorRow .style-swatch { flex-shrink: 0; }
}

@media (max-width: 640px) {
  .site-nav a:not(.nav-cta) {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-tool h1 {
    font-size: 28px;
  }

  .type-grid {
    grid-template-columns: 1fr;
  }

  .canvas-wrap {
    padding: 12px;
    border-radius: var(--radius-sm);
  }

  .btn-lg {
    width: 100%;
    justify-content: center;
    height: 48px;
    font-size: 15px;
  }
}

/* ==================== Reduced Motion ==================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  #paperColorRow .style-swatch:hover {
    transform: none;
  }
}
