@font-face {
  font-family: "D2Coding";
  src: url("fonts/D2Coding-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "D2Coding";
  src: url("fonts/D2Coding-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --paper: #0b0d17;
  --paper-deep: #111421;
  --panel: #171a2a;
  --panel-raised: #1d2134;
  --ink: #eff1fa;
  --muted: #9298b2;
  --line: #303650;
  --accent: #a277ff;
  --accent-soft: #2b2350;
  --moss: #61ffca;
  --blue: #82aaff;
  --danger: #ff6767;
  --sans: "D2Coding", monospace;
  --serif: "D2Coding", monospace;
  --header-height: 4.5rem;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html body,
html body *,
html body *::before,
html body *::after {
  font-family: "D2Coding", monospace;
  line-height: 1.1;
  letter-spacing: 0;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

a { color: inherit; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: -4rem;
  left: 1rem;
  padding: .7rem 1rem;
  color: var(--paper);
  background: var(--moss);
}

.skip-link:focus { top: 1rem; }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 clamp(1.25rem, 4vw, 4rem);
  background: #fff;
}

.wordmark {
  color: #0b0d17;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.home-shell { min-height: calc(100vh - var(--header-height)); }

.hero {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 800px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

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

.hero-image {
  display: block;
  object-fit: fill;
}

.hero-content {
  width: min(100% - 2rem, 58rem);
  display: grid;
  justify-items: center;
  text-align: center;
}

.hero h1 {
  margin: 0 0 2rem;
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  font-weight: 700;
  letter-spacing: .16em;
  text-shadow: 0 .2rem 1.5rem rgba(0, 0, 0, .55);
}

.hero-search {
  width: min(100%, 46rem);
  height: 3.65rem;
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  align-items: center;
  gap: .8rem;
  padding: 0 1.35rem;
  border-radius: 999px;
  background: #fff;
}

.hero-search svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: #272b3d;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.hero-search input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: #151827;
  background: transparent;
  font-size: .96rem;
}

.hero-search input::placeholder { color: #777d91; opacity: 1; }
.hero-search input::-webkit-search-cancel-button { filter: invert(1); }

.related-links {
  width: min(100%, 46rem);
  min-height: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: .55rem;
  margin-top: 1.25rem;
  color: rgba(255, 255, 255, .72);
  font-size: .78rem;
  text-align: left;
}

.related-links a { text-decoration: none; }
.related-links a:hover { color: #fff; }
.related-links span { color: rgba(255, 255, 255, .5); }

.featured {
  width: min(100% - 3rem, 84rem);
  margin: 0 auto;
  padding: 100px 0 140px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 40px;
  row-gap: 100px;
}

.feature-card {
  height: 700px;
  display: grid;
  grid-template-rows: 400px minmax(0, 1fr);
  overflow: hidden;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
}

.feature-card:hover,
.feature-card:focus-visible {
  outline: 0;
}

.feature-card figure { height: 400px; margin: 0; overflow: hidden; }

.feature-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.feature-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 0 0;
}

.feature-card h3 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.4rem, 3vw, 2.25rem);
  font-weight: 700;
}

.feature-card time {
  margin-top: 14px;
  color: var(--muted);
  font-size: .76rem;
}

.search-empty { margin: 3rem 0; color: var(--muted); text-align: center; }

.reader-shell {
  width: min(100%, 100rem);
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  margin: 0 auto;
}

.reader-sidebar {
  min-height: calc(100vh - var(--header-height));
  padding: 3.5rem 0 4rem clamp(1rem, 3vw, 3rem);
  border-right: 1px solid var(--line);
  background: rgba(17, 20, 33, .54);
}

.wiki-nav { position: sticky; top: 8rem; }
.post-index, .toc-list { margin: 0; padding: 0; list-style: none; }
.post-index-item { position: relative; border-top: 1px solid var(--line); }
.post-index-item:last-child { border-bottom: 1px solid var(--line); }

.post-index-item > a {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: .5rem;
  padding: .9rem 1rem .9rem 0;
  color: var(--muted);
  text-decoration: none;
}

.post-index-item > a span { color: var(--accent); font-size: .72rem; }
.post-index-item > a strong { font-size: .82rem; font-weight: 700; }

.post-index-item.is-active {
  margin-right: -1.25rem;
  padding-right: 1.25rem;
  border: 1px solid var(--accent);
  border-right-color: var(--panel);
  border-radius: .7rem 0 0 .7rem;
  background: var(--panel);
  box-shadow: -.35rem .35rem 0 rgba(162, 119, 255, .16);
}

.post-index-item.is-active > a { padding-left: .9rem; color: var(--ink); }
.dev-badge, .scope-badge { padding: .18rem .4rem; color: var(--moss); background: #183b39; font-size: .56rem; font-weight: 700; }
.dev-badge, .scope-badge.is-dev { color: #d6c5ff; background: var(--accent-soft); }

.toc-list { padding: .25rem 1rem 1.1rem 3.4rem; }
.toc-list li { margin: .35rem 0; }
.toc-list a { display: block; color: var(--muted); font-size: .7rem; text-decoration: none; }
.toc-list a:hover, .toc-list a.is-reading { color: var(--moss); }
.toc-level-2 { padding-left: .7rem; }
.toc-level-3 { padding-left: 1.4rem; }
.toc-level-4 { padding-left: 2.1rem; }
.toc-level-5 { padding-left: 2.8rem; }
.toc-level-6 { padding-left: 3.5rem; }
.toc-empty { margin: 0; padding: 0 1rem 1rem 3.4rem; color: var(--muted); font-size: .7rem; }

.article-column { min-width: 0; padding: 5rem clamp(1.25rem, 7vw, 8rem) 7rem; }
.article { max-width: 49rem; margin: 0 auto; }
.article-header { padding-bottom: 3rem; border-bottom: 1px solid var(--line); }
.article-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.article-date { color: var(--muted); font-size: .72rem; }
.article-actions { display: flex; align-items: center; gap: .55rem; font-size: .72rem; font-weight: 700; }
.article-actions a { color: var(--ink); text-decoration: none; }
.article-actions button {
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--danger);
  background: transparent;
  font: inherit;
}
.article-actions button:hover { color: #ff9b9b; background: transparent; }
.article-header h1 { margin: 1rem 0; color: #fff; font-size: clamp(1.3rem, 3vw, 2.8rem); }
.article-header p { max-width: 38rem; margin: 0; color: var(--muted); font-size: 1rem; }

.article-body { padding: 3rem 0; color: #dfe3f2; font-size: 1.02rem; }
.article-body h1, .article-body h2, .article-body h3, .article-body h4, .article-body h5, .article-body h6 { scroll-margin-top: 7rem; color: #fff; }
.article-body h1 { margin: 3.5rem 0 1.2rem; font-size: 2.25rem; }
.article-body h2 { margin: 3rem 0 1rem; font-size: 1.7rem; }
.article-body h3 { margin: 2.5rem 0 .8rem; font-size: 1.3rem; }
.article-body h4 { margin: 2.2rem 0 .7rem; font-size: 1.12rem; }
.article-body h5 { margin: 2rem 0 .6rem; font-size: 1rem; }
.article-body h6 { margin: 1.8rem 0 .55rem; color: var(--muted); font-size: .9rem; }
.article-body p { margin: 0 0 1.35rem; }
.article-body a { color: var(--moss); text-underline-offset: .2rem; }
.article-body del { color: #71778d; text-decoration-color: #71778d; }
.article-body blockquote { margin: 2rem 0; padding: .7rem 0 .7rem 1.5rem; border-left: .25rem solid var(--accent); color: var(--muted); }
.article-body pre { overflow-x: auto; padding: 1.3rem; border: 1px solid var(--line); border-radius: .65rem; color: #f2edff; background: #080a12; }
.article-body code { padding: .1rem .3rem; color: #d9c6ff; background: var(--accent-soft); }
.article-body pre code { padding: 0; background: transparent; }
.article-divider { height: 1px; margin: 3rem 0; border: 0; background: var(--line); }
.post-form label { display: grid; gap: .45rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.manager-empty { color: var(--muted); }

.markdown-image {
  width: min(100%, var(--image-width, 640px));
  margin: 2rem auto;
}
.markdown-image-frame { position: relative; border: 1px solid transparent; }
.markdown-image img { width: 100%; height: auto; display: block; }
.image-flow { display: flow-root; margin: 2rem 0; }
.image-flow .markdown-image { max-width: 55%; margin-top: 0; }
.markdown-image.is-float-left { float: left; margin-right: 1.5rem; margin-left: 0; }
.markdown-image.is-float-right { float: right; margin-right: 0; margin-left: 1.5rem; }
.image-flow > p { margin: 0 0 1.35rem; }
.editor-preview .markdown-image-frame { border-color: var(--line); }
.image-resize-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 15px;
  height: 15px;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  cursor: nwse-resize;
}
.image-resize-handle:hover { background: var(--accent); }

input, textarea, select {
  width: 100%;
  padding: .78rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  outline: none;
  color: var(--ink);
  background: #0e111c;
  font: inherit;
}

input:focus, textarea:focus, select:focus { border-color: var(--line); box-shadow: none; }
textarea { resize: vertical; }

button, .button-link {
  justify-self: start;
  padding: .75rem 1rem;
  border: 1px solid var(--accent);
  border-radius: .5rem;
  color: #fff;
  background: var(--accent-soft);
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

button:hover, .button-link:hover { color: #0b0d17; background: var(--moss); border-color: var(--moss); }

.access-page {
  min-height: calc(100vh - var(--header-height));
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 20% 80%, rgba(23, 79, 140, .26), transparent 46%),
    radial-gradient(circle at 85% 20%, rgba(77, 48, 130, .2), transparent 40%),
    var(--paper);
}

.access-card { width: min(100%, 36rem); }
.access-card h1 { margin: 0 0 1.35rem; color: #fff; font-size: clamp(2.2rem, 6vw, 4rem); text-align: center; }
.access-card input { min-height: 3.4rem; border-radius: .85rem; font-size: 1.1rem; text-align: center; }
.access-status { min-height: 1.2em; margin: 1rem 0 0; color: var(--muted); font-size: .8rem; text-align: center; }

.message-page { min-height: 65vh; display: grid; place-content: center; padding: 3rem 1rem; text-align: center; }
.message-page h1 { max-width: 42rem; margin: 0 0 2rem; color: #fff; font-size: clamp(2.5rem, 6vw, 5rem); }
.text-link { color: var(--moss); font-weight: 700; text-underline-offset: .25rem; }

.manager-shell { width: min(100% - 2rem, 90rem); min-height: 70vh; margin: 0 auto; padding: 4rem 0 7rem; }
.manager-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.manager-heading h1 { margin: 0; color: #fff; font-size: clamp(3rem, 7vw, 6rem); }
.manager-nav { display: flex; gap: 1.5rem; margin-top: 3rem; padding: 1rem 0; border-block: 1px solid var(--line); }
.manager-nav a { color: var(--blue); font-size: .72rem; font-weight: 700; text-underline-offset: .3rem; }

.notice { margin-top: 1.5rem; padding: .9rem 1rem; border-left: .25rem solid var(--moss); color: #caffed; background: #15302e; }
.notice.is-error { border-left-color: var(--danger); color: #ffd3d3; background: #351b25; }

.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-top: 3rem; border: 1px solid var(--line); border-radius: .8rem; overflow: hidden; background: var(--line); }
.metric-grid article { padding: 1.5rem; background: var(--panel); }
.metric-grid span { color: var(--accent); font-size: 3rem; }
.metric-grid p { margin: .5rem 0 0; color: var(--muted); font-size: .75rem; }

.manager-section { margin-top: 4rem; }
.manager-section.compact { padding-top: 2rem; border-top: 1px solid var(--line); }
.manager-section-title { display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.manager-section-title h2, .publish-panel h2 { margin: 0; color: #fff; font-size: clamp(2rem, 4vw, 3.5rem); }
.section-note { color: var(--muted); font-size: .82rem; }
.table-wrap { overflow-x: auto; margin-top: 1.5rem; }
.manager-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.manager-table th { padding: .75rem; border-block: 1px solid var(--line); color: var(--muted); font-size: .66rem; text-align: left; }
.manager-table td { padding: 1rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.manager-table td > a:first-child { display: grid; text-decoration: none; }
.manager-table td small, .readonly-label { color: var(--muted); }
.row-action { color: var(--moss); font-weight: 700; text-underline-offset: .25rem; }

.publish-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; align-items: end; margin-top: 5rem; padding: clamp(1.5rem, 4vw, 3rem); border: 1px solid var(--accent); border-radius: 1rem; background: linear-gradient(135deg, var(--panel), #17112a); }
.publish-panel p:not(.eyebrow), .publish-panel small { color: var(--muted); }
.publish-panel form { display: grid; gap: .5rem; justify-items: end; }
.publish-panel small { max-width: 16rem; text-align: right; }
.publish-button:disabled { opacity: .45; cursor: not-allowed; }
.event-list { padding: 0; list-style: none; }
.event-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 2rem; padding: .7rem 0; border-top: 1px solid var(--line); font-size: .75rem; }

.editor-panel { margin-top: 3rem; }
.scope-callout { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--panel); }
.scope-callout strong { color: var(--accent); font-size: .72rem; }
.scope-callout span { color: var(--muted); font-size: .76rem; }
.post-form { display: grid; gap: 1.1rem; margin-top: 2rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check-label { display: flex !important; align-items: center; align-self: end; min-height: 3rem; }
.check-label input { width: auto; }
.editor-workspace {
  min-height: 70vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  background: #0e111c;
}
.editor-column,
.preview-column { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.editor-column { border-right: 1px solid var(--line); }
.editor-column-title { padding: .75rem 1rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .7rem; font-weight: 700; }
.markdown-editor {
  min-height: 70vh;
  padding: 1.35rem;
  border: 0;
  border-radius: 0;
  resize: none;
  color: #e8ebf6;
  background: #0a0c14;
  font-size: .9rem;
  line-height: 1.45 !important;
  tab-size: 4;
}
.editor-preview { min-height: 70vh; max-height: 78vh; overflow: auto; padding: 1.35rem; }
.editor-status { min-height: 1em; margin: 0; color: var(--muted); font-size: .7rem; }
.editor-status.is-error { color: var(--danger); }
.danger-form { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.button-secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button-danger { color: #ffb8b8; background: #361822; border-color: var(--danger); }
.button-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

.has-open-modal { overflow: hidden; }
.delete-modal { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 1.5rem; }
.delete-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(5, 6, 11, .66);
  backdrop-filter: blur(12px);
  cursor: default;
}
.delete-modal-backdrop:hover { background: rgba(5, 6, 11, .66); }
.delete-dialog { position: relative; width: min(100%, 30rem); padding: 2.2rem; border: 1px solid var(--line); border-radius: .9rem; outline: 0; background: var(--panel); box-shadow: 0 2rem 6rem rgba(0, 0, 0, .45); }
.delete-dialog h2 { margin: 0; color: #fff; font-size: 1.35rem; }
.delete-dialog-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 2rem; }
.delete-dialog-actions form { margin: 0; }

.moderation-list { margin: 1.5rem 0 0; padding: 0; list-style: none; }
.moderation-item { padding: 1.5rem 0; border-top: 1px solid var(--line); }
.moderation-meta { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; color: var(--muted); font-size: .7rem; }
.moderation-meta strong { color: var(--ink); }
.moderation-item > p { max-width: 55rem; }
.moderation-actions { display: flex; gap: .5rem; }
.moderation-actions form { margin: 0; }

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

@media (max-width: 1100px) {
  .featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .site-header { padding-inline: 1.1rem; }
  .hero { height: 620px; }
  .hero h1 { margin-bottom: 1.5rem; }
  .related-links { padding-inline: .5rem; }
  .featured { width: min(100% - 2rem, 40rem); }
  .featured-grid { grid-template-columns: 1fr; }
  .reader-shell { display: block; }
  .reader-sidebar { min-height: 0; padding: 1.5rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .wiki-nav { position: static; }
  .post-index { display: flex; overflow-x: auto; padding: .3rem; gap: .55rem; }
  .post-index-item, .post-index-item:last-child { min-width: 13rem; border: 1px solid var(--line); }
  .post-index-item.is-active { margin: 0; padding: 0; border-right-color: var(--accent); border-radius: .6rem; }
  .toc-list, .toc-empty { display: none; }
  .article-column { padding: 3rem 1.25rem 5rem; }
  .section-heading, .manager-heading, .manager-section-title { align-items: flex-start; flex-direction: column; }
  .manager-shell { padding-top: 2.5rem; }
  .manager-heading form { align-self: flex-end; }
  .metric-grid { grid-template-columns: 1fr; }
  .publish-panel { grid-template-columns: 1fr; }
  .publish-panel form { justify-items: start; }
  .publish-panel small { text-align: left; }
  .form-row { grid-template-columns: 1fr; }
  .editor-workspace { grid-template-columns: 1fr; }
  .editor-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .markdown-editor, .editor-preview { min-height: 55vh; }
  .image-flow .markdown-image { max-width: 100%; }
  .markdown-image.is-float-left,
  .markdown-image.is-float-right { float: none; margin: 1.5rem auto; }
  .event-list li { grid-template-columns: 1fr auto; }
  .event-list time { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
