:root {
  --ink: #17110e;
  --paper: rgba(255, 250, 239, 0.64);
  --paper-strong: rgba(255, 252, 246, 0.84);
  --line: rgba(78, 49, 34, 0.24);
  --rust: #7b3327;
  --amber: #c58a49;
  --cream: #fff9ee;
  --shadow: rgba(15, 9, 5, 0.46);
  --display: Georgia, "Times New Roman", serif;
  --body: Georgia, "Times New Roman", serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: #130f0c;
  font-family: var(--body);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  padding: 0.65rem 0.8rem;
  color: #160d08;
  background: var(--cream);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: none;
}

.video-wallpaper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 70%, rgba(197, 138, 73, 0.28), transparent 34%),
    linear-gradient(120deg, #26150d 0%, #76503c 44%, #e0bf84 100%);
}

.video-wallpaper video,
.video-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.video-wallpaper video {
  object-fit: cover;
  object-position: center;
  filter: saturate(0.9) contrast(1.03) brightness(0.86);
}

.video-fallback {
  opacity: 0;
  background:
    radial-gradient(circle at 22% 74%, rgba(95, 47, 28, 0.42), transparent 34%),
    radial-gradient(circle at 78% 20%, rgba(244, 213, 153, 0.34), transparent 38%),
    linear-gradient(135deg, rgba(30, 14, 9, 0.88), rgba(145, 93, 52, 0.42));
  transition: opacity 320ms ease;
}

body.video-not-ready .video-fallback {
  opacity: 1;
}

.video-wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(16, 10, 7, 0.08) 0%, rgba(16, 10, 7, 0.04) 42%, rgba(255, 246, 231, 0.18) 100%),
    linear-gradient(180deg, rgba(255, 251, 241, 0.09) 0%, rgba(255, 251, 241, 0.22) 100%);
}

.journal-shell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(1.5rem, 4vw, 5rem);
  width: min(100%, 118rem);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 5.5rem);
}

.title-block {
  flex: 1 1 26rem;
  max-width: 32rem;
  min-height: auto;
  padding-bottom: 0;
  color: var(--cream);
  text-shadow: 0 0.18rem 1.5rem rgba(0, 0, 0, 0.62);
}

.kicker,
.folio,
.prompt {
  margin: 0;
  font-size: clamp(0.68rem, 1.2vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.kicker {
  color: rgba(255, 241, 211, 0.78);
}

h1 {
  max-width: 10.5ch;
  margin: clamp(0.7rem, 2vw, 1.35rem) 0 1rem;
  color: #fff4dc;
  font-size: clamp(4rem, 10vw, 9.2rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.82;
}

.prompt {
  color: rgba(255, 231, 189, 0.82);
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.65rem;
  margin-top: clamp(1.2rem, 3vw, 2rem);
  padding: 0.55rem 0.85rem 0.55rem 0.62rem;
  color: rgba(255, 249, 236, 0.9);
  background: rgba(26, 17, 12, 0.38);
  border: 1px solid rgba(255, 239, 208, 0.38);
  border-radius: 999px;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-family: var(--body);
  text-shadow: none;
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  color: #fff8ea;
  background: rgba(48, 29, 18, 0.54);
  border-color: rgba(255, 242, 218, 0.62);
}

.sound-toggle:focus-visible {
  outline: 2px solid rgba(255, 244, 222, 0.85);
  outline-offset: 3px;
}

.sound-toggle[aria-pressed="true"] {
  background: rgba(123, 51, 39, 0.54);
}

.sound-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  color: #2b160f;
  background: rgba(255, 242, 216, 0.86);
  font-size: 0;
}

.sound-icon::before {
  content: "";
  width: 0.62rem;
  height: 0.62rem;
  border: 2px solid currentColor;
  border-left: 0;
  border-bottom: 0;
  transform: rotate(45deg);
}

.sound-icon::after {
  content: "";
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-left: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: translateX(-0.38rem) rotate(-45deg);
}

.sound-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.poem-panel {
  position: relative;
  flex: 0 1 42rem;
  width: min(100%, calc(100vw - 2rem));
  max-width: min(42rem, calc(100vw - 2rem));
  min-width: 0;
  margin: 0 0 0 auto;
  padding: clamp(1.45rem, 3.2vw, 2.9rem);
  color: #21140e;
  overflow: hidden;
  background: rgba(255, 249, 237, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.54);
  box-shadow: 0 1.4rem 4.2rem var(--shadow), inset 0 0 0 1px rgba(92, 58, 36, 0.2);
  backdrop-filter: blur(7px) saturate(0.95);
}

.poem-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(255, 252, 244, 0.58), rgba(255, 250, 241, 0.44)),
    radial-gradient(circle at 25% 20%, rgba(255, 255, 255, 0.24), transparent 44%);
  pointer-events: none;
}

.stone-layer {
  position: absolute;
  inset: -9%;
  z-index: 0;
  width: 118%;
  height: 118%;
  object-fit: cover;
  object-position: center;
  opacity: 0.96;
  filter: saturate(0.82) contrast(1.04) brightness(1.03);
  pointer-events: none;
}

.entry-header {
  position: relative;
  z-index: 2;
  min-width: 0;
  max-width: 100%;
  padding-bottom: clamp(1rem, 2.6vw, 1.7rem);
  border-bottom: 1px solid var(--line);
}

.folio {
  color: var(--rust);
}

h2 {
  max-width: 10ch;
  margin: 0.72rem 0 0;
  color: #2a1710;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 0.94;
  overflow-wrap: anywhere;
}

.journal-text {
  position: relative;
  z-index: 2;
  min-width: 0;
  max-width: 100%;
  padding-top: clamp(1.05rem, 2.6vw, 1.85rem);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.journal-text p {
  margin: 0 0 1.2em;
  max-width: 100%;
  overflow-wrap: break-word;
}

.journal-text p:last-child {
  margin-bottom: 0;
}

.journal-text p:first-child::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: var(--rust);
  font-size: 4.15em;
  font-weight: 700;
  line-height: 0.8;
}

@media (max-width: 880px) {
  .journal-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: clamp(1rem, 5vw, 2rem);
    overflow-x: hidden;
  }

  .title-block {
    min-height: auto;
    padding-top: 8svh;
    padding-bottom: 0;
  }

  h1 {
    max-width: 8.6ch;
  }

  .poem-panel {
    width: min(100%, 20rem);
    max-width: calc(100vw - 2rem);
    margin: 2rem 0 0;
    padding: clamp(1.3rem, 7vw, 1.8rem);
  }

  .journal-text {
    width: 100%;
    max-width: 100%;
    font-size: clamp(0.92rem, 3.75vw, 1.02rem);
    line-height: 1.54;
  }

  .journal-text p {
    padding-right: 0.15rem;
  }

  .journal-text p:first-child::first-letter {
    margin-right: 0.08em;
    font-size: 3.45em;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .video-wallpaper video {
    animation: none;
  }
}
