/* RESET */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── COLOR SCHEMES ── */

body.scheme-light {
  --bg: #ffffff;
  --fg: #1A1A1A;
  --fg-muted: rgba(0,0,0,0.45);
  --border: #E0E0E0;
  --accent: #C93B1A;
}

body.scheme-dark {
  --bg: #0a0a0a;
  --fg: #ffffff;
  --fg-muted: rgba(255,255,255,0.45);
  --border: rgba(255,255,255,0.12);
  --accent: #C93B1A;
}

body.scheme-martian {
  --bg: #E8A838;
  --fg: #000000;
  --fg-muted: rgba(0,0,0,0.45);
  --border: rgba(0,0,0,0.15);
  --accent: #C93B1A;
}

/* BASE */
html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--fg);
  text-decoration: none;
}

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

img {
  display: block;
  width: 100%;
  height: auto;
}

/* ── NAV ── */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  transition: background 0.3s ease;
}

.nav-wordmark a {
  color: var(--fg);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: var(--fg);
}

/* MENU button — hidden on desktop */
.menu-btn {
  display: none;
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: none;
  border: none;
  color: var(--fg);
  cursor: pointer;
  padding: 0;
}

/* ── THEME TOGGLE ── */

.theme-toggle {
  display: flex;
  align-items: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  color: var(--fg);
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.theme-toggle:hover {
  opacity: 0.9;
}

.theme-toggle-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

body.scheme-light .theme-toggle-icon::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: var(--fg);
}

body.scheme-dark .theme-toggle-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--fg);
}

body.scheme-martian .theme-toggle-icon {
  border-color: #000000;
  background: #888888;
}

body.scheme-martian .theme-toggle-icon::after {
  display: none;
}

/* ── ARCHIVE HEADER ── */

.archive-header {
  padding: 60px 20px 40px 20px;
}

.archive-header-text {
  max-width: 480px;
  color: var(--fg);
  line-height: 1.8;
}

/* ── ARCHIVE GRID ── */

.archive-grid {
  column-count: 3;
  column-gap: 20px;
  padding: 0 20px 20px 20px;
}

.archive-item {
  break-inside: avoid;
  margin-bottom: 30px;
}

.archive-item a {
  display: block;
}

.archive-item img {
  display: block;
  width: 100%;
  filter: blur(0px);
  transition: filter 0.15s ease-out;
  will-change: filter;
}

.archive-item img.resolving {
  filter: blur(20px);
  transform: scale(1.04);
}

.archive-item img.sharp {
  filter: blur(0px);
  transform: scale(1);
}

.archive-caption {
  padding: 10px 0 0 0;
}

.archive-caption .caption-title {
  color: var(--fg);
  display: block;
  margin-bottom: 2px;
}

.archive-caption .caption-description {
  color: var(--fg);
  opacity: 0.45;
  display: block;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── POST LAYOUT ── */

.post-container {
  display: flex;
  min-height: calc(100vh - 49px);
}

.post-image {
  width: 50%;
  padding: 40px;
}

.post-image img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.post-meta {
  width: 50%;
  display: flex;
  flex-direction: column;
}

.post-meta-spacer {
  height: 40px;
}

.post-meta-rows {
  flex: 1;
}

.meta-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  padding: 14px 40px 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.meta-label {
  color: var(--fg);
}

.meta-value {
  color: var(--fg);
}

.meta-value a {
  color: var(--fg);
}

.meta-value a:hover {
  color: var(--accent);
}

.disabled {
  opacity: 0.3;
}

.meta-row-group {
  border-bottom: 1px solid var(--border);
}

.meta-row-group .meta-row {
  border-bottom: none;
  padding-top: 6px;
  padding-bottom: 6px;
}

.meta-row-group .meta-row:first-child {
  padding-top: 14px;
}

.meta-row-group .meta-row:last-child {
  padding-bottom: 14px;
}

/* ── RESPONSIVE — TABLET ── */

@media (max-width: 900px) {
  .archive-grid {
    column-count: 2;
    column-gap: 16px;
    padding: 0 16px 16px 16px;
  }

  .archive-header {
    padding: 40px 16px 24px 16px;
  }

  .post-container {
    flex-direction: column;
  }

  .post-image {
    width: 100%;
    padding: 20px;
  }

  .post-meta {
    width: 100%;
  }

  .post-meta-spacer {
    height: 20px;
  }

  .meta-row {
    grid-template-columns: 120px 1fr;
    padding: 12px 20px 12px 20px;
  }
}

/* ── RESPONSIVE — MOBILE ── */

@media (max-width: 768px) {
  /* Nav: collapse links to MENU button */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open {
    display: flex;
  }

  .menu-btn {
    display: block;
  }

  .nav {
    position: sticky;
  }

  /* Header */
  .archive-header {
    padding: 40px 16px 24px 16px;
  }

  .archive-header-text {
    max-width: none;
  }

  /* Grid */
  .archive-grid {
    column-count: 1;
    column-gap: 0;
    padding: 0 16px 16px 16px;
  }

  /* Post */
  .post-image {
    padding: 16px;
  }

  .meta-row {
    grid-template-columns: 100px 1fr;
    padding: 10px 16px;
  }
}
