/* ── Reset & Tokens ──────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  color-scheme: light dark;

  --bg:             light-dark(oklch(0.985 0.003 260), oklch(0.11 0.01 260));
  --surface:        light-dark(oklch(1 0 0),            oklch(0.15 0.01 260));
  --surface-2:      light-dark(oklch(0.97 0.005 260),   oklch(0.19 0.01 260));
  --text-primary:   light-dark(oklch(0.15 0.01 260),    oklch(0.93 0.005 260));
  --text-secondary: light-dark(oklch(0.40 0.01 260),    oklch(0.60 0.005 260));
  --border:         light-dark(oklch(0.91 0.005 260),   oklch(0.25 0.01 260));

  --accent:         light-dark(oklch(0.55 0.22 260),    oklch(0.68 0.20 260));
  --accent-light:   light-dark(oklch(0.92 0.05 260),    oklch(0.22 0.04 260));
  --accent-hover:   light-dark(oklch(0.48 0.22 260),    oklch(0.75 0.20 260));

  --font-body: 'Inter', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-secondary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ─────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 48rem;
  margin-inline: auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.info-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 0.35rem 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.info-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.info-btn svg {
  flex-shrink: 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ── Hero ────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: clamp(3rem, 8vw, 6rem) 1.5rem clamp(1.5rem, 3vw, 2.5rem);
  max-width: 48rem;
  margin-inline: auto;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-wrap: balance;
}

.gradient-text {
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 44ch;
  margin: 1rem auto 0;
}

/* ── Generator ───────────────────────────────────────── */
.generator {
  max-width: 48rem;
  margin-inline: auto;
  padding: 0 1.5rem 4rem;
}

/* ── Examples bar ────────────────────────────────────── */
.examples-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.examples-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.examples-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.example-pill {
  padding: 0.3rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.example-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.example-pill.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* ── Form ────────────────────────────────────────────── */
.content-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ── Platform Checkboxes ─────────────────────────────── */
.platform-fieldset {
  border: none;
  margin-bottom: 1.5rem;
}

.platform-fieldset legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.platform-checks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

@media (max-width: 500px) {
  .platform-checks {
    grid-template-columns: 1fr;
  }
}

.platform-check {
  cursor: pointer;
}

.platform-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}

.check-card svg {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.check-card:hover {
  border-color: var(--text-secondary);
}

.platform-check input:checked + .check-card {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text-primary);
}

.platform-check input:checked + .check-card svg {
  opacity: 1;
  color: var(--accent);
}

.platform-check input:focus-visible + .check-card {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Fields ──────────────────────────────────────────── */
.form-fields {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.field-group .hint {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

input[type="text"]:focus-visible,
input[type="url"]:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

/* ── CTA Section ─────────────────────────────────────── */
.cta-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cta-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cta-pill {
  padding: 0.35rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 9999px;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.cta-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.cta-pill.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.cta-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

@media (max-width: 500px) {
  .cta-fields {
    grid-template-columns: 1fr;
  }
}

.cta-text-field input,
.cta-url-field input {
  width: 100%;
}

/* ── Upload Area ─────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.upload-placeholder svg {
  opacity: 0.4;
  margin-bottom: 0.2rem;
}

.upload-formats {
  font-size: 0.75rem;
  opacity: 0.6;
}

.upload-loaded {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--text-primary);
  font-weight: 500;
}

.btn-remove {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.btn-remove:hover {
  color: oklch(0.55 0.2 25);
  background: oklch(0.55 0.2 25 / 0.1);
}

/* ── Buttons ─────────────────────────────────────────── */
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-primary {
  background: var(--accent);
  color: white;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
}

.btn-small {
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
}

/* ── Output ──────────────────────────────────────────── */
.output-section {
  margin-top: 1.5rem;
  animation: fadeUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUp {
  from { opacity: 0; translate: 0 12px; }
  to   { opacity: 1; translate: 0 0; }
}

.output-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
}

.output-tab {
  padding: 0.55rem 1.2rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.output-tab:hover {
  color: var(--text-primary);
}

.output-tab.active {
  background: var(--surface);
  color: var(--accent);
  border-bottom-color: var(--surface);
}

.output-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 1.25rem;
}

.output-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

/* ── Streaming status indicator ──────────────────────── */
.output-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

/* ── Loading skeleton ────────────────────────────────── */
.output-text.loading {
  color: transparent;
  position: relative;
  min-height: 6rem;
}

.output-text.loading::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--border) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Error state ─────────────────────────────────────── */
.output-error {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: light-dark(oklch(0.95 0.03 25), oklch(0.18 0.03 25));
  color: light-dark(oklch(0.45 0.15 25), oklch(0.75 0.12 25));
}

.output-error svg {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.output-error strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

.output-error p {
  font-size: 0.82rem;
  line-height: 1.45;
  opacity: 0.85;
}

.output-text {
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.7;
  word-wrap: break-word;
  color: var(--text-primary);
  max-height: 32rem;
  overflow-y: auto;
}

.output-text h3,
.output-text h4 {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text-primary);
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.output-text h3:first-child,
.output-text h4:first-child {
  margin-top: 0;
}

.output-text strong {
  font-weight: 600;
  color: var(--text-primary);
}

.output-text hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.output-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Footer ──────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ── Modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: oklch(0 0 0 / 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 36rem;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px oklch(0 0 0 / 0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-intro {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.guide-step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 0.1rem;
}

.guide-step strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.guide-step p {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.modal-footer a {
  color: var(--accent);
  text-decoration: none;
}

.modal-footer a:hover {
  text-decoration: underline;
}

/* ── Utilities ───────────────────────────────────────── */
[hidden] {
  display: none !important;
}
