:root {
  --paper: #f6f1e7;
  --paper-2: #fffdf8;
  --ink: #1a1814;
  --soft: #3a362f;
  --line: #e3d9c8;
  --teal: #0e4f4c;
  --teal-deep: #083532;
  --focus: #0e4f4c;
  --danger: #7a2222;
  --danger-bg: #f8e8e4;
  --ok-bg: #e5f0ec;
  --warn-bg: #f4e7cf;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 40rem;
  --wrap: 68rem;
  --pad: 1.25rem;
}

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

html { scroll-behavior: auto; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  border-top: 4px solid var(--teal);
}

body:focus { outline: none; }

img { max-width: 100%; height: auto; }

a {
  color: var(--teal);
  text-underline-offset: 0.15em;
}

a:hover { color: var(--teal-deep); }

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

.skip {
  position: absolute;
  left: var(--pad);
  top: 0;
  transform: translateY(-120%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 0.9rem;
  z-index: 10;
}

.skip:focus { transform: none; }

.wrap {
  width: min(var(--wrap), calc(100% - 2 * var(--pad)));
  margin-inline: auto;
}

.narrow { width: min(var(--measure), calc(100% - 2 * var(--pad))); }

.site-header {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}

.header-inner,
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding-block: 0.85rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
}

nav a,
.inline-form {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  background: #efe8da;
  color: var(--soft);
}

.footer-grid { align-items: flex-start; }
.footer-grid p { margin: 0.2rem 0; }

main { padding-block: 1.75rem 2.5rem; }

h1, h2, h3, .brand {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 4vw, 3.1rem); margin: 0 0 0.6rem; }
h2 { font-size: 1.55rem; margin: 1.6rem 0 0.5rem; }
h3 { font-size: 1.25rem; }

.intro { max-width: var(--measure); margin-bottom: 2rem; }
.intro p { font-size: 1.15rem; color: var(--soft); }

.meta, .fine { color: var(--soft); font-size: 0.95rem; }
.fine { margin-top: 0.4rem; }

.notes, .admin-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.notes li + li,
.admin-list li + li { border-top: 1px solid var(--line); }

.notes article,
.admin-list li { padding: 1.15rem 0; }

.notes h2 { margin: 0.15rem 0 0.35rem; font-size: 1.7rem; }
.notes h2 a { color: var(--ink); text-decoration-thickness: 1px; }
.notes h2 a:hover { color: var(--teal); }
.notes p { margin: 0.25rem 0 0; max-width: 42rem; }

.prose { font-family: var(--serif); font-size: 1.2rem; line-height: 1.65; }
.prose h2, .prose h3 { font-family: var(--serif); }
.prose p, .prose li { overflow-wrap: anywhere; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose blockquote {
  margin: 1.2rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--teal);
  color: var(--soft);
}
.prose code, .prose pre {
  font-family: var(--mono);
  font-size: 0.92em;
}
.prose pre {
  overflow-x: auto;
  padding: 0.8rem 1rem;
  background: #efe8da;
  border: 1px solid var(--line);
}
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td, table th, table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.prose img { border: 1px solid var(--line); }

.back { margin-top: 2rem; }
.back a { min-height: 44px; display: inline-flex; align-items: center; }

.empty {
  padding: 1rem 0;
  color: var(--soft);
}

.notice {
  background: var(--warn-bg);
  border: 1px solid #e0cfaa;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}
.notice.error, .danger-panel { background: var(--danger-bg); border-color: #e4c4bc; }
.notice p { margin: 0.2rem 0; }
.notice a { overflow-wrap: anywhere; }

label, legend { display: block; font-weight: 650; margin-bottom: 0.3rem; }
fieldset {
  border: 1px solid var(--line);
  margin: 0;
  padding: 0.8rem 1rem 1rem;
}
.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 450;
  min-height: 44px;
  padding-block: 0.35rem;
}
.check input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; }

input, textarea, select, button {
  font: inherit;
  color: inherit;
}
input[type="text"], input[type="email"], input[type="password"], input[type="file"],
input:not([type]), textarea, select {
  width: 100%;
  background: var(--paper-2);
  border: 1px solid #c9bfae;
  border-radius: 2px;
  padding: 0.65rem 0.7rem;
  font-size: 1rem;
}
textarea { min-height: 16rem; resize: vertical; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  background: var(--teal);
  color: #fbf7ef;
  border: 2px solid var(--teal-deep);
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 650;
}
button.secondary, a.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
button.danger {
  background: var(--danger);
  border-color: #5c1515;
  color: #fff8f6;
}
button.linkish {
  background: none;
  border: none;
  color: var(--teal);
  padding: 0;
  min-height: 44px;
  font-weight: 550;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.inline-form { margin: 0; }

.stack { display: grid; gap: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  padding: 1rem;
  margin-bottom: 1rem;
}
.panel h2 { margin-top: 0; }
.title-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.admin-list li {
  display: grid;
  gap: 0.35rem;
}
.admin-list a { color: var(--ink); font-family: var(--serif); font-size: 1.35rem; }
.table-wrap { overflow-x: auto; }

code { font-family: var(--mono); font-size: 0.92em; }

@media (min-width: 900px) {
  .admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    gap: 1.5rem;
    align-items: start;
  }
  .notes article { padding-block: 1.4rem; }
}

@media (max-width: 700px) {
  .actions button, .actions .button, .title-row .button { width: 100%; }
  h1 { font-size: 2rem; }
}

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