:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --paper: #fffdf8;
  --ink: #24211d;
  --muted: #716a62;
  --line: rgba(44, 38, 31, 0.14);
  --accent: #2d6a68;
  --accent-2: #9b4f3c;
  --soft: #e6efe9;
  --shadow: 0 24px 80px rgba(49, 43, 35, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 14%, rgba(45, 106, 104, 0.13), transparent 32%),
    linear-gradient(135deg, #f6f3ee 0%, #fbfaf6 46%, #edf3f0 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(90deg, rgba(255,255,255,.45) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.38) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid rgba(36, 33, 29, 0.08);
  background: rgba(246, 243, 238, 0.78);
  backdrop-filter: blur(18px);
}

.brand,
.nav,
.hero-actions,
.tag-row,
.socials,
.comments-head,
.admin-top,
.toolbar,
.form-row,
.admin-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent);
}

.nav {
  gap: 8px;
}

.nav a,
.button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.nav a {
  padding: 10px 14px;
  color: var(--muted);
}

.nav a:hover {
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
}

.page-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  gap: 28px;
  min-height: calc(100vh - 156px);
  align-items: center;
}

.hero h1,
.section-heading h1,
.article-view h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 8vw, 108px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 760px;
  margin: 24px 0 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.45;
}

.hero-note,
.profile-panel p,
.article-excerpt,
.empty,
.muted {
  color: var(--muted);
  line-height: 1.8;
}

.hero-note {
  max-width: 640px;
  margin: 18px 0 0;
  font-size: 17px;
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  cursor: pointer;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 14px 36px rgba(45, 106, 104, 0.22);
}

.button.ghost {
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.72);
}

.button:hover,
.icon-button:hover,
.article-card:hover {
  transform: translateY(-2px);
}

.profile-panel,
.article-card,
.comments,
.admin-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  box-shadow: var(--shadow);
}

.profile-panel {
  padding: 26px;
}

.avatar {
  width: 112px;
  height: 112px;
  margin-bottom: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, var(--soft), #f8e9df);
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 56px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.socials {
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.socials a,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
  font-size: 13px;
}

.socials a {
  padding: 8px 12px;
}

.section-heading {
  margin: 28px 0 18px;
}

.section-heading h1,
.section-heading h2,
.comments h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 500;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .12em;
  text-transform: uppercase;
}

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

.article-card {
  min-height: 270px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform .22s ease, box-shadow .22s ease;
}

.article-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.12;
}

.article-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.tag-row {
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  padding: 5px 9px;
}

.article-view {
  width: min(820px, 100%);
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  margin-bottom: 28px;
  color: var(--muted);
}

.article-cover {
  min-height: 10px;
}

.article-cover.has-image {
  height: min(420px, 52vw);
  margin-bottom: 28px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
}

.article-excerpt {
  font-size: 18px;
}

.prose {
  margin-top: 36px;
  font-size: var(--article-font-size, 18px);
  line-height: 1.88;
}

.text-size-sm {
  font-size: .9em;
}

.text-size-md {
  font-size: 1em;
}

.text-size-lg {
  font-size: 1.16em;
}

.text-size-xl {
  font-size: 1.32em;
}

.prose h1,
.prose h2,
.prose h3 {
  margin-top: 1.8em;
  line-height: 1.25;
  font-family: Georgia, "Times New Roman", serif;
}

.prose img {
  max-width: 100%;
  border-radius: 8px;
}

.prose pre {
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  background: #211f1c;
  color: #f8f3ec;
}

.prose blockquote {
  margin-left: 0;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.comments {
  width: min(820px, 100%);
  margin: 42px auto 0;
  padding: 24px;
}

.comments-head {
  justify-content: space-between;
  gap: 16px;
}

.comment-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(45, 106, 104, 0.62);
  box-shadow: 0 0 0 4px rgba(45, 106, 104, 0.12);
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.comment {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.comment strong {
  display: block;
  margin-bottom: 4px;
}

.comment p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.7;
}

.reveal {
  animation: rise .52s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-body {
  background: #f7f6f1;
}

.admin-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.login-card {
  width: min(430px, calc(100% - 32px));
  margin: 12vh auto;
  padding: 28px;
}

.login-card h1,
.admin-panel h2 {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
}

.login-card form,
.settings-grid,
.editor-grid,
.article-form,
.admin-list {
  display: grid;
  gap: 14px;
}

.admin-top {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.admin-panel {
  padding: 20px;
}

.admin-sidebar {
  position: sticky;
  top: 86px;
}

.sidebar-head,
.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.sidebar-head h2,
.editor-heading h2 {
  margin: 0;
}

.admin-list {
  max-height: 72vh;
  overflow: auto;
  padding-right: 2px;
}

.admin-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.46);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 8px;
  line-height: 1.35;
}

.admin-item.active {
  border-color: rgba(45, 106, 104, 0.72);
  background: var(--soft);
}

.admin-item strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.admin-meta,
.admin-date {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.status-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border: 1px solid rgba(45, 106, 104, 0.28);
  border-radius: 999px;
  background: rgba(45, 106, 104, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
}

.status-badge.draft {
  border-color: rgba(155, 79, 60, 0.3);
  background: rgba(155, 79, 60, 0.1);
  color: var(--accent-2);
}

.form-row {
  gap: 12px;
}

.form-row > * {
  flex: 1;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button,
.text-tool {
  min-width: 38px;
  height: 38px;
  border-color: var(--line);
  background: var(--paper);
  cursor: pointer;
}

.text-tool {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
}

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

.markdown-editor {
  min-height: 470px;
  resize: vertical;
}

.preview {
  min-height: 470px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.admin-actions {
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-actions {
  padding-top: 2px;
}

.button.danger {
  color: var(--accent-2);
}

.comment-admin-item {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  animation: rise .22s ease both;
}

@media (max-width: 860px) {
  .site-header,
  .admin-top {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .admin-sidebar {
    position: static;
  }

  .hero {
    min-height: auto;
  }

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

  .form-row {
    flex-direction: column;
  }
}
