.lore-page {
  position: relative;
  isolation: isolate;
}

.lore-page::before,
.lore-page::after {
  position: absolute;
  z-index: -1;
  inset-inline: 0;
  pointer-events: none;
  content: "";
}

.lore-page::before {
  inset-block: 0;
  opacity: 0.22;
  background-image: linear-gradient(115deg, transparent 0 48%, rgb(158 161 156 / 0.05) 48.2% 48.35%, transparent 48.5%), linear-gradient(35deg, transparent 0 66%, rgb(158 161 156 / 0.035) 66.1% 66.25%, transparent 66.4%);
}

.lore-page::after {
  bottom: 0;
  height: 44rem;
  background: radial-gradient(ellipse at 50% 100%, rgb(158 161 156 / 0.08), transparent 68%);
}

.lore-threshold__layout {
  display: grid;
  grid-template-columns: minmax(0, 54fr) minmax(0, 46fr);
  align-items: center;
  min-height: 29rem;
}

.lore-threshold__copy {
  width: 100%;
  max-width: 43.125rem;
  min-width: 0;
}

.lore-threshold__copy h1 {
  max-width: 21ch;
  font-size: clamp(3.5rem, 6vw, 4rem);
}

.lore-threshold__copy > p {
  max-width: 64ch;
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
}

.lore-threshold__actions,
.lore-trail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  min-width: 0;
}

.lore-threshold__actions > *,
.lore-trail__actions > * {
  min-width: 0;
}

.lore-threshold__atmosphere {
  width: 100%;
  min-width: 0;
  min-height: 20rem;
  background: radial-gradient(circle at 65% 56%, rgb(158 161 156 / 0.09), transparent 26%), linear-gradient(140deg, transparent 12%, rgb(69 72 74 / 0.22) 50%, transparent 80%);
  animation: lore-fog-drift 23s ease-in-out infinite alternate;
}

.lore-feature__frame {
  position: relative;
  overflow: hidden;
  border: var(--border-default);
  background: var(--color-basalt);
}

.lore-feature__media {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 0;
}

.lore-feature__media img {
  object-position: 62% 36%;
}

.lore-feature__frame::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgb(17 18 20 / 0.95) 0%, rgb(17 18 20 / 0.77) 42%, rgb(17 18 20 / 0.18) 70%, transparent 100%), linear-gradient(0deg, rgb(17 18 20 / 0.6), transparent 58%);
  content: "";
  transition: background var(--transition-standard);
}

.lore-feature__frame:focus-within::after,
.lore-feature__frame:hover::after {
  background: linear-gradient(90deg, rgb(17 18 20 / 0.9) 0%, rgb(17 18 20 / 0.65) 42%, rgb(17 18 20 / 0.12) 70%, transparent 100%), linear-gradient(0deg, rgb(17 18 20 / 0.48), transparent 58%);
}

.lore-feature__content {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  width: min(52%, 40rem);
  min-width: 0;
  display: grid;
  gap: var(--space-3);
  border-inline-start: 2px solid transparent;
  padding: var(--space-10);
  transition: border-color var(--transition-fast);
}

.lore-feature__frame:hover .lore-feature__content,
.lore-feature__frame:focus-within .lore-feature__content {
  border-color: var(--color-ember);
}

.lore-feature__content h2 {
  margin: 0;
  font-size: clamp(2.5rem, 4vw, 2.75rem);
}

.lore-feature__content h2 a {
  color: var(--color-ash-primary);
  text-decoration: none;
}

.lore-feature__content p {
  max-width: 58ch;
  margin: 0;
  color: var(--color-ash-primary);
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
}

.lore-feature__meta {
  color: var(--color-ash-primary);
}

.lore-themes__intro {
  width: 100%;
  max-width: 62ch;
}

.lore-themes__intro h2 {
  max-width: 28ch;
}

.lore-themes__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: var(--border-default);
  background: var(--color-stone-line);
}

.lore-theme-card {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: start;
  gap: var(--space-3);
  background: var(--color-basalt);
  padding: var(--space-6);
}

.lore-theme-card > * {
  min-width: 0;
  margin: 0;
}

.lore-theme-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
  transition: background-color var(--transition-fast);
}

.lore-theme-card:hover,
.lore-theme-card:focus-within {
  background: var(--color-basalt-raised);
}

.lore-theme-card:hover::before,
.lore-theme-card:focus-within::before {
  background: var(--color-ember);
}

.lore-theme-card h3 {
  font-size: var(--text-2xl);
}

.lore-theme-card p {
  max-width: 32ch;
}

.lore-theme-card--marked {
  background-image: linear-gradient(135deg, transparent 68%, rgb(158 161 156 / 0.045) 68.2% 68.6%, transparent 68.8%);
}

.lore-records__intro {
  width: 100%;
  max-width: 62ch;
}

.lore-records__wall {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(15rem, auto));
  gap: 1px;
  overflow: hidden;
  border: var(--border-default);
  background: var(--color-stone-line);
}

.lore-record {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--color-basalt);
}

.lore-record--throne { grid-column: 1 / span 7; grid-row: 1 / span 2; }
.lore-record--boss { grid-column: 8 / span 5; grid-row: 1; }
.lore-record--faction { grid-column: 8 / span 5; grid-row: 2; }
.lore-record--map { grid-column: 1 / span 6; grid-row: 3; }
.lore-record--monster { grid-column: 7 / span 6; grid-row: 3; }

.lore-record__media {
  width: 100%;
  min-width: 0;
  height: 100%;
}

.lore-record__media img {
  width: 100%;
  height: 100%;
}

.lore-record--throne .lore-record__media img { object-position: 68% 50%; }
.lore-record--boss .lore-record__media { height: 48%; }
.lore-record--boss .lore-record__media img { object-position: 62% 25%; }
.lore-record--map .lore-record__media { height: 56%; }
.lore-record--map .lore-record__media img { object-position: 50% 60%; }

.lore-record__overlay,
.lore-record__body {
  min-width: 0;
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
}

.lore-record__overlay > *,
.lore-record__body > * { min-width: 0; margin: 0; }

.lore-record__overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-inline-start: 2px solid transparent;
  background: linear-gradient(0deg, rgb(17 18 20 / 0.98), rgb(17 18 20 / 0.82) 76%, transparent);
  padding-top: var(--space-14);
  transition: border-color var(--transition-fast);
}

.lore-record:hover .lore-record__overlay,
.lore-record:focus-within .lore-record__overlay,
.lore-record:hover .lore-record__body,
.lore-record:focus-within .lore-record__body { border-color: var(--color-ember); }

.lore-record__body {
  border-top: 2px solid transparent;
  background: var(--color-basalt);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.lore-record:hover .lore-record__body,
.lore-record:focus-within .lore-record__body { background: var(--color-basalt-raised); }

.lore-record h3 {
  margin: 0;
  font-size: var(--text-xl);
}

.lore-record h3 a { color: var(--color-ash-primary); text-decoration: none; }
.lore-record p { margin: 0; }
.lore-record--throne h3 { font-size: var(--text-2xl); }
.lore-record--throne p { max-width: 46ch; }
.lore-record__body p { max-width: 30ch; }
.lore-records__continuation { margin-block: var(--space-5) 0; }

.lore-shelf__inner {
  width: min(100%, 56.25rem);
  margin-inline: auto;
}

.lore-shelf__intro { max-width: 66ch; }

.lore-shelf__formats {
  display: grid;
  gap: 1px;
  border: var(--border-default);
  background: var(--color-stone-line);
}

.lore-format {
  display: grid;
  grid-template-columns: minmax(0, 28fr) minmax(0, 72fr);
  background: var(--color-basalt);
}

.lore-format__rail,
.lore-format__detail {
  min-width: 0;
  padding: var(--space-6);
}

.lore-format__rail {
  border-inline-end: 1px solid var(--color-stone-line);
}

.lore-format__rail span {
  display: block;
  margin-block-end: var(--space-3);
  color: var(--color-ember-bright);
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  line-height: 1;
}

.lore-format__rail h3 { margin: 0; font-size: var(--text-xl); }
.lore-format__detail { display: grid; gap: var(--space-4); align-content: start; }
.lore-format__detail > * { min-width: 0; margin: 0; }
.lore-format__detail p { max-width: 48ch; }
.lore-format__detail ul { display: grid; gap: var(--space-2); max-width: 48ch; }
.lore-format__detail blockquote { max-width: 42ch; }

.lore-note__panel {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(0, 35fr);
  border: var(--border-default);
  background: var(--color-basalt);
  box-shadow: var(--shadow-inset);
}

.lore-note__prose,
.lore-note__quote { min-width: 0; padding: var(--space-8); }
.lore-note__prose p { max-width: 60ch; }
.lore-note__quote { margin: 0; display: grid; align-content: start; gap: var(--space-3); }
.lore-note__quote > * { margin: 0; }
.lore-note__quote p { max-width: 28ch; color: var(--color-ash-primary); font-size: var(--text-xl); }
.lore-note__quote cite { color: var(--color-ash-secondary); font-family: var(--font-body); font-size: var(--text-sm); font-style: normal; }
.lore-note__quote small { color: var(--color-ash-secondary); }

.lore-vault__layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--space-8);
  align-items: start;
}

.lore-vault__intro { min-width: 0; }
.lore-vault__intro p { max-width: 58ch; }
.lore-vault__panel { min-width: 0; display: grid; gap: var(--space-5); padding: var(--space-6); }
.lore-search-form { min-width: 0; }
.lore-search-form__row { display: flex; gap: var(--space-3); min-width: 0; }
.lore-search-form__row input { min-width: 0; flex: 1 1 auto; }
.lore-search-form__row button { min-width: max-content; flex: 0 0 auto; }

.lore-filter-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.lore-filter-group { min-width: 0; margin: 0; }
.lore-filter-group__options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.lore-filter-group__options label {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  border: var(--border-default);
  background: var(--color-basalt-raised);
  padding: var(--space-2) var(--space-3);
  font-weight: 500;
}

.lore-filter-group__options label:has(input:checked) {
  border-inline-start: 2px solid var(--color-ember);
  color: var(--color-ash-primary);
}

.lore-vault__status-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-width: 0; }
.lore-vault__status-row > * { min-width: 0; }
.lore-vault__status-row p { margin: 0; color: var(--color-ash-secondary); }

.lore-desk__layout {
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(32.5rem, 58fr);
  gap: var(--space-8);
  align-items: start;
}

.lore-desk__invitation { min-width: 0; }
.lore-desk__invitation p { max-width: 50ch; }
.lore-desk__form-panel { min-width: 0; display: grid; gap: var(--space-4); padding: var(--space-6); }
.lore-desk__fields { display: grid; gap: var(--space-4); }
.lore-desk__fields > * { min-width: 0; }
.lore-desk__fields button { justify-self: start; }
.lore-form-error { min-height: var(--leading-sm); margin: var(--space-1) 0 0; color: var(--color-ember-bright); font-size: var(--text-sm); }
.lore-desk__success { display: grid; gap: var(--space-4); }
.lore-desk__success > * { margin: 0; }
.lore-desk__success button { justify-self: start; }
.lore-desk__note { max-width: 48ch; margin: 0; font-size: var(--text-sm); line-height: var(--leading-sm); }

.lore-trail__inner {
  width: min(100%, 38.75rem);
  margin-inline: auto;
  border-top: var(--border-default);
  padding-top: var(--space-8);
  text-align: center;
}

.lore-trail__inner h2 { max-width: 46ch; margin-inline: auto; font-size: var(--text-2xl); }
.lore-trail__actions { justify-content: center; }

.lore-record[hidden] { display: none; }

@keyframes lore-fog-drift {
  from { opacity: 0.5; transform: translateX(-1%); }
  to { opacity: 1; transform: translateX(1%); }
}

@media (max-width: 61.25rem) {
  .lore-records__wall { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: auto; }
  .lore-record--throne { grid-column: 1 / span 6; grid-row: 1; min-height: 32rem; }
  .lore-record--boss { grid-column: 1 / span 3; grid-row: 2; }
  .lore-record--faction { grid-column: 4 / span 3; grid-row: 2; }
  .lore-record--map { grid-column: 1 / span 3; grid-row: 3; }
  .lore-record--monster { grid-column: 4 / span 3; grid-row: 3; }
  .lore-record--boss .lore-record__media { height: 16rem; }
  .lore-record--map .lore-record__media { height: 12rem; }
  .lore-vault__layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 58.75rem) {
  .lore-themes__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lore-theme-card:nth-child(3) { grid-column: 1 / span 2; }
}

@media (max-width: 56.25rem) {
  .lore-threshold__layout { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .lore-threshold__atmosphere { display: none; }
  .lore-feature__frame { display: grid; grid-template-columns: minmax(0, 1fr); }
  .lore-feature__frame::after { display: none; }
  .lore-feature__content { position: static; width: 100%; border-inline-start: 0; border-top: 2px solid transparent; background: var(--color-basalt); padding: var(--space-6); }
  .lore-feature__frame:hover .lore-feature__content, .lore-feature__frame:focus-within .lore-feature__content { border-color: var(--color-ember); }
  .lore-feature__content h2 { font-size: clamp(1.875rem, 6vw, 2.125rem); }
  .lore-note__panel { grid-template-columns: minmax(0, 1fr); }
  .lore-note__prose, .lore-note__quote { padding: var(--space-6); }
  .lore-desk__layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 55rem) {
  .lore-format { grid-template-columns: minmax(0, 1fr); }
  .lore-format__rail { border-inline-end: 0; border-bottom: 1px solid var(--color-stone-line); }
}

@media (max-width: 47.5rem) {
  .lore-filter-groups { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 45rem) {
  .lore-page::before { opacity: 0.11; }
  .lore-threshold__copy h1 { font-size: 2.5rem; line-height: 1.05; }
  .lore-threshold__actions, .lore-trail__actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .lore-threshold__actions > *, .lore-trail__actions > * { width: 100%; }
  .lore-themes__grid, .lore-records__wall { grid-template-columns: minmax(0, 1fr); }
  .lore-theme-card:nth-child(3), .lore-record--throne, .lore-record--boss, .lore-record--faction, .lore-record--map, .lore-record--monster { grid-column: 1; grid-row: auto; }
  .lore-record--throne { min-height: 29rem; }
  .lore-record--boss .lore-record__media, .lore-record--map .lore-record__media { height: auto; aspect-ratio: 3 / 2; }
  .lore-record h3, .lore-record--throne h3, .lore-theme-card h3 { font-size: 1.625rem; line-height: 1.1; }
  .lore-filter-group__options { grid-template-columns: minmax(0, 1fr); }
  .lore-search-form__row { display: grid; grid-template-columns: minmax(0, 1fr); }
  .lore-search-form__row button { width: 100%; }
  .lore-desk__form-panel { padding: var(--space-5); }
  .lore-desk__fields button { width: 100%; }
  .lore-trail__inner h2 { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lore-threshold__atmosphere { animation: none; }
}
