:root {
  --ink: #0b0b14;
  --body: #1f2333;
  --muted: #6b7280;
  --line: #e6e8f0;
  --surface: #fff;
  --surface-alt: #f5f6fa;
  --brand: #0a6bff;
  --brand-dark: #0049cc;
  --brand-soft: #e7f0ff;
  --accent: #57a5ff;
  --radius-card: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--body);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .logo {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.02em;
}

.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

img { max-width: 100%; }

/* Header */
.site-header {
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.logo {
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}

.logo-img {
  height: 64px;
  width: auto;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 10px;
  padding-top: 7.5px;
}

.main-nav a {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  margin-left: 28px;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.main-nav a:hover {
  color: var(--ink);
  border-color: var(--brand);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-dropdown {
  position: relative;
  margin-left: 28px;
  display: flex;
  align-items: center;
}

.nav-dropdown summary {
  list-style: none;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
}

.nav-dropdown:hover summary,
.nav-dropdown[open] summary {
  color: var(--ink);
  border-color: var(--brand);
}

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  align-items: stretch;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 30px -14px rgba(11,11,20,0.25);
}

.nav-dropdown-menu a {
  display: block;
  width: auto;
  margin: 0;
  box-sizing: border-box;
  text-align: left;
  padding: 9px 12px;
  border-radius: 7px;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--body);
  text-decoration: none;
}

.nav-dropdown-menu a:hover {
  background: var(--surface-alt);
  color: var(--brand);
}

@media (min-width: 601px) {
  .nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 20;
  }
  /* Bridges the gap between the summary and the menu box: without it, that
     empty strip belongs to neither element, so moving the mouse straight
     down through it drops :hover and the menu closes before you arrive. */
  .nav-dropdown-menu::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
  }
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown[open] .nav-dropdown-menu {
    display: flex;
  }
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: auto;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--ink);
  transition: transform 0.15s, opacity 0.15s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.header-account-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brand);
  text-decoration: none;
}

.header-account-link:hover {
  text-decoration: underline;
}

.header-login-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  color: #fff;
  background: linear-gradient(120deg, #2f86ff, #0a6bff);
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 16px -8px rgba(10,107,255,0.8);
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
}

.header-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px rgba(10,107,255,0.9);
}

.header-logout-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.header-logout-btn:hover {
  border-color: #cfd3e2;
  color: var(--ink);
}

.account-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.account-toggle-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
}

.account-toggle-btn.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

altcha-widget {
  color-scheme: light;
  --altcha-color-base: var(--surface);
  --altcha-color-base-content: var(--ink);
  --altcha-border-color: var(--line);
  --altcha-border-radius: 10px;
  --altcha-max-width: 100%;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 130px 0 130px;
  color: #fff;
  background: #05070e;
}

.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.55;
  transform: scale(1.03);
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero--robot {
  min-height: min(82vh, 660px);
  display: flex;
  align-items: center;
  padding: 80px 0;
}

.hero--robot .hero-inner {
  margin-left: max(0px, calc((100% - 1140px) / 2));
  margin-right: auto;
  pointer-events: none;
}

.hero--robot .hero-inner a { pointer-events: auto; }

@media (max-aspect-ratio: 1/1) {
  .hero--robot { min-height: 760px; align-items: flex-end; padding: 40px 0 48px; }
}

.robot-bubble {
  position: absolute;
  z-index: 3;
  left: 70%;
  top: 40%;
  transform: translate(-50%, -100%) scale(0.85);
  transform-origin: 50% 100%;
  max-width: min(240px, 70vw);
  width: max-content;
  padding: 10px 16px;
  border-radius: 16px;
  background: #fff;
  color: #0b0b14;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 28px -10px rgba(0,0,0,0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.robot-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.robot-bubble.is-on {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(100deg, #050914 8%, rgba(6,15,35,0.88) 42%, rgba(8,22,48,0.5) 72%, rgba(8,22,48,0.25)),
    linear-gradient(0deg, #05070e 0%, transparent 55%);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 640px;
  animation: heroRise 0.8s ease both;
}

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

@media (prefers-reduced-motion: reduce) {
  .hero-inner { animation: none; }
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.3rem);
  line-height: 1.1;
  font-weight: 800;
  color: #fff;
}

.hero h1 span {
  background: linear-gradient(100deg, #7db8ff, #57a5ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 1.14rem;
  color: #c3c9e2;
  margin-top: 22px;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.hero-link {
  color: #dbe4ff;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  margin-top: 32px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.hero-link:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

.hero-blob {
  position: absolute;
  right: -60px;
  top: -100px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle at 50% 50%, rgba(87,165,255,0.28), transparent 65%);
  border-radius: 50%;
  z-index: 1;
  filter: blur(10px);
  pointer-events: none;
}

.btn {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 28px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  margin-top: 32px;
}

.btn-primary {
  background: linear-gradient(120deg, #2f86ff, #0a6bff);
  color: #fff;
  box-shadow: 0 8px 22px -10px rgba(10,107,255,0.9);
}

.btn-primary:hover {
  background: linear-gradient(120deg, #0a6bff, #0049cc);
  transform: translateY(-1px);
}

/* Posts */
.posts-section {
  padding: 76px 0 40px;
}

.section-head {
  max-width: 560px;
  margin-bottom: 40px;
}

.section-head h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.section-head p {
  color: var(--muted);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}

.category-filter-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.category-filter-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.category-filter-btn.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  gap: 28px;
}

@media (max-width: 900px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .posts-grid { grid-template-columns: 1fr; }
}

.post-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(11,11,20,0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.post-card:hover {
  box-shadow: 0 20px 36px -18px rgba(11,11,20,0.22);
  border-color: #cfd3e2;
  transform: translateY(-3px);
}

.post-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  height: auto;
  border-radius: 0;
  margin-bottom: 0;
  background: linear-gradient(135deg, var(--brand-soft), #eef3ff);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card-body {
  padding: 22px 24px 0;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  width: fit-content;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.post-category[data-category] {
  cursor: pointer;
}
a.post-category:hover,
.post-category[data-category]:hover {
  background: var(--brand);
  color: #fff;
}

.post-card h3 {
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
}

.post-card p {
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-date {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 18px;
  font-weight: 600;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.btn-load-more {
  margin-top: 0;
}

/* Post detail */
.post-detail-section {
  padding: 50px 0 30px;
}

.back-link {
  display: inline-block;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  margin-bottom: 30px;
  font-size: 0.92rem;
}

.back-link:hover {
  text-decoration: underline;
}

.post-detail {
  max-width: 720px;
  margin: 0 auto 20px;
}

.post-detail h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 14px 0 12px;
}

.post-detail-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-card);
  margin-top: 26px;
}

.post-detail .post-date {
  margin-top: 0;
}

.post-body {
  margin-top: 34px;
  font-size: 1.06rem;
  color: var(--body);
}

.post-body p {
  margin: 0 0 20px;
}

.post-body p:last-child {
  margin-bottom: 0;
}

.post-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 30px 0 14px;
}

.post-body h3 {
  font-size: 1.18rem;
  font-weight: 700;
  margin: 26px 0 12px;
}

.post-body blockquote {
  margin: 0 0 20px;
  padding: 18px 20px;
  border-left: 3px solid var(--brand);
  background: var(--surface-alt);
  border-radius: 0 10px 10px 0;
  color: var(--body);
}

.post-body blockquote p {
  margin: 0 0 12px;
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body ol {
  color: var(--body);
  margin: 0 0 20px;
  padding-left: 22px;
}

.post-body img {
  width: 100%;
  border-radius: 14px;
  margin: 10px 0 24px;
}

.post-body ul {
  color: var(--body);
  margin: 0 0 20px;
  padding-left: 22px;
}

.post-body a {
  color: var(--brand);
}

.post-table-wrap {
  overflow-x: auto;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

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

.post-body th {
  background: var(--surface-alt);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.post-body tbody tr:last-child td {
  border-bottom: none;
}

.post-body tbody tr:nth-child(even) {
  background: var(--surface-alt);
}

.post-body code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88em;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
}

.post-body pre {
  background: #0b0b14;
  color: #e6e8f0;
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 24px;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.88rem;
  line-height: 1.55;
}

.post-cta {
  margin-top: 40px;
  padding: 36px;
  border-radius: var(--radius-card);
  background: linear-gradient(165deg, #0a2c68, #08204a 28%, #06132c 58%, #05070e);
  text-align: center;
}

.post-cta p {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.post-cta .btn {
  margin-top: 18px;
}

.related-section {
  padding: 30px 0 40px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* About */
.about-section {
  padding: 40px 0 60px;
}

.about-card {
  color: #fff;
  border-radius: 20px;
  padding: 48px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #0a2c68, #08204a 28%, #06132c 58%, #05070e);
}

.about-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(#ffffff12, transparent 42%);
  pointer-events: none;
}

.about-card h2 {
  position: relative;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.about-card p {
  position: relative;
  color: #b6bdd6;
  max-width: 600px;
  font-size: 1.03rem;
}

.about-tags {
  position: relative;
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.about-tags span {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #dbe4ff;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Contact */
.contact-section {
  padding: 20px 0 90px;
}

.contact-inner {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 50px;
  align-items: start;
}

.contact-copy h2 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.contact-copy p {
  color: var(--muted);
}

.contact-detail {
  font-weight: 700;
  color: var(--brand) !important;
  font-size: 1.05rem;
  margin-top: 16px;
}

.contact-form {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 30px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  gap: 6px;
}

.contact-form input,
.contact-form textarea {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
  color: #9aa1af;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10,107,255,0.15);
}

.form-status {
  font-weight: 600;
  color: var(--brand);
  min-height: 20px;
}

/* Admin */
.admin-section {
  padding: 60px 0 90px;
  min-height: 50vh;
  background: var(--surface-alt);
}

.admin-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 34px;
  border: 1px solid var(--line);
  max-width: 560px;
  margin-bottom: 30px;
}

#admin-panel .admin-card {
  max-width: 720px;
}

.admin-sub {
  color: var(--muted);
  margin-top: 10px;
  margin-bottom: 24px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  gap: 6px;
}

.admin-form input,
.admin-form textarea {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.admin-form input:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10,107,255,0.15);
}

.image-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: -8px;
}

.image-preview img {
  width: 90px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.btn-link-remove {
  background: none;
  border: none;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.editor-toolbar button {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.83rem;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.editor-toolbar button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.editor-toolbar button[data-cmd="code"],
.editor-toolbar button[data-cmd="codeblock"] {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.editor-body {
  min-height: 220px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.editor-body:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10,107,255,0.15);
}

.editor-body::placeholder {
  color: #9aa1af;
  font-family: 'Inter', sans-serif;
}

.editor-hint {
  margin: -4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.admin-row-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-row-thumb {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.admin-toggle {
  margin-top: 18px;
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-toggle a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.admin-toggle a:hover {
  text-decoration: underline;
}

.admin-toggle-link {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.admin-toggle-link:hover {
  text-decoration: underline;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  max-width: 720px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.admin-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  margin-top: 0;
  padding: 10px 22px;
  font-size: 0.92rem;
  border-radius: 10px;
}

.btn-secondary:hover {
  border-color: #cfd3e2;
  background: var(--surface-alt);
}

.admin-post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.admin-post-row:last-child {
  border-bottom: none;
}

.admin-post-row .post-category {
  margin-bottom: 0;
  margin-right: 12px;
}

.admin-post-row strong {
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  margin-right: 12px;
}

.admin-view-link {
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}

.admin-view-link:hover {
  text-decoration: underline;
}

.admin-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-card-heading h3 {
  margin: 0;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.admin-edit-link, .admin-delete-link {
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  padding: 0;
}

.admin-edit-link {
  color: var(--brand);
}

.admin-edit-link:hover {
  text-decoration: underline;
}

.admin-delete-link {
  color: #d1394a;
}

.admin-delete-link:hover {
  text-decoration: underline;
}

.admin-post-row.is-editing {
  background: var(--brand-soft);
  border-radius: 10px;
  padding-left: 12px;
  padding-right: 12px;
}

@media (max-width: 600px) {
  .admin-card { padding: 24px; }
  .admin-post-row { flex-direction: column; align-items: flex-start; }
  .admin-card-heading { flex-wrap: wrap; }
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--brand);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px -12px rgba(11,11,20,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.15s, color 0.15s;
  z-index: 20;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

@media (max-width: 600px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
  }
}

/* Comments */
.comment-form input[type="text"],
.comment-form textarea {
  font: inherit;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  resize: vertical;
  width: 100%;
}

.comment-form input[type="text"]:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(10,107,255,0.15);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.comments-section {
  padding: 20px 0 30px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}

.comments-inner {
  max-width: 720px;
  margin: 0 auto;
}

.comments-inner h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 30px 0 10px;
}

.comments-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--body);
  margin-bottom: 24px;
}

.comments-count, .comments-none, .comment-date {
  color: var(--muted);
  font-size: 0.85rem;
}

.stars {
  display: inline-flex;
  gap: 2px;
  font-size: 1.05rem;
  color: #d3d8e6;
}

.stars .star.is-on { color: #f5a623; }

.comment-form {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.comment-form h3 { font-size: 1.15rem; }

.comment-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
}

.comment-form .btn { margin-top: 0; width: fit-content; }

.rating-input {
  border: none;
  padding: 0;
  margin: 0;
}

.rating-input legend {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  padding: 0;
  margin-bottom: 6px;
}

.rating-stars {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  font-size: 1.9rem;
}

.rating-stars input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.rating-stars label {
  color: #d3d8e6;
  cursor: pointer;
  padding: 0 2px;
  display: inline-flex;
  transition: color 0.12s, transform 0.12s;
}

.rating-stars label:hover,
.rating-stars label:hover ~ label,
.rating-stars input:checked ~ label { color: #f5a623; }

.rating-stars label:hover { transform: scale(1.1); }

.rating-stars input:focus-visible + label {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

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

.comment:last-child { border-bottom: none; }

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft) center / cover no-repeat;
  color: var(--brand);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-loc { color: var(--muted); font-size: 0.85rem; }
.comment-as { margin: 0; color: var(--muted); font-size: 0.9rem; }
.comment-form p { margin: 0; }
.profile-cover { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: -8px; }
.profile-cover img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }

.comment-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.comment p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-delete {
  margin-left: auto;
  background: none;
  border: none;
  color: #d1394a;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.comment-delete:hover { text-decoration: underline; }

/* Footer */
.site-footer {
  background: var(--surface);
  color: var(--ink);
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

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

.footer-inner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-links a {
  color: var(--ink);
  text-decoration: none;
  margin-left: 20px;
  font-weight: 500;
  font-size: 0.88rem;
}

.footer-links a:hover {
  color: var(--brand);
}

@media (max-width: 760px) {
  .hero { padding: 60px 0 70px; }
  .hero h1 { font-size: 2.2rem; }
  .hero-sub { font-size: 1.02rem; }
  .hero-blob { width: 380px; height: 380px; right: -100px; top: -80px; }
  .contact-inner { grid-template-columns: 1fr; }
  .about-card { padding: 32px; }
  .main-nav a { margin-left: 16px; }
  .section-head h2 { font-size: 1.7rem; }
  .contact-copy h2 { font-size: 1.6rem; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .header-inner { padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
  .logo-img { height: 44px; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    order: 3;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
  }
  .site-nav.is-open { display: flex; }
  .main-nav { display: flex; flex-direction: column; width: 100%; gap: 14px; order: 2; }
  .main-nav a { margin-left: 0; font-size: 1rem; padding-bottom: 0; }
  .nav-dropdown { margin-left: 0; flex-direction: column; align-items: stretch; }
  .nav-dropdown summary { font-size: 1rem; }
  .nav-dropdown-menu { display: flex; margin-top: 10px; box-shadow: none; border: none; background: var(--surface-alt); }
  .nav-dropdown[open] .nav-dropdown-menu { display: flex; }
  .header-auth { width: 100%; flex-direction: column; align-items: flex-start; gap: 10px; order: 1; margin-bottom: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
  .header-logout-btn { order: 2; }
  .hero { padding: 46px 0 56px; }
  .hero h1 { font-size: 1.85rem; }
  .hero-kicker { font-size: 0.68rem; }
  .hero-blob { width: 260px; height: 260px; right: -70px; top: -50px; opacity: 0.8; }
  .btn { padding: 13px 24px; font-size: 0.98rem; width: 100%; text-align: center; margin-top: 26px; }
  .posts-section { padding: 50px 0 20px; }
  .posts-grid { grid-template-columns: 1fr; gap: 20px; }
  .about-card { padding: 26px; border-radius: 18px; }
  .about-card h2 { font-size: 1.45rem; }
  .contact-form { padding: 24px; }
  .contact-section { padding: 10px 0 60px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .footer-links { display: flex; gap: 4px 0; }
  .footer-links a { margin-left: 0; margin-right: 20px; }
}
