:root {
  --sky-50: #f3f8fc;
  --sky-100: #e7f1f9;
  --sky-200: #cfe3f2;
  --sky-700: #2a5f86;
  --ink: #1c2a36;
  --ink-soft: #4a5d6c;
  --gold: #b8892c;
  --gold-deep: #8f6a1c;
  --paper: #fbf9f5;
  --white: #ffffff;
  --line: rgba(42, 95, 134, 0.14);
  --danger: #9b3b3b;
  --ok: #2f6b4f;
  --shadow: 0 18px 50px rgba(28, 42, 54, 0.08);
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
  --font-ui: "Outfit", system-ui, sans-serif;
  --measure: 42rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.075rem;
  line-height: 1.7;
  background:
    radial-gradient(1200px 500px at 50% -10%, #d7ebf8 0%, transparent 60%),
    linear-gradient(180deg, var(--sky-50), var(--paper) 38%, var(--paper));
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: var(--sky-700); text-underline-offset: 0.15em; }
a:hover { color: var(--gold-deep); }

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 50;
  background: var(--white);
  padding: 0.5rem 0.75rem;
}

.container {
  width: min(100% - 2rem, 720px);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(251, 249, 245, 0.82);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  width: min(100% - 2rem, 980px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand__author {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-ui);
  font-size: 0.92rem;
}

.site-nav a { text-decoration: none; color: var(--ink-soft); }
.site-nav a:hover { color: var(--sky-700); }

.inline-form { display: inline; margin: 0; }
.linkish {
  background: none;
  border: none;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.linkish:hover { color: var(--sky-700); }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
}
.badge--soft {
  background: var(--sky-100);
  color: var(--sky-700);
}

/* Hero */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(3.5rem, 10vw, 6.5rem) 1rem 3.5rem;
  text-align: center;
}

.hero__sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(215, 235, 248, 0.9), rgba(251, 249, 245, 0.2) 70%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(255, 255, 255, 0.22) 18px,
      rgba(255, 255, 255, 0.22) 19px
    );
}

.hero__eyebrow {
  font-family: var(--font-ui);
  font-size: clamp(0.95rem, 2.2vw, 1.08rem);
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-soft);
  max-width: 34rem;
  margin: 0 auto 1rem;
  line-height: 1.55;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0;
  animation: rise 0.9s ease both;
}

.hero__author {
  margin: 0.55rem 0 0;
  font-family: var(--font-ui);
  font-size: clamp(0.78rem, 1.6vw, 0.9rem);
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  animation: rise 0.9s ease 0.08s both;
  opacity: 0.9;
}

.hero__tagline {
  display: none;
}

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

.section-label {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-deep);
  margin: 0 0 1.25rem;
}

.feed { padding: 1rem 0 4rem; }

.post-stream {
  display: grid;
  gap: 2rem;
}

.post-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.6rem 1.5rem 1.35rem;
  box-shadow: var(--shadow);
  position: relative;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
}
.post-card.is-expanded .post-card__body,
.post-card.is-expanded .post-card__comments {
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.post-card + .post-card {
  margin-top: 0.25rem;
}

.post-card::before {
  content: "";
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  top: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), rgba(42, 95, 134, 0.35));
  opacity: 0.85;
}

.post-card__header {
  margin-bottom: 0.85rem;
}

.post-card__header time {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.post-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.5vw, 2rem);
  letter-spacing: -0.02em;
  margin: 0.35rem 0 0;
  line-height: 1.2;
}

.post-card__preview p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.7;
}

.post-card__full {
  margin-top: 0.75rem;
}

.post-card__cover {
  margin: 0 0 1.25rem;
}
.post-card__cover img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
}

.post-card__video {
  margin-bottom: 1.25rem;
}

.post-card__body {
  margin-bottom: 1.5rem;
}

.post-card__comments {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.post-card__comments h4 {
  font-family: var(--font-display);
  margin: 1rem 0 0.25rem;
}

.post-card__actions {
  margin-top: 1.15rem;
  display: flex;
  justify-content: flex-start;
}

.read-more-btn {
  min-width: 8.5rem;
  background: var(--white);
  color: var(--sky-700);
  border: 1.5px solid rgba(42, 95, 134, 0.45);
  box-shadow: 0 1px 0 rgba(28, 42, 54, 0.04);
}
.read-more-btn:hover {
  background: var(--sky-50);
  color: var(--sky-700);
  border-color: var(--sky-700);
  transform: translateY(-1px);
}
.read-more-btn.is-collapse {
  background: var(--white);
  color: var(--ink-soft);
  border: 1.5px solid rgba(28, 42, 54, 0.28);
  box-shadow: none;
}
.read-more-btn.is-collapse:hover {
  background: var(--sky-50);
  color: var(--ink);
  border-color: rgba(28, 42, 54, 0.45);
}

.btn-text {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 500;
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}
.btn-text:hover {
  color: var(--sky-700);
}

.comment-form__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.post-card.is-expanded {
  cursor: default;
  padding-bottom: 1.6rem;
}

/* legacy list styles unused on home but kept harmless */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.post-list__link {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  transition: transform 0.25s ease;
}

.post-list__item:first-child .post-list__link { border-top: none; }
.post-list__link:hover { transform: translateX(4px); }
.post-list__link:hover h3 { color: var(--sky-700); }

.post-list__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.post-list__text time {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.post-list__text h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0.2rem 0 0.45rem;
  letter-spacing: -0.02em;
}

.post-list__text p {
  margin: 0;
  color: var(--ink-soft);
}

@media (min-width: 640px) {
  .post-list__link:has(.post-list__cover) {
    grid-template-columns: 200px 1fr;
    align-items: center;
  }
  .post-list__cover { aspect-ratio: 4 / 3; }
  .post-card {
    padding: 2rem 2rem 1.6rem;
  }
  .post-card::before {
    left: 2rem;
    right: 2rem;
  }
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  font-family: var(--font-ui);
  font-size: 0.92rem;
}

.empty, .muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 0.9rem; margin: 0.25rem 0 0.75rem; }

/* Article */
.article { padding-bottom: 2rem; }
.article__header { padding: 2.5rem 0 1.25rem; }
.article__meta {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--ink-soft);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.article__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0.4rem 0 0;
}

.article__cover {
  margin: 0 0 1.75rem;
  width: min(100%, 1100px);
  margin-inline: auto;
}
.article__cover img {
  width: 100%;
  max-height: 52vh;
  object-fit: cover;
}

.article__video { margin-bottom: 1.75rem; }

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0f1b24;
  box-shadow: var(--shadow);
}
.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.prose {
  font-size: 1.12rem;
}
.prose > *:first-child { margin-top: 0; }
.prose h2, .prose h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  margin-top: 1.8em;
}
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.1rem;
  border-left: 3px solid var(--gold);
  color: var(--ink-soft);
  font-style: italic;
}
.prose img {
  border-radius: var(--radius);
  margin: 1.25rem 0;
  box-shadow: var(--shadow);
}
.prose a { color: var(--gold-deep); }

.article__admin {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

/* Comments */
.comments {
  padding: 2.5rem 0 4rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
}
.comment-list {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.comment {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.comment__meta {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}
.comment__body { margin: 0; white-space: pre-wrap; }

.comment-form,
.login-form,
.compose {
  display: grid;
  gap: 0.9rem;
}
.comment-form label,
.login-form label,
.compose label {
  display: grid;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
input[type="text"],
input[type="password"],
input[type="url"],
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: var(--white);
  color: var(--ink);
}
textarea { resize: vertical; min-height: 8rem; }
input:focus, textarea:focus {
  outline: 2px solid rgba(42, 95, 134, 0.28);
  border-color: var(--sky-700);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 500;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  background: var(--sky-700);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { background: #234d6d; color: #fff; transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--sky-700);
  border: 1px solid var(--line);
}
.btn--ghost:hover { background: var(--sky-100); color: var(--sky-700); }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #7e2e2e; }
.btn--wide { width: 100%; }
.btn--small { padding: 0.4rem 0.8rem; font-size: 0.82rem; }

.flash-wrap {
  width: min(100% - 2rem, 720px);
  margin: 1rem auto 0;
}
.flash {
  margin: 0.4rem 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-size: 0.92rem;
}
.flash--success { background: #e7f4ec; color: var(--ok); }
.flash--error { background: #f8e8e8; color: var(--danger); }

.site-footer {
  padding: 2rem 1rem 3rem;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.88rem;
}
.brand-inline {
  font-family: var(--font-display);
  font-weight: 650;
  color: var(--ink);
}

/* Login */
.page-login .site-header { display: none; }
.login-panel {
  min-height: 80vh;
  display: grid;
  place-items: center;
  padding: 3rem 0;
}
.login-card {
  width: min(100%, 420px);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card h1 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 2.2rem;
}
.login-form { text-align: left; margin-top: 1.5rem; }

/* Admin */
.admin-body {
  background: linear-gradient(180deg, var(--sky-50), var(--paper));
  font-family: var(--font-ui);
}

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

.admin-nav {
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 1rem;
}
.admin-nav.is-open { display: flex; }

.brand--admin { margin-bottom: 0.5rem; }

.admin-nav nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.admin-nav nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.admin-nav nav a:hover,
.admin-nav nav a.is-active {
  background: var(--sky-100);
  color: var(--sky-700);
}

.admin-main { padding: 0 0 3rem; }
.admin-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}
.admin-page-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0;
}
.admin-menu-btn {
  font-family: var(--font-ui);
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}
.admin-content {
  width: min(100% - 2rem, 900px);
  margin: 1.25rem auto 0;
}
.admin-logout { margin-top: auto; }

@media (min-width: 900px) {
  .admin-shell { grid-template-columns: 240px 1fr; }
  .admin-nav {
    display: flex;
    position: sticky;
    top: 0;
    height: 100vh;
    border-bottom: none;
    border-right: 1px solid var(--line);
    padding: 1.25rem;
  }
  .admin-menu-btn { display: none; }
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat__n {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
}
.stat__l {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.admin-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 800px) {
  .admin-grid { grid-template-columns: 1fr 1fr; }
}

.panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.panel__head,
.panel__head--page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.panel__head h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
}

.simple-list,
.manage-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.simple-list li,
.manage-list__item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}
.simple-list li:first-child,
.manage-list__item:first-child { border-top: none; }
.manage-list__item--stack { flex-direction: column; }
.manage-list__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-decoration: none;
  color: inherit;
  font-weight: 650;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.clamp {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tabs a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.tabs a.is-active {
  background: var(--sky-700);
  border-color: var(--sky-700);
  color: #fff;
}
.tabs a.is-active .badge--soft {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status--pending { color: var(--gold-deep); }
.status--approved { color: var(--ok); }
.status--rejected { color: var(--danger); }

/* Compose */
.compose__title input {
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.compose__row {
  display: grid;
  gap: 1rem;
}
@media (min-width: 720px) {
  .compose__row { grid-template-columns: 1fr 1fr; }
}
.compose__cover {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.7);
}
.compose__cover legend {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0 0.25rem;
}
.cover-preview img {
  border-radius: 10px;
  margin-bottom: 0.5rem;
  max-height: 160px;
  object-fit: cover;
  width: 100%;
}
.check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
}
.compose em { font-style: normal; color: var(--ink-soft); font-weight: 400; }

.compose__body-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.45rem;
  border-bottom: 1px solid var(--line);
  background: var(--sky-50);
}
.toolbar button {
  font-family: var(--font-ui);
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  color: var(--ink);
}
.toolbar button:hover { background: var(--sky-200); }
.toolbar__preview { margin-left: auto; color: var(--sky-700) !important; }
#body_md {
  border: none;
  border-radius: 0;
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}
#body_md:focus { outline: none; }
.preview {
  padding: 1rem 1.1rem;
  min-height: 320px;
  border-top: 1px solid var(--line);
}
.compose__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

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

@media (max-width: 520px) {
  .stat-row { grid-template-columns: 1fr; }
  .manage-list__item {
    flex-direction: column;
  }
}
