:root {
  color-scheme: light;
  --background: #efe4cf;
  --background-deep: #d7c4a1;
  --paper: rgba(255, 251, 243, 0.86);
  --paper-strong: #fffaf1;
  --ink: #2e231b;
  --ink-soft: #5d4a3a;
  --accent: #244636;
  --accent-soft: rgba(36, 70, 54, 0.12);
  --line: rgba(67, 47, 27, 0.12);
  --shadow: 0 30px 60px rgba(72, 46, 20, 0.12);
  --content-width: 920px;
  --panel-width: 300px;
  --utility-width: 240px;
  --font-display: "Baskerville", "Iowan Old Style", "Palatino Linotype",
    "Book Antiqua", Georgia, serif;
  --font-body: "Literata", "Iowan Old Style", "Palatino Linotype", Georgia,
    serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 32%),
    radial-gradient(circle at right 12% top 24%, rgba(133, 93, 52, 0.14), transparent 18%),
    linear-gradient(135deg, rgba(255, 248, 235, 0.82), rgba(228, 208, 173, 0.72)),
    repeating-linear-gradient(
      180deg,
      rgba(108, 79, 40, 0.03),
      rgba(108, 79, 40, 0.03) 1px,
      transparent 1px,
      transparent 32px
    ),
    var(--background);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

#app {
  min-height: 100vh;
}

.site-shell {
  display: grid;
  grid-template-columns:
    minmax(240px, var(--panel-width))
    minmax(0, var(--content-width))
    minmax(190px, var(--utility-width));
  justify-content: center;
  align-items: start;
  width: min(100%, 1700px);
  margin: 0 auto;
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.site-shell > * {
  min-width: 0;
}

.bookmark-panel,
.utility-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.bookmark-panel.is-expanded {
  align-self: stretch;
  height: var(--bookmark-panel-height, auto);
  min-height: 0;
}

.bookmark-card,
.utility-card {
  padding: 22px 18px;
  border: 1px solid rgba(36, 70, 54, 0.14);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.84), rgba(255, 247, 233, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.bookmark-card.is-expanded {
  display: flex;
  flex: 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel-label {
  margin: 0 0 16px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7a6246;
}

.bookmark-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bookmark-link {
  display: block;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 249, 238, 0.68);
  box-shadow: 0 10px 24px rgba(58, 40, 20, 0.08);
  color: var(--ink-soft);
  transform: translateX(0);
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.bookmark-link:hover,
.bookmark-link:focus-visible {
  color: var(--ink);
  border-color: rgba(36, 70, 54, 0.2);
  transform: translateX(6px);
}

.bookmark-link.is-active {
  color: var(--paper-strong);
  background: linear-gradient(135deg, #2b4d3d, #345f4b);
}

.bookmark-label {
  display: block;
  font-size: 0.98rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.content-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bookmark-menu[open] .panel-arrow,
.language-menu[open] .language-arrow {
  transform: rotate(180deg);
}

.bookmark-card.is-expanded .bookmark-menu {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.bookmark-summary,
.language-summary {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 249, 238, 0.8);
  cursor: pointer;
  list-style: none;
}

.bookmark-summary {
  grid-template-columns: 1fr auto;
  margin-bottom: 12px;
}

.language-summary {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.bookmark-summary::-webkit-details-marker,
.language-summary::-webkit-details-marker {
  display: none;
}

.bookmark-current,
.language-badge,
.language-link-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bookmark-current {
  justify-content: flex-start;
  min-height: 34px;
  padding: 0 14px;
  color: var(--ink);
  text-transform: none;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.language-current {
  display: block;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.panel-arrow,
.language-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  color: var(--ink-soft);
  transition: transform 180ms ease;
}

.bookmark-scroll {
  max-height: calc(100vh - 360px);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 6px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.bookmark-card.is-expanded .bookmark-scroll {
  height: 100%;
  min-height: 0;
  max-height: none;
}

.bookmark-scroll::-webkit-scrollbar,
.language-list::-webkit-scrollbar {
  width: 10px;
}

.bookmark-scroll::-webkit-scrollbar-thumb,
.language-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(36, 70, 54, 0.28);
  background-clip: padding-box;
}

.language-list {
  display: flex;
  max-height: min(50vh, 420px);
  margin-top: 12px;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.language-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: rgba(255, 249, 238, 0.68);
  color: var(--ink-soft);
}

.language-link-label {
  line-height: 1.4;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.language-link.is-active {
  border-color: rgba(36, 70, 54, 0.2);
  background: rgba(36, 70, 54, 0.12);
  color: var(--ink);
}

.page-frame {
  width: 100%;
  padding: clamp(26px, 4vw, 54px);
  border: 1px solid rgba(120, 85, 50, 0.14);
  border-radius: 32px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 248, 237, 0.9)),
    var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.landing-page,
.cover-page,
.essay-page {
  display: flex;
  min-height: min(78vh, 960px);
  flex-direction: column;
}

.page-enter {
  animation: page-fade 340ms ease;
}

.landing-page h1,
.cover-page h1,
.essay-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 1.65rem);
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
}

.landing-hero {
  display: block;
}

.hero-copy {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 18px;
}

.lead,
.supporting-text {
  margin: 0;
  font-size: 1.08rem;
  line-height: 2;
  color: var(--ink);
  text-align: justify;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.hero-copy .lead,
.hero-copy .supporting-text {
  text-indent: 1.5rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.button-primary {
  color: var(--paper-strong);
  background: linear-gradient(135deg, #294938, #38624d);
}

.button-secondary {
  color: var(--accent);
  border-color: rgba(36, 70, 54, 0.18);
  background: rgba(255, 252, 246, 0.88);
}

.button-primary:hover,
.button-primary:focus-visible,
.button-secondary:hover,
.button-secondary:focus-visible {
  transform: translateY(-1px);
}

.contact-email-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--accent);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cover-page {
  justify-content: space-between;
}

.cover-body {
  display: flex;
  min-height: 100%;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.cover-ornament {
  width: min(100%, 240px);
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(36, 70, 54, 0.3), transparent);
}

.cover-subtitle {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a6246;
  overflow-wrap: anywhere;
}

.cover-note {
  width: 100%;
  margin: 0 auto;
  font-size: 1.08rem;
  line-height: 2;
  color: var(--ink);
  text-align: justify;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.translation-disclaimer {
  margin: 0 0 20px;
  font-size: 0.94rem;
  line-height: 1.7;
  color: rgba(46, 35, 27, 0.56);
  text-align: justify;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.essay-header {
  margin-bottom: 28px;
}

.essay-content {
  width: 100%;
}

.essay-content p {
  margin: 0;
  font-size: 1.08rem;
  line-height: 2;
  color: var(--ink);
  text-align: justify;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.essay-content p + p {
  margin-top: 18px;
  text-indent: 1.5rem;
}

.essay-content p:first-child::first-letter {
  float: left;
  padding-right: 10px;
  font-family: var(--font-display);
  font-size: 4.2rem;
  line-height: 0.9;
  color: #7a6246;
}

.essay-footer {
  margin-top: 28px;
}

.page-footer {
  margin-top: auto;
  padding-top: 28px;
}

.page-pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.page-link {
  display: inline-flex;
  flex: 1 1 0;
  min-height: 46px;
  align-items: center;
  padding: 0 2px;
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.page-link.is-previous {
  justify-content: flex-start;
}

.page-link.is-next {
  margin-left: auto;
  justify-content: flex-end;
  text-align: right;
}

.page-link.is-disabled {
  opacity: 0.34;
  pointer-events: none;
}

@keyframes page-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1200px) {
  .site-shell {
    grid-template-columns: 1fr;
    width: min(100%, 980px);
  }

  .bookmark-panel,
  .utility-panel {
    position: static;
  }

  .bookmark-panel,
  .bookmark-card,
  .bookmark-menu,
  .bookmark-scroll,
  .bookmark-nav {
    width: 100%;
  }

  .bookmark-panel.is-expanded {
    height: auto;
    overflow: visible;
  }

  .utility-panel {
    order: -1;
  }

  .utility-card {
    padding: 16px;
  }

  .language-list {
    max-height: 240px;
  }

  .bookmark-link {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .site-shell {
    padding: 16px;
    gap: 16px;
  }

  .page-frame {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .essay-content p {
    font-size: 1rem;
    line-height: 1.9;
  }

  .essay-content p + p {
    text-indent: 1rem;
  }

  .language-link {
    grid-template-columns: auto 1fr;
  }

  .bookmark-summary {
    grid-template-columns: 1fr auto;
  }

  .language-summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .bookmark-nav {
    flex-direction: column;
  }

  .bookmark-scroll {
    overflow: visible;
    padding-bottom: 0;
  }

  .bookmark-link {
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .page-pagination {
    gap: 10px;
  }
}
