:root {
  color-scheme: light dark;
  --ink: #201b17;
  --ink-muted: #524a44;
  --paper: #f5f1e8;
  --paper-raised: #ece4d8;
  --rule: #c7bfb1;
  --accent: #8b4b3e;
  --paper-texture:
    radial-gradient(1200px 800px at 15% 0%, rgba(0, 0, 0, 0.04), transparent 65%),
    radial-gradient(900px 700px at 85% 10%, rgba(0, 0, 0, 0.025), transparent 60%),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.03) 0px,
      rgba(0, 0, 0, 0.03) 1px,
      transparent 1px,
      transparent 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.02) 0px,
      rgba(0, 0, 0, 0.02) 1px,
      transparent 1px,
      transparent 5px
    );
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e5ded5;
    --ink-muted: #b6aaa0;
    --paper: #151311;
    --paper-raised: #201c18;
    --rule: #3a312a;
    --accent: #b96b58;
    --paper-texture:
      radial-gradient(1200px 800px at 15% 0%, rgba(255, 255, 255, 0.04), transparent 65%),
      radial-gradient(900px 700px at 85% 10%, rgba(255, 255, 255, 0.03), transparent 60%),
      repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.025) 0px,
        rgba(255, 255, 255, 0.025) 1px,
        transparent 1px,
        transparent 4px
      ),
      repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.02) 0px,
        rgba(255, 255, 255, 0.02) 1px,
        transparent 1px,
        transparent 5px
      );
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Calibri", "Candara", "Segoe UI", "Trebuchet MS", "Helvetica Neue", "Arial", sans-serif;
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.05rem);
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--paper-texture);
  line-height: 1.7;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

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

.container {
  width: min(1020px, 92vw);
  margin: 0 auto;
}

.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 1.75rem 0 1.25rem;
}

.hero {
  width: 100%;
  height: 340px;
  max-height: 340px;
  overflow: hidden;
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: none;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 75%, transparent);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.brand-share__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}

.brand-share__icon img,
.brand-share__icon svg {
  width: 100%;
  height: 100%;
  display: block;
  margin: 0;
  border: none;
  border-radius: 0;
  padding: 0;
  background: none;
}

.brand-share:hover,
.brand-share:focus-visible {
  border-color: var(--accent);
  background-color: var(--paper-raised);
  color: var(--ink);
  outline: none;
}

.brand-title {
  font-size: clamp(1.6rem, 2vw, 2rem);
  font-weight: 700;
  letter-spacing: 0.015em;
}

.brand-subtitle {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.98rem;
}

.site-nav ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-color: var(--accent);
  background-color: var(--paper-raised);
  color: var(--ink);
  outline: none;
}

.site-main {
  padding: 2.25rem 0 3rem;
}

.page-layout {
  display: block;
}

.page-layout--share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 2rem;
  align-items: start;
}

.page-content {
  min-width: 0;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: clamp(2.2rem, 3.2vw, 3rem);
  margin-top: 0;
}

h2 {
  font-size: clamp(1.7rem, 2.3vw, 2.3rem);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
}

h2::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule);
  transform: translateY(0.05em);
}

h3 {
  font-size: clamp(1.35rem, 1.6vw, 1.7rem);
}

p {
  margin: 0 0 1.1rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  padding: 0.35rem;
  background: var(--paper-raised);
}

.callout,
blockquote.callout {
  margin: 1.35rem 0;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.callout p:last-child,
blockquote.callout p:last-child {
  margin-bottom: 0;
}

.citation {
  margin: 0.75rem 0 1.5rem;
  font-size: 0.86rem;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

sup {
  font-size: 0.72em;
  vertical-align: text-top;
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.25rem 0 2.25rem;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.footer-note {
  margin: 0.35rem 0 0;
  font-style: italic;
}

/* ---------- Share section ---------- */

.share-section {
  margin: 0;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 0.6rem;
  background: var(--paper-raised);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  align-items: start;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  width: min(360px, 90vw);
}

.share-popup {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.share-popup[hidden] {
  display: none;
}

.share-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 27, 23, 0.45);
}

.share-popup__panel {
  position: relative;
  z-index: 1;
  width: min(420px, 90vw);
  padding: 1.35rem;
  border-radius: 0.8rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.share-popup__panel .share-section {
  width: 100%;
  box-shadow: none;
}

.share-popup__close {
  width: 100%;
  margin-top: 0.8rem;
}

.share-popup-open {
  overflow: hidden;
}

.share-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.share-kicker {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.share-label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
}

.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 75%, transparent);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.share-button:hover,
.share-button:focus-visible {
  border-color: var(--accent);
  background-color: var(--paper);
  color: var(--ink);
  outline: none;
}

.share-button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

.share-button--primary:hover,
.share-button--primary:focus-visible {
  background: color-mix(in srgb, var(--accent) 85%, #000 15%);
  color: var(--paper);
}

.share-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

@media (max-width: 700px) {
  .site-nav ul {
    gap: 0.45rem 0.65rem;
    font-size: 0.86rem;
  }

  .site-nav a {
    padding: 0.4rem 0.75rem;
  }

  .site-header {
    padding: 1.5rem 0 1rem;
  }

  .brand-row {
    flex-wrap: wrap;
    row-gap: 0.5rem;
  }

  .brand-share {
    font-size: 0.8rem;
    padding: 0.35rem 0.55rem;
  }

  .hero {
    height: 220px;
    max-height: 220px;
  }

  .site-main {
    padding: 2rem 0 2.75rem;
  }

  .share-actions {
    justify-content: flex-start;
  }
}

/* ---------- Form layout ---------- */

.submission-form {
  margin: 1.5rem 0;
}

.submission-form fieldset {
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  padding: 1.5rem 1.25rem;
  background: var(--paper-raised);
}

.submission-form legend {
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0 0.5rem;
  color: var(--ink);
}

/* ---------- Form groups and inputs ---------- */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group textarea {
  resize: vertical;
  line-height: 1.5;
}

.error-message {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--accent);
}

/* ---------- Submit button ---------- */

.submit-button {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.7rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--accent);
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.submit-button:hover {
  opacity: 0.85;
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Spinner ---------- */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

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

/* ---------- Response panel ---------- */

.submission-response {
  text-align: center;
  padding: 2rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 0.5rem;
  background-color: var(--paper-raised);
}

.submission-response h2 {
  margin-top: 0;
  color: var(--accent);
}

.submission-response .warning {
  font-weight: 500;
  color: var(--accent);
  margin: 1rem 0;
}

.submission-response .reference-number {
  font-family: monospace;
  letter-spacing: 0.1em;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.submission-response strong {
  font-weight: 600;
}

.submission-response .reload-notice {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 0;
}
