/* ============================================
   TOGETHER WE SOLVE — post-problem.css
   Warm, Encouraging, and Gamified Form Styles
   ============================================ */

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

:root {
  /* Editorial Color System */
  --bg-warm: #FAF6F0;       /* Warm Ivory Paper */
  --text-charcoal: #1C1E1D; /* Charcoal Ink */
  --accent-moss: #23382B;   /* Deep Forest Moss */
  --accent-ocean: #3D5A6C;  /* Muted Ocean Blue */
  --accent-clay: #C87D55;   /* Earthy Warm Clay */
  --bg-fog: #EBECE8;        /* Soft Foggy Grey-Green */
  --bg-dark-moss: #1A2E22;  /* Rich Dark Moss Background */

  /* Spacing & Borders */
  --border-light: rgba(28, 30, 29, 0.08);
  --border-dark: rgba(250, 246, 240, 0.1);
  --font-display: 'DM Serif Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  font-size: 16px;
  scroll-behavior: auto;
  background-color: var(--bg-warm);
}

body {
  background-color: var(--bg-warm);
  color: var(--text-charcoal);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Tactile Paper Texture Overlay ────────────────── */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0.045;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ─── UTILITY ─────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 64px;
}

@media (max-width: 768px) {
  .container { padding: 0 28px; }
}

.label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent-clay);
  margin-bottom: 24px;
  display: block;
}

.italic { 
  font-family: var(--font-display);
  font-style: italic; 
}

/* ─── NAV (Editorial Header) ────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 24px 64px;
  display: flex;
  align-items: center;
  transition: var(--transition-smooth);
}

.nav.scrolled {
  background: rgba(250, 246, 240, 0.92);
  backdrop-filter: blur(16px);
  padding: 16px 64px;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

.nav-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-charcoal);
  text-decoration: none;
  letter-spacing: -0.01em;
  font-weight: 400;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 36px;
}

.nav-link {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-charcoal);
  text-decoration: none;
  letter-spacing: 0.01em;
  opacity: 0.75;
  transition: opacity 0.3s, color 0.3s;
  position: relative;
}

.nav-link:hover, .nav-link.active {
  opacity: 1;
  color: var(--accent-moss);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-clay);
  border-radius: 2px;
}

.nav-cta {
  font-size: 13px;
  font-weight: 500;
  color: var(--bg-warm);
  text-decoration: none;
  padding: 12px 28px;
  border: none;
  border-radius: 100px;
  transition: var(--transition-smooth);
  letter-spacing: 0.03em;
  background: var(--accent-moss);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-cta:hover {
  background: var(--text-charcoal);
  color: var(--bg-warm);
  transform: translateY(-1px);
}

.nav-cta-arrow {
  font-size: 14px;
  display: inline-block;
  transition: transform 0.3s;
}

.nav-cta:hover .nav-cta-arrow {
  transform: translate(2px, -2px);
}

@media (max-width: 900px) {
  .nav-links { display: none; }
}

@media (max-width: 600px) {
  .nav { padding: 18px 24px; }
  .nav.scrolled { padding: 14px 24px; }
}

/* ─── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 100px;
  transition: var(--transition-smooth);
  cursor: pointer;
  white-space: nowrap;
}

.btn-arrow {
  font-size: 15px;
  display: inline-block;
  transition: transform 0.3s;
}

.btn:hover .btn-arrow {
  transform: translate(2px, -2px);
}

.btn-primary {
  background: var(--accent-moss);
  color: var(--bg-warm);
  padding: 14px 30px;
  border: 1px solid var(--accent-moss);
}

.btn-primary:hover {
  background: #1a4a2e;
  border-color: #1a4a2e;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(35, 56, 43, 0.18);
}

.btn-outline {
  color: var(--text-charcoal);
  padding: 14px 30px;
  border: 1px solid rgba(28, 30, 29, 0.2);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--text-charcoal);
  background: rgba(28, 30, 29, 0.03);
}

.btn-ghost {
  color: var(--text-charcoal);
  opacity: 0.8;
  padding: 10px 20px;
  border: 1px solid transparent;
}

.btn-ghost:hover {
  opacity: 1;
  color: var(--accent-clay);
}

.btn-sm {
  font-size: 12px;
  padding: 10px 22px;
}

/* ─── WIZARD CONTAINER LAYOUT ───────────────── */
.form-wrapper {
  padding: 160px 0 100px 0;
  min-height: 100vh;
  background: var(--bg-warm);
}

.main-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 60px;
  align-items: start;
}

@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

/* ─── PROGRESS BRANCH (SPOUTING LEAVES) ─────── */
.progress-branch-wrap {
  position: relative;
  width: 100%;
  margin-bottom: 56px;
  padding: 24px 0;
}

.branch-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(28, 30, 29, 0.08);
  transform: translateY(-50%);
  z-index: 1;
}

.branch-nodes {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.branch-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.node-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-warm);
  border: 1px solid rgba(28, 30, 29, 0.15);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-charcoal);
  opacity: 0.6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.node-lbl {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-charcoal);
  opacity: 0.5;
  margin-top: 12px;
  white-space: nowrap;
  transition: var(--transition-smooth);
}

/* Organic Leaf Sprout */
.leaf-sprout {
  position: absolute;
  top: -12px;
  right: -8px;
  width: 14px;
  height: 14px;
  background: var(--accent-moss);
  border-radius: 0 100% 0 100%; /* Perfect organic leaf shape */
  transform: rotate(-45deg) scale(0);
  transform-origin: bottom left;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Active & Completed node states */
.branch-node.active .node-num {
  border-color: var(--accent-clay);
  color: var(--accent-clay);
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(200, 125, 85, 0.08);
}

.branch-node.active .node-lbl {
  color: var(--accent-clay);
  opacity: 1;
}

.branch-node.completed .node-num {
  background: var(--accent-moss);
  border-color: var(--accent-moss);
  color: var(--bg-warm);
  opacity: 1;
}

.branch-node.completed .node-lbl {
  color: var(--accent-moss);
  opacity: 0.8;
}

.branch-node.completed .leaf-sprout,
.branch-node.active .leaf-sprout {
  transform: rotate(-45deg) scale(1);
}

/* ─── FORM STEP CONTAINERS ──────────────────── */
.editorial-form {
  background: var(--bg-warm);
  position: relative;
}

.form-step {
  display: none;
}

.form-step.active {
  display: block;
}

.step-header {
  margin-bottom: 40px;
}

.step-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--accent-moss);
  margin-bottom: 12px;
}

.step-intro {
  font-size: 15px;
  opacity: 0.75;
  line-height: 1.7;
  max-width: 680px;
}

/* Form Controls */
.input-group {
  margin-bottom: 36px;
}

.input-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-moss);
  display: block;
  margin-bottom: 16px;
}

/* Category grid cards */
.category-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 540px) {
  .category-cards {
    grid-template-columns: 1fr;
  }
}

.cat-card input[type="radio"] {
  display: none;
}

.cat-card-inner {
  background: var(--bg-warm);
  border: 1px solid rgba(28, 30, 29, 0.1);
  border-radius: 8px;
  padding: 28px;
  cursor: pointer;
  transition: var(--transition-smooth);
  height: 100%;
}

.cat-icon {
  font-size: 28px;
  margin-bottom: 16px;
}

.cat-card-inner h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-charcoal);
  margin-bottom: 4px;
}

.cat-card-inner p {
  font-size: 12.5px;
  line-height: 1.6;
  opacity: 0.7;
}

/* Hover & active states */
.cat-card:hover .cat-card-inner {
  border-color: rgba(28, 30, 29, 0.25);
  background: rgba(28, 30, 29, 0.01);
}

.cat-card input[type="radio"]:checked + .cat-card-inner {
  border-color: var(--accent-clay);
  background: rgba(200, 125, 85, 0.03);
  box-shadow: 0 8px 24px rgba(200, 125, 85, 0.06);
}

/* Text fields */
.text-group input[type="text"],
.text-group textarea {
  width: 100%;
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid rgba(28, 30, 29, 0.18);
  border-radius: 6px;
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-charcoal);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(250, 246, 240, 0.9);
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.text-group textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.7;
}

.text-group input[type="text"]:focus,
.text-group textarea:focus {
  border-color: var(--accent-moss);
  background: #fffaf3;
  box-shadow: 0 0 0 3px rgba(35, 56, 43, 0.08), inset 0 1px 0 rgba(250, 246, 240, 0.9);
}

.input-help {
  font-size: 12px;
  opacity: 0.55;
  margin-top: 8px;
}

.error-msg {
  color: #a3382c;
  font-size: 12px;
  margin-top: 8px;
  display: none;
}

/* Actions footer */
.step-actions {
  display: flex;
  gap: 16px;
  border-top: 1px solid var(--border-light);
  padding-top: 32px;
  margin-top: 48px;
}

/* ─── SIDEBAR: ENCOURAGEMENT CARD ───────────── */
.form-sidebar {
  position: sticky;
  top: 120px;
}

.encouragement-card {
  background: var(--bg-fog);
  border: 1px solid rgba(28, 30, 29, 0.05);
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 8px 24px rgba(28, 30, 29, 0.01);
  text-align: center;
}

/* Circular SVG Gauge */
.gauge-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 28px;
}

.gauge-svg {
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(28, 30, 29, 0.06);
  stroke-width: 6;
}

.gauge-fill {
  fill: none;
  stroke: var(--accent-clay);
  stroke-width: 6;
  stroke-dasharray: 314.16; /* Circumference of r=50 circle */
  stroke-dashoffset: 314.16; /* Initially empty */
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gauge-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-pct {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: bold;
  color: var(--accent-clay);
  line-height: 1;
}

.gauge-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.55;
  margin-top: 2px;
}

.encouragement-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--accent-moss);
  margin-bottom: 8px;
}

.encouragement-body {
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.75;
  margin-bottom: 28px;
  min-height: 64px; /* Maintain height to prevent layout shifts */
}

.reward-hint {
  display: flex;
  gap: 12px;
  text-align: left;
  border-top: 1px solid rgba(28, 30, 29, 0.08);
  padding-top: 24px;
}

.reward-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.reward-txt {
  font-size: 12px;
  line-height: 1.5;
  opacity: 0.75;
}

/* ─── FULL SCREEN CELEBRATION OVERLAY ────────── */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 46, 34, 0.95);
  backdrop-filter: blur(16px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.celebration-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#celebrationCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.celebration-card {
  background: var(--bg-warm);
  border-radius: 12px;
  width: 100%;
  max-width: 580px;
  padding: 56px 48px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 2;
  transform: scale(0.95) translateY(30px);
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.celebration-overlay.active .celebration-card {
  transform: scale(1) translateY(0);
}

/* Spark Badge Drawing */
.badge-display {
  width: 100px;
  height: 100px;
  margin: 0 auto 28px;
  position: relative;
}

.badge-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed var(--accent-clay);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgeSpin 25s linear infinite;
}

.badge-spark {
  font-size: 40px;
  color: var(--accent-clay);
  animation: badgePulse 2.5s ease-in-out infinite alternate;
}

@keyframes badgeSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes badgePulse {
  0% { transform: scale(0.9) rotate(0deg); text-shadow: 0 0 4px rgba(200, 125, 85, 0.2); }
  100% { transform: scale(1.1) rotate(15deg); text-shadow: 0 0 16px rgba(200, 125, 85, 0.6); }
}

.celebration-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px);
  color: var(--accent-moss);
  margin-bottom: 8px;
}

.celebration-subtitle {
  font-size: 15px;
  font-style: italic;
  color: var(--accent-ocean);
  margin-bottom: 32px;
}

/* Stats Award block */
.stats-awarded {
  display: flex;
  justify-content: center;
  gap: 40px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 20px 0;
  margin-bottom: 32px;
}

.award-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.award-val {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: bold;
  color: var(--accent-clay);
  line-height: 1.1;
}

.award-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.65;
  margin-top: 2px;
}

.celebration-desc {
  font-size: 13.5px;
  line-height: 1.7;
  opacity: 0.8;
  margin-bottom: 36px;
}

.celebration-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ─── FOOTER (Consistent with Homepage) ──────── */
.footer {
  background: var(--bg-dark-moss);
  color: var(--bg-warm);
  padding: 80px 0;
  border-top: 1px solid rgba(250, 246, 240, 0.08);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 64px;
  display: flex;
  flex-direction: column;
  gap: 60px;
}

@media (max-width: 768px) {
  .footer-inner { padding: 0 28px; }
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 40px;
}

.footer-brand {
  max-width: 320px;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.footer-tagline {
  font-size: 13px;
  opacity: 0.7;
  line-height: 1.6;
}

.footer-nav {
  display: flex;
  gap: 40px;
}

@media (max-width: 600px) {
  .footer-nav {
    flex-direction: column;
    gap: 16px;
  }
}

.footer-nav a {
  color: var(--bg-warm);
  text-decoration: none;
  font-size: 14px;
  opacity: 0.7;
  transition: opacity 0.3s;
}

.footer-nav a:hover {
  opacity: 1;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(250, 246, 240, 0.08);
  padding-top: 40px;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-copy {
  font-size: 13px;
  opacity: 0.6;
  max-width: 600px;
}
