:root {
  --void: #070b12;
  --ink: #0c1220;
  --panel: #121a2b;
  --line: rgba(232, 185, 35, 0.22);
  --guide: #e8b923;
  --guide-dim: #b8921c;
  --fog: #9aa7bd;
  --paper: #e8eef8;
  --danger: #ff6b5a;
  --ok: #5dcea6;
  --font-display: "Syne", "Avenir Next", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--paper);
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(232, 185, 35, 0.12), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(93, 206, 166, 0.08), transparent 50%),
    linear-gradient(180deg, var(--ink) 0%, var(--void) 100%);
  background-attachment: fixed;
}

body.face-43 {
  background:
    radial-gradient(1000px 600px at 80% -5%, rgba(93, 206, 166, 0.14), transparent 50%),
    radial-gradient(800px 500px at 10% 30%, rgba(232, 185, 35, 0.07), transparent 45%),
    linear-gradient(165deg, #0a1018 0%, #07141a 55%, #050a10 100%);
}

a {
  color: var(--guide);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #ffe28a;
}

.wrap {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 0.5rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.03em;
  color: var(--paper);
  text-decoration: none;
}

.brand span {
  color: var(--guide);
}

.nav-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fog);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-meta a {
  color: var(--fog);
  text-decoration: none;
}

.nav-meta a:hover {
  color: var(--guide);
}

/* —— Hero (one composition) —— */
.hero {
  position: relative;
  min-height: calc(100vh - 4.5rem);
  display: grid;
  align-content: center;
  padding: 3rem 0 4rem;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 8% -10% auto auto;
  width: min(55vw, 520px);
  height: min(55vw, 520px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 40%, rgba(232, 185, 35, 0.2), transparent 55%),
    conic-gradient(from 210deg, transparent, rgba(232, 185, 35, 0.15), transparent 40%);
  filter: blur(2px);
  animation: drift 18s var(--ease) infinite alternate;
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(-4%, 6%, 0) rotate(12deg); }
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--guide);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 1rem;
  opacity: 0;
  animation: rise 0.8s var(--ease) 0.1s forwards;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 1.25rem;
  max-width: 14ch;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.2s forwards;
}

.hero-lead {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--fog);
  max-width: 36rem;
  line-height: 1.55;
  margin: 0 0 2rem;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.35s forwards;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.5s forwards;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  padding: 0.85rem 1.25rem;
  border-radius: 0.35rem;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--guide);
  color: #1a1400;
}

.btn-primary:hover {
  background: #ffd24a;
  color: #1a1400;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--paper);
}

.btn-ghost:hover {
  border-color: var(--guide);
  color: var(--guide);
}

/* —— Entries —— */
.section {
  padding: 3.5rem 0 5rem;
  border-top: 1px solid var(--line);
}

.section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.section-lead {
  color: var(--fog);
  margin: 0 0 2rem;
  max-width: 36rem;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.entry-list li {
  border-top: 1px solid var(--line);
}

.entry-list a {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  padding: 1.35rem 0;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s;
}

.entry-list a:hover {
  background: rgba(232, 185, 35, 0.04);
}

.entry-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--guide-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 0.35rem;
}

.entry-list h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.entry-list p {
  margin: 0;
  color: var(--fog);
  font-size: 0.98rem;
  line-height: 1.45;
}

/* —— Sitemap —— */
.sitemap-hero {
  padding: 3rem 0 1.5rem;
}

.sitemap-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  letter-spacing: -0.04em;
  margin: 0.35rem 0 0.75rem;
}

.sitemap-formats {
  margin: 1.25rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fog);
  letter-spacing: 0.02em;
  max-width: 40rem;
  line-height: 1.6;
}

.sitemap-formats a {
  color: var(--guide);
}

.sitemap-section {
  padding-top: 2.5rem;
}

.sister-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.sister-list a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.sister-list a:hover strong {
  color: #ffe28a;
}

.sister-list strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--guide);
}

.sister-list span {
  color: var(--fog);
  font-size: 0.95rem;
}

/* —— Post —— */
.post-hero {
  padding: 3rem 0 2rem;
}

.post-hero .entry-meta {
  margin-bottom: 0.75rem;
}

.post-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.post-body {
  max-width: 42rem;
  padding-bottom: 4rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: #c9d3e4;
}

.post-body h2,
.post-body h3 {
  font-family: var(--font-display);
  color: var(--paper);
  letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem;
}

.post-body a {
  color: var(--guide);
}

.site-footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fog);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

/* —— ara43 desk with thread rail —— */
.desk-layout {
  display: block;
  padding-bottom: 1.5rem;
}

.desk-layout--threads {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 1.25rem;
  align-items: stretch;
  min-height: calc(100vh - 5rem);
}

.thread-rail {
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(18, 26, 43, 0.65);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: calc(100vh - 6rem);
}

.thread-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.thread-search {
  width: 100%;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  color: var(--paper);
  padding: 0.55rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.thread-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.thread-item {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  color: var(--paper);
  padding: 0.55rem 0.6rem;
  cursor: pointer;
  font-family: var(--font-body);
}

.thread-item:hover,
.thread-item.is-active {
  border-color: var(--line);
  background: rgba(232, 185, 35, 0.08);
}

.thread-item__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.thread-item__meta {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--fog);
  margin-top: 0.2rem;
}

.thread-empty {
  color: var(--fog);
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.thread-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
  min-height: 0.5rem;
}

.tag-chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fog);
  border-radius: 0.25rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
}

.tag-chip:hover {
  color: var(--guide);
  border-color: var(--guide);
}

@media (max-width: 860px) {
  .desk-layout--threads {
    grid-template-columns: 1fr;
  }

  .thread-rail {
    max-height: 220px;
  }
}

.deep-override {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--fog);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.deep-override input {
  accent-color: var(--guide);
}

.effort-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fog);
  margin: 0.15rem 0 0.35rem;
  min-height: 1.1em;
}

/* —— ara43 chat —— */
.chat-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100vh - 5rem);
  padding-bottom: 1.5rem;
  gap: 1rem;
}

.chat-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.5rem 0 0;
}

.chat-toolbar label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fog);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chat-toolbar select {
  background: var(--panel);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  padding: 0.45rem 0.6rem;
  font-family: var(--font-body);
}

.pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border-radius: 0.25rem;
  border: 1px solid var(--line);
  color: var(--fog);
}

.pill.up {
  color: var(--ok);
  border-color: rgba(93, 206, 166, 0.35);
}

.pill.down {
  color: var(--danger);
  border-color: rgba(255, 107, 90, 0.35);
}

.thread {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
  max-height: min(58vh, 640px);
}

.bubble {
  max-width: min(40rem, 92%);
  padding: 0.9rem 1.05rem;
  border-radius: 0.45rem;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: rise 0.35s var(--ease);
}

.bubble.user {
  align-self: flex-end;
  background: rgba(232, 185, 35, 0.12);
  border: 1px solid var(--line);
}

.bubble.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(154, 167, 189, 0.2);
}

.bubble .who {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--guide-dim);
  margin-bottom: 0.4rem;
}

.composer {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(18, 26, 43, 0.85);
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  backdrop-filter: blur(8px);
}

.composer textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  background: transparent;
  border: 0;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.45;
  outline: none;
}

.composer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-line {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fog);
  min-height: 1em;
}

.login-panel {
  max-width: 24rem;
  margin: 12vh auto;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: rgba(18, 26, 43, 0.7);
}

.login-panel h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0 0 0.5rem;
}

.login-panel p {
  color: var(--fog);
  margin: 0 0 1.5rem;
}

.login-panel input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  color: var(--paper);
  font-size: 1rem;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

/* —— Galaxy Moonshot gallery —— */
.gallery-page {
  padding: 1.5rem 0 3rem;
}

.gallery-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
  max-width: 18ch;
}

.gallery-lead {
  color: var(--fog);
  max-width: 40rem;
  line-height: 1.55;
  margin: 0 0 1.5rem;
}

.gallery-status {
  margin: 0.85rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--fog);
}

.gallery-grid {
  column-count: 1;
  column-gap: 1rem;
  margin-top: 2rem;
}

@media (min-width: 576px) {
  .gallery-grid {
    column-count: 2;
  }
}

@media (min-width: 992px) {
  .gallery-grid {
    column-count: 3;
  }
}

.gallery-card {
  break-inside: avoid;
  margin: 0 0 1rem;
  border-radius: 0.45rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(232, 185, 35, 0.12);
  position: relative;
  cursor: zoom-in;
}

.gallery-card:focus-visible {
  outline: 2px solid rgba(232, 185, 35, 0.7);
  outline-offset: 2px;
}

.gallery-card img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-expand-btn,
.gallery-remove-btn,
.gallery-lightbox-close {
  border: 0;
  cursor: pointer;
}

.gallery-expand-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.35rem;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.gallery-expand-btn svg {
  width: 1rem;
  height: 1rem;
}

.gallery-remove-btn {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  height: 1.85rem;
  padding: 0 0.55rem;
  border-radius: 0.35rem;
  background: rgba(127, 29, 29, 0.82);
  color: #fecaca;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}

.gallery-card:hover .gallery-expand-btn,
.gallery-card:focus-within .gallery-expand-btn,
.gallery-card:hover .gallery-remove-btn,
.gallery-card:focus-within .gallery-remove-btn {
  opacity: 1;
}

.gallery-card.is-removing {
  opacity: 0.45;
  pointer-events: none;
}

.gallery-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 0.7rem 0.55rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.gallery-sentinel {
  text-align: center;
  color: var(--fog);
  font-size: 0.85rem;
  padding: 1.25rem 0 2rem;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: none;
  padding: clamp(0.5rem, 1.5vw, 1rem);
  background: rgba(7, 11, 18, 0.9);
  backdrop-filter: blur(4px);
}

.gallery-lightbox.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-shell {
  position: relative;
  width: min(96vw, 100%);
  height: min(96vh, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.gallery-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(96vh - 3.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.35rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(100%, 48rem);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
}

.gallery-lightbox-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.35rem;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
}

.gallery-lightbox-close svg {
  width: 1.05rem;
  height: 1.05rem;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-teaser-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

@media (min-width: 768px) {
  .gallery-teaser-strip {
    grid-template-columns: repeat(6, 1fr);
  }
}

.gallery-teaser-shot {
  display: block;
  overflow: hidden;
  border-radius: 0.35rem;
  border: 1px solid rgba(232, 185, 35, 0.14);
  aspect-ratio: 4 / 3;
  background: var(--panel);
}

.gallery-teaser-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s var(--ease);
}

.gallery-teaser-shot:hover img {
  transform: scale(1.04);
}

@media (max-width: 640px) {
  .entry-list a {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .hero {
    min-height: auto;
    padding-top: 2.5rem;
  }

  .gallery-teaser-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}
