:root {
  color-scheme: dark;
  --bg: #151616;
  --surface: #1c1d1c;
  --text: #f2f3f2;
  --muted: #a6aaa7;
  --line: #343634;
  --accent: #42d79a;
  --max: 1500px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; }

a:focus-visible,
video:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 9px 12px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(var(--max), calc(100% - 64px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 25px;
  flex: none;
}

.brand-mark i {
  position: absolute;
  left: 1px;
  width: 26px;
  height: 13px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.brand-mark i:nth-child(1) { top: 11px; opacity: .55; }
.brand-mark i:nth-child(2) { top: 6px; opacity: .78; }
.brand-mark i:nth-child(3) { top: 0; }

.about-link {
  padding: 25px 0 17px;
  color: #c5c7c5;
  border-bottom: 2px solid transparent;
}

.about-link:hover,
.about-link.active { color: var(--text); border-color: var(--accent); }

.header-meta,
.update-status {
  display: flex;
  align-items: center;
}

.header-meta { gap: 32px; }

.update-status {
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.update-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.filters {
  width: min(var(--max), calc(100% - 64px));
  margin: 6px auto 10px;
  display: flex;
  gap: 40px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter-link {
  flex: none;
  padding: 12px 4px 11px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.filter-link:hover,
.filter-link.active { color: var(--text); border-color: var(--accent); }

.archive-shell {
  width: min(var(--max), calc(100% - 64px));
  margin: 0 auto;
}

.gallery {
  columns: 4;
  column-gap: 20px;
}

.card {
  break-inside: avoid;
  margin: 0 0 20px;
}

.card-media {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid #222422;
  border-radius: 7px;
  background: #0d0e0d;
}

.card-media img,
.card-media video {
  display: block;
  width: 100%;
  height: auto;
  min-height: 160px;
  object-fit: cover;
  transition: transform 180ms ease, opacity 180ms ease;
}

.card-media video { aspect-ratio: 16 / 10; }
.card-media:hover img,
.card-media:hover video { transform: scale(1.012); opacity: .9; }

.media-badge {
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 4px 7px;
  border-radius: 3px;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.card-meta {
  min-width: 0;
  padding-top: 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.card-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}

.card-user {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
}

.card-meta .dot { color: #747874; }

.empty-state {
  column-span: all;
  min-height: 55vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.pagination {
  padding: 86px 0 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
}

.page-link,
.page-ellipsis {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.page-link:hover { color: var(--text); }
.page-link.active { color: var(--accent); border-bottom: 2px solid var(--accent); }
.page-link.disabled { opacity: .35; }
.page-arrow { margin: 0 8px; font-size: 19px; }

.detail-layout {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 2.05fr) minmax(340px, .95fr);
}

.media-stage {
  min-height: 100svh;
  padding: clamp(32px, 4vw, 72px);
  display: grid;
  place-items: center;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.detail-media {
  display: block;
  width: 100%;
  max-height: calc(100svh - 144px);
  object-fit: contain;
  background: #0b0c0b;
  border: 1px solid #3a3c3a;
  border-radius: 7px;
}

.detail-media.image { width: auto; max-width: 100%; }

.detail-panel {
  min-width: 0;
  padding: 42px 40px 34px;
  display: flex;
  flex-direction: column;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-link {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #d8dad8;
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
}

.detail-copy {
  margin: auto 0;
  padding: 72px 0;
}

.entry-kicker {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 16px;
}

.entry-kicker span { margin: 0 8px; }

.detail-copy h1 {
  max-width: 14ch;
  margin: 0 0 32px;
  font-size: clamp(34px, 3vw, 48px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.tweet-copy {
  max-width: 38ch;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  white-space: pre-line;
}

.author {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 17px;
}

.author img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

.detail-actions { margin-top: auto; }

.goto-x {
  display: inline-block;
  padding: 12px 0 30px;
  color: var(--accent);
  font-size: 17px;
}

.goto-x:hover,
.layer3d-link:hover { color: #75ebb7; }

.entry-nav {
  padding-top: 26px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}

.entry-nav a:hover { color: var(--accent); }
.entry-nav .disabled { color: #676a67; }

.about-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.about-header {
  border-bottom: 1px solid var(--line);
  width: 100%;
  padding: 0 max(32px, calc((100% - var(--max)) / 2));
}

.about-content {
  width: min(var(--max), calc(100% - 64px));
  margin: auto;
  padding: 90px 0;
}

.about-content h1 {
  max-width: 18ch;
  margin: 0 0 34px;
  font-size: clamp(48px, 5.3vw, 82px);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.about-body {
  max-width: 760px;
  color: #c2c5c2;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.48;
}

.about-body p { margin: 0 0 20px; }

.layer3d-link {
  display: inline-block;
  margin-top: 26px;
  color: var(--accent);
  font-size: 18px;
}

.about-footer {
  width: min(var(--max), calc(100% - 64px));
  margin: 0 auto;
  padding: 0 0 34px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1120px) {
  .gallery { columns: 3; }
  .detail-panel { padding-inline: 30px; }
}

@media (max-width: 860px) {
  .gallery { columns: 2; }
  .detail-layout { display: block; }
  .media-stage { min-height: auto; height: 62svh; border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-media { max-height: calc(62svh - 64px); }
  .detail-panel { min-height: 620px; }
  .detail-copy { margin: 0; }
}

@media (max-width: 560px) {
  .site-header,
  .filters,
  .archive-shell,
  .about-content,
  .about-footer { width: calc(100% - 36px); }
  .filters { gap: 24px; }
  .header-meta { gap: 16px; }
  .gallery { columns: 1; }
  .pagination { padding-block: 72px; gap: 5px; }
  .page-arrow { margin-inline: 2px; }
  .media-stage { height: 48svh; padding: 18px; }
  .detail-media { max-height: calc(48svh - 36px); }
  .detail-panel { min-height: 560px; padding: 26px 20px; }
  .detail-copy { padding-block: 58px; }
  .about-header { padding-inline: 18px; }
  .about-content { padding-block: 72px; }
}

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