@import url('https://fonts.googleapis.com/css2?family=Oxanium:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: #0b1116;
  --panel-elevated: #0f1821;
  --text: #f5f8fb;
  --muted: #b4c0cc;
  --accent: #1483c9;
  --accent-soft: rgba(20, 131, 201, 0.18);
  --accent-2: #d91b5c;
  --accent-2-soft: rgba(217, 27, 92, 0.2);
  --danger: #ff6b6b;
  --outline: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Oxanium', system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #0f2336 0%, #050607 70%);
  min-height: 100vh;
  position: relative;
}

.ambient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 18% 18%, rgba(20, 131, 201, 0.18), transparent 45%),
    radial-gradient(circle at 82% 12%, rgba(217, 27, 92, 0.16), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(20, 131, 201, 0.12), transparent 40%);
  background-size: 200% 200%;
  pointer-events: none;
  z-index: 0;
  animation: drift 14s ease-in-out infinite;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height, auto);
  padding: 0 8vw;
  background: rgba(5, 7, 12, 0.50);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline);
  transition: height 0.2s ease, background 0.2s ease;
  overflow: hidden;
}

.site-header.shrink {
  padding: 14px 8vw;
  background: rgba(5, 7, 12, 0.40);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand-logo {
  height: 100px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
  transform: scale(var(--logo-scale, 1));
  transform-origin: center;
  transition: transform 0.12s ease;
  will-change: transform;
}


.brand-text {
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.site-main {
  position: relative;
  z-index: 1;
  padding: 48px 8vw 80px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  margin-bottom: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 4vw, 4rem);
  margin: 0 0 12px;
}

.hero-panel {
  background: var(--panel);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--outline);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  transform: translateY(0);
  animation: float 6s ease-in-out infinite;
}

.latest-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.latest-thumb {
  width: 200px;
  height: 140px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--outline);
  flex-shrink: 0;
}

.latest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.latest-card .read-more {
  flex-shrink: 0;
  align-self: flex-start;
}

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  margin-bottom: 12px;
}

.badge-draft {
  margin-left: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  letter-spacing: 0.12em;
}

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

.load-indicator {
  margin: 28px auto 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.load-indicator.show {
  display: flex;
}

.load-indicator.done {
  display: none;
}

.load-indicator.done.show {
  display: flex;
}

.load-indicator.see-more {
  display: none;
  gap: 10px;
}

.load-indicator.see-more.show {
  display: flex;
}

.scroll-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  color: var(--accent);
  animation: bob 1.2s ease-in-out infinite;
}

.scroll-icon i {
  font-size: 0.8rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.post-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px;
  border-radius: 18px;
  background: var(--panel-elevated);
  border: 1px solid var(--outline);
  animation: fadeInUp 0.6s ease both;
}

.post-thumb {
  width: 180px;
  height: 120px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--outline);
}

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


.post-card h2 {
  margin: 0 0 8px;
}

.post-card a {
  color: var(--text);
  text-decoration: none;
}

.post-card a:hover {
  color: var(--accent);
}

.post-excerpt {
  color: var(--muted);
  margin: 0;
}

.read-more {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(20, 131, 201, 0.45);
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
}

.breadcrumbs {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
}

.post {
  max-width: 900px;
  margin: 0 auto;
  background: var(--panel);
  padding: 36px;
  border-radius: 24px;
  border: 1px solid var(--outline);
  animation: fadeIn 0.5s ease both;
}

.post-hero {
  margin: -12px -12px 24px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--outline);
}

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

.post h1 {
  margin-top: 0;
}

.post-body {
  line-height: 1.8;
  color: #d6dbee;
}

.post-body h2,
.post-body h3 {
  margin-top: 32px;
}

.post-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.post-meta-right {
  text-align: right;
}

.post-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.post-actions-bottom {
  margin-top: 28px;
  justify-content: flex-end;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: rgba(20, 131, 201, 0.15);
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-button.danger {
  background: rgba(217, 27, 92, 0.2);
  color: var(--accent-2);
}

.post-body code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}

.code-block {
  margin: 20px 0;
  background: rgba(5, 9, 14, 0.85);
  border-radius: 14px;
  border: 1px solid var(--outline);
  overflow: hidden;
  line-height: 0.5em;
}

.code-block pre {
  margin: 0;
  padding: 16px 16px 16px 56px;
  overflow: auto;
}

.code-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--outline);
  background: rgba(9, 14, 20, 0.7);
  line-height: 1;
}

.code-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: rgba(20, 131, 201, 0.15);
  color: var(--accent);
  cursor: pointer;
}

.code-btn i {
  font-size: 16px;
}

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(9, 14, 20, 0.9);
  border: 1px solid var(--outline);
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.code-block code {
  counter-reset: line;
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: #d6dbea;
}

.hljs {
  color: #d6dbea;
}

.hljs-comment,
.hljs-quote {
  color: #7d8aa8;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-name {
  color: #5fd2ff;
}

.hljs-string,
.hljs-title,
.hljs-section,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
  color: #a4ff7b;
}

.hljs-number,
.hljs-meta,
.hljs-type,
.hljs-built_in,
.hljs-builtin-name {
  color: #ffb86b;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: 700;
}

.code-line {
  display: block;
  position: relative;
  padding-left: 18px;
  white-space: pre;
  line-height: 1em;
}

.code-line::before {
  counter-increment: line;
  content: counter(line);
  position: absolute;
  left: -48px;
  width: 40px;
  text-align: right;
  color: rgba(180, 192, 204, 0.7);
}

.post-body .center-media {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 24px 0;
}

.post-body .center-media img,
.post-body .center-media video {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--outline);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.panel {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px;
  background: var(--panel);
  border-radius: 24px;
  border: 1px solid var(--outline);
}

.xkcd-panel {
  margin-top: 24px;
  display: grid;
  gap: 12px;
  text-align: center;
}

.xkcd-panel img {
  max-width: 100%;
  border-radius: 16px;
  border: 1px solid var(--outline);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 20px;
}

.panel-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 500;
}

input,
textarea {
  background: #0a0f1b;
  border: 1px solid var(--outline);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
}

select {
  background: #0a0f1b;
  border: 1px solid var(--outline);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
}

textarea {
  font-family: 'JetBrains Mono', monospace;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.upload-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--outline);
  background: rgba(10, 15, 27, 0.6);
}

.md-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: rgba(9, 14, 20, 0.65);
  align-items: center;
}

.md-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  background: rgba(20, 131, 201, 0.12);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
}

.md-btn i {
  font-size: 0.75rem;
}

.md-dropdown {
  position: relative;
}

.md-menu {
  position: absolute;
  top: 36px;
  left: 0;
  min-width: 70px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--outline);
  background: rgba(9, 14, 20, 0.95);
  display: none;
  z-index: 20;
}

.md-menu.open {
  display: grid;
  gap: 4px;
}

.md-menu-item {
  background: rgba(20, 131, 201, 0.12);
  border: 1px solid var(--outline);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  text-align: left;
}

.upload-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

#uploadSnippet {
  font-family: 'JetBrains Mono', monospace;
}

.button,
button {
  background: var(--accent);
  color: #041018;
  border: none;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

.button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--outline);
}

.button.danger {
  background: var(--danger);
  color: #1a0505;
}

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

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(10, 15, 27, 0.7);
  border: 1px solid var(--outline);
}

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

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.error {
  color: var(--danger);
}

.success {
  color: #79f2a6;
}

.site-footer {
  padding: 40px 8vw;
  color: var(--muted);
  border-top: 1px solid var(--outline);
  text-align: center;
}

.footer-links {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1.1rem;
}

.post-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  padding: 40px;
  border-radius: 20px;
  border: 1px dashed var(--outline);
  text-align: center;
  color: var(--muted);
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes drift {
  0% {
    background-position: 0% 0%, 100% 0%, 50% 100%;
  }
  50% {
    background-position: 30% 20%, 70% 15%, 60% 85%;
  }
  100% {
    background-position: 0% 0%, 100% 0%, 50% 100%;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bob {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

@media (max-width: 700px) {
  .site-header {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .site-header.shrink {
    align-items: center;
    justify-content: center;
  }

  .brand {
    width: 100%;
    justify-content: center;
  }

  .site-header,
  .site-header.shrink {
    height: var(--header-height-mobile, auto);
    padding: 0 8vw;
  }

  .post-card,
  .admin-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-thumb {
    width: 100%;
    height: 180px;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .latest-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .latest-thumb {
    width: 100%;
    height: 200px;
  }

}
