:root {
  --ink: #1f2933;
  --muted: #607080;
  --paper: #f7f4ef;
  --surface: #ffffff;
  --header: #1f2933;
  --accent: #7f3d00;
  --accent-dark: #5f4024;
  --border: #e4ddd3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

header {
  background: var(--header);
  border-bottom: 1px solid var(--header);
}

.nav {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
}

.brand img {
  width: 84px;
  height: auto;
  display: block;
}

nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 0;
  padding: 0;
}

nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

nav a:hover {
  color: #f3d7b5;
}

nav a.nav-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--header);
}

nav a.nav-button:hover {
  color: var(--header);
  background: #f3d7b5;
}

.hero {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 22px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.02;
  letter-spacing: 0;
  color: var(--ink);
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero .eyebrow {
  margin-top: 0;
}

.featured-post,
.stacked-post {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

#featured-post,
#featured-post .featured-post {
  height: 100%;
}

.featured-post {
  min-height: 460px;
  background: #fffdf9;
}

.post-image {
  width: 100%;
  border: 1px dashed #c9b9a5;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(139, 94, 52, 0.12), rgba(31, 41, 51, 0.06)),
    #f3ece3;
}

.post-image::after {
  content: "Image";
  min-height: inherit;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-image.has-image {
  border-color: transparent;
  background-position: center 35%;
  background-size: cover;
}

.post-image.has-image::after {
  content: "";
}

.featured-image {
  flex: 1 1 auto;
  min-height: 285px;
  border-width: 0 0 1px;
  border-radius: 8px 8px 0 0;
}

.stacked-image {
  flex: 1 1 auto;
  min-height: 155px;
  border-width: 0 0 1px;
  border-radius: 8px 8px 0 0;
}

.post-card-image {
  width: calc(100% + 44px);
  height: 180px;
  margin: -22px -22px 18px;
  border-width: 0 0 1px;
  border-radius: 8px 8px 0 0;
  flex: 0 0 auto;
}

.post-card-category {
  margin-bottom: 6px;
}

.post-card-meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.post-card-meta time {
  color: var(--accent);
  font-size: inherit;
  font-weight: 700;
}

.post-card-excerpt {
  margin-bottom: 14px;
}

.post-summary {
  padding: 18px 20px 20px;
}

.hero-post-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.hero-post-meta time {
  color: var(--accent);
  font-weight: 700;
}

.featured-post h1 {
  margin-top: 8px;
}

.featured-post .button {
  align-self: flex-start;
  margin-top: 14px;
}

.post-stack {
  display: grid;
  gap: 18px;
}

.stacked-post {
  min-height: 221px;
}

.stacked-post h2 {
  margin: 6px 0 0;
  font-size: 1.1rem;
  line-height: 1.18;
}

.stacked-post .eyebrow {
  margin-bottom: 5px;
  font-size: 0.7rem;
}

.stacked-post .hero-post-meta {
  margin-bottom: 6px;
}

.stacked-post p:not(.eyebrow):not(.hero-post-meta) {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.stacked-post a {
  display: inline-block;
  margin-top: 8px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
}

.button.secondary {
  background: transparent;
  color: var(--accent-dark);
}

.button.danger {
  border-color: #a7332f;
  background: #a7332f;
  color: #ffffff;
}

.button.danger:hover {
  border-color: #7c201d;
  background: #7c201d;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(31, 41, 51, 0.08);
}

.service-card h2 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.service-card dl {
  margin: 0;
  display: grid;
  gap: 12px;
}

.service-card dt {
  font-weight: 700;
  color: var(--accent-dark);
}

.service-card dd {
  margin: 2px 0 0;
  color: var(--muted);
}

main {
  background: var(--surface);
}

.section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

.section-heading h1 {
  font-size: 2.4rem;
}

.section-heading a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.posts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.series-carousel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.series-track {
  display: grid;
  grid-auto-columns: minmax(280px, 360px);
  grid-auto-flow: column;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: 8px;
}

.series-card {
  scroll-snap-align: start;
}

.series-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: -4px 0 16px;
  border-radius: 8px;
}

.series-card h3 {
  margin-top: 10px;
  font-size: 1.35rem;
}

.series-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.series-card-actions a:last-child {
  color: var(--muted);
}

.series-carousel-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fffdf9;
  color: var(--accent-dark);
  cursor: pointer;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
}

.series-carousel-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.series-carousel-button[hidden] {
  display: none;
}

article {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  background: #fffdf9;
}

article time {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

article h3 {
  margin: 10px 0 8px;
  font-size: 1.2rem;
  line-height: 1.25;
}

article p {
  margin: 0 0 16px;
  color: var(--muted);
}

article a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.welcome {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 34px;
  align-items: start;
}

.welcome h2 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

.welcome p {
  margin-top: 0;
  color: var(--muted);
}

.about-page {
  max-width: 820px;
}

.about-page h1 {
  margin-bottom: 24px;
}

.about-content p {
  color: var(--muted);
  font-size: 1.05rem;
}

.post-page {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 52px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.post-page h1 {
  margin-bottom: 10px;
}

.post-page time {
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 24px;
}

.post-hero-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin-bottom: 10px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  background:
    linear-gradient(135deg, rgba(139, 94, 52, 0.12), rgba(31, 41, 51, 0.06)),
    #f3ece3;
}

.post-hero-image.has-image {
  border-color: transparent;
  background-position: center;
  background-size: cover;
}

.post-author {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.post-body {
  color: var(--ink);
  font-size: 1.08rem;
}

.post-body p {
  margin: 0 0 18px;
  color: var(--ink);
}

.post-body h2 {
  margin: 34px 0 12px;
  font-size: 1.6rem;
  line-height: 1.2;
}

.post-quote {
  margin: 30px 0;
  padding: 22px 24px;
  border-left: 5px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #fff7ec;
}

.post-quote p {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
  line-height: 1.55;
  font-weight: 700;
}

.post-quote cite {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
  font-style: normal;
}

.post-note {
  margin-top: 36px;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-note p {
  margin: 0 0 10px;
}

.post-note a {
  color: var(--accent-dark);
  font-weight: 700;
}

.builder-page {
  width: min(1280px, calc(100% - 32px));
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 24px;
  align-items: start;
}

.builder-form,
.builder-output section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  background: #fffdf9;
}

.builder-form {
  display: grid;
  gap: 16px;
}

.builder-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
}

.builder-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.builder-check input {
  width: auto;
}

.builder-help {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.builder-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.builder-toolbar button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.builder-toolbar button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.builder-editor {
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
  line-height: 1.6;
  outline: none;
  overflow-y: auto;
}

.builder-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 61, 0, 0.12);
}

.builder-editor p,
.builder-editor h2,
.builder-editor blockquote {
  margin: 0 0 14px;
}

.builder-editor h2 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.builder-editor blockquote {
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #fff7ec;
}

.builder-editor blockquote cite {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: normal;
}

.builder-form input,
.builder-form textarea,
.builder-output textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.builder-form textarea,
.builder-output textarea {
  resize: vertical;
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.builder-actions button {
  cursor: pointer;
}

.delete-confirmation {
  display: grid;
  gap: 10px;
  border: 1px solid #d9aaa7;
  border-radius: 8px;
  padding: 14px;
  background: #fff6f5;
}

.delete-confirmation p {
  margin: 0;
  color: #7c201d;
  font-size: 0.92rem;
  font-weight: 800;
}

.delete-confirmation input {
  width: 100%;
  border: 1px solid #d9aaa7;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.delete-confirmation .button {
  justify-self: start;
}

.builder-save-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.builder-output {
  display: grid;
  gap: 18px;
}

.builder-output h2 {
  margin: 0 0 10px;
}

.builder-preview-panel {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.builder-preview-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 18px;
}

.builder-preview-heading h2,
.builder-preview-heading #builder-file-name {
  margin: 0;
}

.builder-live-preview {
  width: 100%;
  padding: 0;
}

.builder-live-preview .post-body {
  min-height: 120px;
}

.builder-raw-output {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #fffdf9;
}

.builder-raw-output summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 800;
}

.builder-raw-output section {
  margin-top: 16px;
  padding: 0;
  border: 0;
  background: transparent;
}

#builder-file-name {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-weight: 700;
}

.admin-page {
  min-height: 58vh;
  display: grid;
  place-items: center;
}

.admin-panel {
  width: min(100%, 460px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
}

.admin-panel h1 {
  margin: 0 0 22px;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.admin-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
}

.admin-dashboard {
  display: grid;
  gap: 24px;
}

.admin-dashboard[hidden],
.admin-page[hidden] {
  display: none;
}

.admin-dashboard .section-heading {
  align-items: end;
}

.admin-dashboard .section-heading .eyebrow {
  margin-bottom: 8px;
}

.admin-dashboard h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-stats article {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
}

.admin-stats span {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
}

.admin-stats p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.admin-recent {
  display: grid;
  gap: 14px;
}

.admin-recent .section-heading {
  margin-bottom: 0;
}

.admin-recent h2 {
  margin: 0;
}

#admin-dashboard-status {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.admin-post-list {
  display: grid;
  gap: 10px;
}

.admin-post-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.admin-post-row .eyebrow {
  margin-bottom: 6px;
}

.admin-post-row h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.admin-post-row p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-post-row a {
  color: var(--accent-dark);
  font-weight: 800;
}

.admin-post-actions {
  display: flex;
  gap: 12px;
}

.admin-series {
  display: grid;
  gap: 14px;
}

.admin-series .section-heading {
  margin-bottom: 0;
}

.admin-series-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-series-option {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.admin-series-option input {
  width: 18px;
  height: 18px;
}

.admin-series-option span {
  display: grid;
  gap: 2px;
}

.admin-series-option small,
#admin-series-status {
  color: var(--muted);
  font-weight: 700;
}

.visit {
  border-top: 1px solid var(--border);
}

.visit h2 {
  margin: 0 0 18px;
  font-size: 2rem;
  line-height: 1.15;
}

.visit-intro {
  max-width: 680px;
  margin: -6px 0 22px;
  color: var(--muted);
  font-size: 1.05rem;
}

.visit dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.visit div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  background: #fffdf9;
}

.visit dt {
  font-weight: 700;
  color: var(--accent-dark);
}

.visit dd {
  margin: 4px 0 0;
  color: var(--muted);
}

footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--muted);
  background: var(--paper);
}

.footer-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  nav ul {
    flex-wrap: wrap;
    gap: 12px 18px;
  }

  .hero,
  .welcome {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 48px;
  }

  .posts {
    grid-template-columns: 1fr;
  }

  .series-carousel {
    grid-template-columns: 1fr;
  }

  .series-carousel-button {
    display: none;
  }

  .series-track {
    grid-auto-columns: minmax(250px, 86vw);
  }

  .visit dl {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    grid-template-columns: 1fr;
  }

  .admin-post-row {
    grid-template-columns: 1fr;
  }

  .admin-series-list {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .builder-layout {
    grid-template-columns: 1fr;
  }

  .builder-preview-panel {
    position: static;
    max-height: none;
  }
}
