/* ═══════════════════════════════════════════════════════════════
   Super Rad Maker — feedback.css
   The "Share Feedback" tab and drawer, shared by the home page and
   both playable demos. feedback.js builds the markup and wires it up.

   Self-contained on purpose: the demo pages carry their own palettes
   and resets, and Farm TDS sits behind a CSP that blocks web fonts,
   so nothing here leans on styles.css. Every colour is the site's own.
   ═══════════════════════════════════════════════════════════════ */

.feedback-tab,
.feedback-backdrop,
.feedback-panel {
  --fb-bg:         #0d1117;
  --fb-bg-2:       #131922;
  --fb-ink:        #07090f;
  --fb-cyan:       #00e5ff;
  --fb-cyan-hi:    #33edff;
  --fb-cyan-dim:   rgba(0, 229, 255, 0.12);
  --fb-border:     rgba(0, 229, 255, 0.12);
  --fb-border-hot: rgba(0, 229, 255, 0.35);
  --fb-green:      #39ff14;
  --fb-green-dim:  rgba(57, 255, 20, 0.12);
  --fb-text:       #e8f4f8;
  --fb-muted:      #7a9ab0;
  --fb-dim:        #3a5a6e;
  --fb-mono:       'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --fb-sans:       Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fb-shadow:     0 4px 32px rgba(0, 229, 255, 0.18);
  --fb-ease:       cubic-bezier(0.22, 0.9, 0.3, 1);
  --fb-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
.feedback-tab *, .feedback-tab *::before, .feedback-tab *::after,
.feedback-panel *, .feedback-panel *::before, .feedback-panel *::after {
  box-sizing: border-box;
}

/* ── The tab ─────────────────────────────────────────────────────
   Laid out as a tall box by giving the label writing-mode: vertical-rl,
   then the whole button is turned 180° so the text reads bottom-to-top
   with the tops of the letters facing the page, the way an edge tab
   is expected to read. Because of that turn, physical sides are
   mirrored: the rounded right corners below land on the visual left,
   and a local translateX(-n) moves the tab visually right, off screen. */
.feedback-tab {
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 22px;
  border: 0;
  border-radius: 0 16px 16px 0;
  background: var(--fb-cyan);
  color: var(--fb-ink);
  font-family: var(--fb-mono);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--fb-shadow);
  transform: translateY(-50%) rotate(180deg) translateX(-140%);
  transition: transform 0.7s var(--fb-spring), background 0.2s;
  will-change: transform;
}
.feedback-tab.is-shown {
  transform: translateY(-50%) rotate(180deg);
}
.feedback-tab.is-shown:hover {
  background: var(--fb-cyan-hi);
  transform: translateY(-50%) rotate(180deg) translateX(6px);
}
.feedback-tab:focus-visible {
  outline: 3px solid var(--fb-green);
  outline-offset: 3px;
}
.feedback-tab-label {
  writing-mode: vertical-rl;
  white-space: nowrap;
}
.feedback-tab-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  transform: rotate(180deg);
}

/* Attention animation. Two rings expand from the tab, a light sweeps
   along it, and it wiggles and glows, then it settles into a slow
   breathe and goes quiet. feedback.js adds the classes in sequence. */
.feedback-tab::before,
.feedback-tab::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--fb-cyan);
  opacity: 0;
  pointer-events: none;
}
.feedback-tab-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.feedback-tab-shine::after {
  content: '';
  position: absolute;
  left: -30%;
  right: -30%;
  top: 0;
  height: 42%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.85) 50%,
    rgba(255, 255, 255, 0) 100%);
  transform: translateY(-160%) skewY(-14deg);
  opacity: 0;
}
.feedback-tab.is-flashing {
  animation: fb-tab-burst 3.2s ease-out both;
}
.feedback-tab.is-flashing::before { animation: fb-ring 1.15s ease-out 0s 3; }
.feedback-tab.is-flashing::after  { animation: fb-ring 1.15s ease-out 0.4s 3; }
.feedback-tab.is-flashing .feedback-tab-shine::after {
  animation: fb-shine 1.1s ease-in-out 0.1s 3;
}
.feedback-tab.is-breathing {
  animation: fb-breathe 2.8s ease-in-out 4;
}
@keyframes fb-tab-burst {
  0%   { transform: translateY(-50%) rotate(180deg) scale(1);    box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.8), var(--fb-shadow); }
  7%   { transform: translateY(-50%) rotate(185deg) scale(1.1);  box-shadow: 0 0 56px 14px rgba(0, 229, 255, 0.6), var(--fb-shadow); }
  14%  { transform: translateY(-50%) rotate(175deg) scale(1.08); }
  21%  { transform: translateY(-50%) rotate(183deg) scale(1.06); }
  28%  { transform: translateY(-50%) rotate(178deg) scale(1.03); }
  35%  { transform: translateY(-50%) rotate(180deg) scale(1);    box-shadow: 0 0 28px 6px rgba(0, 229, 255, 0.4), var(--fb-shadow); }
  50%  { transform: translateY(-50%) rotate(180deg) scale(1.06); box-shadow: 0 0 48px 12px rgba(0, 229, 255, 0.55), var(--fb-shadow); }
  64%  { transform: translateY(-50%) rotate(180deg) scale(1);    box-shadow: 0 0 20px 4px rgba(0, 229, 255, 0.3), var(--fb-shadow); }
  80%  { transform: translateY(-50%) rotate(180deg) scale(1.05); box-shadow: 0 0 40px 10px rgba(0, 229, 255, 0.5), var(--fb-shadow); }
  100% { transform: translateY(-50%) rotate(180deg) scale(1);    box-shadow: var(--fb-shadow); }
}
@keyframes fb-ring {
  0%   { transform: scale(1);          opacity: 0.9; }
  100% { transform: scale(1.7, 1.28);  opacity: 0; }
}
@keyframes fb-shine {
  0%   { transform: translateY(-160%) skewY(-14deg); opacity: 0; }
  12%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: translateY(380%) skewY(-14deg);  opacity: 0; }
}
@keyframes fb-breathe {
  0%, 100% { box-shadow: var(--fb-shadow); }
  50%      { box-shadow: 0 0 36px 8px rgba(0, 229, 255, 0.45), var(--fb-shadow); }
}

/* ── The drawer ─────────────────────────────────────────────── */
.feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(7, 9, 15, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.feedback-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0s;
}
.feedback-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 121;
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 36px 32px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(0, 229, 255, 0.05), transparent 220px),
    var(--fb-bg);
  border-left: 1px solid var(--fb-border-hot);
  box-shadow: -16px 0 56px rgba(0, 0, 0, 0.6);
  color: var(--fb-text);
  font-family: var(--fb-sans);
  user-select: text;
  -webkit-user-select: text;
  cursor: auto;
  outline: none;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.4s var(--fb-ease), visibility 0s linear 0.4s;
}
.feedback-panel.is-open {
  transform: none;
  visibility: visible;
  transition: transform 0.4s var(--fb-ease), visibility 0s;
}
/* The form and the received state are flex containers, which would
   otherwise beat the browser's [hidden] rule. */
.feedback-panel [hidden] { display: none !important; }
.feedback-panel h2,
.feedback-panel h3,
.feedback-panel p,
.feedback-panel fieldset,
.feedback-panel legend {
  margin: 0;
  padding: 0;
}

.feedback-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.feedback-eyebrow {
  font-family: var(--fb-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--fb-green);
  margin-bottom: 8px;
}
.feedback-title {
  font-family: var(--fb-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--fb-text);
  margin-bottom: 10px;
}
.feedback-lede {
  font-family: var(--fb-sans);
  font-size: 15px;
  color: var(--fb-muted);
  line-height: 1.7;
}
.feedback-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--fb-border);
  border-radius: 50%;
  background: transparent;
  color: var(--fb-muted);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.feedback-close:hover {
  border-color: var(--fb-cyan);
  color: var(--fb-cyan);
  transform: rotate(90deg);
}
.feedback-close:focus-visible { outline: 2px solid var(--fb-green); outline-offset: 2px; }
.feedback-close svg { width: 16px; height: 16px; }

/* ── The form ───────────────────────────────────────────────── */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.feedback-label {
  font-family: var(--fb-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fb-muted);
}
.feedback-label em {
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--fb-dim);
  margin-left: 6px;
}
.feedback-row--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.feedback-form input[type="text"],
.feedback-form input[type="email"],
.feedback-form select,
.feedback-form textarea {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  background: var(--fb-bg-2);
  border: 1px solid var(--fb-border);
  border-radius: 8px;
  color: var(--fb-text);
  font-family: var(--fb-sans);
  font-size: 15px;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.feedback-form textarea {
  resize: vertical;
  min-height: 140px;
}
.feedback-form select {
  padding-right: 40px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300e5ff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
}
.feedback-form select option {
  background: var(--fb-bg-2);
  color: var(--fb-text);
}
.feedback-form input::placeholder,
.feedback-form textarea::placeholder { color: var(--fb-dim); }
.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
  outline: none;
  border-color: var(--fb-cyan);
  box-shadow: 0 0 0 3px var(--fb-cyan-dim);
}

.feedback-topics {
  border: 0;
  min-width: 0;
}
.feedback-topics legend {
  margin-bottom: 8px;
}
.feedback-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.feedback-pills label {
  position: relative;
  cursor: pointer;
}
.feedback-pills input {
  position: absolute;
  margin: 0;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.feedback-pills span {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--fb-border);
  border-radius: 999px;
  background: var(--fb-bg-2);
  font-family: var(--fb-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fb-muted);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.feedback-pills label:hover span {
  border-color: var(--fb-border-hot);
  color: var(--fb-text);
}
.feedback-pills input:checked + span {
  border-color: var(--fb-cyan);
  color: var(--fb-cyan);
  background: var(--fb-cyan-dim);
}
.feedback-pills input:focus-visible + span {
  outline: 2px solid var(--fb-green);
  outline-offset: 2px;
}

/* Buttons inside the drawer. */
.feedback-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 14px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--fb-cyan);
  color: var(--fb-ink);
  font-family: var(--fb-mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.feedback-btn:hover {
  background: var(--fb-cyan-hi);
  transform: translateY(-2px);
  box-shadow: var(--fb-shadow);
}
.feedback-btn:focus-visible { outline: 2px solid var(--fb-green); outline-offset: 3px; }
.feedback-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.feedback-btn--ghost {
  padding: 13px 28px;
  border: 1.5px solid var(--fb-border-hot);
  background: transparent;
  color: var(--fb-text);
}
.feedback-btn--ghost:hover {
  background: var(--fb-cyan-dim);
  border-color: var(--fb-cyan);
  box-shadow: none;
}
.feedback-submit {
  width: 100%;
  margin-top: 4px;
}
.feedback-submit:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
  box-shadow: none;
}
.feedback-note {
  font-family: var(--fb-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--fb-dim);
}
.feedback-error {
  font-family: var(--fb-sans);
  font-size: 14px;
  line-height: 1.6;
  color: #ffb4b4;
  background: rgba(255, 80, 80, 0.10);
  border: 1px solid rgba(255, 80, 80, 0.35);
  border-radius: 8px;
  padding: 12px 14px;
}
.feedback-error a {
  color: var(--fb-cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Received state ─────────────────────────────────────────── */
.feedback-done {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 8px 0;
}
.feedback-done-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--fb-green);
  border-radius: 50%;
  color: var(--fb-green);
  background: var(--fb-green-dim);
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.25);
}
.feedback-done-icon svg { width: 26px; height: 26px; }
.feedback-done h3 {
  font-family: var(--fb-mono);
  font-size: 21px;
  font-weight: 700;
  color: var(--fb-text);
  outline: none;
}
.feedback-done p {
  font-family: var(--fb-sans);
  font-size: 15px;
  color: var(--fb-muted);
  line-height: 1.7;
}
.feedback-done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

/* ── Small screens ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .feedback-tab {
    gap: 10px;
    padding: 20px 14px;
    font-size: 13px;
    letter-spacing: 0.12em;
    border-radius: 0 10px 10px 0;
  }
  .feedback-tab-icon { width: 18px; height: 18px; }
  .feedback-panel { padding: 28px 22px 36px; gap: 22px; }
  .feedback-row--2 { grid-template-columns: 1fr; }
  .feedback-done-actions .feedback-btn { flex: 1; }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .feedback-tab {
    transform: translateY(-50%) rotate(180deg);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .feedback-tab.is-shown { opacity: 1; }
  .feedback-tab.is-shown:hover { transform: translateY(-50%) rotate(180deg); }
  .feedback-tab.is-flashing,
  .feedback-tab.is-flashing::before,
  .feedback-tab.is-flashing::after,
  .feedback-tab.is-flashing .feedback-tab-shine::after,
  .feedback-tab.is-breathing { animation: none; }
  .feedback-panel,
  .feedback-backdrop { transition: none; }
  .feedback-close:hover { transform: none; }
}
