/* ==========================================================================
   DESIGN TOKENS — same palette and fonts as my portfolio (adi-burgic.github.io)
   ========================================================================== */
:root {
  --bg-base: #0b1526;       /* page background */
  --bg-elevated: #10203a;   /* form panel */
  --bg-floating: #16284a;   /* result cards */

  --text: #edf1f8;
  --text-muted: #91a4c4;
  --text-faint: #5f7295;

  --accent: #f2a33c;
  --accent-soft: rgba(242, 163, 60, 0.14);

  --error: #ff8a7a;
  --error-soft: rgba(255, 138, 122, 0.1);

  --border: rgba(237, 241, 248, 0.09);
  --border-strong: rgba(237, 241, 248, 0.16);

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;

  --radius: 14px;
}

/* ==========================================================================
   BASE
   ========================================================================== */
* {
  box-sizing: border-box;
}

/* The hero glow reaches past the screen edges (inset -50vw). Clip it there so
   the page can't scroll sideways. "clip" rather than "hidden": hidden would turn
   html/body into scroll containers, clip just cuts off the overflow. */
html,
body {
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

/* Wide container so the three result columns have room */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

button:focus-visible,
textarea:focus-visible,
.chip input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.hero {
  position: relative;
  padding: clamp(3rem, 8vw, 5rem) 0 2rem;
}

/* Soft orange/blue glow, like the portfolio hero */
.hero__glow {
  position: absolute;
  inset: -2rem -50vw 0;
  z-index: -1;
  background:
    radial-gradient(40% 60% at 25% 20%, rgba(242, 163, 60, 0.14), transparent 70%),
    radial-gradient(30% 50% at 80% 30%, rgba(90, 130, 200, 0.12), transparent 70%);
  pointer-events: none;
}

.hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hero__tagline {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 52ch;
}

/* ==========================================================================
   FORM PANEL
   ========================================================================== */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.75rem);
}

.label {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0;
}

textarea {
  width: 100%;
  resize: vertical;
  background: var(--bg-base);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font: inherit;
  line-height: 1.6;
}

textarea::placeholder {
  color: var(--text-faint);
}

.counter {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.35rem;
}

.counter.is-near-limit {
  color: var(--accent);
}

/* Tone + channel pickers */
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2.5rem;
  margin: 1rem 0 1.5rem;
}

.option-group {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option-group legend {
  width: 100%;
}

/* Radio buttons styled as pill "chips" */
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.chip span:hover {
  border-color: var(--accent);
  color: var(--text);
}

.chip input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* ==========================================================================
   BUTTONS (same pill buttons as the portfolio)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.btn--primary {
  background: var(--accent);
  color: #1a1206;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 24px -10px rgba(242, 163, 60, 0.55);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn--small {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
}

/* Little spinner shown inside the Generate button while waiting */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(26, 18, 6, 0.3);
  border-top-color: #1a1206;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   ERROR MESSAGE
   ========================================================================== */
.error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--error-soft);
  border: 1px solid rgba(255, 138, 122, 0.35);
  color: var(--error);
  font-size: 0.95rem;
}

/* ==========================================================================
   RESULTS — three cards side by side (stacked on small screens)
   ========================================================================== */
.results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.results[hidden],
.error[hidden] {
  display: none;
}

.card {
  background: var(--bg-floating);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem;
  min-width: 0; /* lets long words wrap instead of stretching the grid */
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.card__lang {
  font-size: 1.1rem;
}

.card__lang span {
  font-size: 0.75rem;
  color: var(--accent);
  margin-left: 0.35rem;
  letter-spacing: 0.05em;
}

.card__text {
  white-space: pre-wrap; /* keeps the line breaks from the AI */
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 0.95rem;
}

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

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-faint);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
