/* Fancy Text Generator
   Light theme is the default: warm paper, ink, one deep green.
   Dark theme overrides the same tokens. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/fraunces-500.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/fraunces-600.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/fraunces-500-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/outfit-400.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/outfit-500.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/outfit-600.woff2") format("woff2");
}

:root {
  --bg: #efeae2;
  --bg-deep: #e6dfd4;
  --surface: #fbf8f3;
  --surface-2: #f4efe7;
  --ink: #1c1916;
  --muted: #5e584f;
  --faint: #8a8276;
  --line: #ddd4c6;
  --line-strong: #c9bead;
  --accent: #243f36;
  --accent-ink: #f6f1e8;
  --high: #1b6b43;
  --high-bg: #e4f2ea;
  --med: #8a5620;
  --med-bg: #f8efe4;
  --over: #8d3a32;
  --over-bg: #f8e8e5;
  --shadow: 0 1px 2px rgba(48, 36, 22, 0.04), 0 16px 40px rgba(48, 36, 22, 0.06);
  --radius: 18px;
  --header: 64px;
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --preview: "Noto Sans", "Noto Sans Math", "Noto Sans Symbols", "Noto Sans Symbols 2", "Noto Sans Canadian Aboriginal", "Noto Sans Gothic", "Noto Music", "Droid Sans Fallback", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #141311;
  --bg-deep: #0f0e0c;
  --surface: #1d1b18;
  --surface-2: #26231f;
  --ink: #f3efe6;
  --muted: #b7b0a4;
  --faint: #8f887d;
  --line: #34302a;
  --line-strong: #4a453c;
  --accent: #d7c7ae;
  --accent-ink: #1c1916;
  --high: #8dcea8;
  --high-bg: #1c2c24;
  --med: #e2b57a;
  --med-bg: #2c2418;
  --over: #f0a8a0;
  --over-bg: #3a2220;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(36, 63, 54, 0.06), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

[data-theme="dark"] body {
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(215, 199, 174, 0.06), transparent 46%),
    var(--bg);
}

img { max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-200%);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 40;
}
.skip:focus { transform: none; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: auto;
}
.mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.2rem;
  line-height: 1;
}
.brand-name {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.02rem;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.nav-toggle,
.theme-toggle,
.star,
.copy,
.btn,
.filter,
.clear {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
}

.nav-toggle,
.theme-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  flex: none;
}
.nav-toggle { padding: 0; }
.theme-toggle {
  padding: 0;
  overflow: hidden;
}
/* Both icons share one grid cell, so they stay centered and cannot stack.
   Light mode shows the moon. Dark mode shows the sun. The hide rules are
   more specific than the shared display rule, which is what used to leave
   the moon painted after the theme had already switched. */
.theme-toggle .theme-icon {
  grid-area: 1 / 1;
  width: 20px;
  height: 20px;
  display: block;
}
html:not([data-theme="dark"]) .theme-toggle .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle .theme-icon-moon { display: none; }
  html:not([data-theme]) .theme-toggle .theme-icon-sun { display: block; }
}

.site-nav {
  display: none;
  position: absolute;
  top: calc(var(--header) - 1px);
  left: 0;
  right: 0;
  padding: 8px 16px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.site-nav.is-open { display: grid; gap: 4px; }
.site-nav a {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
}
.site-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}
.site-nav a:hover { color: var(--ink); }

.lede,
.prose p,
.notice { color: var(--muted); }

h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); margin: 0 0 12px; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0 0 12px; }
h3 { margin: 0; }

.kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.crumb { margin: 0 0 12px; color: var(--faint); font-size: 0.92rem; }
.crumb a { color: var(--muted); text-underline-offset: 3px; }

.intro { padding: 36px 0 8px; }
.intro p { max-width: 42rem; margin: 0; font-size: 1.125rem; }

.generator { padding: 22px 0 12px; }

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.composer-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 600;
}
.composer-label span { color: var(--faint); font-weight: 500; }
textarea, input[type="text"], input[type="email"] {
  width: 100%;
  margin-top: 8px;
  border: 0;
  resize: vertical;
  min-height: 96px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
  padding: 0;
}
input[type="text"], input[type="email"] {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--surface);
}
textarea:focus, input:focus { outline: none; }
.composer:focus-within { border-color: var(--line-strong); }

.composer-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.count-block { min-width: 0; }
#count-points { margin: 0; font-weight: 600; }
#count-units { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.clear { padding: 8px 14px; background: var(--surface-2); }

.limits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.chip {
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
}
.chip.is-ok { background: var(--high-bg); color: var(--high); }
.chip.is-over { background: var(--over-bg); color: var(--over); }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 10px;
}
#result-count { margin: 0; color: var(--faint); font-size: 0.92rem; }
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 -16px 6px;
  padding-left: 16px;
  padding-right: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.filter[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.results {
  display: grid;
  gap: 12px;
}
[hidden] { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card.is-copied { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-name { font-family: var(--sans); font-weight: 600; font-size: 0.98rem; letter-spacing: -0.01em; }
.badge { margin: 2px 0 0; font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-high { color: var(--high); }
.badge-medium { color: var(--med); }
.star {
  width: 44px;
  height: 44px;
  border: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--faint);
}
.star.is-on { color: var(--accent); }
.preview {
  margin: 0;
  min-height: 2.6em;
  max-height: 8.4rem;
  overflow: auto;
  font-family: var(--preview);
  font-size: 1.45rem;
  line-height: 1.45;
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview.is-empty {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 1rem;
}
.card-foot { display: flex; justify-content: flex-end; margin-top: auto; }
.copy {
  min-width: 92px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}
.copy:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.copy.is-copied {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.copy:disabled { opacity: 0.45; cursor: not-allowed; }

.empty, .notice {
  margin: 8px 0 0;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}

.section { padding: 28px 0; }
.prose { max-width: 44rem; }
.prose p, .prose li { color: var(--ink); }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 1.2rem; }
.prose li { margin: 0 0 8px; }
.prose a { color: var(--accent); }
.grid-2 {
  display: grid;
  gap: 12px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 6px;
}
.panel h3 { font-size: 1.25rem; margin-bottom: 8px; }
.faq details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 4px; color: var(--muted); }

.related { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.related a {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
}

.site-footer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.95rem;
}
.footer-grid {
  display: grid;
  gap: 22px;
}
.site-footer h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 8px;
  color: var(--faint);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: 0 0 6px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.legal-note { margin: 18px 0 0; color: var(--faint); font-size: 0.88rem; }

.form { display: grid; gap: 14px; max-width: 36rem; }
.form label { font-weight: 600; display: grid; gap: 6px; }
.form textarea { min-height: 140px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); }
.btn {
  justify-self: start;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  padding: 12px 18px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.ready textarea {
  min-height: 160px;
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.92rem;
}

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

@media (min-width: 720px) {
  .results { grid-template-columns: 1fr 1fr; gap: 14px; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .filters { margin: 0; padding-left: 0; padding-right: 0; flex-wrap: wrap; overflow: visible; gap: 10px; padding-bottom: 0; margin-bottom: 10px; }
}

@media (min-width: 960px) and (max-width: 1120px) {
  .site-nav a { padding: 8px 7px; font-size: 0.88rem; }
  .brand-name { font-size: 1.02rem; }
}

@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .site-nav {
    display: flex;
    position: static;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    gap: 2px;
    align-items: center;
  }
  .site-nav a { padding: 8px 10px; font-size: 0.95rem; }
  .intro { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .card, .composer, .filter, .copy { border: 1px solid CanvasText; }
}

/* Buttons inside prose keep their light text instead of the green link color. */
.prose a.btn,
.prose a.btn:hover,
a.btn:visited { color: var(--accent-ink); text-decoration: none; }

/* Brand mark is an inline SVG logo. */
svg.mark { width: 34px; height: 34px; display: block; flex: none; background: none; border-radius: 0; }
