/* Spirit Bits (spiritbits) — Organic Handmade Paper, Translucent Wash & Literary Typography */

@font-face {
  font-family: "Shippori Mincho";
  src: url("/fonts/shippori-mincho-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Shippori Mincho";
  src: url("/fonts/shippori-mincho-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper-linen: #efece4;
  --paper-tea: #ece5d5;
  --paper-lichen: #e6eae2;
  --paper-clay: #efe5dc;
  --paper-mist: #e5e9ec;

  --paper-active: var(--paper-linen);
  --ink-primary: #1c1d1a;
  --ink-secondary: #51544c;
  --ink-muted: #6e7268;
  --ink-whisper: rgba(28, 29, 26, 0.22);
  --border-hairline: rgba(28, 29, 26, 0.11);

  --accent-moss: #364739;
  --accent-moss-hover: #29382c;
  --accent-moss-ink: #f5f2ea;
  --danger-clay: #7c3629;

  --font-poem: "Shippori Mincho", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-studio: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;

  --ease-meditative: cubic-bezier(0.22, 1, 0.36, 1);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-height: 100dvh;
  background-color: var(--paper-active);
  color: var(--ink-primary);
  font-family: var(--font-poem);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Fixed handmade paper fiber grain overlay (GPU-safe, pointer-events: none) */
.paper-fiber-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='fiber'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23fiber)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}

/* ============================================================================
   PUBLIC CONTEMPLATIVE CAROUSEL (/) — ZERO EXTRANEOUS WORDS
   ============================================================================ */

body.public-sanctuary {
  overflow: hidden;
  height: 100dvh;
}

.poem-carousel {
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-y pan-x;
}

.poem-carousel::-webkit-scrollbar {
  display: none;
}

.poem-slide {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2.5rem, 8vw, 7rem) clamp(1.75rem, 7vw, 6rem);
  overflow: hidden;
  transition: background-color 900ms var(--ease-meditative);
}

.poem-slide[data-paper="linen"] {
  background-color: var(--paper-linen);
}
.poem-slide[data-paper="tea"] {
  background-color: var(--paper-tea);
}
.poem-slide[data-paper="lichen"] {
  background-color: var(--paper-lichen);
}
.poem-slide[data-paper="clay"] {
  background-color: var(--paper-clay);
}
.poem-slide[data-paper="mist"] {
  background-color: var(--paper-mist);
}

/* Organic blotchy watercolor / mineral wash layer behind each poem */
.wash-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.wash-blotch {
  position: absolute;
  border-radius: 54% 46% 61% 39% / 48% 58% 42% 52%;
  filter: blur(56px);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* Optical vertical centering slightly above geometric middle (46% horizon) */
.poem-vessel {
  position: relative;
  z-index: 2;
  max-width: 58ch;
  width: 100%;
  transform: translateY(-2vh);
  opacity: 1;
  transition: opacity 750ms var(--ease-meditative), transform 750ms var(--ease-meditative);
}

.poem-vessel[data-scale="spark"] {
  font-size: clamp(2.25rem, 4.8vw, 4rem);
  line-height: 1.3;
  letter-spacing: -0.025em;
  text-align: center;
  text-wrap: balance;
}

.poem-vessel[data-scale="short"] {
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  line-height: 1.65;
  letter-spacing: -0.015em;
  text-align: left;
  width: fit-content;
  margin-inline: auto;
}

.poem-vessel[data-scale="stanza"] {
  font-size: clamp(1.25rem, 2.1vw, 1.85rem);
  line-height: 1.72;
  letter-spacing: -0.01em;
  text-align: left;
  width: fit-content;
  margin-inline: auto;
}

.poem-vessel[data-scale="extended"] {
  font-size: clamp(1.08rem, 1.65vw, 1.42rem);
  line-height: 1.75;
  letter-spacing: 0;
  text-align: left;
  width: fit-content;
  margin-inline: auto;
}

.poem-stanza {
  margin-bottom: 1.35em;
}

.poem-stanza:last-child {
  margin-bottom: 0;
}

.poem-line {
  display: block;
}

.poem-vessel em {
  font-style: italic;
}

.poem-vessel strong {
  font-weight: 700;
}

/* Wordless spatial stone dots for 2+ poems */
.carousel-dots {
  position: fixed;
  right: clamp(1.25rem, 3vw, 2.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0.45;
  transition: opacity 500ms var(--ease-meditative);
}

.carousel-dots:hover,
.carousel-dots:focus-within {
  opacity: 0.9;
}

.carousel-dots[hidden] {
  display: none;
}

.stone-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 1px solid var(--ink-primary);
  background: transparent;
  padding: 0;
  cursor: pointer;
  opacity: 0.25;
  transition: transform 400ms var(--ease-meditative), opacity 400ms var(--ease-meditative), background-color 400ms var(--ease-meditative);
}

.stone-dot[aria-current="true"] {
  background: var(--ink-primary);
  opacity: 0.65;
  transform: scale(1.28);
}

.stone-dot:focus-visible {
  outline: 2px solid var(--accent-moss);
  outline-offset: 4px;
}

/* Wordless edge click zones for 2+ poems (pure CSS hairpin chevron, zero text) */
.viewer-click-zone {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: clamp(8rem, 26vw, 18rem);
  height: clamp(2.75rem, 7vh, 4.25rem);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.14;
  transition: opacity 450ms var(--viewer-easing, var(--ease-meditative)),
    transform 450ms var(--viewer-easing, var(--ease-meditative));
}

.viewer-click-zone-prev {
  top: clamp(0.5rem, 1.8vh, 1.25rem);
}

.viewer-click-zone-next {
  bottom: clamp(0.5rem, 1.8vh, 1.25rem);
}

.viewer-click-zone::before {
  content: "";
  display: block;
  width: 9px;
  height: 9px;
  border-right: 1.25px solid var(--ink-primary);
  border-bottom: 1.25px solid var(--ink-primary);
  transition: transform 350ms var(--viewer-easing, var(--ease-meditative));
}

.viewer-click-zone-prev::before {
  transform: rotate(-135deg);
}

.viewer-click-zone-next::before {
  transform: rotate(45deg);
}

.viewer-click-zone:hover,
.viewer-click-zone:focus-visible {
  opacity: 0.55;
}

.viewer-click-zone:focus-visible {
  outline: 2px solid var(--accent-moss);
  outline-offset: 4px;
  border-radius: 999px;
}

.viewer-click-zone[disabled],
.viewer-click-zone[data-at-boundary="true"] {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================================
   OWNER STUDIO SURFACES (/log AND /review) — OPERATE MODE
   ============================================================================ */

body.studio-surface {
  min-height: 100dvh;
  position: relative;
  transition: background-color 600ms var(--ease-meditative);
}

.studio-shell {
  position: relative;
  z-index: 5;
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 2.5rem) 5rem;
}

.studio-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--border-hairline);
  font-family: var(--font-studio);
}

.studio-brand {
  font-family: var(--font-poem);
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--ink-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.studio-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.studio-link,
.studio-btn {
  font-family: var(--font-studio);
  font-size: 0.84rem;
  line-height: 1.2;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-hairline);
  background: rgba(255, 255, 255, 0.36);
  color: var(--ink-primary);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: transform 250ms var(--ease-meditative), background-color 250ms var(--ease-meditative), border-color 250ms var(--ease-meditative);
}

.studio-link:hover,
.studio-btn:hover {
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(28, 29, 26, 0.28);
}

.studio-link:active,
.studio-btn:active {
  transform: scale(0.98);
}

.studio-btn-primary {
  background: var(--accent-moss);
  color: var(--accent-moss-ink);
  border-color: var(--accent-moss);
}

.studio-btn-primary:hover {
  background: var(--accent-moss-hover);
  color: var(--accent-moss-ink);
}

.studio-btn-danger {
  color: var(--danger-clay);
  border-color: rgba(124, 54, 41, 0.25);
}

/* Double-Bezel / Nested Enclosure Card for Studio Composer */
.double-bezel-outer {
  background: rgba(28, 29, 26, 0.035);
  border: 1px solid rgba(28, 29, 26, 0.08);
  padding: 0.45rem;
  border-radius: 1.5rem;
}

.double-bezel-inner {
  position: relative;
  overflow: hidden;
  background: var(--paper-linen);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: calc(1.5rem - 0.35rem);
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.field-label {
  font-family: var(--font-studio);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

.field-input,
.poem-textarea {
  width: 100%;
  border: 1px solid rgba(28, 29, 26, 0.18);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.52);
  color: var(--ink-primary);
  padding: 0.85rem 1rem;
  transition: border-color 250ms var(--ease-meditative), background-color 250ms var(--ease-meditative);
}

.field-input {
  font-family: var(--font-studio);
  font-size: 0.9rem;
}

.poem-textarea {
  font-family: var(--font-poem);
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  line-height: 1.68;
  min-height: 240px;
  resize: vertical;
}

.field-input:focus,
.poem-textarea:focus {
  outline: none;
  border-color: var(--accent-moss);
  background: rgba(255, 255, 255, 0.82);
}

.substrate-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-hairline);
  font-family: var(--font-studio);
}

.paper-swatches {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.paper-swatch {
  font-family: var(--font-studio);
  font-size: 0.76rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(28, 29, 26, 0.18);
  cursor: pointer;
  color: var(--ink-primary);
}

.paper-swatch[aria-pressed="true"] {
  border-color: var(--accent-moss);
  box-shadow: 0 0 0 2px rgba(54, 71, 57, 0.22);
  font-weight: 700;
}

/* Hide-Edit / Full Rendered Preview Mode inside /log and /review */
body.preview-only-mode .hide-in-preview {
  display: none !important;
}

.FloatingPreviewExit {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 40;
}

.status-banner {
  font-family: var(--font-studio);
  font-size: 0.85rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-top: 1rem;
  background: rgba(54, 71, 57, 0.1);
  color: var(--ink-primary);
}

.status-banner[data-kind="error"] {
  background: rgba(124, 54, 41, 0.12);
  color: var(--danger-clay);
}

/* Review Queue Cards */
.review-list {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.review-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-family: var(--font-studio);
  font-size: 0.8rem;
  color: var(--ink-secondary);
}

.status-pill {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(28, 29, 26, 0.08);
  color: var(--ink-primary);
}

.status-pill[data-status="published"] {
  background: rgba(54, 71, 57, 0.16);
  color: var(--accent-moss);
}

@media (max-width: 767px) {
  .poem-slide {
    padding: 2rem 1.25rem;
  }
  .studio-shell {
    padding: 1.25rem 1rem 4rem;
  }
  .studio-topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

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