/* color-drenching-palette-generator.css */

:root {
      --font-display: 'Playfair Display', Georgia, serif;
      --font-body: 'DM Sans', sans-serif;
      --ink: #1a1410;
      --ink-light: #5a5048;
      --paper: #faf8f5;
      --paper-warm: #f2ede6;
      --rule: #e0d8d0;
      --accent: #c8622a;
    }

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

    body {
      font-family: var(--font-body);
      background: var(--paper);
      color: var(--ink);
      line-height: 1.6;
    }

    h1, h2, h3 {
      font-family: var(--font-display);
    }

    /* ── Layout ── */
    .tool-shell {
      max-width: 1200px;
      margin: 0 auto;
      padding: 2.5rem 1.25rem 4rem;
    }

    .tool-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2rem;
      align-items: start;
    }

    @media (max-width: 820px) {
      .tool-grid { grid-template-columns: 1fr; }
      .tool-shell { padding: 1.5rem 1rem 2.5rem; }
      .page-header { margin-bottom: 1.5rem; }
      .palette-row { grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
      .chip-swatch { height: 3rem; }
      .chip-body { padding: 0.4rem 0.45rem; }
      .chip-name { font-size: 0.72rem; }
      .finish-table td, .finish-table th { padding: 0.5rem 0.5rem; font-size: 0.78rem; }
      .finish-tag { font-size: 0.68rem; padding: 0.1rem 0.3rem; }
    }

    @media (max-width: 480px) {
      .finish-table { font-size: 0.75rem; }
      .presets-grid { gap: 0.4rem; }
      .preset-btn { font-size: 0.72rem; padding: 0.3rem 0.55rem; }
      h1.page-title { font-size: 1.6rem; }
    }

    /* ── Hero header ── */
    .page-header {
      border-bottom: 1px solid var(--rule);
      padding-bottom: 1.5rem;
      margin-bottom: 2.5rem;
    }

    .page-eyebrow {
      font-family: var(--font-body);
      font-size: 0.7rem;
      font-weight: 500;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 0.5rem;
    }

    h1.page-title {
      font-size: clamp(1.8rem, 4vw, 2.8rem);
      font-weight: 700;
      line-height: 1.15;
      letter-spacing: -0.02em;
      margin-bottom: 0.75rem;
    }

    .page-desc {
      font-size: 0.95rem;
      color: var(--ink-light);
      max-width: 600px;
    }

    /* ── Panel card ── */
    .panel {
      background: #fff;
      border: 1px solid var(--rule);
      border-radius: 0.75rem;
      padding: 1.5rem;
    }

    .panel-title {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 700;
      margin-bottom: 1.25rem;
      padding-bottom: 0.75rem;
      border-bottom: 1px solid var(--rule);
    }

    /* ── Mobile scroll nudge ── */
    .scroll-nudge {
      display: none;
      align-items: center;
      gap: 0.5rem;
      background: var(--accent);
      color: #fff;
      font-size: 0.78rem;
      font-weight: 500;
      padding: 0.55rem 1rem;
      border-radius: 2rem;
      margin-top: 0.75rem;
      width: fit-content;
      animation: nudgeBounce 1.2s ease-in-out infinite;
      cursor: pointer;
    }

    @media (max-width: 820px) {
      .scroll-nudge { display: flex; }
    }

    @keyframes nudgeBounce {
      0%, 100% { transform: translateY(0); }
      50%       { transform: translateY(4px); }
    }

    /* ── Live preview pulse on color change ── */
    @keyframes previewPulse {
      0%   { box-shadow: 0 0 0 0 rgba(200, 98, 42, 0.5); }
      60%  { box-shadow: 0 0 0 8px rgba(200, 98, 42, 0); }
      100% { box-shadow: 0 0 0 0 rgba(200, 98, 42, 0); }
    }

    .preview-panel.pulse {
      animation: previewPulse 0.6s ease-out;
    }

    /* ── Color picker area ── */
    .color-input-row {
      display: flex;
      gap: 0.75rem;
      align-items: center;
      margin-bottom: 1.25rem;
    }

    .color-swatch-btn {
      width: 3rem;
      height: 3rem;
      border-radius: 0.5rem;
      border: 2px solid var(--rule);
      cursor: pointer;
      padding: 0;
      overflow: hidden;
      flex-shrink: 0;
      position: relative;
    }

    .color-swatch-btn input[type="color"] {
      position: absolute;
      inset: -4px;
      width: calc(100% + 8px);
      height: calc(100% + 8px);
      border: none;
      cursor: pointer;
      opacity: 0;
    }

    .color-swatch-preview {
      width: 100%;
      height: 100%;
      border-radius: 0.35rem;
      pointer-events: none;
    }

    .hex-input {
      flex: 1;
      border: 1px solid var(--rule);
      border-radius: 0.5rem;
      padding: 0.6rem 0.9rem;
      font-family: 'Courier New', monospace;
      font-size: 0.95rem;
      color: var(--ink);
      background: var(--paper);
      outline: none;
      transition: border-color 0.15s;
    }

    .hex-input:focus {
      border-color: var(--accent);
    }

    /* ── Trend presets ── */
    .presets-label {
      font-size: 0.72rem;
      font-weight: 500;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--ink-light);
      margin-bottom: 0.6rem;
    }

    .presets-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      margin-bottom: 1.25rem;
    }

    .preset-btn {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      padding: 0.35rem 0.65rem;
      border: 1px solid var(--rule);
      border-radius: 2rem;
      background: #fff;
      cursor: pointer;
      font-size: 0.78rem;
      font-family: var(--font-body);
      color: var(--ink);
      transition: all 0.15s;
    }

    .preset-btn:hover {
      border-color: var(--ink);
      background: var(--paper);
    }

    .preset-btn.active {
      border-color: var(--ink);
      background: var(--ink);
      color: #fff;
    }

    .preset-dot {
      width: 0.75rem;
      height: 0.75rem;
      border-radius: 50%;
      flex-shrink: 0;
      border: 1px solid rgba(0,0,0,0.15);
    }

    /* ── SVG Room Preview ── */
    .room-svg-wrap {
      position: relative;
      border-radius: 0.5rem;
      overflow: hidden;
      aspect-ratio: 16/10;
      background: #e8e2d9;
    }

    #roomSVG {
      width: 100%;
      height: 100%;
    }

    /* ── Palette chips ── */
    .palette-row {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 0.75rem;
      margin-bottom: 1.25rem;
    }

    .chip {
      border-radius: 0.5rem;
      overflow: hidden;
      border: 1px solid var(--rule);
    }

    .chip-swatch {
      height: 4rem;
      transition: background 0.3s;
    }

    .chip-body {
      padding: 0.5rem 0.6rem;
      background: #fff;
    }

    .chip-label {
      font-size: 0.68rem;
      font-weight: 500;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--ink-light);
      margin-bottom: 0.15rem;
    }

    .chip-name {
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 700;
      color: var(--ink);
    }

    .chip-hex {
      font-family: 'Courier New', monospace;
      font-size: 0.72rem;
      color: var(--ink-light);
    }

    /* Mobile: chip is horizontal — swatch strip on left, text on right */
    @media (max-width: 600px) {
      .palette-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
      }
      .chip {
        display: flex;
        flex-direction: row;
        align-items: stretch;
      }
      .chip-swatch {
        width: 5rem;
        height: auto;
        min-height: 4.5rem;
        flex-shrink: 0;
        border-radius: 0;
      }
      .chip-body {
        flex: 1;
        padding: 0.6rem 0.85rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
      }
      .chip-label { font-size: 0.65rem; }
      .chip-name  { font-size: 0.88rem; }
      .chip-hex   { font-size: 0.75rem; margin-top: 0.1rem; }
    }

    /* ── Finish table ── */
    .finish-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.85rem;
      margin-bottom: 1rem;
    }

    .finish-table th {
      text-align: left;
      font-family: var(--font-body);
      font-weight: 500;
      font-size: 0.7rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--ink-light);
      padding: 0.5rem 0.75rem;
      border-bottom: 1px solid var(--rule);
      background: var(--paper-warm);
    }

    .finish-table td {
      padding: 0.65rem 0.75rem;
      border-bottom: 1px solid var(--rule);
      vertical-align: top;
    }

    .finish-table tr:last-child td { border-bottom: none; }

    .finish-tag {
      display: inline-block;
      background: var(--paper-warm);
      border: 1px solid var(--rule);
      border-radius: 0.25rem;
      padding: 0.15rem 0.45rem;
      font-size: 0.75rem;
      font-weight: 500;
    }

    .surface-dot {
      display: inline-block;
      width: 0.55rem;
      height: 0.55rem;
      border-radius: 50%;
      margin-right: 0.4rem;
      vertical-align: middle;
      border: 1px solid rgba(0,0,0,0.12);
    }

    /* ── Designer's note ── */
    .designers-note {
      background: var(--paper-warm);
      border-left: 3px solid var(--accent);
      border-radius: 0 0.5rem 0.5rem 0;
      padding: 0.85rem 1rem;
      font-size: 0.83rem;
      color: var(--ink-light);
      line-height: 1.6;
    }

    .designers-note strong {
      color: var(--ink);
      display: block;
      font-family: var(--font-display);
      font-size: 0.88rem;
      margin-bottom: 0.25rem;
    }

    /* ── Pair Me / Double drench ── */
    .pair-box {
      border: 1px dashed var(--rule);
      border-radius: 0.5rem;
      padding: 1rem;
      margin-top: 1rem;
    }

    .pair-box-title {
      font-size: 0.72rem;
      font-weight: 500;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--ink-light);
      margin-bottom: 0.6rem;
    }

    .pair-row {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .pair-swatch {
      width: 2.5rem;
      height: 2.5rem;
      border-radius: 0.4rem;
      flex-shrink: 0;
      border: 1px solid rgba(0,0,0,0.1);
    }

    .pair-info { flex: 1; }

    .pair-name {
      font-family: var(--font-display);
      font-size: 0.9rem;
      font-weight: 700;
    }

    .pair-desc {
      font-size: 0.75rem;
      color: var(--ink-light);
    }

    /* ── Buttons ── */
    .btn-primary {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      background: var(--ink);
      color: #fff;
      border: none;
      border-radius: 0.5rem;
      padding: 0.65rem 1.25rem;
      font-family: var(--font-body);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: opacity 0.15s;
      width: 100%;
    }

    .btn-primary:hover { opacity: 0.85; }

    .btn-outline {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      background: transparent;
      color: var(--ink);
      border: 1px solid var(--rule);
      border-radius: 0.5rem;
      padding: 0.65rem 1.25rem;
      font-family: var(--font-body);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s;
      width: 100%;
    }

    .btn-outline:hover {
      border-color: var(--ink);
      background: var(--paper-warm);
    }

    .btn-accent {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      background: var(--accent);
      color: #fff;
      border: none;
      border-radius: 0.5rem;
      padding: 0.65rem 1.25rem;
      font-family: var(--font-body);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      transition: opacity 0.15s;
      width: 100%;
    }

    .btn-accent:hover { opacity: 0.88; }

    .btn-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.6rem;
      margin-top: 1rem;
    }

    @media (max-width: 480px) {
      .btn-row { grid-template-columns: 1fr; }
    }

    /* ── Content sections ── */
    .content-section {
      max-width: 1200px;
      margin: 0 auto;
      padding: 0 1.25rem;
    }

    .section-divider {
      border: none;
      border-top: 1px solid var(--rule);
      margin: 1.75rem 0;
    }

    h2.section-title {
      font-size: clamp(1.3rem, 3vw, 1.8rem);
      margin-bottom: 1rem;
      letter-spacing: -0.01em;
    }

    .prose {
      font-size: 0.92rem;
      color: #3a3028;
      line-height: 1.75;
      max-width: 72ch;
    }

    .prose + .prose { margin-top: 0.75rem; }

    /* ── FAQ ── */
    .faq-item {
      border: 1px solid var(--rule);
      border-radius: 0.5rem;
      margin-bottom: 0.75rem;
      background: #fff;
      overflow: hidden;
    }

    .faq-q {
      padding: 1rem 1.25rem;
      font-family: var(--font-display);
      font-size: 0.98rem;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;
    }

    .faq-q::after {
      content: '+';
      font-family: var(--font-body);
      font-size: 1.2rem;
      color: var(--ink-light);
      flex-shrink: 0;
      transition: transform 0.2s;
    }

    .faq-item.open .faq-q::after {
      transform: rotate(45deg);
    }

    .faq-a {
      display: none;
      padding: 0 1.25rem 1rem;
      font-size: 0.88rem;
      color: var(--ink-light);
      line-height: 1.7;
      border-top: 1px solid var(--rule);
    }

    .faq-item.open .faq-a { display: block; }

    /* ── Export canvas (hidden) ── */
    #exportCanvas { display: none; }

    /* ── Toast ── */
    .toast {
      position: fixed;
      bottom: 2rem;
      left: 50%;
      transform: translateX(-50%) translateY(2rem);
      background: var(--ink);
      color: #fff;
      padding: 0.65rem 1.25rem;
      border-radius: 2rem;
      font-size: 0.85rem;
      opacity: 0;
      pointer-events: none;
      transition: all 0.3s;
      z-index: 100;
    }

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

    /* ── Hidden export template ── */
    #exportTemplate {
      position: fixed;
      left: -9999px;
      top: 0;
      width: 1000px;
      height: 1500px;
      padding: 60px;
      display: flex;
      flex-direction: column;
    }
