/* The “Scorpio” Ball — guestbook and host pages.
   Builds on site.css: same tokens, buttons, fields and type. */

.gb {
  display: flex;
  flex-direction: column;
  gap: clamp(44px, 6vw, 88px);
  padding: clamp(32px, 6vw, 88px) 0 clamp(56px, 8vw, 112px);
}

.gb-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.gb-lead {
  color: var(--silver);
  text-wrap: balance;
}

.gb-center {
  text-align: center;
}

.gb-open {
  display: flex;
  flex-direction: column;
  gap: clamp(64px, 8vw, 112px);
}

.gb-open[hidden] {
  display: none;
}

/* One centred column for the code, the form and the host sign-in. */
.gb-panel {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.gb-words {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.gb-title {
  font-family: var(--serif);
  font-variation-settings: 'opsz' 30;
  font-weight: 500;
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.15;
  color: var(--white);
}

.gb-title:focus {
  outline: none;
}

.gb-note {
  font-size: 16px;
  color: var(--pewter);
}

.gb-panel .form-row {
  flex-direction: column;
  text-align: center;
}

.gb-code-field {
  font-size: 22px;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

/* ---------- Photo picker ---------- */

.gb-label {
  font-size: 15px;
  color: var(--pewter);
}

.gb-quiet {
  color: var(--edge);
}

.gb-photos-field {
  gap: 12px;
}

.gb-picked {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.gb-picked:empty {
  display: none;
}

.gb-pick {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: #0B0D10;
  font-size: 13px;
  line-height: 1.3;
  color: var(--pewter);
  text-align: center;
}

.gb-pick img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gb-pick[data-state="error"] {
  padding: 8px 36px 8px 8px;
}

.gb-pick-wait {
  animation: gb-breathe 1.4s ease-in-out infinite;
}

@keyframes gb-breathe {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gb-pick-wait {
    animation: none;
  }
}

.gb-pick-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #FFFFFF;
  cursor: pointer;
}

/* The real file input stays focusable; the label is what you see. */
.gb-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.gb-file:focus-visible + .gb-add {
  outline: 2px solid var(--tide);
  outline-offset: 4px;
}

.gb-add {
  align-self: flex-start;
  min-height: 48px;
  padding: 0 26px;
  font-size: 16px;
}

.gb-add.is-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* ---------- After posting ---------- */

.gb-thanks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 36px 24px;
  border: 1px solid var(--rule);
  text-align: center;
}

.gb-thanks:focus {
  outline: none;
}

.gb-thanks-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-variation-settings: 'opsz' 28;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
  color: var(--white);
}

.gb-thanks .ghost {
  margin-top: 8px;
}

/* ---------- The wall ---------- */

.gb-wall-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gb-wall-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.gb-link {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--pewter);
  font: inherit;
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.gb-link:hover {
  color: var(--white);
}

.gb-link[disabled] {
  opacity: 0.5;
  cursor: default;
}

.gb-wall-status:empty {
  display: none;
}

.gb-wall {
  columns: 3 300px;
  column-gap: 24px;
}

.gb-post {
  break-inside: avoid;
  margin: 0 0 24px;
  padding: 1px;
  background: linear-gradient(155deg, #AEB8C4, #2F363F 32%, #1E232A 60%, #6B7683);
}

.gb-post-face {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--black);
}

.gb-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: -20px -20px 0;
}

.gb-photos[data-count="1"] {
  grid-template-columns: 1fr;
}

.gb-photo {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #0B0D10;
  cursor: zoom-in;
}

.gb-photos[data-count="1"] .gb-photo {
  aspect-ratio: auto;
}

.gb-photos[data-count="3"] .gb-photo:first-child,
.gb-photos[data-count="5"] .gb-photo:first-child {
  grid-column: 1 / -1;
  aspect-ratio: 2 / 1;
}

.gb-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gb-photos[data-count="1"] .gb-photo img {
  height: auto;
  max-height: 72vh;
}

.gb-photo:focus-visible {
  outline: 2px solid var(--tide);
  outline-offset: -2px;
}

.gb-message {
  font-size: 17px;
  line-height: 1.6;
  color: var(--white);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.gb-sign {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}

.gb-name {
  font-family: var(--serif);
  font-style: italic;
  font-variation-settings: 'opsz' 24;
  font-size: 22px;
  line-height: 1.2;
  color: var(--white);
  overflow-wrap: anywhere;
}

.gb-date {
  font-size: 14px;
  color: var(--pewter);
}

.gb-empty {
  padding: 40px 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.3;
  color: var(--pewter);
  text-align: center;
  text-wrap: balance;
  column-span: all;
}

/* ---------- Photo viewer ---------- */

.gb-viewer {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.97);
  color: var(--silver);
}

.gb-viewer::backdrop {
  background: rgba(0, 0, 0, 0.9);
}

.gb-viewer[open] {
  display: grid;
  place-items: center;
}

.gb-viewer-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 64px 12px 20px;
}

.gb-viewer-figure img {
  display: block;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 140px);
  max-height: calc(100svh - 140px);
  object-fit: contain;
}

.gb-viewer-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--white);
}

.gb-viewer-button {
  position: fixed;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #FFFFFF;
  cursor: pointer;
}

.gb-viewer-button:hover {
  border-color: var(--white);
}

.gb-viewer-close {
  top: 12px;
  right: 12px;
}

.gb-viewer-prev,
.gb-viewer-next {
  top: 50%;
  transform: translateY(-50%);
}

.gb-viewer-prev {
  left: 12px;
}

.gb-viewer-next {
  right: 12px;
}

/* ---------- Host page ---------- */

.gh-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gh-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

/* Three equal tabs: the status, with its count underneath. */
.gh-tabs {
  display: grid;
  flex: 1 1 320px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 520px;
}

.gh-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 6px 8px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: transparent;
  color: var(--silver);
  font: inherit;
  font-size: 14px;
  line-height: 1.25;
  cursor: pointer;
}

.gh-tab-count {
  font-family: var(--serif);
  font-variation-settings: 'opsz' 24;
  font-size: 22px;
  line-height: 1.1;
}

.gh-tab[aria-selected="true"] {
  border-color: transparent;
  background: linear-gradient(180deg, #FFFFFF, #B4BECA);
  color: #000000;
}

.gh-tools {
  display: flex;
  gap: 20px;
}

.gh-list {
  columns: 2 340px;
  column-gap: 24px;
}

.gh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gh-actions .btn,
.gh-actions .ghost {
  min-height: 44px;
  padding: 0 22px;
  font-size: 15px;
}

.gh-settings {
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--pewter);
}

.gh-settings summary {
  min-height: 44px;
  font-size: 16px;
  cursor: pointer;
}

.gh-settings .form {
  max-width: 420px;
  padding-top: 12px;
}
