:root {
  /* color */
  --bg:        #ffffff;
  --ink:       #101113;
  --prose:     #2c2e31;
  --muted:     #5b5b5b;
  --faint:     #9a9a9a;
  --hairline:  #e3e3e3;
  --field:     #cfcfcf;
  --panel:     #f7f7f5;
  --hover:     #fafafa;
  --btn-hover: #2a2c30;

  /* type */
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
          "Liberation Mono", monospace;

  /* layout widths */
  --w-wide:   1080px;
  --w-nav:     960px;
  --w-index:   1160px;
  --w-detail:  780px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main.container { flex: 1; }

/* ─── Animated underline ─── */
.u-link { position: relative; text-decoration: none; color: inherit; cursor: pointer; }
.u-link::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  height: 1px; width: 0%; background: currentColor; transition: width .28s ease;
}
.u-link:hover::after, .u-link.active::after { width: 100%; }

/* ─── Navbar ─── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--ink);
  padding: 0;
}
.navbar-inner {
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 26px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  column-gap: 24px;
}
.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: 0 0 auto;
}
.logo a {
  color: var(--ink);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
}
.logo__tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--faint);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-right a {
  color: var(--faint);
  text-decoration: none;
  position: relative;
}
.nav-right a.active { color: var(--ink); }
.nav-right a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 1px;
  width: 0%;
  background: currentColor;
  transition: width .28s ease;
}
.nav-right a:hover::after,
.nav-right a.active::after { width: 100%; }

.language-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #c4c4c4;
}
.language-switcher a { color: #c4c4c4; }
.language-switcher a.active { color: var(--ink); }
.language-switcher span { color: #c4c4c4; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-direction: column;
  border: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.container {
  padding: 0;
}

/* ─── Home hero ─── */
.home-page .navbar {
  position: absolute;
  inset: 0 0 auto 0;
  background: transparent;
  border-bottom: none;
}
.home-page .nav-right a,
.home-page .logo a { color: #fff; }
.home-page .nav-right a { color: rgba(255,255,255,.92); }
.home-page .logo__tag { color: rgba(255,255,255,.72); }
.home-page .nav-right a::after { background: rgba(255,255,255,0.9); }
.home-page .language-switcher,
.home-page .language-switcher a,
.home-page .language-switcher span { color: rgba(255,255,255,.72); }
.home-page .language-switcher a.active { color: #fff; }
.home-page .nav-toggle { border-color: rgba(255,255,255,.45); color: #fff; }
.home-page main.container { max-width: none; padding: 0; }

.home-hero {
  position: relative;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
  background: url('/static/images/mountain_in_the_morning.jpg') center / cover no-repeat;
}
.home-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(8,12,20,.28), rgba(8,12,20,.52));
}
.home-hero__coords {
  position: absolute;
  top: 84px;
  left: 0;
  right: 0;
  z-index: 2;
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.78);
}
.home-hero__content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 64px;
  z-index: 2;
  max-width: var(--w-wide);
  margin: 0 auto;
  padding: 0 32px;
}
.home-hero__eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.72);
  margin-bottom: 16px;
}
.home-hero .intro {
  margin: 0;
  color: #fff;
  font-size: 52px;
  line-height: 1.22;
  font-weight: 500;
  letter-spacing: -.02em;
  max-width: 760px;
}
.home-hero__caption {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255,255,255,.85);
  background: none;
  padding: 0;
}

/* ─── Index pages ─── */
.content-index {
  max-width: var(--w-index);
  margin: 0 auto;
  padding: 56px 24px 80px;
}
.content-index__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 14px;
  margin: 0;
}
.content-index h1 {
  margin: 0;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -.015em;
}
.content-index__count {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--faint);
}

.entry-list { display: block; }
.entry {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 18px;
  padding: 30px 6px;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  color: var(--ink);
  transition: background .18s ease;
}
.entry:hover { background: var(--hover); }
.entry__num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  padding-top: 5px;
}
.entry__title {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.01em;
}
.entry__summary {
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 60ch;
}
.entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--faint);
}
.entry__status { color: var(--ink); }

.tag-list {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag {
  border: 1px solid var(--hairline);
  padding: 4px 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--faint);
}

.empty-state {
  padding: 40px 0;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
}

/* ─── Detail pages ─── */
.content-detail {
  max-width: var(--w-detail);
  margin: 0 auto;
  padding: 44px 24px 90px;
}
.content-back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--faint);
  margin-bottom: 30px;
  text-decoration: none;
  position: relative;
}
.content-back::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 1px;
  width: 0%;
  background: currentColor;
  transition: width .28s ease;
}
.content-back:hover::after { width: 100%; }

.content-detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
}
.content-detail__meta a {
  color: var(--faint);
  text-decoration: none;
  position: relative;
}
.content-detail__meta a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 1px;
  width: 0%;
  background: currentColor;
  transition: width .28s ease;
}
.content-detail__meta a:hover::after { width: 100%; }
.content-detail__status { color: var(--ink); }

.content-detail h1 {
  margin: 0 0 18px;
  font-size: 46px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.025em;
}
.content-detail__summary {
  margin: 0 0 22px;
  font-size: 21px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 60ch;
}
.content-detail .tag-list { margin-bottom: 34px; }
.content-detail .tag-list .tag { padding: 5px 10px; }

.content-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 34px;
}

.content-detail__figure {
  border: 1px solid var(--hairline);
  background: var(--panel);
  margin: 0 0 40px;
}
.content-detail__figure img {
  width: 100%;
  height: auto;
  display: block;
}

/* Prose */
.markdown-content {
  max-width: 68ch;
  margin: 0;
  font-size: 19px;
  line-height: 1.75;
  color: var(--prose);
}
.markdown-content p  { margin: 0 0 26px; }
.markdown-content ul { margin: 0 0 26px; padding-left: 20px; }
.markdown-content li { margin-bottom: 9px; }

/* Section markers via CSS counter */
.markdown-content { counter-reset: sec; }
.markdown-content h2,
.markdown-content h3 {
  counter-increment: sec;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 40px 0 18px;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--faint);
}
.markdown-content h2::before { content: counter(sec, decimal-leading-zero) " — "; }
.markdown-content h2::after,
.markdown-content h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

.markdown-content pre {
  margin: 0 0 24px;
  padding: 18px 20px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  color: var(--prose);
}
.markdown-content code { font-family: var(--mono); font-size: .9em; }
.markdown-content a { color: var(--ink); text-underline-offset: 3px; }
.markdown-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 28px auto;
  border: 1px solid var(--hairline);
  background: var(--panel);
}
.markdown-content figure { margin: 32px 0; }
.markdown-content figure img { margin: 0 auto; }
.markdown-content figcaption {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--faint);
}
.markdown-content h1 {
  margin: 40px 0 18px;
  font-size: 32px;
  line-height: 1.2;
  color: var(--ink);
}

/* ─── Contact ─── */
.contact { max-width: 840px; margin: 0 auto; padding: 56px 24px 90px; }
.contact__header {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 24px;
  margin-bottom: 40px;
}
.contact__title { margin: 0 0 12px; font-size: 38px; font-weight: 700; letter-spacing: -.015em; }
.contact__subtitle { margin: 0; font-size: 18px; line-height: 1.6; color: var(--muted); max-width: 54ch; }

.contact__grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  align-items: start;
}

.form-row { display: block; margin-bottom: 20px; }
.form-row label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 400;
  margin-bottom: 8px;
}
.form-row input,
.form-row textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--field);
  border-radius: 0;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
}
.form-row textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.form-row input:focus,
.form-row textarea:focus { outline: none; border-color: var(--ink); box-shadow: none; }

.form-actions { margin-top: 4px; }
.btn {
  appearance: none;
  border: none;
  background: var(--ink);
  color: #fff;
  padding: 13px 22px;
  border-radius: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: background .18s ease;
}
.btn:hover { background: var(--btn-hover); filter: none; }
.btn:active { transform: translateY(1px); }
a.btn { display: inline-block; text-decoration: none; }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.btn--ghost:hover { background: var(--hover); }

.alert {
  padding: 14px 16px;
  border-radius: 0;
  margin-bottom: 24px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .5px;
}
.alert--success { background: #fff; color: var(--ink); border: 1px solid var(--ink); }
.alert--error   { background: #fff; color: #991b1b; border: 1px solid #991b1b; }

.contact__socials {
  border-left: 1px solid var(--hairline);
  padding-left: 24px;
  text-align: left;
}
.contact__socials::before {
  content: "Elsewhere";
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 18px;
}
.contact__socials ul { list-style: none; margin: 0; padding: 0; display: block; }
.contact__socials li { border-top: 1px solid var(--hairline); }
.contact__socials li:last-child { border-bottom: 1px solid var(--hairline); }
.contact__socials a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  transition: background .18s ease;
}
.contact__socials a:hover { background: var(--hover); }
.contact__socials svg { display: none; }
.social__label { color: var(--faint); }
.social__arrow { color: var(--ink); }

/* ─── Footer ─── */
.site-footer { border-top: 1px solid var(--ink); margin-top: 40px; }
.site-footer__inner {
  max-width: var(--w-nav);
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--faint);
}

/* ─── About ─── */
.about-page { max-width: var(--w-detail); margin: 0 auto; padding: 64px 24px 80px; }
.about-page__header { text-align: left; margin: 0 0 40px; }
.about-page__title {
  margin: 0;
  font-size: 36px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: -.015em;
  max-width: 24ch;
}
.about-page__content {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 28px;
  border-top: 1px solid var(--ink);
  padding-top: 28px;
}
.about-page__label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 2px;
}
.about-page__body {
  font-size: 18px;
  line-height: 1.75;
  color: var(--prose);
}
.about-page__body p { margin: 0 0 18px; max-width: 64ch; }
.about-page__body p:last-child { margin-bottom: 0; }

/* ─── Error pages ─── */
.error-page {
  min-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  row-gap: 8px;
  letter-spacing: 0.5px;
  padding: 0 20px;
}
.error-page h1 {
  margin: 0 0 6px;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.error-page p { margin: 0 0 8px; }
.error-page a {
  color: var(--ink);
  text-decoration: none;
  position: relative;
  padding: 6px;
}
.error-page a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 0%;
  height: 1px;
  background: var(--ink);
  transition: width 0.28s ease;
}
.error-page a:hover::after,
.error-page a:focus-visible::after { width: 100%; }

/* ─── Responsive ─── */
@media (max-width: 700px) {
  /* Navbar */
  .navbar { padding: 0; }
  .navbar-inner {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
  }
  .nav-toggle { display: inline-flex; }
  .navbar .nav-right {
    display: none;
    flex: 0 0 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    padding-top: 8px;
    gap: 0;
  }
  .navbar.is-open .nav-right { display: flex; }
  .navbar li { width: 100%; }
  .nav-right a { display: block; padding: 11px 0; }
  .language-switcher { gap: 6px; padding: 8px 0; }
  .language-switcher a { display: inline-block; padding: 3px 0; }
  .logo { flex: 1 1 0; }

  /* Home */
  .home-hero .intro { font-size: 32px; }
  .home-hero__coords,
  .home-hero__content { padding: 0 20px; }

  /* Index */
  .content-index { padding: 32px 20px 60px; }
  .entry { grid-template-columns: 28px 1fr; gap: 12px; padding: 24px 2px; }
  .entry__title { font-size: 22px; }

  /* Detail */
  .content-detail { padding: 28px 20px 64px; }
  .content-detail h1 { font-size: 34px; }
  .markdown-content { font-size: 17px; }

  /* Contact */
  .contact { padding: 32px 20px 64px; }
  .contact__grid { grid-template-columns: 1fr; gap: 32px; }
  .contact__socials { border-left: none; padding-left: 0; }

  /* About */
  .about-page { padding: 32px 20px 60px; }
  .about-page__content { grid-template-columns: 1fr; gap: 14px; }

  /* Footer */
  .site-footer__inner { flex-direction: column; gap: 8px; text-align: center; }
}

/* ─── Admin ─── */
.admin-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 0;
}

.admin-page--narrow {
  max-width: 520px;
}

.admin-header {
  margin-bottom: 24px;
}

.admin-header--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.admin-header h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.2;
}

.admin-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}

.admin-actions--compact {
  margin: 0;
}

.admin-secondary-button,
.admin-danger-button,
.admin-link-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.admin-danger-button {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.admin-link-button {
  min-height: 0;
  padding: 6px 8px;
  border: none;
  color: var(--muted);
  background: transparent;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.admin-stat,
.admin-panel {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(31,41,55,0.04);
}

.admin-stat {
  display: block;
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
}

.admin-stat span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.admin-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.admin-panel {
  padding: 20px;
  margin-top: 20px;
}

.admin-panel__header {
  margin-bottom: 14px;
}

.admin-panel__header--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.admin-panel__header h2 {
  margin: 0;
  font-size: 20px;
}

.admin-latest,
.admin-media-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-latest li,
.admin-media-list li {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--hairline);
}

.admin-latest li:first-child,
.admin-media-list li:first-child {
  border-top: none;
}

.admin-latest span,
.admin-latest time,
.admin-media-list span,
.admin-muted,
.admin-help {
  color: var(--muted);
  font-size: 13px;
}

.admin-flashes {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-flash {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}

.admin-flash--success {
  border-color: #a7f3d0;
  color: #065f46;
  background: #ecfdf5;
}

.admin-flash--error {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.admin-form {
  display: grid;
  gap: 16px;
}

.admin-search {
  display: flex;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.admin-search--stacked {
  display: grid;
  align-items: stretch;
  margin-bottom: 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.admin-field label,
.admin-panel label {
  font-weight: 600;
}

.admin-field input,
.admin-field select,
.admin-field textarea,
.admin-panel input,
.admin-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

.admin-field textarea {
  min-height: 420px;
  field-sizing: content;
  resize: vertical;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 14px;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  border-top: 1px solid var(--hairline);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  border-top: none;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-table code,
.admin-panel code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-row-actions a,
.admin-media-list a {
  color: var(--ink);
  text-underline-offset: 3px;
}

/* ─── Editor ─── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.admin-editor-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
}

.admin-editor-bar__place,
.admin-editor-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.admin-editor-bar__place .content-back { margin: 0; }
.admin-editor-bar__place h1 { margin: 0; font-size: 18px; }
.admin-editor-bar__place code { color: var(--muted); font-size: 13px; }

.admin-status {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.admin-status--draft { color: #92400e; background: #fef3c7; }
.admin-status--published { color: #065f46; background: #d1fae5; }

.admin-backup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
}

.admin-backup p { margin: 0; }

.admin-backup[hidden],
[data-save-state][hidden] {
  display: none;
}

/* One column: title and text, details, images, preview. */
.admin-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main" "details" "picker" "preview";
  gap: 20px;
  align-items: start;
}

/* Its children are placed by the layout. The picker has to stay outside the
   form, or pressing Enter in its filter would save. */
.admin-editor { display: contents; }

.admin-editor-main { grid-area: main; min-width: 0; }
.admin-editor-details { grid-area: details; }
.admin-media-picker { grid-area: picker; }
.admin-preview { grid-area: preview; }

.admin-editor-layout .admin-panel { margin-top: 0; }

.admin-field.admin-editor-title input {
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  font-size: 30px;
  font-weight: 700;
}

.admin-field textarea.is-drop-target {
  outline: 2px dashed var(--ink);
  outline-offset: 2px;
}

.admin-url-hint {
  margin: -8px 0 0;
  overflow-wrap: anywhere;
}

.admin-editor-details summary {
  cursor: pointer;
  font-weight: 700;
}

.admin-editor-details[open] summary { margin-bottom: 14px; }

/* Their display rules would otherwise win over the hidden attribute. */
.admin-preview[hidden],
[data-preview-button][hidden],
[data-preview-toggle][hidden] {
  display: none;
}

/* The mode classes are set by the script, so without JavaScript a requested
   preview always shows. */
.admin-page--editor.editor-mode--write .admin-preview { display: none; }

[data-preview-toggle][aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

@media (min-width: 1100px) {
  .admin-page--editor { max-width: 1500px; }

  .admin-editor-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas: "main details" "main picker" "preview preview";
    /* So the sidebar's panels stay together at the top. */
    grid-template-rows: auto 1fr auto;
  }

  .admin-editor-main { max-width: 860px; width: 100%; justify-self: center; }

  .admin-page--editor.editor-mode--split .admin-editor-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "main preview" "details preview" "picker preview";
    grid-template-rows: auto auto 1fr;
  }

  .admin-page--editor.editor-mode--split .admin-preview {
    position: sticky;
    /* Below the sticky bar. */
    top: 80px;
    max-height: calc(100vh - 96px);
    overflow: auto;
  }
}

.admin-media-picker summary {
  cursor: pointer;
  font-weight: 700;
}

.admin-media-picker .admin-picker-filter {
  margin-bottom: 12px;
}

/* These set their own `display`, which would override `hidden`. */
.admin-picker-item[hidden],
.admin-picker-filter[hidden],
[data-media-insert][hidden],
[data-media-copy][hidden] {
  display: none;
}

.admin-uploaded-media {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 24px;
}

.admin-uploaded-media > div {
  display: grid;
  gap: 12px;
}

.admin-uploaded-media img,
.admin-media-thumb,
.admin-picker-item img {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: #f9fafb;
}

.admin-uploaded-media img {
  width: 100%;
  max-width: 160px;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  grid-row: span 2;
}

.admin-media-groups {
  display: grid;
  gap: 22px;
}

.admin-media-group h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.admin-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}

.admin-media-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
}

.admin-media-thumb {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 160px;
}

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

.admin-media-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-media-meta a,
.admin-picker-item input,
.admin-media-card input {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-media-meta strong,
.admin-picker-item__body strong,
.admin-picker-item__body span {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-media-meta a {
  color: var(--ink);
  font-size: 13px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.admin-media-action {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.admin-media-action__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-picker-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.admin-picker-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.admin-picker-item:first-child {
  padding-top: 0;
  border-top: none;
}

.admin-picker-item img {
  display: block;
  max-width: 100%;
  width: 72px;
  height: 72px;
  object-fit: cover;
}

.admin-picker-item__body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.admin-picker-item__body span {
  color: var(--muted);
  font-size: 12px;
}

.admin-empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 700px) {
  .admin-page { padding-top: 20px; }

  .admin-header--split,
  .admin-grid,
  .admin-stats { grid-template-columns: 1fr; }

  .admin-header--split,
  .admin-panel__header--split,
  .admin-search { display: grid; }

  .admin-uploaded-media { grid-template-columns: 1fr; }
  .admin-uploaded-media img { max-width: 100%; grid-row: auto; }
  .admin-media-thumb { height: 130px; }

  .admin-picker-item { grid-template-columns: 64px minmax(0, 1fr); }
  .admin-picker-item img { width: 64px; height: 64px; }

  .admin-header h1 { font-size: 28px; }

  /* The sticky bar mustn't take much of a small screen. */
  /* The bar stays on screen, so it keeps to two rows. */
  .admin-editor-bar { gap: 6px; padding: 8px 0; }
  .admin-editor-bar__place code,
  .admin-editor-bar [data-text-stats] { display: none; }
  .admin-editor-bar__actions { gap: 4px; }
  .admin-editor-bar__actions > * { padding-inline: 8px; }

  .admin-editor-bar__place h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}

@media (max-width: 480px) {
  .admin-media-action__row { grid-template-columns: 1fr; }
}
