/* Stargazer museum — static shell */
:root {
  --bg: #0c0b0a;
  --surface: #161410;
  --ink: #efe6d6;
  --muted: #b3a894;
  --subtle: #7a7164;
  --line: #3a342c;
  --accent: #d7b07a;
  --fg: #efe6d6;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Viewer */
#app { position: relative; width: 100%; height: 100dvh; overflow: hidden; background: var(--bg); }
#c { display: block; width: 100%; height: 100%; touch-action: none; }
.hud {
  pointer-events: none;
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 1.1rem 1.25rem;
}
.hud .pe { pointer-events: auto; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.kicker {
  font-family: system-ui, sans-serif;
  font-size: 0.625rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--subtle);
  margin: 0;
}
.hud h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 400; font-style: italic;
  letter-spacing: -0.03em; line-height: 1;
}
.sub { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.92rem; }
.nav-links {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  margin-left: auto;
  max-width: min(100%, 68rem);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(22, 20, 16, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px -18px rgba(0, 0, 0, 0.8);
}
.nav-links .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.45rem;
  padding: 0 0.78rem;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: 500 0.62rem/1 system-ui, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  backdrop-filter: none;
  cursor: pointer;
  flex: 0 0 auto;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links .chip:last-child { border-right: 0; }
.nav-links .chip:hover {
  background: rgba(239, 230, 214, 0.1);
  text-decoration: none;
}
.nav-links .chip.chip-appfam {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 0.58rem;
  padding: 0 0.95rem;
  white-space: nowrap;
}
.chip {
  display: inline-flex; align-items: center; height: 2.5rem;
  padding: 0 0.85rem; border-radius: 0.55rem;
  border: 1px solid var(--line); background: rgba(22,20,16,0.82);
  color: var(--ink); font: 500 0.7rem/1 system-ui, sans-serif;
  letter-spacing: 0.14em; text-transform: uppercase;
  backdrop-filter: blur(10px); cursor: pointer;
}
.chip:hover { background: rgba(239,230,214,0.08); text-decoration: none; }
.hud-bottom { display: flex; flex-direction: column; align-items: center; gap: 0.65rem; }
.toolbar {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.25rem;
  max-width: 100%; padding: 0.4rem;
  border-radius: 0.75rem; border: 1px solid var(--line);
  background: rgba(22,20,16,0.88); backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px -20px rgba(0,0,0,0.7);
}
.seg { display: flex; gap: 0.15rem; }
.seg button, .iconbtn {
  appearance: none; border: 0; cursor: pointer;
  height: 2.4rem; min-width: 2.4rem; padding: 0 0.7rem;
  border-radius: 0.45rem;
  background: transparent; color: var(--muted);
  font: 500 0.7rem/1 system-ui, sans-serif; letter-spacing: 0.04em;
}
.seg button:hover, .iconbtn:hover { background: rgba(239,230,214,0.08); color: var(--ink); }
.seg button.active, .iconbtn.active { background: var(--ink); color: var(--bg); }
.divider { width: 1px; height: 1.6rem; background: var(--line); margin: 0 0.2rem; }
.hint {
  margin: 0; text-align: center;
  font-family: system-ui, sans-serif;
  font-size: 0.65rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--subtle);
}
.hint-phone { display: none; }
.scatter {
  will-change: transform;
}
.scatter.is-return {
  transition: transform 0.48s cubic-bezier(0.16, 1, 0.3, 1);
}
#load {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--muted);
  font-family: system-ui, sans-serif; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  transition: opacity 0.4s;
}
#load.hidden { opacity: 0; pointer-events: none; }

/* Info panel */
#scrim {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(12,11,10,0.4); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; border: 0; cursor: pointer;
}
#scrim.open { opacity: 1; pointer-events: auto; }
#panel,
#contact-panel,
#purpose-panel,
#build-panel {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(100%, 26rem);
  border-left: 1px solid var(--line);
  background: rgba(22,20,16,0.96); backdrop-filter: blur(16px);
  transform: translateX(100%); transition: transform 0.3s;
  display: flex; flex-direction: column;
  box-shadow: -24px 0 60px -30px rgba(0,0,0,0.65);
}
#panel.open,
#contact-panel.open,
#purpose-panel.open,
#build-panel.open { transform: translateX(0); }
.purpose-list {
  margin: 1.1rem 0 0;
  padding-left: 1.15rem;
  color: var(--muted);
}
.purpose-list li { margin: 0 0 0.7rem; line-height: 1.5; }
.purpose-list li:last-child { margin-bottom: 0; }
.panel-body .q { margin: 1.2rem 0 0.35rem; color: var(--ink); }
.panel-body .log {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.2rem;
  font-size: 0.88rem;
}
.panel-body .log th,
.panel-body .log td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.65rem 0.55rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.panel-body .log th {
  font-family: system-ui, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--subtle);
  font-weight: 500;
}
.mail-list {
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 1.3rem;
}
.mail-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.mail-list li:last-child { border-bottom: 0; }
.mail-list a {
  display: block;
  color: var(--ink);
  font-size: 1.05rem;
}
.mail-list a:hover { color: var(--accent); }
.mail-list span {
  display: block;
  margin-top: 0.2rem;
  color: var(--subtle);
  font-family: system-ui, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.15rem; border-bottom: 1px solid var(--line);
}
.panel-body { flex: 1; overflow-y: auto; padding: 1.15rem; }
.panel-body h2 {
  margin: 0.35rem 0 0; font-size: 1.7rem; font-weight: 400; font-style: italic;
  letter-spacing: -0.03em; line-height: 1.15;
}
.panel-body dl {
  display: grid; grid-template-columns: 7rem 1fr; gap: 0.55rem 0.7rem;
  margin: 1.2rem 0; font-size: 0.9rem;
}
.panel-body dt { color: var(--subtle); }
.panel-body dd { margin: 0; color: var(--ink); }
.panel-body img {
  display: block; width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: top;
  border-radius: 0.75rem; border: 1px solid var(--line);
}
.panel-body h3 {
  margin: 1.2rem 0 0.4rem;
  font-family: system-ui, sans-serif;
  font-size: 0.65rem; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--subtle);
}
.panel-body p, .panel-body li { color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.panel-body ol { padding-left: 1.1rem; margin: 0.4rem 0 0; }
.fine { font-size: 0.75rem !important; color: var(--subtle) !important; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.2rem; }

/* Workshop essay */
.essay { max-width: 42rem; margin: 0 auto; padding: 3.5rem 1.3rem 5rem; }
.essay .mark {
  font-family: system-ui, sans-serif;
  letter-spacing: 0.16em; text-transform: uppercase;
  font-size: 0.72rem; color: var(--accent);
}
.essay h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 400; font-style: italic;
  letter-spacing: -0.03em; margin: 0.7rem 0 0.6rem; line-height: 1.05;
}
.essay .lede { color: var(--muted); font-size: 1.05rem; margin: 0 0 0.5rem; }
.essay .meta { color: var(--subtle); font-size: 0.9rem; margin: 0 0 2rem; }
.essay h2 {
  font-size: 1.65rem; font-weight: 400; font-style: italic;
  letter-spacing: -0.02em; margin: 2.4rem 0 0.7rem;
}
.essay p { color: var(--muted); margin: 0 0 1rem; }
.essay figure {
  margin: 1.4rem 0; border: 1px solid var(--line); border-radius: 0.75rem; overflow: hidden;
}
.essay figure img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.essay figcaption {
  padding: 0.7rem 1rem; border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--subtle); line-height: 1.45;
}
.essay .toc {
  display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.6rem 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin: 1.5rem 0 0.5rem; position: sticky; top: 0;
  background: rgba(12,11,10,0.92); backdrop-filter: blur(8px); z-index: 5;
}
.essay .toc a {
  font-family: system-ui, sans-serif;
  font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); padding: 0.45rem 0.65rem;
}
.essay .toc a:hover { color: var(--ink); }
.essay ul { color: var(--muted); padding-left: 1.15rem; }
.essay .steps {
  list-style: none; padding: 0; margin: 1rem 0 1.4rem;
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 0.75rem; overflow: hidden;
}
.essay .steps li { background: var(--surface); padding: 1rem 1.1rem; }
.essay .steps strong { display: block; color: var(--ink); margin-bottom: 0.25rem; }
.essay .back {
  display: inline-flex; margin-top: 1.5rem; height: 2.6rem; align-items: center;
  padding: 0 1rem; border: 1px solid var(--line); border-radius: 0.55rem;
  background: var(--surface); color: var(--ink); font-size: 0.9rem;
}
.essay .back:hover { text-decoration: none; background: rgba(239,230,214,0.06); }
@media (min-width: 640px) {
  .essay .steps { grid-template-columns: 1fr 1fr; }
  .hud { padding: 1.4rem 1.5rem; }
}
@media (min-width: 1100px) {
  .essay {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 3.2rem 4.5vw 5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 4.5vw;
    align-items: start;
  }
  .essay > .mark,
  .essay > .crumbs,
  .essay > .kicker,
  .essay > h1,
  .essay > .lede,
  .essay > .meta,
  .essay > .toc,
  .essay > .nav-row,
  .essay > p {
    grid-column: 1 / -1;
  }
  .essay > figure {
    grid-column: 1 / -1;
  }
  .essay .steps { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 720px) {
  #app, #c { touch-action: none; }
  #panel, #panel .panel-body,
  #contact-panel, #contact-panel .panel-body,
  #purpose-panel, #purpose-panel .panel-body,
  #build-panel, #build-panel .panel-body { touch-action: pan-y; }
  .hint-desk { display: none; }
  .hint-phone { display: inline; }
  .hud { padding: 0.85rem 0.85rem 0.7rem; }
  .hud h1 { font-size: 1.55rem; }
  .hud-top { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .nav-links { margin-left: 0; max-width: 100%; }

  .hud-bottom {
    width: 100%;
    background: rgba(6, 5, 4, 0.97);
    border: 1px solid #2e2922;
    border-radius: 0.9rem;
    padding: 0.4rem 0.35rem 0.55rem;
    gap: 0.42rem;
    box-shadow: 0 18px 48px -12px rgba(0, 0, 0, 0.95);
  }
  .toolbar {
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0.1rem 0;
  }
}


@media (min-width: 721px) {
  .temp-record {
    outline: 2px solid #6e1222;
    outline-offset: 2px;
    background: #4a0c16 !important;
    color: #ffd6d6 !important;
    box-shadow:
      0 0 0 1px #7a1428,
      0 0 8px #ff1a1a,
      0 0 18px rgba(255, 16, 16, 0.85),
      0 0 36px rgba(160, 0, 24, 0.55);
  }
  .temp-record:hover,
  .temp-record:focus-visible {
    background: #5c101c !important;
    color: #fff !important;
    box-shadow:
      0 0 0 1px #a01830,
      0 0 12px #ff2a2a,
      0 0 28px rgba(255, 24, 24, 0.95),
      0 0 48px rgba(200, 0, 20, 0.7);
  }
}
.pose-out {
  position: fixed;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 100;
  max-width: min(28rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: 0.7rem 0.9rem;
  border: 1px solid #6e1222;
  border-radius: 0.5rem;
  background: rgba(20, 6, 8, 0.92);
  color: #ffd6d6;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: auto;
  box-shadow: 0 0 18px rgba(255, 20, 20, 0.35);
}
