/* Interface polish (21 Nov 2026). Loaded after the theme so it applies to every look.
   Light looks: "Crafted" (option B): raised buttons, a springy sliding selector, tiles that lift, soft rings.
   Dark look (graphite): "Night" (option C): flat buttons with a warm glow, no lifting, glowing selections.
   Colours come from each theme's own variables, so every look keeps its palette.
   Everything that moves is switched off for people who ask their device for less motion. */

:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ring: 0 0 0 4px color-mix(in srgb, var(--color-accent) 18%, transparent);
  --lift-shadow: 0 10px 22px color-mix(in srgb, var(--color-text) 14%, transparent);
}

/* — Buttons — */
.btn { transition: transform 140ms ease, box-shadow 200ms ease, background-color 200ms ease, border-color 200ms ease, color 200ms ease; }
.btn:not(:disabled):active { transform: translateY(1px) scale(.97); }
.btn-primary:not(:disabled) {
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 82%, #fff 18%), var(--color-accent));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--color-accent) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:not(:disabled):hover {
  background-image: linear-gradient(180deg, var(--color-accent), var(--color-accent-600));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--color-accent) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
  transform: translateY(-1px);
}
.btn-primary:not(:disabled):active { transform: translateY(1px) scale(.97); }
.btn-secondary:not(:disabled):hover { box-shadow: 0 6px 14px color-mix(in srgb, var(--color-text) 12%, transparent); }

/* Working: a small spinner in the button while a prompt is written */
.btn.is-loading::before {
  content: ""; width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, currentColor 35%, transparent); border-top-color: currentColor;
  animation: pb-spin 700ms linear infinite;
}
.generate-btn.is-loading { justify-content: flex-start; }
.btn.is-loading:disabled { opacity: 1; cursor: progress; }
.btn-primary.is-loading:disabled {
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 82%, #fff 18%), var(--color-accent));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--color-accent) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22);
}
html[data-theme="graphite"] .btn-primary.is-loading:disabled { background-image: none; box-shadow: 0 0 22px rgba(212, 183, 139, .35); }
.generate-btn.is-loading > svg { display: none; }
@keyframes pb-spin { to { transform: rotate(360deg); } }

/* Copied: the button turns green with a tick for a moment */
.btn.is-done, .btn.is-done:hover, .output-panel .btn.is-done {
  background: #e1eecc; border-color: #aebf92; color: #272e1b; box-shadow: none;
}
.btn.is-done svg { display: none; }
.btn.is-done::before {
  content: ""; width: 14px; height: 8px; flex: none; margin: -3px 2px 0 1px;
  border-left: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(-45deg);
}

/* — Fields: a soft ring on focus — */
.input, .topic-input, textarea { transition: border-color 200ms ease, box-shadow 200ms ease; }
.input:focus-visible, .topic-input:focus-visible, .topic-input:focus {
  outline: none; border-color: var(--color-accent); box-shadow: var(--ring);
}

/* — Sliding selector (the builder's filter and the log-in tabs). The thumb is added by polish.js;
     without JavaScript the selected option keeps its normal filled look. — */
.seg.has-thumb {
  position: relative; padding: 4px; gap: 0; border: 0;
  background: color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
  box-shadow: inset 0 2px 4px color-mix(in srgb, var(--color-text) 14%, transparent), inset 0 -1px 0 rgba(255, 255, 255, .45);
}
.seg.has-thumb .seg-opt { position: relative; z-index: 1; border: 0; border-radius: inherit; transition: color 200ms ease; }
.seg.has-thumb .seg-opt + .seg-opt { border-left: 0; }
.seg.has-thumb .seg-opt:hover { background: transparent; }
.seg.has-thumb .seg-opt[aria-selected="true"],
.seg.has-thumb .seg-opt[aria-selected="true"]:hover { background: transparent; color: #fff; }
.seg-thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: inherit;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-accent) 82%, #fff 18%), var(--color-accent));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--color-accent) 38%, transparent), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: left 420ms var(--spring), width 420ms var(--spring);
  pointer-events: none;
}
.seg-thumb.is-still { transition: none; }

/* — Platform tiles: lift on hover, a soft ring when chosen. The lift is on the wrapper so the compare
     tick-box moves with its tile. — */
.tile-wrap { transition: transform 200ms var(--spring); }
.platform-tile { transition: box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease; }
.tile-wrap:hover { transform: translateY(-3px); }
.tile-wrap:hover .platform-tile { box-shadow: var(--lift-shadow); }
.tile-wrap:active { transform: translateY(0); }
.tile-wrap.is-on, .tile-wrap:has(.platform-tile[aria-checked="true"]) { transform: translateY(-2px); }
.platform-grid .platform-tile[aria-checked="true"], .platform-grid .tile-wrap.is-on .platform-tile {
  box-shadow: var(--ring), 0 10px 22px color-mix(in srgb, var(--color-accent) 18%, transparent);
}

/* — Cards that are links lift a little too — */
.chip { transition: transform 160ms var(--spring), box-shadow 160ms ease, background-color 160ms ease; }
.chip:hover { transform: translateY(-1px); }

/* — Dark look (graphite, "Night"): flat colours and a warm sand glow instead of lift and gradients — */
html[data-theme="graphite"] {
  --ring: 0 0 0 1px rgba(212, 183, 139, .5), 0 0 20px rgba(212, 183, 139, .18);
}
html[data-theme="graphite"] .btn-primary:not(:disabled),
html[data-theme="graphite"] .btn-primary:not(:disabled):hover { background-image: none; transform: none; }
html[data-theme="graphite"] .btn-primary:not(:disabled) { box-shadow: 0 0 0 rgba(212, 183, 139, 0); }
html[data-theme="graphite"] .btn-primary:not(:disabled):hover { box-shadow: 0 0 22px rgba(212, 183, 139, .45); }
html[data-theme="graphite"] .btn-primary:not(:disabled):active { transform: scale(.97); }
html[data-theme="graphite"] .btn-secondary:not(:disabled):hover { box-shadow: none; }
html[data-theme="graphite"] .btn.is-done, html[data-theme="graphite"] .output-panel .btn.is-done { background: #26322a; border-color: #4f6b54; color: #cfe6c9; }
html[data-theme="graphite"] .seg.has-thumb { background: #202125; border: 1px solid #2f3136; box-shadow: none; }
html[data-theme="graphite"] .seg.has-thumb .seg-opt { color: #bbb9b3; }
html[data-theme="graphite"] .seg.has-thumb .seg-opt[aria-selected="true"] { color: #18191c; }
html[data-theme="graphite"] .seg-thumb {
  background: #e8e6e1;
  box-shadow: 0 0 0 1px rgba(212, 183, 139, .55), 0 0 18px rgba(212, 183, 139, .45), 0 0 42px rgba(212, 183, 139, .18);
  transition: left 380ms cubic-bezier(.22, 1.2, .36, 1), width 380ms cubic-bezier(.22, 1.2, .36, 1);
}
html[data-theme="graphite"] .tile-wrap, html[data-theme="graphite"] .tile-wrap:hover,
html[data-theme="graphite"] .tile-wrap.is-on, html[data-theme="graphite"] .tile-wrap:has(.platform-tile[aria-checked="true"]) { transform: none; }
html[data-theme="graphite"] .tile-wrap:not(.is-on):hover .platform-tile:not([aria-checked="true"]) { background: #26272b; border-color: #5d5e61; box-shadow: none; }
html[data-theme="graphite"] .platform-grid .platform-tile[aria-checked="true"], html[data-theme="graphite"] .platform-grid .tile-wrap.is-on .platform-tile {
  border-color: #d4b78b; box-shadow: 0 0 0 1px rgba(212, 183, 139, .6), 0 0 18px rgba(212, 183, 139, .4), 0 0 36px rgba(212, 183, 139, .15);
}
html[data-theme="graphite"] .chip:hover { transform: none; }

/* — Less motion when asked — */
@media (prefers-reduced-motion: reduce) {
  .btn, .seg-thumb, .platform-tile, .tile-wrap, .chip, .input, .topic-input { transition: none; }
  .btn:active, .btn-primary:not(:disabled):hover, .btn-primary:not(:disabled):active,
  .tile-wrap, .tile-wrap:hover, .tile-wrap.is-on, .tile-wrap:has(.platform-tile[aria-checked="true"]), .chip:hover { transform: none; }
  .btn.is-loading::before { animation: none; border-top-color: color-mix(in srgb, currentColor 35%, transparent); }
}
