/* Shared APP layout for SmallPie tools */

body.apps-page {
  background: #ffffff;
  color: #0d0a0c;
}

/* === Gradient text (pink + gold, smooth loop) === */

:root {
  --grad-ink-pink: #F48FB1;
  --grad-ink-gold: #F4C430;
}

.grad-ink {
  display: inline-block;
  background-image: linear-gradient(
    90deg,
    var(--grad-ink-pink) 0%,
    var(--grad-ink-pink) 25%,
    var(--grad-ink-gold) 50%,
    var(--grad-ink-pink) 75%,
    var(--grad-ink-pink) 100%
  );
  background-size: 200% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: sp-grad-sweep 14s linear infinite;
  text-shadow: 0 0 0.01px rgba(0,0,0,0.01);
}

/* Smooth continuous gradient without visible jump */
@keyframes sp-grad-sweep {
  0%   { background-position: 0% 50%; }
  100% { background-position: -200% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .grad-ink { animation: none; }
}

/* === HERO === */

.apps-hero {
  background: #ffffff;
}

/* Slightly tighter vertical rhythm between hero and results */
.apps-hero.section-pad {
  padding-bottom: clamp(32px, 4vw, 56px);
}

.apps-hero__inner {
  width: var(--content-width);
  margin: 0 auto;
  text-align: left;
  position: relative;
  z-index: 2; /* content above fx-layer (z:1) */
}

.apps-hero .hero-title {
  margin: 0 0 clamp(16px, 2.4vw, 22px);
}

.apps-hero .hero-subtitle {
  margin: 0 0 clamp(18px, 3vw, 26px);
  max-width: 720px;
  color: rgba(13,10,12,.75);
}

/* === FORM === */

.apps-form {
  margin-top: clamp(20px, 3vw, 30px);
  display: flex;
  flex-wrap: wrap;
  gap: clamp(14px, 2.4vw, 22px); /* slightly more than base, but not huge */
  align-items: stretch;
}

/* Input shell: opaque, no shadow, 16px radius, magnet via data-magnet */

.apps-input-shell {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 16px;
  background: linear-gradient(
    120deg,
    rgba(244, 143, 177, 0.08) 0%,
    #f8f6fb 35%,
    #f9f6f0 65%,
    rgba(244, 196, 48, 0.12) 100%
  );
  border: 1px solid rgba(13,10,12,.08);
  /* no box-shadow here -> magnet only, no “button” feel */
}

/* Kill generic .hvr shadow/glow on this specific input shell */
.apps-input-shell.hvr,
.apps-input-shell.hvr:hover,
.apps-input-shell.hvr:focus-within {
  box-shadow: none !important;
}

.apps-input-shell.hvr::before,
.apps-input-shell.hvr::after {
  box-shadow: none !important;
  opacity: 0 !important;
}

/* Input itself */

.apps-input-shell input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  width: 100%;
  color: #0d0a0c;
}

.apps-input-shell input::placeholder {
  color: rgba(13,10,12,.45);
}

/* Generate button: use global glass style, no extra dark stroke */

.apps-generate-btn {
  border: none;
  outline: none;
  white-space: nowrap;
}

/* === RESULTS === */

.apps-results {
  background: #ffffff;
}

/* Bring sections closer on desktop and mobile */
.apps-results.section-pad {
  padding-top: clamp(28px, 3.6vw, 52px);
}

.apps-results__inner {
  width: var(--content-width);
  margin: 0 auto;
  position: relative;
  z-index: 2; /* content above fx-layer (z:1) */
}

.apps-results__title {
  margin: 0 0 clamp(10px, 2.0vw, 16px);
}

.apps-results__hint {
  margin: 0 0 clamp(10px, 2.2vw, 18px);
  color: rgba(13,10,12,.7);
  max-width: 720px;
}

/* === Brand preloader (canvas-based, sized by JS/HTML) === */

.apps-preloader {
  margin: 8px 0 18px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.apps-preloader canvas {
  display: block;
  width: 70px;
  height: 70px;
}

/* Hidden state after first generate */

.apps-preloader.apps-preloader--hidden {
  display: none;
}

/* === Cards grid === */

.apps-grid {
  display: grid;
  gap: clamp(14px, 2.2vw, 20px);
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); /* ~3 per row */
  margin-top: 4px;
}

/* Card base: white background, no outline stroke; magnets handled by JS */

.apps-card {
  opacity: 0;
  background: #ffffff;
  border-radius: 16px;
  transform: translateY(6px);
  transition:
    opacity 0.36s cubic-bezier(.22,.61,.36,1),
    transform 0.36s cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--apps-delay, 0s);
  cursor: default;
}

.apps-card.glass.glass--outline {
  border: none;
}

.apps-card .glass__filter {
  background: #ffffff;
  opacity: 1;
  backdrop-filter: none;
}

.apps-card .glass__overlay,
.apps-card .glass__specular {
  opacity: 0;
  pointer-events: none;
}

.apps-card .glass__content.card {
  background: transparent;
  padding: 16px 16px 12px;
}

/* Card header */

.apps-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.apps-style-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(13,10,12,.70);
}

/* Copy button */

.apps-copy-btn {
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  font-size: 13px;
  color: #555555;
  text-decoration: underline;
  cursor: pointer;
}

.apps-copy-btn:hover {
  color: #000000;
}

/* Card text */

.apps-output {
  margin: 0;
  font-size: 16px;
  word-break: break-word;
  color: #0d0a0c;
}

/* Visible state used by JS / IntersectionObserver */

.apps-card.apps-card--visible {
  opacity: 1;
  transform: translateY(0);
}

/* === Responsive === */

@media (max-width: 768px) {
  .apps-form {
    flex-direction: column;
    align-items: stretch;
    gap: clamp(18px, 4.8vw, 26px); /* slightly more space on mobile */
  }

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

  .apps-preloader {
    justify-content: center;
  }
}

/* === PALETTE DOCTOR LAYOUT === */

.palette-controls {
  flex: 1 1 320px;
  min-width: 260px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(
    120deg,
    rgba(244,143,177,0.10) 0%,
    rgba(248,246,251,0.96) 40%,
    rgba(249,246,240,0.96) 70%,
    rgba(244,196,48,0.12) 100%
  );
  border: 1px solid rgba(13,10,12,.08);
  display: grid;
  gap: 10px;
}

.palette-count-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(13,10,12,.8);
}

.palette-count-label span {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  color: rgba(13,10,12,.65);
}

.palette-count-label select {
  border-radius: 999px;
  border: 1px solid rgba(13,10,12,.16);
  background: rgba(255,255,255,.96);
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  color: #0d0a0c;
  outline: 0;
}

.palette-count-label select:focus-visible {
  box-shadow: 0 0 0 2px rgba(244,143,177,.65);
}

.palette-controls-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(13,10,12,.75);
}

/* Actions beside controls */

.palette-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.palette-actions .btn-glass,
.palette-actions .btn-glass-grad {
  white-space: nowrap;
  padding-inline: 1.4rem;
  font-size: 15px;
}

/* Stack controls on mobile */

@media (max-width: 768px) {
  .palette-controls {
    order: 1;
  }
  .palette-actions {
    order: 2;
  }
  .palette-actions .btn-glass,
  .palette-actions .btn-glass-grad {
    width: 100%;
    justify-content: center;
  }
}

/* === MAIN COLORS BLOCK === */

.palette-main-block {
  margin-top: clamp(26px, 3.6vw, 40px);
}

.palette-main-header {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.palette-main-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: rgba(13,10,12,.7);
}

.palette-main-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(13,10,12,.8);
  max-width: 720px;
}

/* Grid for 1–4 main colors */

.palette-main-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

/* Single color layout: long bar */

.palette-main-grid--count-1 {
  grid-template-columns: minmax(260px, 1fr);
}

/* Main swatch card */

.palette-main-swatch {
  border-radius: 16px;
  background: rgba(247,247,249,.95);
  box-shadow: var(--shadow-1);
  padding: 12px 14px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: stretch;
}

.palette-main-grid--count-1 .palette-main-swatch {
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr);
}

/* Color sample */

.palette-main-color {
  display: flex;
  align-items: center;
}

.palette-main-sample {
  width: 100%;
  height: 64px;
  border-radius: 14px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.45),
    0 14px 30px rgba(0,0,0,.22);
  background: #cccccc;
}

/* Meta: hex + lock */

.palette-main-meta {
  display: grid;
  gap: 8px;
  align-content: space-between;
}

.palette-main-label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(13,10,12,.6);
}

.palette-main-hex {
  border-radius: 999px;
  border: 1px solid rgba(13,10,12,.18);
  padding: 7px 12px;
  font: inherit;
  font-size: 14px;
  background: #ffffff;
  color: #0d0a0c;
  outline: 0;
}

.palette-main-hex:focus-visible {
  box-shadow: 0 0 0 2px rgba(244,143,177,.65);
}

/* Lock button */

.palette-lock-btn {
  border-radius: 999px;
  border: none;
  padding: 7px 12px;
  font-size: 11px;
  letter-spacing: .10em;
  text-transform: uppercase;
  cursor: pointer;
  background: rgba(13,10,12,.06);
  color: rgba(13,10,12,.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.palette-lock-btn::before {
  content: "○";
  font-size: 12px;
}

.palette-lock-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(244,143,177,.95), rgba(244,196,48,.95));
  color: #ffffff;
  box-shadow: var(--shadow-1);
}

.palette-lock-btn[aria-pressed="true"]::before {
  content: "●";
}

/* === ACCENT COLORS === */

.palette-accents-block {
  margin-top: clamp(26px, 3.4vw, 36px);
}

.palette-accents-header {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.palette-accents-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: rgba(13,10,12,.7);
}

.palette-accents-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(13,10,12,.8);
  max-width: 720px;
}

.palette-accents-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Accent chip acts as a pill button */

.palette-accent-chip {
  border-radius: 999px;
  padding: 5px 10px 5px 6px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 6px 14px rgba(0,0,0,.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: rgba(13,10,12,.9);
}

.palette-accent-chip:hover {
  box-shadow: var(--shadow-1);
  transform: translateY(-1px);
}

.palette-accent-sample {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.6),
    0 0 0 1px rgba(0,0,0,.12);
  background: #cccccc;
}

.palette-accent-hex {
  font-size: 13px;
}

/* === REPORT BLOCK === */

.palette-report-block {
  margin-top: clamp(28px, 3.8vw, 42px);
}

.palette-report-header {
  margin-bottom: 8px;
}

.palette-report-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: rgba(13,10,12,.7);
}

.palette-report-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(13,10,12,.82);
  max-width: 720px;
}


/* ================== */
/* SmallPie Palette   */
/* ================== */

.palette-toolbar {
  margin-top: clamp(20px, 3vw, 30px);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.palette-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.palette-label {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.palette-select {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

/* Make .btn-glass / .btn-glass-grad work on <button> without grey border */
button.btn-glass,
button.btn-glass-grad {
  border: 0;
  background: transparent;
}

/* Layout under the hero */
.palette-layout {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 28px);
  margin-top: 12px;
}

/* Main colors grid */
.palette-main-swatches {
  display: grid;
  gap: clamp(14px, 2vw, 20px);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Main color card */
.palette-main-swatch {
  border-radius: 16px;
  padding: 14px 14px 12px;
  background: rgba(0, 0, 0, 0.64);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 1:1 placeholder area for a small image (future) + color block behind */
.palette-main-visual {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #222;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Real color layer */
.palette-main-color {
  position: absolute;
  inset: 0;
}

/* Slot for your later image overlay (kept empty for now) */
.palette-main-thumb {
  position: relative;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* Hex + lock row */
.palette-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

/* Hex input */
.palette-hex-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font: inherit;
  font-size: 13px;
}

/* Lock button (small icon button, not using global big button styles) */
.palette-lock-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  padding: 0;
}

.palette-lock-btn[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(244, 196, 48, 0.25);
}

.palette-lock-icon {
  font-size: 15px;
}

/* Subtitles / hints */
.palette-subtitle {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.palette-hint {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.7);
}

/* Accent swatches */
.palette-accents-block {
  margin-top: 4px;
}

.palette-accent-swatches {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.palette-accent-swatch {
  border-radius: 12px;
  padding: 10px 10px 8px;
  background: rgba(0, 0, 0, 0.7);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.palette-accent-color {
  border-radius: 9px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.palette-accent-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.84);
}

/* Status text */
.palette-status {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
}

/* Mobile tweaks */
@media (max-width: 768px) {
  .palette-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .palette-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
  }

  .palette-toolbar-right .btn-glass,
  .palette-toolbar-right .btn-glass-grad {
    flex: 1;
    justify-content: center;
  }
}
