:root {
  --paper: #f4efe6;
  --ink: #1c1916;
  --muted: #534d45;
  --line: #e4ddd2;
  --card: #fffdf8;
  --accent: #b44a1f;
  --accent-dark: #8c3514;
  --forest: #1e4d3e;
  --ok: #1e4d3e;
  --error: #8b2e1f;
  --shadow: 0 1px 2px rgba(28, 25, 22, 0.06), 0 8px 24px rgba(28, 25, 22, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip:focus {
  position: absolute;
  left: 8px;
  top: 8px;
  width: auto;
  height: auto;
  margin: 0;
  clip: auto;
  overflow: visible;
  white-space: normal;
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  z-index: 20;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }
.btn:focus-visible,
button.btn:focus-visible,
.nav a:focus-visible {
  outline-offset: 3px;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
body.admin .site-header {
  background: var(--accent);
  border-bottom-color: var(--accent-dark);
  backdrop-filter: none;
}
body.admin .wordmark,
body.admin .wordmark:hover {
  color: #fff;
}
body.admin .wordmark-sub {
  color: rgba(255, 255, 248, 0.82);
}
body.admin .nav a,
body.admin .nav a:hover {
  color: #fff;
}
body.admin .nav a:focus-visible {
  outline-color: #fff;
}
body.admin .nav-toggle {
  background: transparent;
  border-color: rgba(255, 255, 248, 0.45);
}
body.admin .nav-toggle-bars,
body.admin .nav-toggle-bars::before,
body.admin .nav-toggle-bars::after {
  background: #fff;
}
body.admin .nav-toggle[aria-expanded="true"] .nav-toggle-bars {
  background: transparent;
}

.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
}
.header-inner { position: relative; }

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

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

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  position: relative;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.045em;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
}
.wordmark img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.wordmark:hover { color: var(--accent-dark); }
.wordmark-sub {
  font-weight: 400;
  font-size: 0.62em;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 0.45em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}
.nav a:hover { color: var(--accent); }

main.wrap { flex: 1; padding: 28px 0 64px; }
main:focus,
main:focus-visible { outline: none; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

h1, h2, h3 {
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-weight: 700;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 12px; }
h2 { font-size: 1.35rem; margin: 0 0 8px; }

.lede {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 38rem;
}

.hero {
  padding: 28px 0 12px;
  display: grid;
  gap: 28px;
}
@media (min-width: 800px) {
  .hero { grid-template-columns: 1.2fr 0.8fr; align-items: center; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 16px;
}
@media (min-width: 700px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: inherit;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 0.9rem; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { background: #fff; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.actions label { margin: 0; }
.actions select { width: auto; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, textarea, select {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}
label:has(input[type="checkbox"]) {
  font-weight: 500;
}
.hint { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0 0 20px;
}
.flash-ok { background: #e7f0eb; color: var(--ok); }
.flash-error { background: #f8e7e3; color: var(--error); }

.meta, .muted { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; list-style: none; padding: 0; }
.chip {
  background: #efe8dc;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
}
.chip-ok { background: #dceae3; }
.chip-warn { background: #f3e1d4; }

.table-list { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.row-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.row-link:hover .card { border-color: var(--accent); }
.card-applied {
  border-color: #b7d0c4;
  background: #f7fbf8;
}
.row-link:hover .card-applied { border-color: var(--forest); }
.job-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}
.job-card-head h2 { margin: 0; flex: 1 1 12rem; }
.job-card-head .chips { margin: 0; }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.timeline time { color: var(--muted); font-size: 0.85rem; }

.split {
  display: grid;
  gap: 24px;
}
@media (min-width: 880px) {
  .split { grid-template-columns: 1.4fr 0.8fr; align-items: start; }
}

.empty { text-align: center; padding: 40px 20px; }

.job-pay { font-size: 1.2rem; font-weight: 700; }

.auth-card { max-width: 440px; margin: 24px auto; }

.nudge { border-left: 4px solid var(--accent); }

.job-attach {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.job-attach a { font-weight: 700; display: block; }
.job-attach .meta { display: block; margin: 4px 0 0; }

.prose :first-child { margin-top: 0; }
.prose h2 { margin-top: 1.6em; }
.prose { max-width: 42rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 20px;
}
.filters input, .filters select { width: auto; min-width: 140px; }
.filters a { align-self: center; }

.pager {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pager .actions { margin-top: 0; }

.tag-box { position: relative; }
.tag-box.is-ready [data-tag-list]:empty { display: none; }
.tag-add {
  display: none;
  gap: 8px;
  margin-top: 8px;
}
.tag-box.is-ready .tag-add { display: flex; }
.tag-add input { flex: 1; min-width: 0; width: auto; }
.tag-add .btn { width: auto; flex-shrink: 0; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tag-chip button {
  border: 0;
  background: transparent;
  padding: 0;
  min-width: 24px;
  min-height: 24px;
  font: inherit;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.tag-chip button:hover { color: var(--error); }
.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.role-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin: 14px 0 8px;
}
.role-switch-label { font-weight: 600; }
.role-switch a[aria-current="page"] {
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle-bars,
  .nav-toggle-bars::before,
  .nav-toggle-bars::after {
    transition: none;
  }
}

@media (max-width: 880px) {
  .header-inner {
    flex-wrap: nowrap;
    align-items: center;
  }
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 16px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .nav.is-open { display: flex; z-index: 6; }
  .nav a {
    padding: 12px 4px;
    font-size: 1.05rem;
    border-bottom: 1px solid var(--line);
  }
  .nav a:last-child { border-bottom: 0; }
  .nav .btn {
    margin-top: 8px;
    text-align: center;
    border-bottom: 0;
  }
  body.nav-open { overflow: hidden; }
  body.admin .nav {
    background: var(--accent-dark);
    border-bottom-color: var(--accent-dark);
    box-shadow: none;
  }
  body.admin .nav a {
    border-bottom-color: rgba(255, 255, 248, 0.2);
  }
}

@media (max-width: 640px) {
  .wrap { width: min(1080px, calc(100% - 24px)); }
  main.wrap { padding: 20px 0 48px; }
  .lede { font-size: 1.05rem; }
  .card { padding: 16px; }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filters input,
  .filters select,
  .filters .btn {
    width: 100%;
    min-width: 0;
  }
  input, textarea, select { font-size: 16px; }
  .actions { gap: 8px; }
  .auth-card { margin: 8px auto; }
}
