:root {
  --ink: #3a1f6e;
  --ink-soft: #5a3d8a;
  --muted: #7a6699;
  --paper: #f2ebe1;
  --line: #d4c9b8;
  --accent: #3d4f62;
  --accent-ink: #2a3746;
  --surface: #faf6ef;
  --font-display: "Fredoka", "Nunito", sans-serif;
  --font-ui: "Nunito", "Segoe UI", sans-serif;
  --radius: 2px;
  --measure: 40rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.55;
  background: var(--paper);
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* —— Open at the top —— */
.top {
  width: min(100% - 2rem, var(--measure));
  margin: 0 auto;
  padding: 1.35rem 0 0.35rem;
  animation: rise 0.65s ease-out both;
}

.top h1 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(1.85rem, 5.2vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  width: 100%;
  max-width: none;
}

.lede {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-soft);
  max-width: none;
  width: 100%;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Intro —— */
.intro {
  width: min(100% - 2rem, var(--measure));
  margin: 0 auto;
  padding: 1.25rem 0 0.5rem;
}

.intro__copy {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
  animation: rise 0.65s ease-out 0.08s both;
}

.intro__copy p {
  margin: 0;
}

.intro__copy strong {
  color: var(--ink);
  font-weight: 600;
}

.intro__copy a {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.intro__copy a:hover {
  color: var(--accent-ink);
}

/* —— Tool —— */
.tool {
  width: min(100% - 2rem, var(--measure));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.status {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.2em;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

textarea,
#output {
  width: 100%;
  min-height: 9rem;
  padding: 0.9rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea:focus,
#output:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(47, 36, 82, 0.12);
}

#output {
  min-height: 11rem;
  cursor: pointer;
  margin: 0;
}

#output:empty::before {
  content: "Generated post appears here…";
  color: var(--muted);
}

#output.copied {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(47, 36, 82, 0.16);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.25rem 0 0.5rem;
}

button {
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

#generate {
  background: var(--ink);
  color: var(--paper);
}

#generate:hover:not(:disabled) {
  background: var(--accent-ink);
}

.btn-secondary {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#copy-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

/* —— Footer —— */
.site-foot {
  width: min(100% - 2rem, var(--measure));
  margin: 0 auto;
  padding: 0 0 2rem;
}

.foot-credit {
  margin: 0;
  padding: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: center;
}

.foot-credit a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.foot-credit a:hover {
  color: var(--accent-ink);
}

.foot-github {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  vertical-align: middle;
}

.foot-github__icon {
  flex-shrink: 0;
  display: block;
}

@media (max-width: 640px) {
  .actions {
    width: 100%;
  }

  #generate,
  .btn-secondary {
    flex: 1;
    text-align: center;
  }

  .foot-credit {
    font-size: 0.8rem;
    word-break: break-word;
  }
}

.cookie-consent {
  position: fixed;
  z-index: 40;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  max-width: 40rem;
  margin-inline: auto;
  padding: 1rem 1.15rem;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: 0 0.75rem 1.75rem color-mix(in srgb, var(--ink) 10%, transparent);
  animation: cookie-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cookie-consent__text {
  flex: 1 1 14rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.cookie-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cookie-consent__btn {
  appearance: none;
  margin: 0;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.cookie-consent__btn:hover,
.cookie-consent__btn:focus-visible {
  border-color: var(--ink-soft);
  outline: none;
}

.cookie-consent__btn--accept {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.cookie-consent__btn--accept:hover,
.cookie-consent__btn--accept:focus-visible {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

.cookie-consent__btn--decline:hover,
.cookie-consent__btn--decline:focus-visible {
  color: var(--ink);
}

@keyframes cookie-rise {
  from {
    opacity: 0;
    transform: translateY(0.6rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .top,
  .intro__copy {
    animation: none;
    transition: none;
  }

  .cookie-consent {
    animation: none;
  }
}
