/* WeDoodle brand overrides for Pico CSS v2 */

/* ── Self-hosted Fonts (Fredoka + Nunito) ── */
@font-face {
  font-family: 'Fredoka';
  src: url('/static/fonts/fredoka-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/static/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/nunito-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/nunito-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Color Palette ── */
:root {
  --pico-primary: #7c3aed;
  --pico-primary-hover: #6d28d9;
  --pico-primary-focus: rgba(124, 58, 237, 0.25);
  --pico-primary-inverse: #fff;

  --pico-font-family: "Nunito", system-ui, -apple-system, sans-serif;
  --pico-border-radius: 1rem;
  --pico-block-spacing-vertical: 1.5rem;

  /* WeDoodle extended palette */
  --wd-purple: #7c3aed;
  --wd-pink: #ec4899;
  --wd-coral: #f97316;
  --wd-teal: #06b6d4;
  --wd-yellow: #facc15;
  --wd-green: #16a34a;
  --wd-red: #dc2626;

  /* Decorative */
  --wd-bg-subtle: #faf5ff;
  --wd-border-sketch: 2.5px solid var(--wd-purple);
  --wd-heading-font: "Fredoka", "Nunito", system-ui, sans-serif;
  --wd-card-shadow: 0 2px 12px rgba(124, 58, 237, 0.08);
  --wd-card-shadow-hover: 0 8px 24px rgba(124, 58, 237, 0.16);
}

[data-theme="dark"] {
  --pico-primary: #a78bfa;
  --pico-primary-hover: #8b5cf6;
  --wd-bg-subtle: #1a1025;
  --wd-card-shadow: 0 2px 12px rgba(167, 139, 250, 0.1);
  --wd-card-shadow-hover: 0 8px 24px rgba(167, 139, 250, 0.2);
}

/* ── Playful headings ── */
h1, h2, h3 {
  font-family: var(--wd-heading-font);
}

h1 {
  background: linear-gradient(135deg, var(--wd-purple) 0%, var(--wd-pink) 50%, var(--wd-coral) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Let sparkle emoji render normally inside gradient headings */
.sparkle {
  -webkit-text-fill-color: initial;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
}

/* ── Wavy decorative underline on h2 ── */
h2 {
  position: relative;
  display: inline-block;
  color: var(--wd-purple);
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8'%3E%3Cpath d='M0 4 Q15 0 30 4 Q45 8 60 4 Q75 0 90 4 Q105 8 120 4' fill='none' stroke='%23ec4899' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  background-size: 60px 6px;
}

/* ── Cards: hand-drawn feel ── */
article {
  border: 2.5px solid var(--wd-purple);
  border-radius: 1.2rem;
  box-shadow: var(--wd-card-shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

/* Colorful top accent bar on cards */
article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--wd-purple), var(--wd-pink), var(--wd-coral), var(--wd-yellow), var(--wd-teal));
  border-radius: 1.2rem 1.2rem 0 0;
}

/* ── Card hover lift ── */
article:hover {
  transform: translateY(-3px);
  box-shadow: var(--wd-card-shadow-hover);
}

/* ── Gallery grid ── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* Slight random tilt on gallery cards — polaroid feel */
.gallery-grid article:nth-child(4n+1) { transform: rotate(-1.2deg); }
.gallery-grid article:nth-child(4n+2) { transform: rotate(0.8deg); }
.gallery-grid article:nth-child(4n+3) { transform: rotate(-0.6deg); }
.gallery-grid article:nth-child(4n+4) { transform: rotate(1.0deg); }

.gallery-grid article:hover {
  transform: rotate(0deg) translateY(-4px) scale(1.02);
}

/* ── Upload zone: sketchpad style ── */
.sketchpad {
  border: 3px dashed var(--wd-purple) !important;
  border-radius: 1.5rem !important;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(124, 58, 237, 0.06) 27px,
      rgba(124, 58, 237, 0.06) 28px
    ),
    var(--wd-bg-subtle) !important;
  box-shadow: inset 0 0 0 4px var(--wd-bg-subtle);
  position: relative;
}

.sketchpad::before {
  content: ""; /* override the rainbow bar — sketchpad has its own style */
  background: none;
  height: 0;
}

/* Pencil icon decoration for upload */
.sketchpad-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--wd-heading-font);
  font-size: 1.1rem;
  color: var(--wd-purple);
}

.sketchpad-label svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

/* ── Styled file input area ── */
.file-drop-zone {
  border: 2px dashed var(--wd-pink);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  background: rgba(236, 72, 153, 0.04);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.file-drop-zone:hover {
  border-color: var(--wd-coral);
  background: rgba(249, 115, 22, 0.06);
}

.file-drop-zone p {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--pico-muted-color);
}

/* ── Submit button: playful wiggle ── */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

button[type="submit"],
[role="button"]:not(.outline) {
  background: linear-gradient(135deg, var(--wd-purple), var(--wd-pink));
  border: none;
  font-family: var(--wd-heading-font);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button[type="submit"]:hover,
[role="button"]:not(.outline):hover {
  animation: wiggle 0.4s ease;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.3);
  background: linear-gradient(135deg, var(--wd-purple), var(--wd-pink));
}

/* ── Outline buttons ── */
[role="button"].outline {
  border: 2.5px solid var(--wd-purple);
  color: var(--wd-purple);
  font-family: var(--wd-heading-font);
  font-weight: 700;
}

/* ── Loading spinner: bouncing dots ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

.spinner {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.spinner::before,
.spinner::after {
  content: "";
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.2s infinite ease-in-out;
}

.spinner::before {
  background: var(--wd-purple);
  animation-delay: -0.3s;
}

.spinner::after {
  background: var(--wd-pink);
  animation-delay: 0.15s;
}

/* Middle dot via box-shadow trick */
.spinner {
  width: auto;
  height: auto;
  border: none;
  position: relative;
}

/* ── Credit badge in nav ── */
.credit-badge {
  background: linear-gradient(135deg, var(--wd-purple), var(--wd-pink));
  color: var(--pico-primary-inverse);
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: var(--wd-heading-font);
}

/* ── Status indicators ── */
[data-status] {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.15rem 0.6rem;
  border-radius: 2rem;
  display: inline-block;
}

[data-status="pending"] {
  --pico-color: var(--pico-muted-color);
  background: rgba(0, 0, 0, 0.06);
}
[data-status="processing"] {
  --pico-color: var(--wd-purple);
  background: rgba(124, 58, 237, 0.1);
  color: var(--wd-purple);
}
[data-status="completed"] {
  --pico-color: var(--wd-green);
  background: rgba(22, 163, 74, 0.1);
  color: var(--wd-green);
}
[data-status="failed"] {
  --pico-color: var(--wd-red);
  background: rgba(220, 38, 38, 0.1);
  color: var(--wd-red);
}
[data-status="rejected"] {
  --pico-color: var(--wd-red);
  background: rgba(220, 38, 38, 0.1);
  color: var(--wd-red);
}

/* ── Nav brand styling ── */
nav strong {
  font-family: var(--wd-heading-font);
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--wd-purple), var(--wd-pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Hero section ── */
.hero {
  text-align: center;
  padding: 2rem 1rem 3rem;
  position: relative;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.2rem;
  color: var(--pico-muted-color);
}

/* Decorative sparkles */
.sparkle {
  display: inline-block;
  animation: sparkle-pulse 2s ease-in-out infinite;
}

@keyframes sparkle-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* ── Footer wavy top ── */
footer.container {
  text-align: center;
  padding-top: 2rem;
  margin-top: 3rem;
  border-top: none;
  position: relative;
}

footer.container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 8'%3E%3Cpath d='M0 4 Q15 0 30 4 Q45 8 60 4 Q75 0 90 4 Q105 8 120 4' fill='none' stroke='%237c3aed' stroke-width='1.5' stroke-linecap='round' opacity='0.3'/%3E%3C/svg%3E") repeat-x;
  background-size: 60px 8px;
}

/* ── How-it-works steps with colored numbers ── */
.steps-list {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps-list li {
  counter-increment: step;
  padding: 0.5rem 0 0.5rem 3rem;
  position: relative;
  font-size: 1.05rem;
}

.steps-list li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-family: var(--wd-heading-font);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.steps-list li:nth-child(1)::before { background: var(--wd-purple); }
.steps-list li:nth-child(2)::before { background: var(--wd-pink); }
.steps-list li:nth-child(3)::before { background: var(--wd-coral); }
.steps-list li:nth-child(4)::before { background: var(--wd-teal); }
.steps-list li:nth-child(5)::before { background: var(--wd-yellow); color: #333; }

/* ── Duration selector cards ── */
.duration-options {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.duration-option {
  flex: 1;
  min-width: 120px;
}

.duration-option input[type="radio"] {
  display: none;
}

.duration-option label {
  display: block;
  text-align: center;
  padding: 1rem 0.75rem;
  border: 2.5px solid var(--pico-muted-border-color);
  border-radius: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  font-family: var(--wd-heading-font);
}

.duration-option label:hover {
  border-color: var(--wd-purple);
  background: var(--wd-bg-subtle);
  transform: translateY(-2px);
}

.duration-option input[type="radio"]:checked + label {
  border-color: var(--wd-purple);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: 0 0 0 3px var(--pico-primary-focus);
}

.duration-option .duration-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--wd-purple);
  display: block;
}

.duration-option .duration-label {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
  display: block;
  margin-top: 0.25rem;
}

/* ── Page background subtle pattern ── */
body {
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.02) 0%, transparent 50%);
}
