/* Friday Update Writer — styles.
   Plain CSS, no framework. Calm, spacious, one deep green accent. */

:root {
  --ink: #232a26;          /* main text */
  --ink-soft: #6b7570;     /* secondary text */
  --paper: #faf9f6;        /* soft off-white page background */
  --card: #ffffff;         /* cards and the letter */
  --line: #e6e3da;         /* hairline borders */
  --accent: #2f6f4f;       /* the one deep green */
  --accent-dark: #265c41;  /* same green, pressed/hover */
  --accent-tint: rgba(47, 111, 79, 0.12); /* green at low opacity for focus rings */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 88px 24px 120px;
}

/* ---- Header ------------------------------------------------------------ */

.app-header {
  text-align: center;
  margin-bottom: 56px;
}

h1 {
  margin: 0 0 12px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 2.4rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.tagline {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

/* ---- The input card ---------------------------------------------------- */

.composer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 1px 2px rgba(35, 42, 38, 0.04),
    0 8px 24px rgba(35, 42, 38, 0.05);
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  padding: 16px 18px;
  font: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea::placeholder {
  color: var(--ink-soft);
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* ---- Toggle + button row ------------------------------------------------ */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
}

.tone-toggle {
  border: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tone-toggle legend {
  padding: 0;
  margin-bottom: 10px;
}

.tone-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ink-soft);
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease;
}

.tone-option:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* Selected tone pill: filled deep green */
.tone-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* Hide the raw radio dot — the pill itself shows the state */
.tone-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Keyboard focus on a pill */
.tone-option:has(input:focus-visible) {
  box-shadow: 0 0 0 3px var(--accent-tint);
}

#write-button {
  padding: 13px 32px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

#write-button:hover {
  background: var(--accent-dark);
}

#write-button:active {
  transform: translateY(1px);
}

#write-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* ---- The result: tab bar + panels -------------------------------------- */

.result {
  margin-top: 56px;
}

.hidden {
  display: none;
}

/* Tab bar: same pill aesthetic as the tone toggle */
.tab-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab-pill {
  padding: 9px 20px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease;
}

.tab-pill:hover {
  border-color: var(--accent);
  color: var(--ink);
}

/* Active tab: filled deep green, matching the selected tone pill */
.tab-pill.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.tab-pill:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* Copy button row: sits just above the letter, button on the right */
.result-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

/* Copy button: quiet outlined pill (same shape as the tone pills),
   fills deep green for a moment once the copy has happened */
.copy-button {
  padding: 9px 20px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease,
    color 0.15s ease;
}

.copy-button:hover {
  background: var(--accent);
  color: #fff;
}

.copy-button:active {
  transform: translateY(1px);
}

.copy-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-tint);
}

/* The brief "Copied!" confirmation state */
.copy-button.copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* The output itself — set like a letter, not terminal output */
.output-text {
  margin: 0;
  padding: 48px 52px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(35, 42, 38, 0.06),
    0 16px 40px rgba(35, 42, 38, 0.07);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-wrap: break-word;
}

@media (max-width: 540px) {
  .app {
    padding-top: 56px;
  }

  .composer {
    padding: 24px 20px;
  }

  .output-text {
    padding: 32px 24px;
  }
}
