:root {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --surface-3: #30363d;
  --text: #c9d1d9;
  --text-soft: #8b949e;
  --muted: #7d8590;
  --line: #30363d;
  --green: #58a6ff;
  --green-2: #79c0ff;
  --amber: #d29922;
  --rose: #f85149;
  --sky: #58a6ff;
  --max: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #0d1117;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.topbar {
  align-items: center;
  background: rgba(13, 17, 23, 0.96);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 70px;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand,
.desktop-nav,
.admin-trigger,
.hero-actions,
.section-heading,
.toolbar,
.tag-row,
.console-head,
.console-tabs,
.form-actions,
.resource-meta,
.attachment-list,
.item-meta,
.detail-actions,
.manage-actions {
  align-items: center;
  display: flex;
}

.brand {
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--text);
  color: var(--bg);
  display: flex;
  font-size: 18px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.brand-copy strong,
.brand-copy small {
  display: block;
  letter-spacing: 0;
}

.brand-copy strong {
  font-size: 13px;
}

.brand-copy small,
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.desktop-nav {
  align-self: stretch;
  gap: 26px;
}

.nav-link {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 760;
  height: 100%;
  position: relative;
  text-decoration: none;
}

.nav-link::after {
  background: var(--green);
  bottom: -1px;
  content: "";
  height: 2px;
  left: 0;
  opacity: 0;
  position: absolute;
  right: 0;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  opacity: 1;
}

.admin-trigger {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 12px;
  gap: 7px;
  padding: 8px 11px;
}

.status-dot {
  background: var(--amber);
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.admin-trigger.authorized .status-dot {
  background: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(320px, 0.78fr);
  margin: 0 auto;
  max-width: var(--max);
  min-height: 620px;
  padding: 0 30px;
}

.hero-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 78px 54px 78px 0;
}

.eyebrow {
  color: var(--green);
  margin: 0 0 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(46px, 6vw, 86px);
  letter-spacing: 0;
  line-height: 1.02;
  margin-bottom: 22px;
}

h2 {
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: 0;
  line-height: 1.14;
  margin-bottom: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.35;
  margin-bottom: 8px;
}

.hero-lead {
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.85;
  margin-bottom: 30px;
  max-width: 720px;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  border: 1px solid var(--line);
  display: inline-flex;
  font-size: 13px;
  font-weight: 820;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  text-decoration: none;
}

.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #0d1117;
}

.button.primary:hover {
  background: var(--green-2);
  border-color: var(--green-2);
}

.button.subtle {
  background: var(--surface);
  color: var(--text);
}

.button.ghost {
  background: transparent;
  color: var(--sky);
}

.button.subtle:hover,
.button.ghost:hover {
  border-color: var(--green);
  color: var(--green);
}

.hero-aside {
  align-items: end;
  background:
    linear-gradient(rgba(110, 118, 129, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 118, 129, 0.12) 1px, transparent 1px),
    linear-gradient(145deg, #161b22, #0d1117 65%, #161b22);
  background-size: 34px 34px, 34px 34px, auto;
  display: flex;
  min-height: 420px;
  overflow: hidden;
  padding: 26px;
  position: relative;
}

.hero-aside::before,
.hero-aside::after {
  border: 1px solid rgba(139, 148, 158, 0.32);
  content: "";
  position: absolute;
}

.hero-aside::before {
  height: 190px;
  right: 12%;
  top: 18%;
  transform: rotate(14deg);
  width: 190px;
}

.hero-aside::after {
  height: 112px;
  right: 36%;
  top: 38%;
  transform: rotate(42deg);
  width: 112px;
}

.signal-panel {
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid var(--line);
  padding: 18px;
  position: relative;
  width: 100%;
  z-index: 1;
}

.panel-label {
  color: var(--amber);
  font-size: 10px;
  font-weight: 820;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.stat-line {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
}

.stat-line span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  text-transform: uppercase;
}

.stat-line strong {
  color: var(--green);
  font-family: "Courier New", monospace;
  font-size: 17px;
}

.home-section {
  border-top: 1px solid var(--line);
  margin: 0 auto;
  max-width: var(--max);
  padding: 56px 30px;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 22px;
}

.text-link,
.text-button {
  background: transparent;
  border: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 820;
  text-decoration: none;
}

.profile-band {
  display: grid;
  gap: 46px;
  grid-template-columns: minmax(250px, 0.78fr) minmax(0, 1.22fr);
}

.profile-band p:last-child {
  color: var(--text-soft);
  font-size: 16px;
  line-height: 1.9;
  margin-bottom: 0;
}

.method-grid,
.feature-grid,
.resource-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.method-card,
.feature-card,
.resource-card {
  background: var(--surface);
  border: 1px solid var(--line);
  display: block;
  min-height: 190px;
  padding: 18px;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.method-card {
  background: linear-gradient(180deg, var(--surface) 0%, #0d1117 100%);
}

.method-card:hover,
.feature-card:hover,
.resource-card:hover {
  background: var(--surface-2);
  border-color: #58a6ff;
  transform: translateY(-3px);
}

.method-card span,
.feature-number {
  color: var(--amber);
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.method-card h3,
.feature-card h3,
.resource-card h3 {
  font-size: 18px;
  margin: 30px 0 8px;
}

.method-card p,
.feature-card p,
.resource-card p,
.list-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.archive-view {
  margin: 0 auto;
  max-width: var(--max);
  min-height: calc(100vh - 119px);
  padding: 54px 30px;
}

.page-heading {
  max-width: 850px;
}

.page-heading h1 {
  font-size: clamp(42px, 6vw, 72px);
  margin-bottom: 15px;
}

.page-heading > p:last-child {
  color: var(--text-soft);
  line-height: 1.8;
}

.toolbar {
  gap: 10px;
  margin: 27px 0 15px;
}

.search-box {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex: 1;
  gap: 8px;
  max-width: 610px;
  padding: 0 12px;
}

input,
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--green);
}

.search-box input {
  background: transparent;
  border: 0;
  min-width: 0;
  padding: 12px 0;
  width: 100%;
}

select {
  padding: 12px;
}

.tag-row {
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.tag-button,
.tag {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  padding: 5px 7px;
}

.tag-button.active,
.tag-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.archive-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 15px;
  text-align: left;
}

.list-item.active,
.list-item:hover {
  border-color: var(--green);
}

.list-item p {
  margin-bottom: 11px;
}

.item-meta {
  flex-wrap: wrap;
  gap: 6px;
}

.difficulty {
  color: var(--amber);
  font-size: 11px;
  font-weight: 820;
}

.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  min-height: 460px;
  padding: 25px;
}

@media (min-width: 861px) {
  .view.active.archive-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
    min-height: 0;
    overflow: hidden;
    padding-bottom: 30px;
    padding-top: 30px;
  }

  .view.active.archive-view .archive-layout {
    flex: 1;
    min-height: 0;
  }

  .view.active.archive-view .item-list,
  .view.active.archive-view .detail-panel {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--surface-3) var(--surface);
    scrollbar-width: thin;
  }

  .view.active.archive-view .detail-panel {
    min-height: 0;
  }
}

.empty-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 14px;
  justify-content: center;
  min-height: 210px;
  padding: 18px;
  text-align: center;
}

.detail-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 17px;
}

.detail-head h2 {
  margin: 8px 0;
}

.detail-summary {
  color: var(--text-soft);
  line-height: 1.75;
}

.detail-actions {
  flex-wrap: wrap;
  gap: 9px;
  margin: 15px 0;
}

.small-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  padding: 8px 10px;
  text-decoration: none;
}

.small-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.markdown {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

.markdown h2,
.markdown h3 {
  color: var(--text);
  margin-top: 22px;
}

.markdown h2 {
  font-size: 19px;
}

.markdown h3 {
  font-size: 16px;
}

.markdown ul {
  padding-left: 20px;
}

.markdown code {
  color: var(--green-2);
}

.code-block {
  background: #010409;
  border: 1px solid var(--line);
  margin-top: 17px;
  overflow: auto;
  padding: 15px;
}

.code-block code {
  color: #c9d1d9;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.code-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-top: 23px;
}

.code-head h3 {
  margin: 0;
}

.copy-button {
  background: transparent;
  border: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 820;
}

.attachment-list {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.attachment-link {
  border: 1px solid var(--line);
  color: var(--sky);
  font-size: 12px;
  padding: 7px 9px;
  text-decoration: none;
}

.resource-meta {
  color: var(--muted);
  font-size: 11px;
  gap: 9px;
  margin-top: 14px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-size: 10px;
  font-weight: 820;
  justify-content: space-between;
  padding: 17px 30px;
  text-transform: uppercase;
}

.modal-shell {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 30;
}

.modal-shell.open {
  display: block;
}

.modal-backdrop {
  background: rgba(1, 4, 9, 0.82);
  inset: 0;
  position: absolute;
}

.modal-card {
  background: var(--bg);
  border: 1px solid var(--line);
  left: 50%;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 27px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(580px, calc(100vw - 24px));
}

.modal-card.wide {
  width: min(930px, calc(100vw - 24px));
}

.admin-card {
  width: min(820px, calc(100vw - 24px));
}

.close-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 20px;
  height: 32px;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 32px;
}

.form-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.field {
  display: block;
  margin-bottom: 13px;
}

.field span,
.check-field span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 820;
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  padding: 10px;
  resize: vertical;
  width: 100%;
}

.code-input {
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
}

.check-field {
  align-items: center;
  display: flex;
  gap: 7px;
  padding-top: 23px;
}

.check-field span {
  margin: 0;
}

.console-head {
  justify-content: space-between;
  padding-right: 37px;
}

.console-tabs {
  border-bottom: 1px solid var(--line);
  gap: 17px;
  margin: 15px 0 18px;
}

.console-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  padding: 10px 0;
}

.console-tab.active {
  border-color: var(--green);
  color: var(--text);
}

.console-view {
  display: none;
}

.console-view.active {
  display: block;
}

.form-actions {
  gap: 9px;
}

.attachment-draft {
  color: var(--muted);
  font-size: 12px;
  margin: -5px 0 11px;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manage-row {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  gap: 11px;
  justify-content: space-between;
  padding: 12px;
}

.manage-row h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.manage-row span {
  color: var(--muted);
  font-size: 11px;
}

.manage-actions {
  flex-shrink: 0;
  gap: 5px;
}

.manage-actions button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
  padding: 6px 7px;
}

.manage-actions button:hover {
  border-color: var(--green);
  color: var(--green);
}

.toast {
  background: var(--amber);
  bottom: 20px;
  color: #0d1117;
  font-size: 13px;
  font-weight: 820;
  left: 50%;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 8px);
  transition: 160ms ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 860px) {
  .topbar {
    height: 62px;
    padding: 0 14px;
  }

  .brand-copy small {
    display: none;
  }

  .desktop-nav {
    background: var(--bg);
    border-top: 1px solid var(--line);
    bottom: 0;
    gap: 0;
    height: 56px;
    justify-content: space-around;
    left: 0;
    position: fixed;
    right: 0;
    z-index: 20;
  }

  .nav-link {
    font-size: 11px;
    height: 100%;
    justify-content: center;
    width: 25%;
  }

  .nav-link::after {
    bottom: auto;
    top: -1px;
  }

  .hero {
    display: block;
    min-height: auto;
    padding: 0 18px;
  }

  .hero-main {
    padding: 68px 0 50px;
  }

  h1 {
    font-size: 48px;
  }

  .hero-aside {
    min-height: 320px;
  }

  .home-section,
  .archive-view {
    padding: 40px 18px;
  }

  .method-grid,
  .feature-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .profile-band {
    display: block;
  }

  .profile-band p:last-child {
    margin-top: 15px;
  }

  .archive-layout {
    display: block;
  }

  .detail-panel {
    display: none;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    max-width: none;
  }

  .site-footer {
    margin-bottom: 56px;
    padding: 14px 18px;
  }

  .site-footer span:last-child {
    display: none;
  }
}

@media (max-width: 520px) {
  .brand-copy strong {
    font-size: 11px;
  }

  .admin-trigger {
    padding: 7px 8px;
  }

  h1 {
    font-size: 42px;
  }

  .hero-lead {
    font-size: 15px;
  }

  .section-heading {
    align-items: flex-end;
  }

  .form-grid {
    display: block;
  }

  .modal-card {
    padding: 22px 16px;
  }

  .manage-row {
    align-items: flex-start;
    display: block;
  }

  .manage-actions {
    margin-top: 10px;
  }
}
