@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Source+Sans+3:ital,wght@0,400;0,600;0,700;1,400&display=swap");

:root {
  --ink: #1c2430;
  --navy: #243044;
  --navy-deep: #18202c;
  --burgundy: #7c2f2f;
  --burgundy-hover: #632424;
  --gold: #c4a35a;
  --paper: #f3eee4;
  --paper-dark: #e7dfd0;
  --card: #fffcf6;
  --line: #d9d0c0;
  --muted: #5d6570;
  --focus: #3d6a8a;
  --ok: #2d5a3d;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --radius: 14px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.55;
  background:
    radial-gradient(1200px 500px at 50% -80px, #fffaf0 0%, transparent 70%),
    linear-gradient(180deg, #f7f2e8 0%, var(--paper) 40%, #efe7d8 100%);
}

img {
  max-width: 100%;
}

a {
  color: var(--burgundy);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--burgundy-hover);
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 20;
  padding: 0.5rem 0.8rem;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
}

.skip:focus {
  top: 0.75rem;
}

.site-header {
  background: linear-gradient(180deg, var(--navy-deep), var(--navy));
  color: #f7f1e4;
  border-bottom: 4px solid var(--gold);
  box-shadow: 0 8px 24px rgba(24, 32, 44, 0.18);
}

.header-inner,
.page,
.site-footer .footer-inner {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1.15rem 0 1.05rem;
}

.brand {
  text-decoration: none;
  color: inherit;
}

.brand h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand p {
  margin: 0.15rem 0 0;
  color: #d5c7a4;
  font-size: 0.92rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.nav a {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  color: #f3ead8;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: rgba(255, 252, 246, 0.1);
  border-color: rgba(196, 163, 90, 0.55);
  color: #fff;
}

.nav a[aria-current="page"] {
  background: var(--gold);
  color: var(--navy-deep);
  border-color: var(--gold);
}

.page {
  flex: 1;
  padding: 1.75rem 0 3rem;
}

.hero {
  text-align: center;
  margin-bottom: 1.4rem;
}

.hero h2 {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 600;
  line-height: 1.2;
}

.hero p {
  margin: 0 auto;
  max-width: 42rem;
  color: var(--muted);
}

.banner {
  margin: 1rem auto 0;
  max-width: 40rem;
  padding: 0.7rem 1rem;
  background: #edf5ee;
  color: var(--ok);
  border: 1px solid #c9ddce;
  border-radius: 10px;
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.3rem 1.4rem;
}

.card + .card,
.stack > * + * {
  margin-top: 1rem;
}

.card h3,
.section-title {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.2rem;
}

.options {
  display: grid;
  gap: 0.35rem;
}

.options label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.7rem;
  background: #f7f1e6;
  border-radius: 10px;
  cursor: pointer;
}

.options input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--burgundy);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span,
.field-label {
  font-weight: 700;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cfc5b4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input[type="text"]:focus,
textarea:focus,
button:focus-visible,
.btn:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 3px solid #9bb8c9;
  outline-offset: 2px;
}

textarea,
#thespot textarea {
  min-height: 8.5rem;
  resize: vertical;
  line-height: 1.45;
}

.ref-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: end;
}

#thespot {
  min-height: 8.5rem;
  display: grid;
}

#thespot img,
.spinner {
  place-self: center;
}

.spinner {
  width: 2.1rem;
  height: 2.1rem;
  border: 3px solid var(--paper-dark);
  border-top-color: var(--burgundy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: end;
}

.actions .field {
  min-width: 9rem;
}

.short {
  max-width: 6.5rem;
}

.hint {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.btn,
button,
input[type="submit"] {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.62rem 1.05rem;
  border: 0;
  border-radius: 10px;
  background: var(--burgundy);
  color: #fffaf3;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
  background: var(--burgundy-hover);
  color: #fff;
}

.btn-secondary,
#search {
  background: var(--navy);
}

.btn-secondary:hover,
#search:hover {
  background: var(--navy-deep);
}

.btn-submit,
input[type="submit"] {
  min-height: 2.7rem;
  padding-inline: 1.25rem;
}

.practice {
  display: none;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: #eef5f0;
  border: 1px solid #c5d8cb;
  border-radius: var(--radius);
  text-align: center;
}

.practice:not(:empty) {
  display: block;
}

.practice h2 {
  margin: 0.45rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ok);
  overflow-wrap: anywhere;
}

.passages {
  display: grid;
  gap: 1rem;
}

@media (min-width: 800px) {
  .passages {
    grid-template-columns: 1fr 1fr;
  }
}

.passage {
  padding: 1rem 1.05rem 1.15rem;
}

.passage h3 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-size: 1.12rem;
}

.passage .field + .field {
  margin-top: 0.75rem;
}

.prose p {
  margin: 0 0 1rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.card > .hint {
  margin-top: 0;
  margin-bottom: 0.85rem;
}

.changelog {
  list-style: none;
  margin: 0;
  padding: 0;
}

.changelog li {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.changelog time {
  color: var(--burgundy);
  font-weight: 700;
  font-size: 0.92rem;
}

.site-footer {
  margin-top: auto;
  padding: 1.4rem 0 1.8rem;
  background: var(--navy-deep);
  color: #e8dfcc;
  border-top: 4px solid var(--gold);
}

.site-footer a {
  color: #f0d48a;
}

.footer-inner {
  text-align: center;
}

.footer-inner p {
  margin: 0.35rem 0;
}

.credit {
  margin-top: 0.8rem !important;
  color: #b7ae9d;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .ref-row,
  .actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .short,
  .actions .field {
    max-width: none;
    min-width: 0;
  }
}
