/* === Tasty Jam — Shared Design System ===
   Single source of truth for colors, typography, theme toggle, and common components.
   In C++ terms: this is the shared header file that every translation unit includes. */

/* --- Dark palette (default) --- */
:root {
  --bg: #06010f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(167, 139, 250, 0.35);
  --text: #f0eef5;
  --text-muted: rgba(255, 255, 255, 0.45);
  --text-dim: rgba(255, 255, 255, 0.25);
  --accent: #a78bfa;
  --accent-solid: #7c3aed;
  --toggle-bg: rgba(255, 255, 255, 0.08);
  --toggle-hover: rgba(255, 255, 255, 0.14);
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "DM Sans", -apple-system, sans-serif;
}

/* --- Light palette --- */
:root.light {
  --bg: #f8f6fc;
  --surface: rgba(0, 0, 0, 0.025);
  --surface-hover: rgba(0, 0, 0, 0.05);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(124, 58, 237, 0.3);
  --text: #1a1225;
  --text-muted: rgba(26, 18, 37, 0.55);
  --text-dim: rgba(26, 18, 37, 0.35);
  --accent: #7c3aed;
  --accent-solid: #6d28d9;
  --toggle-bg: rgba(0, 0, 0, 0.06);
  --toggle-hover: rgba(0, 0, 0, 0.1);
}
@media (prefers-color-scheme: light) {
  :root:not(.dark) {
    --bg: #f8f6fc;
    --surface: rgba(0, 0, 0, 0.025);
    --surface-hover: rgba(0, 0, 0, 0.05);
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(124, 58, 237, 0.3);
    --text: #1a1225;
    --text-muted: rgba(26, 18, 37, 0.55);
    --text-dim: rgba(26, 18, 37, 0.35);
    --accent: #7c3aed;
    --accent-solid: #6d28d9;
    --toggle-bg: rgba(0, 0, 0, 0.06);
    --toggle-hover: rgba(0, 0, 0, 0.1);
  }
}

/* --- Reset & base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
ul, ol {
  list-style: none;
}
html {
  scroll-behavior: smooth;
}
a {
  color: var(--accent);
}
a:hover {
  color: var(--accent-solid);
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition:
    background 0.4s,
    color 0.3s;
}

/* --- Top-right control group (Ko-fi · Language · Theme) ---
   All three controls live in a single fixed flex container so they're
   positioned together and expand leftward as pills on hover.
   In C++ terms: a single allocation that owns all three UI elements. */

.tj-topbar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Gradient backdrop — radial fade from the page background color at the
   top-right corner, so any content scrolling behind the controls is
   masked cleanly regardless of scroll position or theme. */
.tj-topbar-gradient {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100px;
  background: radial-gradient(ellipse 260px 100px at 100% 0%, var(--bg) 30%, transparent 100%);
  pointer-events: none;
  z-index: 99;
  transition: background 0.4s; /* track body bg transition */
}
@media (max-width: 480px) {
  .tj-topbar-gradient {
    width: 240px;
    height: 88px;
  }
}

/* Base pill — 40×40 circle collapsed, expands leftward on hover.
   max-width transition drives the "pill reveal" effect. */
.topbar-btn {
  height: 40px;
  border-radius: 20px;
  background: var(--toggle-bg);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  overflow: hidden;
  max-width: 40px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition:
    background 0.2s,
    border-color 0.2s,
    max-width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.topbar-btn:hover {
  background: var(--toggle-hover);
  border-color: var(--border-hover);
  /* No expand or scale here — lang/theme stay as quiet circles */
}
.topbar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Icon area — always visible at 40×40, centered */
.topbar-btn .btn-icon {
  min-width: 40px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  position: relative;
}

/* Expanded label — hidden by default; only .kofi-btn reveals it on hover */
.topbar-btn .btn-label {
  padding: 0 14px 0 2px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.15s 0.06s, transform 0.15s 0.06s;
  pointer-events: none;
  user-select: none;
}

/* Ko-fi icon — rendered via CSS mask so its colour is a CSS variable,
   not baked into the image. The PNG is used as a shape stencil (alpha mask);
   background-color is what you actually see. This gives full theme control. */
.kofi-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background-color: var(--text-muted);
  mask-image: url('https://storage.ko-fi.com/cdn/brandasset/v2/kofi_symbol.png');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url('https://storage.ko-fi.com/cdn/brandasset/v2/kofi_symbol.png');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  transition: background-color 0.2s;
}

/* Ko-fi pill — only this button expands and reveals its label on hover.
   Colour tokens use a warm amber (close to Claude's brand orange) rather
   than a jarring red, so it feels at home in both dark and light themes. */
.kofi-btn:hover {
  max-width: 220px;
  transform: scale(1.04);
  background: var(--kofi-hover-bg);
  border-color: var(--kofi-hover-border);
}
.kofi-btn:hover .kofi-icon {
  background-color: var(--kofi-icon-hover);
}
.kofi-btn:hover .btn-label {
  opacity: 1;
  transform: translateX(0);
  color: var(--kofi-icon-hover);
}

/* Ko-fi colour tokens — warm amber, adapts per theme */
:root {
  --kofi-hover-bg:     rgba(210, 130, 70, 0.13);
  --kofi-hover-border: rgba(210, 130, 70, 0.40);
  --kofi-icon-hover:   #d4875a;   /* warm amber, readable on dark bg */
}
:root.light {
  --kofi-hover-bg:     rgba(175, 95, 35, 0.10);
  --kofi-hover-border: rgba(175, 95, 35, 0.35);
  --kofi-icon-hover:   #a85c2a;   /* slightly deeper for contrast on light bg */
}
@media (prefers-color-scheme: light) {
  :root:not(.dark) {
    --kofi-hover-bg:     rgba(175, 95, 35, 0.10);
    --kofi-hover-border: rgba(175, 95, 35, 0.35);
    --kofi-icon-hover:   #a85c2a;
  }
}

/* Language pill — invisible native <select> covers the full pill;
   visuals are our custom HTML, interaction is the native control.
   font-size ≥16px prevents iOS auto-zoom on focus. */
.lang-btn select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  border: none;
  background: transparent;
  z-index: 2;
}
.lang-btn .lang-code {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Theme pill — sun/moon icon crossfade */
.theme-btn .btn-icon .icon-sun,
.theme-btn .btn-icon .icon-moon {
  position: absolute;
  transition: opacity 0.3s, transform 0.3s;
}
.theme-btn .btn-icon .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}
.theme-btn .btn-icon .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}
:root.light .theme-btn .btn-icon .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}
:root.light .theme-btn .btn-icon .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}
@media (prefers-color-scheme: light) {
  :root:not(.dark) .theme-btn .btn-icon .icon-sun {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
  :root:not(.dark) .theme-btn .btn-icon .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
  }
}

/* Touch devices — kofi expand doesn't apply; tap gives a scale pulse */
@media (hover: none) {
  .kofi-btn:hover {
    max-width: 40px;
    transform: none;
  }
  .topbar-btn:active {
    transform: scale(0.93);
    background: var(--toggle-hover);
  }
}

/* --- Shared Free/Pro pricing cards ---
   App pages set --app-accent and --app-accent-dim on :root or .container
   to tint the Pro card. Falls back to --accent / --border. */
.pricing-cards {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  align-items: stretch;
}
@media (max-width: 600px) {
  .pricing-cards { flex-direction: column; }
}
.pricing-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
}
.pricing-card.card-pro {
  border-color: var(--app-accent, var(--accent));
  /* color-mix() has limited Safari support — use a layered background instead.
     Inner layer: low-opacity accent tint (like a semi-transparent paint coat over the surface).
     Outer layer: the regular --surface. Same visual effect, universally supported. */
  background:
    linear-gradient(160deg, rgba(255,255,255,0.035) 0%, transparent 60%),
    var(--surface);
  box-shadow: inset 0 0 0 1px var(--app-accent, var(--accent));
  border-color: var(--app-accent, var(--accent));
}
.pricing-card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.card-pro .pricing-card-label { color: var(--app-accent, var(--accent)); }
.pricing-card-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.pricing-card-price {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.card-pro .pricing-card-price {
  color: var(--app-accent, var(--accent));
  font-weight: 600;
}
.pricing-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 18px 0;
}
.pricing-feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.pricing-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.fi-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--app-accent-free, var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  font-size: 0.6rem;
  color: #fff;
  font-weight: 900;
}
.card-pro .fi-check { background: var(--app-accent, var(--accent)); }
.fi-inherit-note {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  padding: 8px 0 4px 0;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}


/* (theme-toggle styles now live in .theme-btn within .tj-topbar above) */

/* --- Layout --- */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Nav breadcrumb --- */
nav {
  padding: 28px 0;
  font-size: 0.88rem;
  animation: fadeUp 0.6s ease both;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
nav a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
nav a:hover {
  color: var(--accent);
}
nav .sep {
  color: rgba(255, 255, 255, 0.12);
  margin: 0 10px;
}
nav .nav-legal {
  display: flex;
  gap: 8px;
}
nav .nav-legal .pill {
  font-size: 0.72rem;
  padding: 4px 11px;
}

/* --- Section headers --- */
.section {
  margin-bottom: 56px;
  animation: fadeUp 0.7s ease 0.2s both;
}
/* Pricing cards section must be visible immediately — override the deferred
   fill-mode so cards don't start hidden and fail to animate in on fast loads. */
.section:has(.pricing-cards) {
  animation: fadeUp 0.5s ease both;
}
.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}

/* --- FAQ cards --- */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.faq-item:hover {
  border-color: rgba(167, 139, 250, 0.2);
}
.faq-q {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 8px;
}
.faq-a {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.9rem;
}

/* --- Forms --- */
.form-group {
  margin-bottom: 16px;
}
label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
input,
textarea,
select {
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.2);
}
textarea {
  min-height: 140px;
  resize: vertical;
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a78bfa' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
select option {
  background: #1a0d2e;
  color: var(--text);
}
button[type="submit"] {
  background: var(--accent-solid);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  width: 100%;
  transition:
    background 0.2s,
    transform 0.1s;
}
button[type="submit"]:hover {
  background: #6d28d9;
}
button[type="submit"]:active {
  transform: scale(0.99);
}
button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.msg {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  display: none;
  font-size: 0.88rem;
  font-weight: 500;
}
.msg-ok {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.2);
}
.msg-err {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Badges --- */
.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 12px;
  background: rgba(167, 139, 250, 0.12);
  color: var(--accent);
  border: 1px solid rgba(167, 139, 250, 0.2);
  position: relative;
  z-index: 1;
}
.badge.coming {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.2);
}
.badge.archived {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-color: var(--border);
}

/* --- Pills (links) --- */
.pill {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(167, 139, 250, 0.1);
  color: var(--accent);
  text-decoration: none;
  border: 1px solid rgba(167, 139, 250, 0.2);
  transition:
    background 0.2s,
    border-color 0.2s;
  cursor: pointer;
}
.pill:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.4);
}

/* --- Footer --- */
.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 24px 40px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}
.site-footer a:hover {
  color: var(--accent);
}
.site-footer .footer-links {
  display: flex;
  gap: 20px;
}

/* --- Privacy page typography --- */
.privacy h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.privacy .updated {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 40px;
}
.privacy h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 12px;
  color: var(--accent);
}
.privacy p,
.privacy ul {
  font-size: 0.94rem;
  line-height: 1.75;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.privacy ul {
  padding-left: 20px;
  list-style: disc;
}
.privacy li {
  margin-bottom: 6px;
}
.privacy a {
  color: var(--accent);
}

/* --- Support page headers --- */
.header {
  padding: 24px 0 56px;
  animation: fadeUp 0.7s ease 0.1s both;
}
.header-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
}
.header-icon img {
  width: 80px;
  height: 80px;
  border-radius: 18px;
}
.header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 8px;
}
.header .tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* --- Animation --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .container {
    padding: 0 18px;
  }
  .site-footer {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}
