/*
 * Melon Tools site pages (homepage, legal, support) in the shadcn/ui "Maia" look of the tools.
 * Tokens live in /melon-shell.css; markup comes from includes/site-shell.php.
 */
:root,
[data-theme="dark"] {
  /* Aliases read by /melon-support.js so the bottom bar matches. */
  --surface: color-mix(in srgb, var(--m-card) 88%, transparent);
  --border: var(--m-border);
  --text: var(--m-fg);
  --muted: var(--m-muted-fg);
  --accent: var(--m-fg);
}

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

body {
  margin: 0;
  background: var(--m-page);
  color: var(--m-fg);
  font-family: var(--m-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.shell-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- Hero ---------- */
.shell-hero {
  padding: 56px 0 32px;
}

.shell-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
}

.shell-hero .search {
  margin-top: 24px;
}

/* ---------- Buttons, badges, inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--m-fg);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn:focus-visible,
.chip:focus-visible,
.tool-card:focus-visible,
.input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--m-focus);
}

.btn-primary {
  background: var(--m-primary);
  color: var(--m-primary-fg);
}

.btn-primary:hover {
  background: var(--m-primary-hover);
}

.btn-outline {
  background: var(--m-input-bg);
  box-shadow: inset 0 0 0 1px var(--m-border);
}

.btn-outline:hover {
  background: var(--m-muted);
}

/* Same look as the heart button in the support bar (/melon-support.js). */
.btn-heart {
  background: #e0475b;
  color: #fff;
  font-weight: 600;
}

.btn-heart:hover {
  filter: brightness(1.07);
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-primary {
  background: var(--m-primary-soft);
  color: var(--m-primary-soft-fg);
}

.badge-outline {
  box-shadow: inset 0 0 0 1px var(--m-border);
  color: var(--m-muted-fg);
}

.search {
  position: relative;
  display: block;
  max-width: 560px;
}

.search > svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--m-muted-fg);
  pointer-events: none;
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 48px 0 42px;
  border: 1px solid var(--m-border);
  border-radius: 999px;
  background: var(--m-card);
  color: var(--m-fg);
  font: inherit;
  font-size: 15px;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.input::placeholder {
  color: var(--m-muted-fg);
}

.input:focus-visible {
  border-color: var(--m-primary);
}

.search kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--m-border);
  border-radius: 6px;
  background: var(--m-muted);
  color: var(--m-muted-fg);
  font: 500 12px/20px var(--m-font);
  text-align: center;
  pointer-events: none;
}

.input:not(:placeholder-shown) ~ kbd,
.input:focus ~ kbd {
  display: none;
}

@media (hover: none) {
  .search kbd {
    display: none;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--m-input-bg);
  box-shadow: inset 0 0 0 1px var(--m-border);
  color: var(--m-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.chip:hover {
  background: var(--m-muted);
}

.chip[aria-pressed="true"] {
  background: var(--m-fg);
  box-shadow: none;
  color: var(--m-page);
}

/* ---------- Sections ---------- */
.section {
  padding: 40px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--m-font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--m-muted-fg);
}

.card {
  min-width: 0;
  border-radius: var(--m-radius-card);
  background: var(--m-card);
  box-shadow: 0 0 0 1px var(--m-ring-line);
}

/* ---------- Tool cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
}

.tool-card:hover {
  box-shadow: 0 0 0 1px var(--m-primary), 0 8px 24px -12px rgba(0, 0, 0, 0.25);
}

.tool-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.tool-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: var(--m-muted);
  color: var(--m-primary-soft-fg);
  font-family: var(--m-font-heading);
  font-size: 18px;
  font-weight: 700;
}

.tool-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tool-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.tool-title {
  margin: 0;
  font-family: var(--m-font-heading);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tool-desc {
  flex: 1;
  margin: 0;
  color: var(--m-muted-fg);
  font-size: 13.5px;
}

.tool-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--m-primary-soft-fg);
  font-weight: 500;
  font-size: 13px;
}

.tool-action svg {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}

.tool-card:hover .tool-action svg {
  transform: translateX(3px);
}

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 40px 20px;
  border: 1px dashed var(--m-border);
  border-radius: var(--m-radius-card);
  text-align: center;
}

.empty strong {
  font-size: 15px;
}

.empty p {
  margin: 0 0 8px;
  color: var(--m-muted-fg);
}

/* ---------- Features ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.feature {
  padding: 20px;
}

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--m-primary-soft);
  color: var(--m-primary-soft-fg);
}

.feature-icon svg {
  width: 18px;
  height: 18px;
}

.feature h3 {
  margin: 14px 0 6px;
  font-family: var(--m-font-heading);
  font-size: 15px;
  font-weight: 600;
}

.feature p {
  margin: 0;
  color: var(--m-muted-fg);
  font-size: 13.5px;
}

/* ---------- CTA ---------- */
.cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 28px;
}

.cta h2 {
  margin: 0 0 6px;
  font-family: var(--m-font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cta p {
  max-width: 60ch;
  margin: 0;
  color: var(--m-muted-fg);
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--m-border);
  padding: 40px 0 32px;
  color: var(--m-muted-fg);
  font-size: 13px;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 3.4fr);
  gap: 24px 40px;
}

.footer-heading {
  margin: 0 0 12px;
  color: var(--m-fg);
  font-size: 13px;
  font-weight: 600;
}

/* Tool categories flow into as many ~190px columns as fit. */
.footer-cats {
  columns: 190px 4;
  column-gap: 24px;
}

.footer-cat {
  break-inside: avoid;
  margin-bottom: 20px;
}

.footer-cat h3 {
  margin: 0 0 2px;
  color: var(--m-fg);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.75;
}

.footer-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--m-border);
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--m-fg);
  font-weight: 600;
  text-decoration: none;
}

.footer-brand img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.footer-top p {
  max-width: 32ch;
  margin: 10px 0 0;
}

.footer-col {
  display: grid;
  align-content: start;
  gap: 8px;
}

.footer-col h2 {
  margin: 0 0 2px;
  color: var(--m-fg);
  font-size: 13px;
  font-weight: 600;
}

.footer-col a {
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--m-fg);
}

.footer-bottom {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--m-border);
}

@media (max-width: 960px) {
  .grid,
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-top {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .page {
    padding: 0 16px;
  }

  .shell-hero {
    padding: 36px 0 24px;
  }

  .grid,
  .grid--2,
  .features {
    grid-template-columns: 1fr;
  }
}

/* ---------- Content pages (legal, support) ---------- */
.article {
  max-width: 720px;
  padding: 8px 0 24px;
}

.article .shell-hero {
  padding-bottom: 8px;
}

.article .shell-hero h1 {
  font-size: clamp(28px, 4vw, 40px);
}

.article .shell-hero p {
  font-size: 16px;
}

.article h2 {
  margin: 32px 0 8px;
  font-family: var(--m-font-heading);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.article p,
.article ul {
  margin: 0 0 12px;
  color: var(--m-muted-fg);
  font-size: 15px;
}

.article ul {
  padding-left: 20px;
}

.article li {
  margin-bottom: 4px;
}

/* Text links only; buttons keep their own colors. */
.article a:not(.btn) {
  color: var(--m-primary-soft-fg);
}

.article hr {
  margin: 24px 0;
  border: 0;
  border-top: 1px solid var(--m-border);
}

.article .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.article-banner {
  display: block;
  width: 100%;
  margin: 28px 0 8px;
  border-radius: var(--m-radius-card);
  box-shadow: 0 0 0 1px var(--m-ring-line);
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}

.facts .card {
  padding: 16px;
}

.facts h3 {
  margin: 0 0 4px;
  font-family: var(--m-font-heading);
  font-size: 14px;
  font-weight: 600;
}

.facts p {
  margin: 0;
  font-size: 13.5px;
}

.note {
  padding: 18px 20px;
  margin: 20px 0;
}

.note h2 {
  margin-top: 0;
}

.note p:last-child {
  margin-bottom: 0;
}

.note--success {
  background: var(--m-primary-soft);
  box-shadow: none;
}

.note--success h2,
.note--success p {
  color: var(--m-primary-soft-fg);
}

@media (max-width: 700px) {
  .facts {
    grid-template-columns: 1fr;
  }
}

/* ---------- Support page ---------- */
.btn-lg {
  height: 44px;
  padding: 0 22px;
  font-size: 15px;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.support .shell-hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.support .shell-hero .support-title {
  margin: 14px 0 8px;
  font-family: var(--m-font-heading);
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.amounts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.amount {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  text-decoration: none;
  transition: box-shadow 0.15s;
}

.amount:hover {
  box-shadow: 0 0 0 1px #e0475b, 0 8px 24px -12px rgba(0, 0, 0, 0.25);
}

.amount:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--m-focus);
}

.amount-melons {
  display: flex;
  height: 32px;
  margin-bottom: 10px;
}

.amount-melons svg {
  width: 44px;
  height: 30px;
  flex: 0 0 auto;
}

.amount-melons svg + svg {
  margin-left: -14px;
}

.amount-name {
  font-family: var(--m-font-heading);
  font-size: 16px;
  font-weight: 600;
}

.amount-price {
  color: #e0475b;
  font-weight: 600;
}

.amount-text {
  flex: 1;
  color: var(--m-muted-fg);
  font-size: 13.5px;
}

.amount .tool-action {
  color: var(--m-fg);
}

.amount:hover .tool-action svg {
  transform: translateX(3px);
}

.about {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
}

.about-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--m-ring-line);
}

.about h2 {
  margin: 0 0 6px;
  font-family: var(--m-font-heading);
  font-size: 18px;
  font-weight: 700;
}

.about p {
  max-width: 68ch;
  margin: 0;
  color: var(--m-muted-fg);
  font-size: 15px;
}

.about .about-sign {
  margin-top: 10px;
  color: var(--m-fg);
  font-style: italic;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.stats.has-results {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stat {
  display: grid;
  gap: 2px;
  padding: 16px;
  text-align: center;
}

.stat strong {
  font-family: var(--m-font-heading);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat span {
  color: var(--m-muted-fg);
  font-size: 13px;
}

.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px 0 6px;
  border-radius: 999px;
  background: var(--m-card);
  box-shadow: inset 0 0 0 1px var(--m-border);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.tool-chip:hover {
  background: var(--m-muted);
}

.tool-chip img {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
}

.support .facts {
  margin: 0;
}

.support .facts p {
  color: var(--m-muted-fg);
}

.free-ways {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.free-ways .feature {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.free-ways .feature p {
  flex: 1;
  margin-bottom: 14px;
}

.faq {
  padding: 4px 20px;
}

.faq details + details {
  border-top: 1px solid var(--m-border);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid var(--m-muted-fg);
  border-bottom: 2px solid var(--m-muted-fg);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s;
}

.faq details[open] summary::after {
  transform: rotate(-135deg) translateY(-2px);
}

.faq summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--m-focus);
  border-radius: 6px;
}

.faq details p {
  max-width: 72ch;
  margin: 0 0 16px;
  color: var(--m-muted-fg);
  font-size: 14.5px;
}

.faq a {
  color: var(--m-primary-soft-fg);
}

/* thank-you view after a Stripe payment */
.thanks {
  margin-top: 32px;
  padding: 32px 24px;
  background: var(--m-primary-soft);
  box-shadow: none;
  text-align: center;
}

.thanks h1 {
  margin: 8px 0 6px;
  font-family: var(--m-font-heading);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.thanks p {
  max-width: 56ch;
  margin: 0 auto 18px;
  color: var(--m-primary-soft-fg);
  font-size: 15px;
}

.thanks-melon {
  position: relative;
  display: inline-block;
  width: 120px;
  height: 80px;
}

.thanks-melon svg {
  width: 100%;
  height: 100%;
  animation: melon-thanks-hop 1.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s 2 both;
}

.thanks-heart {
  position: absolute;
  left: 50%;
  top: 30%;
  color: #e0475b;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  animation: melon-thanks-heart 1.8s ease-out both;
}

.thanks-heart:nth-of-type(1) { --x: -70px; animation-delay: 0.3s; }
.thanks-heart:nth-of-type(2) { --x: -35px; animation-delay: 0.5s; font-size: 14px; }
.thanks-heart:nth-of-type(3) { --x: 0px; animation-delay: 0.4s; font-size: 22px; }
.thanks-heart:nth-of-type(4) { --x: 35px; animation-delay: 0.6s; font-size: 14px; }
.thanks-heart:nth-of-type(5) { --x: 70px; animation-delay: 0.35s; }

@keyframes melon-thanks-hop {
  0% { transform: translateY(16px) scale(0.6) rotate(-12deg); opacity: 0; }
  35% { transform: translateY(-10px) scale(1.08) rotate(5deg); opacity: 1; }
  55% { transform: translateY(0) scale(0.97) rotate(-2deg); }
  75% { transform: translateY(-4px) rotate(1deg); }
  100% { transform: none; opacity: 1; }
}

@keyframes melon-thanks-heart {
  0% { transform: translate(-50%, 0) scale(0.4); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), -70px) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .thanks-melon svg,
  .thanks-heart {
    animation: none;
  }
}

@media (max-width: 960px) {
  .stats,
  .stats.has-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .amounts,
  .free-ways {
    grid-template-columns: 1fr;
  }

  .footer-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats,
  .stats.has-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about {
    flex-direction: column;
    gap: 14px;
  }
}
