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

:root {
  --page: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #eef3f7;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --border: #d8e1ea;
  --border-strong: #bcc8d5;
  --text: #152033;
  --text-soft: #4d5c70;
  --text-muted: #798698;
  --blue: #2563eb;
  --blue-soft: #e7efff;
  --green: #0f9f6e;
  --green-soft: #e3f7ee;
  --amber: #b7791f;
  --amber-soft: #fff4dc;
  --coral: #df5a4f;
  --ink: #0b1220;
  --transparent-image-bg: #eef3f7;
  --transparent-image-frame: #d8e1ea;
  --gallery-showcase-bg: var(--surface);
  --gallery-header-bg: var(--surface);
  --gallery-header-text: var(--text);
  --gallery-header-meta: var(--text-muted);
  --gallery-header-border: var(--border);
  --logo-start: #2563eb;
  --logo-end: #0f9f6e;
  --shadow: 0 18px 50px rgba(20, 31, 45, 0.12);
  --shadow-strong: 0 26px 70px rgba(15, 23, 42, 0.26);
  --radius: 8px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --page: #101722;
  --surface: #151f2d;
  --surface-muted: #1e2a3a;
  --surface-glass: rgba(21, 31, 45, 0.84);
  --border: #2b3a4f;
  --border-strong: #405169;
  --text: #ecf4ff;
  --text-soft: #b8c4d4;
  --text-muted: #8290a2;
  --blue: #73a4ff;
  --blue-soft: #1d3156;
  --green: #45d79d;
  --green-soft: #193d31;
  --amber: #f6c260;
  --amber-soft: #3c301c;
  --coral: #ff8178;
  --ink: #050914;
  --transparent-image-bg: #0b1220;
  --transparent-image-frame: #050914;
  --gallery-showcase-bg: #050914;
  --gallery-header-bg: rgba(5, 9, 20, 0.92);
  --gallery-header-text: #fff;
  --gallery-header-meta: rgba(255, 255, 255, 0.72);
  --gallery-header-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 26px 70px rgba(0, 0, 0, 0.46);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(15, 159, 110, 0.08), transparent 38%),
    var(--page);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.viewer-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

a,
button {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

img,
video,
iframe {
  display: block;
  max-width: 100%;
}

#ambient-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.topbar,
.page-shell,
.footer {
  position: relative;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 10px clamp(16px, 4vw, 42px);
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand > span {
  min-width: 0;
}

.brand-logo-container {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
  animation: logoPulse 4.8s ease-in-out infinite;
}

.brand-logo-svg {
  display: block;
}

.brand strong,
.brand small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 0.98rem;
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.topnav a,
.theme-toggle {
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.topnav a {
  padding: 9px 12px;
}

.topnav a:hover,
.topnav a:focus-visible,
.topnav a[aria-current="page"] {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
}

.topnav a[aria-current="page"] {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--border));
  color: var(--blue);
}

.theme-toggle {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
}

.theme-toggle svg {
  position: absolute;
  transition: transform 220ms ease, opacity 220ms ease;
}

:root[data-theme="light"] .theme-toggle .moon-icon,
:root[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(55deg) scale(0.72);
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 26px 20px 52px;
  align-items: start;
}

body[data-view="projects"] .page-shell {
  width: min(1180px, 100%);
}

.page-view[hidden] {
  display: none !important;
}

.feed-column,
.projects-column {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.post-card,
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feed-list {
  display: grid;
  gap: 18px;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}

.projects-grid > .empty-state,
.projects-grid > .notice-card {
  grid-column: 1 / -1;
}

.post-card {
  position: relative;
  overflow: hidden;
  animation: cardEnter 520ms ease both;
  animation-delay: var(--enter-delay, 0ms);
  transform-origin: 50% 70%;
}

.project-card {
  position: relative;
  display: grid;
  min-width: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: cardEnter 520ms ease both;
  animation-delay: var(--enter-delay, 0ms);
  transform-origin: 50% 70%;
}

.project-card.is-clickable {
  cursor: pointer;
}

.project-card.is-clickable:hover .project-thumb img,
.project-card.is-clickable:focus-visible .project-thumb img {
  transform: scale(1.035);
}

.project-card.is-clickable:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 62%, transparent);
  outline-offset: 4px;
}

.post-card:hover .media-slide img {
  transform: scale(1.035);
}

.project-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--transparent-image-bg);
}

.project-thumb img,
.project-thumb .thumbnail-fallback {
  width: 100%;
  height: 100%;
}

.project-thumb img {
  object-fit: cover;
  object-position: center;
  transition: transform 700ms ease, filter 300ms ease;
}

.project-card-body {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px 14px 12px;
}

.project-kicker {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.project-kicker span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.08rem;
  line-height: 1.24;
}

.project-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.project-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 14px;
}

.project-actions .action-button {
  min-height: 42px;
}

.media-showcase {
  position: relative;
  overflow: hidden;
  background: #111827;
}

.gallery-showcase {
  background: var(--gallery-showcase-bg);
}

.gallery-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gallery-header-border);
  background: var(--gallery-header-bg);
  color: var(--gallery-header-text);
  font-size: 0.82rem;
  font-weight: 800;
}

.gallery-header > span:last-child {
  color: var(--gallery-header-meta);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 2px;
  padding: 2px;
  background: var(--transparent-image-frame);
  touch-action: pan-y;
}

.gallery-thumb {
  position: relative;
  grid-column: span var(--gallery-span, 4);
  min-width: 0;
  aspect-ratio: var(--gallery-thumb-ratio, var(--gallery-tile-ratio, 1));
  overflow: hidden;
  background: var(--transparent-image-bg);
}

.gallery-grid[data-layout="feature-3"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 3 / 2;
  max-height: none;
  overflow: hidden;
}

.gallery-grid[data-layout="feature-3"] .gallery-thumb {
  grid-column: auto;
  aspect-ratio: auto;
}

.gallery-grid[data-layout="feature-3"] .gallery-thumb:first-child {
  grid-row: span 2;
}

.gallery-grid[data-layout="single"],
.gallery-grid[data-layout="pair"],
.gallery-grid[data-layout="quad"] {
  max-height: none;
  overflow: hidden;
}

.gallery-open-button {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  background: var(--transparent-image-bg);
  color: #fff;
  touch-action: pan-y;
}

.gallery-open-button img,
.gallery-open-button video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background-color: var(--transparent-image-bg);
  transition: transform 220ms ease, filter 220ms ease;
}

.gallery-open-button:hover img,
.gallery-open-button:hover video,
.gallery-open-button:focus-visible img,
.gallery-open-button:focus-visible video {
  filter: brightness(0.86);
  transform: scale(1.035);
}

.gallery-open-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: -5px;
}

.gallery-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 2;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(5, 9, 20, 0.72);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.media-rail {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
}

.media-rail::-webkit-scrollbar {
  display: none;
}

.media-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: clamp(440px, 62vw, 760px);
  min-width: 0;
  overflow: hidden;
  background: #111827;
  scroll-snap-align: center;
}

.media-open-button,
.media-slide video,
.embed-showcase iframe,
.thumbnail-fallback {
  width: 100%;
  height: 100%;
}

.media-open-button {
  position: relative;
  display: block;
  border: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  touch-action: pan-y;
}

.media-slide img,
.media-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: var(--transparent-image-bg);
}

.media-gif img {
  position: relative;
  z-index: 1;
  object-fit: contain;
}

.media-gif::before {
  position: absolute;
  inset: -18px;
  content: "";
  background-image: var(--media-url);
  background-position: center;
  background-size: cover;
  filter: blur(22px) brightness(0.55) saturate(1.18);
  transform: scale(1.08);
  opacity: 0.7;
}

.media-slide img {
  transition: transform 700ms ease, filter 300ms ease;
}

.media-open-button:focus-visible img {
  filter: brightness(0.82);
}

.media-open-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: -6px;
}

.embed-showcase {
  aspect-ratio: 16 / 10;
}

.embed-showcase iframe {
  border: 0;
}

.media-overlay,
.swipe-cue,
.media-expand {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(8, 13, 24, 0.58);
  color: #fff;
  backdrop-filter: blur(12px);
}

.media-overlay {
  top: 12px;
  left: 12px;
  right: 12px;
  justify-content: space-between;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  pointer-events: none;
}

.media-overlay > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.swipe-cue {
  right: 12px;
  bottom: 52px;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0.86;
  pointer-events: none;
  animation: cueSlide 2.2s ease-in-out infinite;
}

.media-expand {
  right: 12px;
  bottom: 12px;
  min-width: 44px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.media-open-button .media-expand {
  pointer-events: none;
}

button.media-expand {
  min-height: 44px;
  cursor: pointer;
}

.media-slide video + .media-expand {
  border-color: rgba(255, 255, 255, 0.36);
}

.status-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 800;
}

.status-pill.image,
.status-pill.gallery {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.gif {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.video,
.status-pill.embed {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.text {
  background: var(--surface-muted);
  color: var(--text-soft);
}

.post-body {
  display: grid;
  gap: 7px;
  padding: 14px 16px 4px;
}

.post-kicker {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.post-kicker span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-title {
  margin: 0;
  font-size: clamp(1.12rem, 2vw, 1.45rem);
  line-height: 1.22;
}

.post-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-description-block {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.post-description-block.is-expanded .post-description {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.post-description-meta {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.post-description-toggle {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.post-description-toggle:hover,
.post-description-toggle:focus-visible {
  text-decoration: underline;
  outline: none;
}

.post-description-toggle[hidden] {
  display: none;
}

.post-description-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.post-description-link:hover,
.post-description-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 800;
}

.post-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 10px 16px 16px;
}

.action-button,
.reset-btn,
.viewer-close,
.viewer-nav {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 800;
  text-decoration: none;
}

.action-button {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 0.88rem;
  text-align: center;
}

.action-button:hover,
.action-button:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
  outline: none;
}

.action-button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.action-button.primary:hover,
.action-button.primary:focus-visible {
  background: #1d4ed8;
  color: #fff;
}

.action-button.disabled,
.action-button:disabled {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.comments-panel {
  border-top: 1px solid var(--border);
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 92%, var(--page));
}

.comments-panel[hidden] {
  display: none;
}

.comments-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

.comments-note a {
  color: var(--blue);
  font-weight: 800;
}

.notice-card {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.thumbnail-fallback {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.24), rgba(15, 159, 110, 0.2)),
    repeating-linear-gradient(90deg, transparent 0 20px, rgba(255, 255, 255, 0.08) 20px 21px);
  color: #fff;
  font-size: clamp(2rem, 9vw, 5rem);
  font-weight: 800;
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
  font-size: 1.2rem;
}

.empty-state p {
  margin: 10px auto 0;
  max-width: 420px;
  color: var(--text-soft);
  line-height: 1.5;
}

.reset-btn {
  min-height: 40px;
  margin-top: 18px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
}

.media-viewer {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: rgba(5, 9, 20, 0.96);
  color: #fff;
}

.media-viewer::backdrop {
  background: rgba(5, 9, 20, 0.84);
  backdrop-filter: blur(14px);
}

.viewer-shell {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.viewer-stage {
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: var(--transparent-image-frame);
  touch-action: none;
  user-select: none;
}

.viewer-stage.can-zoom {
  cursor: zoom-in;
}

.viewer-stage.can-zoom.is-zoomed {
  cursor: grab;
}

.viewer-stage.can-zoom.is-panning {
  cursor: grabbing;
}

.viewer-stage img,
.viewer-stage video {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
  background: var(--transparent-image-bg);
  user-select: none;
  will-change: width, height, transform;
  -webkit-user-drag: none;
}

.viewer-stage img.viewer-fit-width,
.viewer-stage video.viewer-fit-width {
  width: 100%;
  height: auto;
}

.viewer-stage img.viewer-fit-height,
.viewer-stage video.viewer-fit-height {
  width: auto;
  height: 100%;
}

.viewer-stage img.viewer-fit-fill,
.viewer-stage video.viewer-fit-fill {
  width: 100%;
  height: 100%;
}

.viewer-close,
.viewer-nav {
  position: absolute;
  z-index: 3;
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  backdrop-filter: blur(14px);
}

.viewer-close {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  min-width: 44px;
  padding: 0 14px;
}

.viewer-nav {
  top: 50%;
  width: 56px;
  transform: translateY(-50%);
}

.viewer-prev {
  left: max(12px, env(safe-area-inset-left));
}

.viewer-next {
  right: max(12px, env(safe-area-inset-right));
}

.media-viewer.is-single .viewer-nav {
  display: none;
}

.viewer-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(5, 9, 20, 0), rgba(5, 9, 20, 0.92) 20%);
}

.viewer-title,
.viewer-meta {
  max-width: min(70vw, 820px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-title {
  font-size: 1rem;
  font-weight: 800;
}

.viewer-meta {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 700;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 22px 20px;
  background: var(--surface-glass);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.84rem;
  backdrop-filter: blur(16px);
}

.footer p {
  margin: 0;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cueSlide {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(-6px);
  }
}

@keyframes logoPulse {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

@media (max-width: 1080px) {
  .page-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .media-slide {
    height: clamp(420px, 74vw, 780px);
  }
}

@media (max-width: 760px) {
  body {
    background: var(--page);
  }

  .topbar {
    justify-content: flex-start;
    min-height: 58px;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  }

  .brand {
    gap: 9px;
  }

  .brand-logo-container {
    width: 36px;
    height: 36px;
  }

  .brand-logo-svg {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    max-width: clamp(96px, 30vw, 152px);
    font-size: 0.9rem;
  }

  .brand small {
    display: none;
  }

  .brand > span {
    display: none;
  }

  .topnav {
    gap: 4px;
  }

  .topnav a {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .theme-toggle {
    width: 44px;
    height: 44px;
  }

  .page-shell {
    display: block;
    width: 100%;
    padding: 0 0 28px;
  }

  .feed-column,
  .projects-column {
    gap: 10px;
  }

  .feed-list,
  .projects-grid {
    gap: 12px;
  }

  .post-card,
  .project-card {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-card {
    min-height: auto;
  }

  .project-thumb {
    aspect-ratio: 16 / 9;
  }

  .project-card-body {
    padding: 12px 12px 10px;
  }

  .project-title {
    font-size: 1rem;
  }

  .project-description {
    font-size: 0.84rem;
    -webkit-line-clamp: 2;
  }

  .project-card .tag-list {
    display: flex;
  }

  .project-actions {
    padding: 0 12px 12px;
  }

  .media-slide {
    height: calc(100svh - 232px);
    min-height: 430px;
    max-height: 760px;
  }

  .gallery-header {
    padding: 9px 10px;
  }

  .media-overlay {
    top: 10px;
    left: 10px;
    right: 10px;
    padding: 7px 9px;
  }

  .post-body {
    padding: 12px 12px 2px;
  }

  .post-title {
    font-size: 1.08rem;
  }

  .post-description {
    font-size: 0.86rem;
    -webkit-line-clamp: 2;
  }

  .tag-list {
    display: none;
  }

  .post-actions {
    grid-template-columns: minmax(0, 1fr);
    padding: 9px 12px 12px;
  }

  .action-button {
    min-height: 44px;
    font-size: 0.82rem;
  }

  .footer {
    display: none;
  }

  .viewer-caption {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .viewer-title,
  .viewer-meta {
    max-width: calc(100vw - 32px);
  }

  .viewer-nav {
    top: auto;
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: 52px;
    transform: none;
  }
}

@media (max-width: 960px) and (max-height: 520px) and (orientation: landscape) {
  html {
    scroll-snap-type: y mandatory;
  }

  .topbar,
  .footer {
    display: none;
  }

  .page-shell {
    display: block;
    width: 100%;
    padding: 0;
  }

  .feed-column {
    display: block;
  }

  .feed-list {
    gap: 0;
  }

  .post-card {
    min-height: 100svh;
    scroll-snap-align: start;
    background: #050914;
  }

  .media-slide {
    height: 100svh;
    min-height: 100svh;
    max-height: none;
  }

  .post-body {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    padding: 32px 12px 12px;
    background: linear-gradient(180deg, transparent, rgba(5, 9, 20, 0.88) 42%, rgba(5, 9, 20, 0.96));
    color: #fff;
  }

  .post-kicker,
  .post-description {
    color: rgba(255, 255, 255, 0.72);
  }

  .post-description-block,
  .post-body .tag-list {
    display: none;
  }

  .post-description-block.has-link {
    display: grid;
  }

  .post-description-block.has-link .post-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
  }

  .media-overlay {
    right: auto;
    max-width: 190px;
  }

  .media-expand,
  .swipe-cue {
    display: none;
  }

  .post-actions {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    z-index: 4;
    display: flex;
    width: auto;
    padding: 0;
  }

  .action-button {
    min-width: 54px;
    min-height: 44px;
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(5, 9, 20, 0.52);
    color: #fff;
    backdrop-filter: blur(12px);
  }

  .action-button.primary {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(37, 99, 235, 0.72);
  }

  .comments-panel {
    position: relative;
    z-index: 4;
  }

  .post-card.gallery {
    min-height: auto;
    background: var(--surface);
  }

  .post-card.gallery .post-body {
    position: static;
    padding: 12px 12px 2px;
    background: transparent;
    color: var(--text);
  }

  .post-card.gallery .post-kicker,
  .post-card.gallery .post-description {
    color: var(--text-muted);
  }

  .post-card.gallery .post-description-block {
    display: grid;
  }

  .post-card.gallery .post-description {
    display: -webkit-box;
  }

  .post-card.gallery .post-description-block.is-expanded .post-description {
    display: block;
  }

  .post-card.gallery .post-body .tag-list {
    display: flex;
  }

  .post-card.gallery .post-actions {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: auto;
    padding: 9px 12px 12px;
  }

  .post-card.gallery .action-button {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text-soft);
    backdrop-filter: none;
  }

  .post-card.gallery .action-button.primary {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
  }

}

@media (max-width: 430px) {
  .media-slide {
    height: calc(100svh - 236px);
    min-height: 380px;
  }

  .post-kicker {
    font-size: 0.72rem;
  }

  .post-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
  }

  .post-description.has-link {
    display: -webkit-box;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #ambient-canvas {
    display: none;
  }
}
