body[data-view="about"],
body[data-view="zen"],
body[data-view="gallery"],
body[data-view="notes"] { background: var(--view-folder); color: var(--paper); }

.folder-view {
  min-height: 100svh;
  animation: viewIn 0.2s ease;
}

@keyframes viewIn { from { opacity: 0; } to { opacity: 1; } }

.page-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 1.35rem 1.4rem 1rem;
  background: var(--view-folder);
  font-size: 0.7rem;
  line-height: 1;
}

.back-btn {
  margin: -0.6rem -0.1rem -0.6rem -0.6rem;
  padding: 0.6rem;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.12s ease, color 0.12s ease;
}

.back-btn:hover,
.back-btn:focus-visible { opacity: 1; color: var(--crimson); }

.page-label { opacity: 0.7; }

.page-body { padding: 0.35rem 1.4rem 6rem; }

.page-text {
  max-width: var(--measure);
  font-size: 0.8rem;
  line-height: 1.3;
}

.page-text p + p { margin-top: 1.3em; }

.page-figure {
  --figure-w: 50%;
  max-width: var(--measure);
  margin: 2rem 0 0;
}

.page-figure img {
  display: block;
  width: var(--figure-w);
  min-width: min(100%, 9rem);
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.page-figure-empty {
  width: var(--figure-w);
  margin-inline: auto;
  aspect-ratio: 4 / 3;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.page-figure--tall { --figure-w: 100%; max-width: 24rem; margin-top: 0.9rem; }

.page-figure--tall img { margin-inline: 0; }

.page-figure--tall .page-figure-empty { aspect-ratio: 3 / 4; margin-inline: 0; }

@media (min-width: 46rem) {
  .page-figure--tall { max-width: clamp(24rem, 50vw, 52rem); }
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 2rem 1.75rem;
  margin-top: 0.55rem;
}

.gallery-grid:empty::before {
  content: 'no images yet — fill in GALLERY_IMAGES in main.js';
  color: var(--muted);
  font-size: 0.7rem;
}

.gallery-tile {
  margin: 0;
  max-width: min(100%, 20rem);
}

.gallery-tile img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70svh;
}

.elsewhere {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

.rias-figure {
  position: relative;
  width: min(190px, 55vw);
  margin: 0 auto 1.75rem;
  -webkit-mask-image: linear-gradient(to bottom, #000 68%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 68%, transparent 100%);
}

.rias-figure img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(1) contrast(1.1) brightness(0.94);
}

.rias-figure::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--crimson);
  mix-blend-mode: multiply;
  opacity: 0.3;
  pointer-events: none;
}

[data-pending] > * { visibility: hidden; }

[data-pending]::after { display: none; }

.rias-figure-empty {
  aspect-ratio: 3 / 4;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.7rem;
  text-align: center;
}

.elsewhere-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  font-size: 0.8rem;
}

.elsewhere-list li:not(:last-child)::after {
  content: '/';
  margin-left: 1.25rem;
  color: var(--muted);
}

@media (max-width: 59.99rem) {
  .elsewhere-list { gap: 0.9rem 1.5rem; }
  .elsewhere-list li:not(:last-child)::after { display: none; }
}

.gb-dialog {
  color-scheme: light;
  position: fixed;
  inset: auto clamp(0.75rem, 3vw, 1.5rem) clamp(0.75rem, 3vw, 1.5rem) auto;
  margin: 0;
  width: min(90vw, 23rem);
  max-height: 78vh;
  padding: 1.4rem 1.5rem;
  border: none;
  border-radius: 3px;
  background-color: #f4ecdd;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 27px,
    rgba(40, 30, 20, 0.08) 28px
  );
  color: #241c14;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45), 0 3px 10px rgba(0, 0, 0, 0.2);

  transform-origin: bottom right;
  transform: rotate(-1deg) scale(0.9) translateY(8px);
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    overlay 0.2s ease allow-discrete,
    display 0.2s ease allow-discrete;
}

.gb-dialog[open] {
  transform: rotate(-1deg) scale(1) translateY(0);
  opacity: 1;
}

@starting-style {
  .gb-dialog[open] {
    transform: rotate(-1deg) scale(0.9) translateY(8px);
    opacity: 0;
  }
}

.gb-dialog::backdrop {
  background: rgba(20, 14, 10, 0.25);
}

.gb-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: rgba(36, 28, 20, 0.5);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.gb-close:hover { color: var(--crimson); background: rgba(0,0,0,0.06); }

.gb-heading { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--crimson); }

.gb-sub { margin-top: 0.3rem; color: rgba(36, 28, 20, 0.6); font-size: 0.75rem; }

.gb-form { margin-top: 1.1rem; }

.gb-field { margin-bottom: 0.8rem; }

.gb-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(36, 28, 20, 0.55);
  margin-bottom: 0.25rem;
}

.gb-field input,
.gb-field textarea {
  width: 100%;
  padding: 0.3rem 0.1rem 0.4rem;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(36, 28, 20, 0.3);
  border-radius: 0;
  color: #241c14;
  font-family: var(--font-body);
  font-size: 0.85rem;
  resize: vertical;
}

.gb-field input:focus,
.gb-field textarea:focus { border-bottom-color: var(--crimson); }

.gb-field input:disabled,
.gb-field textarea:disabled { opacity: 0.4; cursor: not-allowed; }

.gb-hp {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.gb-submit {
  width: 100%;
  padding: 0.55rem 1rem;
  border: 1.5px solid var(--crimson);
  border-radius: 3px;
  background: transparent;
  color: var(--crimson);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.gb-submit:hover { background: var(--crimson); color: #fff8ee; }

.gb-submit:disabled { opacity: 0.6; cursor: progress; }

.gb-status {
  min-height: 1.2em;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: rgba(36, 28, 20, 0.6);
}

.gb-entries {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid rgba(36, 28, 20, 0.2);
  max-height: 12rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.gb-entry-name {
  display: block;
  font-size: 0.72rem;
  color: var(--crimson);
}

.gb-entry-message {
  margin-top: 0.1rem;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.gb-loading, .gb-empty {
  color: rgba(36, 28, 20, 0.55);
  font-size: 0.8rem;
}

.status-corner {
  position: fixed;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: calc(100vw - 1.5rem);
}

/* keep this home-only, same as .gb-trigger: it's tied to the desktop scene,
   not something that should float over the folder pages */
body[data-view]:not([data-view="home"]) .status-corner { display: none; }

.zen-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.zen-badge[data-shown] { opacity: 0.85; }

.zen-badge img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  filter: grayscale(1) contrast(1.1) brightness(1.05);
}

.now-playing {
  margin: 0;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.now-playing[data-shown] { opacity: 1; }

.now-playing-track {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.hidden-mark {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.5rem;
  border: none;
  background: none;
  color: var(--line);
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.hidden-mark:hover,
.hidden-mark:focus-visible {
  opacity: 1;
  color: var(--crimson);
  cursor: pointer;
}

.page-note {
  margin-top: 2rem;
  padding-top: 1.3rem;
  border-top: 1px dashed var(--line-dark);
  opacity: 0.85;
}
