.site-header{
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.skip-link{
  position: fixed;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
  transform: translateY(calc(-100% - var(--s-3)));
  transition: transform 160ms ease;
}

.skip-link:focus,
.skip-link:focus-visible{
  transform: translateY(0);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-3) 0;
  gap: var(--s-3);
  position: relative;
}

.site-logo{
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.site-nav{
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--text-sm);
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a{
  color: var(--muted);
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible{
  color: var(--text);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-toggle{
  display: none;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
}

.nav-group{
  position: relative;
}

.nav-group .nav-link{
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.nav-dropdown{
  position: absolute;
  top: calc(100% + var(--s-1));
  left: 0;
  width: max-content;
  min-width: min(180px, calc(100vw - (2 * var(--s-3))));
  max-width: calc(100vw - (2 * var(--s-3)));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2);
  padding: var(--s-1);
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-1);
}

.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown{
  display: flex;
}

.nav-group::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--s-2);
  top: 100%;
}

.nav-group:hover::after,
.nav-group:focus-within::after{
  background: transparent;
}

.nav-dropdown a{
  padding: 0.25rem 0.65rem;
  border-radius: var(--r-1);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

.nav-dropdown a:hover,
.nav-dropdown a:focus-visible{
  background: var(--surface-2);
  color: var(--text);
}

.button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  max-width: 100%;
  min-height: 44px;
  min-width: 0;
  padding: 0.65rem 1.2rem;
  border-radius: var(--r-1);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.15;
  text-align: center;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: normal;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.button-primary{
  background: var(--accent);
  color: var(--bg);
}

.button-primary:hover,
.button-primary:focus-visible{
  background: var(--accent-2);
  transform: translateY(-1px);
}

.button-secondary{
  background: var(--theme-button-secondary-bg);
  border-color: var(--theme-button-secondary-border);
  color: var(--text);
}

.button-secondary:hover,
.button-secondary:focus-visible{
  border-color: var(--accent);
}

.button-ghost{
  border-color: var(--theme-button-ghost-border);
  color: var(--theme-button-ghost-text);
}

.button-ghost:hover,
.button-ghost:focus-visible{
  color: var(--text);
  border-color: var(--accent);
}

.button.is-active{
  border-color: var(--accent);
  color: var(--text);
}

.button.is-selected{
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  box-shadow: 0 8px 18px rgba(8, 20, 28, 0.24);
}

.button.is-selected:hover,
.button.is-selected:focus-visible{
  background: var(--accent-2);
  border-color: var(--accent-2);
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 24px rgba(8, 20, 28, 0.3);
}

.input{
  background: var(--theme-card-bg);
  color: var(--text);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--r-1);
  padding: 0.45rem 0.6rem;
  font-size: var(--text-sm);
  line-height: 1.2;
}

select.input{
  background-color: var(--theme-card-bg);
  color: var(--text);
}

select.input option{
  background: var(--surface);
  color: var(--text);
}

.card{
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--r-2);
  padding: var(--s-4);
  box-shadow: var(--shadow-1);
  display: grid;
  gap: var(--s-2);
}

.card-title{
  font-size: var(--text-lg);
  font-weight: 600;
}

.card-meta{
  color: var(--muted);
  font-size: var(--text-sm);
}

.card-actions{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.tag-list{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
}

.tag{
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--theme-tag-border);
  color: var(--theme-tag-text);
}

.badge{
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.badge-stable{
  background: var(--badge-stable-bg);
  color: var(--badge-stable-text);
  border: 1px solid var(--badge-stable-border);
}

.badge-beta{
  background: var(--badge-beta-bg);
  color: var(--badge-beta-text);
  border: 1px solid var(--badge-beta-border);
}

.badge-experimental{
  background: var(--badge-experimental-bg);
  color: var(--badge-experimental-text);
  border: 1px solid var(--badge-experimental-border);
}

.grid{
  display: grid;
  gap: var(--s-3);
}

.grid-3{
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.stagger > *{
  opacity: 0;
  transform: translateY(10px);
}

@media (prefers-reduced-motion: no-preference){
  .stagger > *{
    animation: fade-in 0.6s ease forwards;
  }
  .stagger > *:nth-child(1){ animation-delay: 0.05s; }
  .stagger > *:nth-child(2){ animation-delay: 0.1s; }
  .stagger > *:nth-child(3){ animation-delay: 0.15s; }
  .stagger > *:nth-child(4){ animation-delay: 0.2s; }
  .stagger > *:nth-child(5){ animation-delay: 0.25s; }
  .stagger > *:nth-child(6){ animation-delay: 0.3s; }
}

@keyframes fade-in{
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

.media-frame{
  background: var(--surface-2);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--r-2);
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: var(--text-sm);
}

.media-frame.has-image{
  min-height: 0;
  padding: var(--s-2);
  display: block;
  width: fit-content;
  max-width: 100%;
  justify-self: start;
}

.media-frame.has-image .art-detail{
  display: block;
  width: auto;
  max-width: min(100%, 760px);
  height: auto;
  max-height: min(72vh, 720px);
  object-fit: contain;
  margin: 0;
}

.code-block{
  background: var(--theme-code-bg);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--r-1);
  padding: var(--s-3);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  overflow-x: auto;
}

.list{
  display: grid;
  gap: var(--s-2);
  margin-left: var(--s-3);
  list-style: disc;
}

.badge-platform{
  background: var(--badge-platform-bg);
  color: var(--badge-platform-text);
  border: 1px solid var(--badge-platform-border);
}

.project-ctas{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.project-block{
  padding: var(--s-4);
  border-radius: var(--r-2);
  border: 1px solid var(--theme-card-border);
  background: var(--theme-panel-bg);
}

.filter-bar{
  display: grid;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.filter-group{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.filter-group .button{
  min-height: 40px;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  background: var(--theme-filter-bg);
  border-color: var(--theme-filter-border);
}

.filter-group .button:hover,
.filter-group .button:focus-visible{
  color: var(--text);
  transform: translateY(-1px);
}

.filter-group .button.is-active{
  color: var(--text);
  font-weight: 600;
  border-color: var(--theme-filter-active-border);
}

.filter-label{
  font-size: var(--text-sm);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.filter-search{
  width: min(360px, 100%);
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-1);
  border: 1px solid var(--theme-search-border);
  background: var(--theme-search-bg);
  color: var(--text);
}

.filter-search::placeholder{
  color: var(--muted);
}

.copy-button{
  align-self: flex-start;
}

.toc{
  display: grid;
  gap: var(--s-2);
  padding: var(--s-3);
  border-radius: var(--r-2);
  border: 1px solid var(--theme-card-border);
  background: var(--theme-panel-bg);
}

.toc h3{
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.toc ul{
  list-style: none;
  display: grid;
  gap: var(--s-1);
}

.toc a{
  color: var(--muted);
}

.toc a:hover,
.toc a:focus-visible{
  color: var(--text);
}

.lightbox{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.lightbox.is-open{
  display: flex;
}

.lightbox-backdrop{
  position: absolute;
  inset: 0;
  background: var(--lightbox-backdrop);
}

.lightbox-content{
  position: relative;
  z-index: 1;
  background: var(--theme-panel-bg);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--r-2);
  padding: var(--s-4);
  width: min(720px, calc(100vw - (2 * var(--s-3))));
  max-width: calc(100vw - (2 * var(--s-3)));
  max-height: calc(100vh - (2 * var(--s-3)));
  overflow: auto;
  box-shadow: var(--shadow-1);
  display: grid;
  gap: var(--s-3);
}

.lightbox-image{
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72vh, 680px);
  object-fit: contain;
  margin: 0 auto;
  border-radius: var(--r-1);
  border: 1px solid var(--theme-thumb-border);
}

.lightbox-caption{
  color: var(--muted);
  font-size: var(--text-sm);
}

.lightbox-close{
  justify-self: end;
  padding: var(--s-1) var(--s-2);
  border-radius: var(--r-1);
  border: 1px solid var(--theme-card-border);
}

.art-thumb{
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--r-2);
  border: 1px solid var(--theme-thumb-border);
  background: var(--surface-2);
}

.support-panel{
  display: grid;
  gap: var(--s-2);
  padding: var(--s-4);
  border-radius: var(--r-2);
  border: 1px solid var(--theme-card-border);
  background: var(--theme-panel-bg);
}

.footer{
  border-top: 1px solid var(--border);
  padding: var(--s-4) 0;
  color: var(--muted);
  font-size: var(--text-sm);
  background: var(--footer-gradient);
}

.footer-inner{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  justify-content: space-between;
  align-items: center;
}

.footer-links{
  display: flex;
  gap: var(--s-3);
}

.admin-edit-mode [data-edit-field]{
  outline: 1px dashed rgba(255, 149, 0, 0.6);
  outline-offset: 3px;
  cursor: pointer;
}

.admin-edit-mode [data-text-key]{
  outline: 1px dashed rgba(95, 208, 200, 0.58);
  outline-offset: 3px;
  cursor: pointer;
  transition: outline-color 120ms ease, background 120ms ease;
}

.admin-edit-mode [data-text-key]:hover{
  outline-color: rgba(109, 153, 255, 0.88);
  background: rgba(109, 153, 255, 0.1);
}

.admin-edit-mode [data-text-key].admin-text-active{
  outline-color: rgba(95, 208, 200, 1);
  background: rgba(95, 208, 200, 0.14);
}

.admin-toolbar{
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: calc(100vw - 2.5rem);
  gap: 0.5rem;
  background: rgba(18, 20, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  z-index: 999;
  backdrop-filter: blur(10px);
}

.admin-toolbar-title{
  color: #f5f0e8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.admin-toolbar-state{
  color: rgba(245, 240, 232, 0.86);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.admin-toolbar-state[data-state="ok"]{
  color: #78e3b8;
}

.admin-toolbar-state[data-state="warn"]{
  color: #f5d38a;
}

.admin-toolbar-state[data-state="error"]{
  color: #ff9f9f;
}

.admin-editor{
  position: fixed;
  width: min(320px, calc(100vw - (2 * var(--s-3))));
  max-height: calc(100vh - (2 * var(--s-3)));
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  border-radius: var(--r-2);
  padding: var(--s-3);
  z-index: 1000;
  display: none;
}

.admin-editor.is-open{
  display: block;
}

.admin-editor-header{
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--s-2);
}

.admin-editor-title{
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.admin-editor-status{
  font-size: 0.7rem;
  color: var(--muted);
}

.admin-editor-body input,
.admin-editor-body textarea,
.admin-editor-body select{
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  padding: 0.5rem;
  font-size: var(--text-sm);
}

.admin-editor-body textarea{
  resize: vertical;
}

.admin-editor-actions{
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2);
  justify-content: flex-end;
}

@media (max-width: 720px){
  .site-header{
    position: relative;
  }

  .site-nav{
    display: none;
  }

  .site-nav.is-open{
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    right: 0;
    top: calc(100% + var(--s-2));
    overflow: auto;
    max-height: calc(100vh - 7rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-2);
    padding: var(--s-3);
    box-shadow: var(--shadow-1);
    min-width: min(220px, calc(100vw - (2 * var(--s-4))));
    max-width: calc(100vw - (2 * var(--s-4)));
  }

  .site-nav.is-open .nav-dropdown{
    position: static;
    display: flex;
    border: none;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-toggle{
    display: inline-flex;
  }

  .header-inner{
    align-items: center;
  }

  .site-logo{
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .filter-group .button{
    flex: 1 1 auto;
  }

  .lightbox{
    align-items: start;
    padding: var(--s-3) 0;
    overflow: auto;
  }

  .lightbox-content{
    width: min(100% - (2 * var(--s-3)), 720px);
    max-height: none;
    padding: var(--s-3);
  }

  .lightbox-image{
    max-height: none;
  }

  .admin-toolbar{
    right: var(--s-3);
    bottom: var(--s-3);
    width: calc(100vw - (2 * var(--s-3)));
    border-radius: var(--r-2);
    justify-content: space-between;
  }
}

@media (max-height: 520px){
  .site-header{
    position: relative;
  }
}

@media (prefers-reduced-motion: reduce){
  html{
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
