/* jasonofabiscuit blog — colors and type from jasonofabiscuit.com.
   The masthead wears a random paper color on every load, like the landing
   page; long-form text sits on a calm paper/charcoal ground for reading. */

:root {
  --cyan: #00aeef;
  --cyan-ink: #007aa7;
  --magenta: #ec008c;
  --magenta-ink: #a50062;
  --yellow: #fff200;
  --yellow-ink: #b2a900;
  --charcoal: #333333;
  --paper: #f6f6f4;

  --bg: var(--paper);
  --surface: #ffffff;
  --text: #2b2b2b;
  --muted: #5c5c5a;
  --border: #d9d9d5;
  --link: var(--magenta-ink);
  --focus: var(--cyan-ink);
  --danger: #b00020;
  --success: #1b6e3a;

  --font: "Zilla Slab", "Rockwell", "Roboto Slab", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 42rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2a2a2a;
    --surface: var(--charcoal);
    --text: #f0f0ee;
    --muted: #b8b8b5;
    --border: #4a4a4a;
    --link: #5fd0ff;
    --focus: var(--yellow);
    --danger: #ff7a8a;
    --success: #7ddc9b;
    color-scheme: dark;
  }
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.1875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 2rem);
  margin-inline: auto;
  padding-inline: 1rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.15em;
}
a:hover {
  text-decoration-thickness: 0.14em;
}

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

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
}
.skip-link:focus {
  top: 1rem;
}

/* ---------- Papers (shared by masthead, chips and swatches) ---------- */

.paper--dark {
  --p-bg: #333333;
  --p-fg: #000000;
  --p-text: #f6f6f4;
  --p-highlight: rgba(255, 255, 255, 0.16);
  --p-glow: rgba(255, 255, 255, 0.06);
  --p-shade: rgba(0, 0, 0, 0.5);
}
.paper--light {
  --p-bg: #f6f6f4;
  --p-fg: #acacab;
  --p-text: #333333;
  --p-highlight: rgba(255, 255, 255, 1);
  --p-glow: rgba(255, 255, 255, 0.7);
  --p-shade: rgba(0, 0, 0, 0.3);
}
.paper--cyan {
  --p-bg: #00aeef;
  --p-fg: #007aa7;
  --p-text: #000000;
  --p-highlight: rgba(255, 255, 255, 0.55);
  --p-glow: rgba(255, 255, 255, 0.2);
  --p-shade: rgba(0, 0, 0, 0.4);
}
.paper--magenta {
  --p-bg: #ec008c;
  --p-fg: #a50062;
  --p-text: #000000;
  --p-highlight: rgba(255, 255, 255, 0.45);
  --p-glow: rgba(255, 255, 255, 0.15);
  --p-shade: rgba(0, 0, 0, 0.4);
}
.paper--yellow {
  --p-bg: #fff200;
  --p-fg: #b2a900;
  --p-text: #000000;
  --p-highlight: rgba(255, 255, 255, 0.9);
  --p-glow: rgba(255, 255, 255, 0.4);
  --p-shade: rgba(0, 0, 0, 0.3);
}

/* ---------- Masthead ---------- */

.masthead {
  background: var(--p-bg);
  padding: clamp(2rem, 6vw, 3.5rem) 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.masthead__title {
  display: inline-block;
  color: var(--p-fg);
  font-weight: 600;
  font-size: clamp(2.25rem, 8vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-decoration: none;
  /* letterpress, as on the landing page */
  text-shadow:
    0 0.014em 0 var(--p-highlight),
    0 0.022em 0.02em var(--p-glow),
    0 -0.01em 0.01em var(--p-shade);
}
.masthead__title:hover {
  text-decoration: none;
}
.masthead__title:focus-visible {
  outline-color: var(--p-text);
}

/* ---------- Page furniture ---------- */

.page-title {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  margin: 2.5rem 0 1rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.meta {
  margin: 0.25rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.site-footer {
  margin-top: 4rem;
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer a {
  color: var(--muted);
}

/* ---------- Category chips ---------- */

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
  padding: 0;
}

.chip {
  --p-bg: var(--surface);
  --p-text: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: var(--p-bg);
  color: var(--p-text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.6;
  text-decoration: none;
}
a.chip:hover {
  text-decoration: underline;
}
.chip--cyan {
  --p-bg: var(--cyan);
  --p-text: #000;
}
.chip--magenta {
  --p-bg: var(--magenta);
  --p-text: #000;
}
.chip--yellow {
  --p-bg: var(--yellow);
  --p-text: #000;
}
.chip--dark {
  --p-bg: var(--charcoal);
  --p-text: var(--paper);
  border-color: rgba(255, 255, 255, 0.2);
}
.chip--light {
  --p-bg: var(--paper);
  --p-text: var(--charcoal);
  border-color: #bdbdb9;
}
.chip--all {
  --p-bg: transparent;
  --p-text: var(--text);
  border-color: var(--border);
}

.chip__count {
  font-weight: 400;
  opacity: 0.85;
}

/* The selected filter gets a pressed-in, outlined look. */
.filters .chip[aria-current="page"] {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--text);
  text-decoration: none;
}

.filters {
  margin-bottom: 1.5rem;
}

/* ---------- Post list ---------- */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-card {
  --accent: var(--border);
  padding: 1.5rem 0 1.5rem 1.25rem;
  border-left: 6px solid var(--accent);
  margin-bottom: 1.5rem;
}
.post-card--cyan {
  --accent: var(--cyan);
}
.post-card--magenta {
  --accent: var(--magenta);
}
.post-card--yellow {
  --accent: var(--yellow);
}
.post-card--dark {
  --accent: var(--charcoal);
}
.post-card--light {
  --accent: #cfcfcb;
}
@media (prefers-color-scheme: dark) {
  .post-card--dark {
    --accent: #111;
  }
}

.post-card__title {
  margin: 0;
  font-size: clamp(1.4rem, 3.5vw, 1.75rem);
}
.post-card__title a {
  color: inherit;
  text-decoration: none;
}
.post-card__title a:hover {
  text-decoration: underline;
}
.post-card__summary {
  margin: 0.25rem 0 0.5rem;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}
.pager__status {
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Single post ---------- */

.post__header {
  margin-bottom: 2rem;
}
.post__title {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 2.5rem 0 0.5rem;
}
.post__footer {
  margin-top: 3rem;
}

.prose {
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose h2 {
  font-size: 1.6rem;
  margin: 2.25rem 0 0.75rem;
}
.prose h3 {
  font-size: 1.3rem;
  margin: 2rem 0 0.5rem;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.25rem;
}
.prose li + li {
  margin-top: 0.35rem;
}
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 4px;
}
.prose figure {
  margin: 2rem 0;
}
.prose figure img {
  margin: 0 auto;
}
.prose figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 4px solid var(--magenta);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.prose pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.45;
}
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1.25rem;
}
.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.message {
  padding-bottom: 2rem;
}

/* ---------- Admin ---------- */

.admin-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}
.admin-nav__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-block: 0.6rem;
}
.admin-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
}
.admin-nav a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.admin-nav a:hover,
.admin-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 0.14em;
}
.admin-nav form {
  margin: 0;
}

.stack > * + * {
  margin-top: 1.25rem;
}

.field {
  margin-inline: 0;
}
fieldset.field,
.swatches {
  border: 0;
  padding: 0;
  margin-inline: 0;
  min-width: 0;
}
label,
legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.optional {
  font-weight: 400;
  color: var(--muted);
}
.hint {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.hint code {
  font-family: var(--mono);
  font-size: 0.85em;
}

input[type="text"],
input[type="password"],
textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #8a8a86;
  border-radius: 4px;
}
textarea {
  line-height: 1.5;
  resize: vertical;
}
.editor__body {
  font-family: var(--mono);
  font-size: 0.95rem;
  min-height: 20rem;
}
input:user-invalid {
  border-color: var(--danger);
}

.button,
.link-button {
  font: inherit;
  cursor: pointer;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.45rem 1.1rem;
  border-radius: 4px;
  border: 1px solid #8a8a86;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
}
.button:hover {
  border-color: var(--text);
}
.button--primary {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--paper);
}
.button--primary:hover {
  background: #000;
}
@media (prefers-color-scheme: dark) {
  .button--primary {
    background: var(--yellow);
    border-color: var(--yellow);
    color: #000;
  }
  .button--primary:hover {
    background: #fff;
  }
}
.button--danger {
  color: var(--danger);
  border-color: currentColor;
}
.button--small {
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.9rem;
}
.button[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.link-button--danger {
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.notice {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  border-left: 5px solid;
  background: var(--surface);
}
.notice--error {
  border-color: var(--danger);
}
.notice--success {
  border-color: var(--success);
}

.editor__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.editor__bar label {
  margin: 0;
}
.editor__tools {
  display: flex;
  gap: 0.5rem;
}
.editor__body.is-dragging {
  outline: 3px dashed var(--focus);
}
.preview {
  min-height: 20rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.chips--choose {
  margin-top: 0.25rem;
}
.chip--check {
  cursor: pointer;
  margin: 0;
  padding-left: 0.55rem;
}
.chip--check input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #000;
}
.chip--check:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.swatches legend {
  width: 100%;
}
.swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}
.swatch input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
}
.swatch__dot {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--p-bg);
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.card h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

.category-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-list .card {
  display: grid;
  gap: 0.75rem;
}

.danger-zone {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.admin-table thead th {
  font-size: 0.9rem;
  color: var(--muted);
}
.admin-table .chips {
  margin: 0;
}
.small {
  font-size: 0.85rem;
  font-weight: 400;
}

.status {
  display: inline-block;
  padding: 0 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
}
.status--published {
  color: var(--success);
  border-color: currentColor;
}

.login {
  max-width: 24rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
