:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --paper-deep: #ebe4d6;
  --ink: #20251f;
  --muted: #6f756c;
  --line: rgba(32, 37, 31, 0.15);
  --accent: #365f48;
  --accent-soft: #dce7dc;
  --danger: #9b3f36;
  --white: #fffdf8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgba(119, 150, 119, 0.16), transparent 32rem),
    var(--paper);
}

body.compact-page {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

body.compact-page main,
body.compact-page .home-view {
  min-height: 0;
  height: 100%;
}

body.compact-page .guest-view {
  min-height: 0;
  height: 100%;
  padding-block: clamp(24px, 5vh, 54px);
  overflow-y: auto;
}

button,
input,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

a { color: inherit; }

[hidden] { display: none !important; }

.site-header,
.site-footer,
main {
  width: min(100% - 40px, 1120px);
  margin-inline: auto;
}

.site-header {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: block;
  width: 48px;
  height: 42px;
}

.pen-icon {
  position: absolute;
  top: 15px;
  left: 9px;
  width: 31px;
  height: 5px;
  border: 1px solid var(--accent);
  border-radius: 1px 7px 7px 1px;
  background: linear-gradient(90deg, rgba(54, 95, 72, 0.04), rgba(54, 95, 72, 0.16));
  transform: rotate(-40deg);
  transform-origin: center;
}

.pen-icon::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -10px;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-right: 10px solid var(--accent);
  border-bottom: 4px solid transparent;
}

.pen-icon::after {
  content: "";
  position: absolute;
  top: -2px;
  right: 6px;
  width: 1px;
  height: 7px;
  background: rgba(54, 95, 72, 0.48);
}

.brand-mark::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 37px;
  height: 11px;
  border-bottom: 1px solid rgba(54, 95, 72, 0.42);
  border-radius: 50%;
  transform: rotate(-7deg);
}

.text-button,
.icon-button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.text-button {
  padding: 9px 2px;
  border-bottom: 1px solid transparent;
}

.text-button:hover,
.text-button:focus-visible {
  border-color: currentColor;
  color: var(--ink);
}

.hero {
  padding: clamp(72px, 13vw, 150px) 0 clamp(82px, 12vw, 132px);
}

.guest-view {
  min-height: calc(100vh - 196px);
  display: grid;
  place-items: center;
  padding: 72px 0 96px;
}

.private-intro {
  width: min(100%, 720px);
  text-align: center;
}

.privacy-mark {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  margin: 0 auto 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: 0 20px 60px rgba(38, 48, 37, 0.08);
}

.private-intro h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.4rem, 10vw, 7rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.private-intro > p:not(.eyebrow) {
  max-width: 560px;
  margin: 28px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.guest-login-button {
  width: auto;
  min-width: 150px;
  margin-top: 34px;
}

.guest-note {
  display: block;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.76rem;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 880px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.25rem, 9vw, 7.2rem);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.98;
}

.hero-copy {
  max-width: 500px;
  margin: 32px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.posts-section {
  padding: 0 0 120px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 500;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.85rem;
}

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

.post-card {
  min-height: 270px;
  padding: 32px 28px 34px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background 180ms ease, padding 180ms ease;
}

.post-card:nth-child(odd) {
  padding-right: 46px;
  border-right: 1px solid var(--line);
}

.post-card:nth-child(even) { padding-left: 46px; }

.post-card:hover,
.post-card:focus-visible { background: rgba(255, 255, 255, 0.28); }

.post-meta,
.article-date {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-card h3 {
  margin: 48px 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  font-weight: 500;
  line-height: 1.15;
}

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

.empty-state {
  padding: 82px 0;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.empty-state p {
  margin: 0 0 8px;
  font-family: Georgia, serif;
  font-size: 1.5rem;
}

.empty-state span { color: var(--muted); }

.article-view {
  max-width: 760px;
  padding: 72px 0 120px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  margin-bottom: 88px;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover { color: var(--ink); }

.article-view h1 {
  margin: 16px 0 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 1;
}

.article-excerpt {
  margin: 0 0 54px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.8;
}

.article-content {
  padding-top: 46px;
  border-top: 1px solid var(--line);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 2vw, 1.24rem);
  line-height: 1.95;
  white-space: pre-wrap;
}

.site-footer {
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.dialog {
  width: min(92vw, 480px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(24, 30, 24, 0.28);
}

.dialog::backdrop {
  background: rgba(24, 29, 24, 0.48);
  backdrop-filter: blur(6px);
}

.dialog > form { padding: 34px; }

.dialog-heading,
.editor-topbar,
.editor-footer,
.admin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading { margin-bottom: 28px; }

.dialog-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.8rem;
  font-weight: 500;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.55rem;
}

.icon-button:hover { background: var(--paper-deep); }

label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 0.96rem;
}

input { min-height: 46px; padding: 0 13px; }
textarea { padding: 12px 13px; resize: vertical; line-height: 1.55; }

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(54, 95, 72, 0.1);
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  background: var(--accent);
  color: white;
}

.primary-button:hover { background: #284c38; }

.primary-button.compact { width: auto; }

.secondary-button {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.secondary-button:hover { background: var(--paper-deep); }

.danger-button {
  border: 1px solid rgba(155, 63, 54, 0.3);
  background: transparent;
  color: var(--danger);
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.danger-button:hover,
.danger-button:focus-visible {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
  box-shadow: 0 8px 20px rgba(155, 63, 54, 0.2);
  transform: translateY(-1px);
}

.danger-button:active {
  box-shadow: none;
  transform: translateY(0);
}

.form-message {
  min-height: 1.2em;
  margin: 0 0 16px;
  color: var(--danger);
  font-size: 0.82rem;
}

.form-message.success { color: var(--accent); }

.form-hint {
  margin: -6px 0 18px;
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-dialog {
  width: min(96vw, 1120px);
  max-width: none;
}

.admin-shell {
  min-height: min(82vh, 760px);
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  padding: 30px 24px;
  border-right: 1px solid var(--line);
  background: #f4f0e7;
}

.admin-posts {
  flex: 1;
  margin: 22px -10px;
  overflow-y: auto;
}

.admin-post {
  width: 100%;
  padding: 13px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.admin-post:hover,
.admin-post.active { background: rgba(255, 255, 255, 0.7); }

.admin-post strong,
.admin-post span { display: block; }

.admin-post strong {
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-post span {
  color: var(--muted);
  font-size: 0.76rem;
}

.admin-actions { align-items: flex-end; }

.admin-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.admin-actions .danger-text { margin-left: auto; }

.danger-text { color: var(--danger); }

.editor-form {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 30px;
}

.editor-topbar {
  min-height: 46px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.84rem;
}

.editor-buttons { display: flex; gap: 8px; }

.content-label { flex: 1; }

.content-label textarea {
  min-height: 240px;
  height: 100%;
}

.editor-advanced {
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(245, 241, 232, 0.42);
}

.editor-advanced summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 15px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.editor-advanced summary::-webkit-details-marker { display: none; }

.editor-advanced summary::after {
  content: "+";
  margin-left: auto;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 400;
}

.editor-advanced[open] summary::after { content: "−"; }

.editor-advanced summary:hover,
.editor-advanced summary:focus-visible {
  background: rgba(54, 95, 72, 0.06);
  outline: none;
}

.editor-advanced summary:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(54, 95, 72, 0.34);
}

.editor-advanced summary small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
}

.editor-advanced-fields {
  padding: 4px 15px 0;
  border-top: 1px solid var(--line);
}

.editor-advanced-fields label:last-child { margin-bottom: 15px; }

.editor-advanced-fields .switch-label { margin-bottom: 15px; }

.editor-footer {
  align-items: flex-start;
  justify-content: flex-end;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--ink);
}

.switch-label input { width: 18px; min-height: auto; }

.editor-footer .form-message { margin: 0; text-align: right; }

.trash-dialog { width: min(92vw, 620px); }

.trash-shell { padding: 34px; }

.trash-description {
  margin: -12px 0 22px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.trash-posts {
  border-top: 1px solid var(--line);
}

.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.trash-item strong,
.trash-item span { display: block; }

.trash-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.restore-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.restore-button:hover,
.restore-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.trash-empty {
  padding-block: 46px;
  border-bottom: 0;
}

@media (max-width: 760px) {
  .site-header,
  .site-footer,
  main { width: min(100% - 28px, 1120px); }

  .hero { padding-top: 64px; }

  .guest-view {
    min-height: calc(100vh - 196px);
    padding: 54px 0 72px;
  }

  body.compact-page .guest-view {
    min-height: 0;
    padding-block: clamp(18px, 4vh, 40px);
  }

  .privacy-mark {
    width: 88px;
    height: 88px;
    margin-bottom: 30px;
  }

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

  .post-card,
  .post-card:nth-child(odd),
  .post-card:nth-child(even) {
    min-height: 230px;
    padding: 28px 4px;
    border-right: 0;
  }

  .post-card h3 { margin-top: 34px; }

  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 6px; }

  .admin-dialog { width: 100vw; max-height: 100vh; border-radius: 0; }

  .admin-shell { min-height: 100vh; grid-template-columns: 1fr; }

  .admin-sidebar { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }

  .admin-posts { max-height: 180px; }

  .editor-form { min-height: 620px; padding: 24px 18px; }
}
