/* ==========================================================================
   STICKERSNAP — design tokens
   Palette:  ink #14231C (text) / paper #FFFFFF (bg) / mint #EBF6EF (cards)
             emerald #1FA97A (primary accent) / coral #FF5A5F (secondary accent)
   Type:     Baloo 2 (display, bubbly/sticker feel) / Inter (body/UI)
             Space Mono (tags, technical labels)
   Signature: dashed "die-cut" borders on cards + canvas, like a sticker
              waiting to be peeled and cut out.
   ========================================================================== */

:root {
  --ink: #14231c;
  --ink-soft: #4a5c53;
  --paper: #ffffff;
  --mint: #eaf6ef;
  --mint-line: #cfe9da;
  --emerald: #1fa97a;
  --emerald-dark: #157a58;
  --coral: #ff5a5f;
  --shadow: 0 8px 24px rgba(20, 35, 28, 0.08);
  --shadow-lift: 0 14px 32px rgba(20, 35, 28, 0.14);
  --radius: 20px;
  --font-display: 'Baloo 2', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 0.5em;
}

a { color: var(--emerald-dark); }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   HEADER + NAV
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 2px dashed var(--mint-line);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink);
}

.brand-mark { font-size: 1.3rem; }
.brand-name { letter-spacing: -0.02em; }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  background: var(--mint);
  border: 2px solid var(--mint-line);
  border-radius: 12px;
  cursor: pointer;
  z-index: 110;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--emerald-dark);
  border-bottom-color: var(--emerald);
}

/* Mobile nav (slide-down) */
@media (max-width: 860px) {
  .site-nav {
    position: fixed;
    top: 70px;
    left: 16px;
    right: 16px;
    background: var(--paper);
    border: 2px dashed var(--mint-line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lift);
    padding: 12px 8px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .site-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .site-nav ul {
    flex-direction: column;
    gap: 2px;
  }
  .site-nav a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    border-bottom: none;
  }
  .site-nav a:hover,
  .site-nav a[aria-current="page"] {
    background: var(--mint);
    border-bottom: none;
  }
}

@media (min-width: 861px) {
  .hamburger { display: none; }
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hero {
  background: linear-gradient(180deg, var(--mint) 0%, var(--paper) 100%);
  padding: 48px 20px 32px;
  text-align: center;
}

.hero-inner { max-width: 720px; margin: 0 auto; }

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--emerald-dark);
  margin: 0 0 14px;
}

.hero h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  line-height: 1.15;
}

.hero-sub {
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 20px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--paper);
  border: 2px dashed var(--mint-line);
  border-radius: 999px;
  padding: 6px 14px;
}

/* ==========================================================================
   TOOL LAYOUT
   ========================================================================== */

.tool {
  padding: 24px 20px 56px;
  max-width: 1120px;
  margin: 0 auto;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 1024px) {
  .tool-grid {
    grid-template-columns: 1fr 1.3fr 1fr;
    align-items: start;
  }
}

.card {
  background: var(--mint);
  border: 2px dashed var(--mint-line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  position: relative;
}

/* Signature "peeling corner" die-cut detail on the upload card */
#uploadCard::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 34px;
  height: 34px;
  background: var(--paper);
  border-left: 2px dashed var(--mint-line);
  border-bottom: 2px dashed var(--mint-line);
  border-radius: 0 var(--radius) 0 60%;
  box-shadow: -2px 2px 6px rgba(20,35,28,0.08);
}

.step-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--emerald);
  color: #fff;
  border-radius: 50%;
  font-size: 0.9rem;
}

/* --- Upload / dropzone --- */

.dropzone {
  border: 2px dashed var(--emerald);
  border-radius: 14px;
  background: var(--paper);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  background: #f2fbf6;
  border-color: var(--emerald-dark);
}

.dropzone-icon { font-size: 2.4rem; display: block; margin-bottom: 8px; }

.dropzone-text { margin: 0 0 4px; font-weight: 500; }

.link-text { color: var(--emerald-dark); text-decoration: underline; }

.dropzone-hint { margin: 0; font-size: 0.8rem; color: var(--ink-soft); font-family: var(--font-mono); }

.upload-preview img {
  max-width: 140px;
  max-height: 140px;
  margin: 0 auto 10px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.upload-filename {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  word-break: break-all;
  margin: 0;
}

.upload-error {
  color: #b3261e;
  background: #fdecea;
  border: 1px solid #f5c2be;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin: 12px 0 0;
}

.privacy-note {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-align: center;
}

/* --- Canvas / edit card --- */

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 20px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px dashed var(--mint-line);
  background: repeating-conic-gradient(#f4f4f4 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
}

#stickerCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--mint);
  margin: 0;
}

/* The [hidden] attribute normally sets display:none, but the display:flex
   rule above (same specificity, author stylesheet) was winning the cascade
   and keeping this placeholder visible forever, blocking the canvas
   underneath. This rule forces it to actually disappear once the JS
   sets canvasPlaceholder.hidden = true. */
.canvas-placeholder[hidden] {
  display: none;
}

.controls { display: flex; flex-direction: column; gap: 16px; }

.control-group { display: flex; flex-direction: column; gap: 6px; }

.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label, .control-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

textarea, select, input[type="color"], input[type="range"] {
  font-family: var(--font-body);
  border: 2px solid var(--mint-line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}

textarea { resize: vertical; min-height: 56px; }

input[type="color"] {
  padding: 3px;
  height: 40px;
  cursor: pointer;
}

.checkbox-group { justify-content: center; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.position-buttons { display: flex; gap: 8px; }

.pos-btn {
  flex: 1;
  padding: 8px 0;
  border: 2px solid var(--mint-line);
  background: var(--paper);
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pos-btn.active,
.pos-btn:hover {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.layer-actions { display: flex; }

.layer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--paper);
  border: 2px solid var(--mint-line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.layer-item.selected {
  border-color: var(--emerald);
  background: #f2fbf6;
}

.layer-item .layer-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-item .layer-delete {
  background: none;
  border: none;
  color: var(--coral);
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 6px;
}

/* --- Export card --- */

.export-card { text-align: center; }

.export-copy { font-size: 0.9rem; color: var(--ink-soft); margin: 0 0 18px; }

.export-status {
  min-height: 1.4em;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--emerald-dark);
  margin: 12px 0 4px;
}

.export-status.warn { color: #b3261e; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  font-family: var(--font-body);
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--coral);
  color: #fff;
  padding: 12px 20px;
  box-shadow: 0 6px 16px rgba(255, 90, 95, 0.35);
}

.btn-primary:hover:not(:disabled) { background: #ff474c; }

.btn-primary:disabled {
  background: #d9d9d9;
  color: #8a8a8a;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-large { width: 100%; font-size: 1rem; padding: 14px 20px; }

.btn-secondary {
  background: var(--emerald);
  color: #fff;
  padding: 10px 16px;
  width: 100%;
}

.btn-secondary:hover { background: var(--emerald-dark); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  text-decoration: underline;
  padding: 10px 16px;
  margin-top: 10px;
  width: 100%;
}

/* ==========================================================================
   SEO CONTENT
   ========================================================================== */

.seo-content {
  background: var(--mint);
  border-top: 2px dashed var(--mint-line);
  padding: 48px 20px 64px;
}

.seo-inner { max-width: 760px; margin: 0 auto; }

.seo-inner h2 {
  font-size: 1.4rem;
  margin-top: 2em;
}

.seo-inner h2:first-child { margin-top: 0; }

.seo-inner p, .seo-inner li { color: var(--ink-soft); font-size: 0.98rem; }

.how-to-list { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }

.faq { display: flex; flex-direction: column; gap: 18px; margin-top: 12px; }

.faq-item h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: 4px;
  color: var(--ink);
}

.faq-item p { margin: 0; }

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  background: var(--ink);
  color: #dfe9e3;
  padding: 32px 20px;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}

.footer-nav a {
  color: #dfe9e3;
  text-decoration: none;
  font-size: 0.9rem;
}

.footer-nav a:hover { color: var(--emerald); }

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #93a49b;
  margin: 0;
}

/* ==========================================================================
   PLACEHOLDER PAGES
   ========================================================================== */

.placeholder-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 20px;
  min-height: 40vh;
}

.placeholder-main h1 { font-size: 2rem; }

.placeholder-main p { color: var(--ink-soft); }

/* ==========================================================================
   RESPONSIVE TWEAKS
   ========================================================================== */

@media (max-width: 480px) {
  .control-row { grid-template-columns: 1fr; }
  .hero { padding: 36px 16px 24px; }
}
