/* ===========================================================================
   Life in Woodchester Wiki — custom theme
   Brand: logo blue + pink, cozy rounded type.
   =========================================================================== */

:root {
  --liw-blue:      #1f9fd6;
  --liw-blue-deep: #0e4f78;
  --liw-pink:        #ff5fa2;
  --liw-pink-soft:   #ffb3d1;
  --liw-gold:        #ffce5c;
}

/* ---- Palette overrides ---------------------------------------------------- */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color:        #096b9f;
  --md-primary-fg-color--light: #3bb3e6;
  --md-primary-fg-color--dark:  #0d5a86;
  --md-accent-fg-color:         var(--liw-pink);

  --md-hue: 205;
  --md-default-bg-color:        hsla(205, 24%, 11%, 1);
  --md-default-bg-color--light: hsla(205, 24%, 14%, 1);
  --md-typeset-a-color:         #79d2f5;
  --md-footer-bg-color:         hsla(205, 28%, 8%, 1);
}

[data-md-color-scheme="default"] {
  --md-primary-fg-color:        #096b9f;
  --md-primary-fg-color--light: #3bb3e6;
  --md-primary-fg-color--dark:  #0e4f78;
  --md-accent-fg-color:         #9d225e;
  --md-typeset-a-color:         #1278b0;
}

/* Keep floats inside articles and retain a readable gutter at tablet sizes. */
.md-content__inner { display: flow-root; }
@media (min-width: 37.5em) and (max-width: 76.234375em) {
  .md-content__inner { margin-inline: 1.2rem; }
}
/* A newly toggled palette tooltip can be measured before its text is visible. */
@media (max-width: 59.984375em) {
  .md-header__option .md-tooltip--inline { left: auto; right: .8rem; }
}

/* Friendlier headings */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  font-weight: 800;
  letter-spacing: -0.01em;
}
.md-typeset h2 {
  display: flow-root;
  border-bottom: 2px solid color-mix(in srgb, var(--liw-blue) 35%, transparent);
  padding-bottom: .25rem;
}

/* ===========================================================================
   HERO (home page)
   =========================================================================== */
.liw-hero {
  position: relative;
  margin: 0 -.8rem 1.6rem;
  padding: 1.4rem 1rem 1.3rem;
  text-align: center;
  border-radius: 0 0 1.5rem 1.5rem;
  background:
    radial-gradient(1100px 380px at 50% -8%, rgba(255,95,162,.30), transparent 60%),
    linear-gradient(160deg, rgba(14,79,120,.85), rgba(11,24,38,.93) 78%),
    url(../img/hero-bg.png) center 38% / cover no-repeat;
  overflow: hidden;
}
.liw-hero::after {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.liw-hero img.liw-hero-logo {
  position: relative;
  width: min(1150px, 99%);
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.6));
}
.liw-hero .liw-tagline {
  position: relative;
  margin: .6rem auto 0;
  max-width: 32rem;
  color: #f3e9ff;
  font-size: .88rem;
}
.liw-badges {
  position: relative;
  margin-top: 1rem;
  display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
}
.liw-badge {
  font-size: .64rem; font-weight: 700; letter-spacing: .03em;
  padding: .2rem .55rem; border-radius: 2rem;
  background: rgba(255,255,255,.12); color: #fff;
  border: 1px solid rgba(255,255,255,.18);
}
.liw-cta {
  position: relative;
  margin-top: 1rem;
  display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center;
}
/* Markdown wraps these controls in a paragraph; keep the intended flex gaps. */
.liw-badges > p,
.liw-cta > p { display: contents; }

/* Big call-to-action buttons */
.md-typeset .liw-cta .md-button {
  border-radius: 2rem;
  font-weight: 800;
  padding: .46rem 1.1rem;
  font-size: .78rem;
}

/* Compact, clickable town-map thumbnail (home page) */
.liw-map {
  display: block; max-width: 380px; margin: .4rem auto 1rem;
  border-radius: .8rem; overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .18s ease, box-shadow .18s ease;
}
.liw-map:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(31,159,214,.45); }
.liw-map img { display: block; width: 100%; }

/* Home hero sits flush against the top bar (no gap above it) */
.md-main__inner:has(.liw-hero) { margin-top: 0; }
.md-content__inner:has(.liw-hero) { padding-top: 0; }
.md-content__inner:has(.liw-hero)::before { display: none; }
/* Hide the auto-injected page-title h1 ("Home") — the hero is the title */
.md-content__inner:has(.liw-hero) > h1 { display: none; }

/* Hero download/build list (public · patron · deluxe) */
.liw-builds {
  position: relative;
  z-index: 2; /* Keep download controls above the hero's decorative bottom fade. */
  margin: 1.1rem auto 0;
  max-width: 40rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.liw-build {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 1rem;
  flex-wrap: wrap;
  padding: .7rem 1.1rem;
  border-radius: .7rem;
  border: 1px solid rgba(255,255,255,.12);
  background: #0e1722;
  text-align: left;
}
.liw-build > .liw-build-background {       /* faded decorative screenshot */
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 28%;
  opacity: .30;
  pointer-events: none;
}
.liw-build::after {                         /* wash for legibility */
  content: "";
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, rgba(11,24,38,.92) 30%, rgba(11,24,38,.45));
}
.liw-build > :not(.liw-build-background) { position: relative; z-index: 1; }
.liw-build-info { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 auto; min-width: 0; }
.liw-build-ico { flex: 0 0 auto; display: inline-flex; align-items: center; color: #cfe6f5; }
.liw-build-ico svg { width: 28px; height: 28px; fill: currentColor; }
.liw-old { color: #8fa6b5; font-weight: 600; font-size: .72rem; white-space: nowrap; }
.liw-build-name { color: #fff; font-weight: 700; font-size: .9rem; }
.liw-build-name b { color: var(--liw-blue); font-weight: 800; }
.liw-build-tag {
  color: var(--liw-pink-soft);
  font-size: .66rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em;
}
.liw-build-plat { white-space: nowrap; font-weight: 700; font-size: .82rem; color: #cfe6f5; }
.md-typeset .liw-build-plat a { color: #aee2fb; font-weight: 700; }
.md-typeset .liw-build-plat a:hover { color: #fff; }
.md-typeset .liw-cta .md-button--primary {
  background: var(--liw-pink);
  border-color: var(--liw-pink);
  color: #102331;
}
.md-typeset .liw-cta .md-button--primary:hover {
  background: #ff7bb4; border-color: #ff7bb4;
}
.md-typeset .liw-cta .md-button:not(.md-button--primary) {
  color: var(--liw-pink-soft);
  border-color: var(--liw-pink-soft);
}
.md-typeset .liw-cta .md-button:not(.md-button--primary):hover {
  background: var(--liw-pink-soft);
  color: #102331;
}

/* ===========================================================================
   CHARACTER GRID  (used on Characters overview + home)
   =========================================================================== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.4rem 0;
}
.char-card {
  position: relative;
  display: block;
  border-radius: 1rem;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #16283a, #0e1722);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.06);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.char-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(31,159,214,.45);
  border-color: var(--liw-pink);
}
.char-card img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.char-card .char-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.6rem .7rem .55rem;
  background: linear-gradient(transparent, rgba(15,8,24,.92));
}
.char-card .char-name {
  display: block; color: #fff; font-weight: 800; font-size: .98rem; line-height: 1.1;
}
.char-card .char-role {
  display: block; color: var(--liw-pink-soft); font-size: .72rem; margin-top: .12rem;
}
/* Make linked images in cards not get the default underline/box */
.md-typeset .char-card,
.md-typeset .char-card:hover { text-decoration: none; }

/* ===========================================================================
   CHARACTER INFOBOX (right-floated card on character pages)
   =========================================================================== */
.md-typeset .infobox {
  float: right;
  width: 300px;
  max-width: 100%;
  margin: 0 0 1.2rem 1.4rem;
  text-align: start;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--md-default-bg-color--light, #241830);
  border: 1px solid color-mix(in srgb, var(--liw-blue) 30%, transparent);
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
.md-typeset .infobox > p:first-child { margin: 0; }
.md-typeset .infobox > img:first-child,
.md-typeset .infobox > p:first-child > img {
  width: 100%; display: block; background: #0e1722;
  height: auto;
  max-height: 26rem;
  object-fit: contain;
}
.infobox .infobox-title {
  text-align: center;
  font-weight: 800; font-size: 1.1rem;
  padding: .6rem .8rem .2rem;
  color: var(--md-default-fg-color);
  background: linear-gradient(180deg, color-mix(in srgb, var(--liw-blue) 55%, transparent), transparent);
}
.infobox .infobox-sub {
  text-align: center; color: var(--liw-pink-soft);
  font-size: .8rem; padding: 0 .8rem .6rem;
}
.md-typeset .infobox dl {
  margin: 0; padding: .4rem .9rem .9rem;
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: .35rem .7rem;
  font-size: .82rem;
}
.md-typeset .infobox dt { margin: 0; font-weight: 700; color: var(--liw-pink-soft); }
.md-typeset .infobox dd { margin: 0; overflow-wrap: anywhere; }
[data-md-color-scheme="default"] .infobox :is(dt, .infobox-sub) { color: #9d225e; }

@media (max-width: 50em) {
  .md-typeset .infobox { float: none; width: min(100%, 18rem); margin: 0 auto 1.4rem; }
}

/* ===========================================================================
   STAT CHIPS / LABELS
   =========================================================================== */
.stat-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.stat-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .7rem; border-radius: 2rem;
  background: rgba(31,159,214,.18);
  border: 1px solid rgba(31,159,214,.4);
  font-size: .8rem; font-weight: 700;
}
.stat-chip img { width: 22px; height: 22px; object-fit: contain; }

.label {
  display: inline-block; padding: .12rem .6rem; border-radius: 1rem;
  font-size: .72rem; font-weight: 700; color: #102331;
  background: var(--liw-blue);
}
.label.romance { background: var(--liw-pink); }
.label.side    { background: #4aa7a2; }
.label.support { background: #8a8a99; }
.label.special { background: var(--liw-gold); color: #3a2a00; }

/* ===========================================================================
   MISC
   =========================================================================== */
/* Screenshot thumbnails — small samples that open in a lightbox on click */
.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 190px));
  gap: .7rem; margin: 1.2rem 0;
  justify-content: start;
}
.shot-grid > p { display: contents; }              /* unwrap md_in_html <p> */
.shot-grid a { display: block; width: 100%; }
.shot-grid img {
  display: block; width: 100%; height: 120px; object-fit: cover;
  border-radius: .6rem; box-shadow: 0 4px 12px rgba(0,0,0,.35);
  cursor: zoom-in; transition: transform .15s ease, box-shadow .15s ease;
}
.shot-grid img:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(31,159,214,.45); }

/* Tighter, framed inline figures */
.md-typeset figure img { border-radius: .6rem; }

/* Quote styling for "Notable Quotes" */
.md-typeset blockquote {
  border-left: .3rem solid var(--liw-pink);
}

/* Home feature cards reuse Material .grid.cards — add a little flair */
.md-typeset .grid.cards > :is(ul, ol) > li,
.md-typeset .grid.cards > .card {
  border-radius: .9rem;
  transition: border-color .18s ease, transform .18s ease;
}
.md-typeset .grid.cards > :is(ul, ol) > li:hover {
  border-color: var(--liw-pink);
  transform: translateY(-3px);
}

/* Age-gate / adult notice admonition flavor */
.md-typeset .admonition.adult {
  border-color: var(--liw-pink);
}
.md-typeset .adult > .admonition-title {
  background: rgba(255,95,162,.15);
}
.md-typeset .adult > .admonition-title::before {
  background-color: var(--liw-pink);
  -webkit-mask-image: var(--md-admonition-icon--warning);
          mask-image: var(--md-admonition-icon--warning);
}

/* Footer logo spacing */
.md-footer-meta { backdrop-filter: blur(4px); }

/* ===========================================================================
   FADE GRADIENTS  (banners, image fades, dividers)  ✨
   =========================================================================== */

/* Section banner: a wide image that fades into the page on all four sides. */
.md-typeset .liw-banner {
  position: relative;
  width: 100%;
  margin: .2rem 0 1.6rem;
  height: clamp(150px, 26vw, 280px);
  border-radius: 1rem;
  overflow: hidden;
}
.liw-banner img,
.liw-banner p { margin: 0; height: 100%; }
.liw-banner img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 28%;
  /* vertical fade: top & bottom dissolve into the page */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 24%, #000 76%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 24%, #000 76%, transparent 100%);
}
/* horizontal fade: left & right dissolve into the page background colour */
.liw-banner::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right,
    var(--md-default-bg-color) 0%, transparent 16%,
    transparent 84%, var(--md-default-bg-color) 100%);
}
/* Optional caption sitting on the banner */
.liw-banner .liw-banner-cap {
  position: absolute; left: 1.1rem; bottom: .7rem; z-index: 2;
  font-weight: 800; font-size: 1.4rem; color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}

/* Utility: fade the bottom edge of any inline image into the page. */
.fade-img img,
img.fade-img {
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
}

/* Character card art now fades into the card (smoother, taller meta). */
.char-card .char-meta {
  padding-top: 2.4rem;
  background: linear-gradient(transparent, rgba(15,8,24,.55) 40%, rgba(15,8,24,.95));
}
.char-card img {
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, rgba(0,0,0,.65) 100%);
          mask-image: linear-gradient(to bottom, #000 78%, rgba(0,0,0,.65) 100%);
}

/* Infobox portrait fades softly into the infobox panel. */
.md-typeset .infobox > img:first-child,
.md-typeset .infobox > p:first-child > img {
  -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}

/* Fix: md_in_html wraps grid children in a <p>; promote them to grid items. */
.char-grid > p { display: contents; }

/* Fade-off horizontal rule — a divider that dissolves at both ends. */
.md-typeset hr {
  border: 0; height: 2px;
  background: linear-gradient(to right, transparent,
    var(--liw-blue) 25%, var(--liw-pink) 75%, transparent);
}

/* Heading underline now fades off to the right instead of a hard line. */
.md-typeset h2 {
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(to right, var(--liw-pink), var(--liw-blue) 55%, transparent) 1;
}

/* The hero blends into the page along its bottom edge. */
.liw-hero { border-radius: 0; }
.liw-hero::before {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 90px; z-index: 1;
  background: linear-gradient(to bottom, transparent, var(--md-default-bg-color));
  pointer-events: none;
}

/* ===========================================================================
   SCREENSHOT LIGHTBOX (click a thumbnail to view full-size)
   =========================================================================== */
.liw-lb {
  position: fixed; inset: 0; z-index: 3000;
  display: none; align-items: center; justify-content: center;
  padding: 3.5rem max(1rem, 4vmin) 4.5rem;
  background: rgba(10,6,16,.92);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  cursor: zoom-out;
}
.liw-lb.open { display: flex; }
.liw-lb img {
  max-width: 100%; max-height: calc(100dvh - 8rem); border-radius: .6rem;
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
  animation: liw-lb-in .18s ease;
}
.liw-lb .liw-lb-cap {
  position: absolute; bottom: 1rem; left: 1rem; right: 1rem;
  max-height: 3.5rem; overflow: auto;
  text-align: center; color: #f3e9ff; font-size: .9rem;
  text-shadow: 0 2px 8px #000; pointer-events: none;
}
.liw-lb .liw-lb-close {
  position: absolute; top: .5rem; right: .5rem;
  display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; padding: 0; border-radius: .4rem;
  background: rgba(255,255,255,.1);
  color: #fff; font-size: 2.2rem; line-height: 1; cursor: pointer; opacity: .85;
}
.liw-lb .liw-lb-close:hover { opacity: 1; }
.liw-lb-status { color: #f3e9ff; text-align: center; }
.shot-grid :is(img, a):focus-visible,
img.zoomable:focus-visible,
.char-card:focus-visible,
.liw-lb-close:focus-visible {
  outline: 3px solid var(--liw-pink);
  outline-offset: 4px;
}
@media (prefers-reduced-motion: reduce) {
  .char-card, .liw-map, .shot-grid img, .md-typeset .grid.cards > :is(ul, ol) > li { transition: none; }
  .liw-lb img { animation: none; }
}
@keyframes liw-lb-in { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Portrait icons and small pet art retain their full frame on cast cards. */
.char-card--profile img {
  object-fit: contain;
  padding: .65rem .65rem 2.6rem;
}
