:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --surface: #fffdf8;
  --surface-2: #ece6d9;
  --ink: #18211f;
  --muted: #66716c;
  --line: #d8d0c0;
  --brand: #146c5b;
  --brand-2: #b94b3f;
  --brand-3: #315d89;
  --accent: #d9a441;
  --shadow: 0 18px 50px rgba(33, 42, 36, 0.14);
  --radius: 8px;
  --max: 1180px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121715;
  --surface: #1a211f;
  --surface-2: #25302c;
  --ink: #f5f0e6;
  --muted: #b7c1bb;
  --line: #38443f;
  --brand: #62c9ae;
  --brand-2: #ee8b7d;
  --brand-3: #8bb6df;
  --accent: #f0c86a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 20;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
}

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

.brand,
.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-size: 0.8rem;
  letter-spacing: 0;
}

.nav-links a {
  color: var(--muted);
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.menu-toggle {
  display: none;
  gap: 4px;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  background: currentColor;
}

.sun-icon {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -10px 0 -7px currentColor, 0 10px 0 -7px currentColor, 10px 0 0 -7px currentColor, -10px 0 0 -7px currentColor;
}

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

.section.tight {
  padding: 32px 0;
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bg) 98%, transparent) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 46%, transparent 70%),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1800&q=80") center / cover;
}

.hero-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 104px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(3rem, 7vw, 6.75rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
}

.lead {
  max-width: 650px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fffdf8;
}

.button.danger {
  border-color: var(--brand-2);
  background: var(--brand-2);
  color: #fffdf8;
}

.button.ghost {
  background: transparent;
}

.hero-preview {
  position: absolute;
  left: 50%;
  bottom: 20px;
  width: min(560px, calc(100% - 32px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.preview-tile {
  min-height: 72px;
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  padding: 12px;
  box-shadow: var(--shadow);
}

.preview-tile strong {
  display: block;
  font-size: 0.9rem;
}

.preview-tile span {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.section-head p {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.card-body {
  padding: 18px;
}

.card-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface-2);
}

.muted {
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.feature-card {
  min-height: 156px;
  padding: 18px;
  border-left: 5px solid var(--brand);
}

.feature-card:nth-child(3n + 2) {
  border-left-color: var(--brand-2);
}

.feature-card:nth-child(3n) {
  border-left-color: var(--brand-3);
}

.feature-card p,
.article-card p,
.category-card p {
  color: var(--muted);
}

.article-card {
  display: flex;
  flex-direction: column;
}

.article-card .card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
}

.article-card .button {
  margin-top: auto;
}

.category-card {
  padding: 18px;
}

.testimonial-band,
.footer-band {
  background: var(--surface-2);
}

.newsletter-band {
  border-block: 1px solid var(--line);
  background: var(--ink);
  color: var(--bg);
}

.newsletter-band .eyebrow,
.newsletter-band .lead,
.newsletter-band .muted {
  color: color-mix(in srgb, var(--bg) 78%, transparent);
}

.newsletter-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 28px;
  align-items: center;
}

.newsletter-shell h2 {
  max-width: 760px;
}

.newsletter-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--bg) 20%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 10%, transparent);
}

.newsletter-form .field label {
  color: color-mix(in srgb, var(--bg) 76%, transparent);
}

.newsletter-form input {
  border-color: color-mix(in srgb, var(--bg) 24%, transparent);
  background: color-mix(in srgb, var(--bg) 10%, transparent);
  color: var(--bg);
}

.newsletter-form input::placeholder {
  color: color-mix(in srgb, var(--bg) 52%, transparent);
}

.newsletter-form .button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #18211f;
}

.newsletter-feedback {
  min-height: 22px;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
}

.newsletter-feedback[data-state="success"] {
  color: #9ee0c0;
}

.newsletter-feedback[data-state="warning"] {
  color: var(--accent);
}

.newsletter-confirmation {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, #9ee0c0 60%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, #9ee0c0 16%, transparent);
  color: var(--bg);
}

.newsletter-confirmation[hidden] {
  display: none;
}

.newsletter-confirmation strong {
  font-size: 1.05rem;
}

.newsletter-confirmation span {
  color: color-mix(in srgb, var(--bg) 82%, transparent);
}

.newsletter-form.subscribed .field,
.newsletter-form.subscribed > .button,
.newsletter-form.subscribed > .muted {
  display: none;
}

.quote {
  max-width: 760px;
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1.18;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-bar,
.admin-toolbar,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
}

.field textarea {
  min-height: 160px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: 1 / -1;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

.article-content {
  font-size: 1.08rem;
}

.article-content h2 {
  margin-top: 34px;
  font-size: 1.9rem;
}

.article-content p,
.article-content li {
  color: color-mix(in srgb, var(--ink) 86%, var(--muted));
}

.article-content blockquote {
  margin: 24px 0;
  padding: 16px 18px;
  border-left: 5px solid var(--accent);
  background: var(--surface-2);
}

.article-content pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: #101614;
  color: #f5f0e6;
}

.sidebar {
  position: sticky;
  top: 92px;
}

.reader-card {
  margin-bottom: 16px;
}

.reader-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.reader-head p {
  margin: 8px 0 0;
}

.reader-progress {
  height: 8px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.reader-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 180ms ease;
}

.reader-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.reader-controls .button {
  min-width: 0;
  padding-inline: 12px;
}

.reader-controls .button.ghost {
  grid-column: 1 / -1;
}

.reader-settings {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 2rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
}

.status {
  font-weight: 900;
  color: var(--brand);
}

.status.draft,
.status.archived {
  color: var(--brand-2);
}

.login-shell {
  width: min(460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 70px 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(380px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .grid.cols-4,
  .grid.cols-3,
  .newsletter-shell,
  .stat-grid,
  .filter-bar,
  .admin-toolbar,
  .form-grid,
  .article-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-layout,
  .span-4 {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-4 {
    grid-column: 1 / -1;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 680px) {
  .nav-shell {
    min-height: 64px;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .nav-links {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 72px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links .icon-button {
    width: 100%;
  }

  .hero {
    min-height: 760px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--bg) 98%, transparent) 0%, color-mix(in srgb, var(--bg) 88%, transparent) 58%, transparent 100%),
      url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1100&q=80") center / cover;
  }

  .hero-inner {
    padding-top: 42px;
  }

  .hero-preview,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .newsletter-shell,
  .stat-grid,
  .filter-bar,
  .admin-toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: block;
  }

  .actions .button {
    width: 100%;
  }
}
