/* Palette sampled from the character sheet */
:root {
  --bg: #0e110f;        /* near-black with a green cast */
  --card: #1b1e1c;      /* cloak charcoal */
  --ink: #e9e6da;       /* text */
  --muted: #9a9f94;
  --green: #4d8a3c;     /* armour highlight */
  --green-deep: #314d2c;/* armour */
  --gold: #a5824a;      /* trim */
  --maroon: #6c1e20;    /* sash */
  --red: #d2322d;       /* eyes */
  --font: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;     /* keeps the footer at the bottom on short pages */
}
main {
  width: 100%;
  flex: 1 0 auto;
  max-width: 34rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
header { text-align: center; margin-bottom: 2.25rem; }
.avatar {
  width: 7.5rem; height: 7.5rem;
  margin: 0 auto 1.1rem;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: var(--card);
  display: grid; place-items: center;
  font-size: 3rem;
  overflow: hidden;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--maroon), 0 0 26px rgba(210, 50, 45, .35);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
h1 { font-size: 1.8rem; margin: 0 0 .25rem; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 0 auto; max-width: 28rem; }

ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.link {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--gold);
  border-left: 6px solid var(--green);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--maroon);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.link:hover, .link:focus-visible {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--maroon);
  border-color: var(--red);
  border-left-color: var(--green);
}
.link:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.link strong { display: block; font-size: 1.05rem; }
.link span { color: var(--muted); font-size: .9rem; }
.page-link { border-left-color: var(--gold); }
.page-link strong::after { content: "  ›"; color: var(--gold); }
.plain {
  padding: 1rem 1.25rem;
  border: 2px dashed var(--green-deep);
  border-radius: 6px;
}
.plain strong { display: block; }
.plain span { color: var(--muted); font-size: .9rem; }

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--gold);
  font-weight: 600;
  text-decoration: none;
}
.back:hover { color: var(--red); }
.back:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.page-head { margin-bottom: 1.75rem; }
.page-head h1 { text-align: left; }
.page-head .sub { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .link { transition: none; }
}

/* Fading background slideshow */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.bg-layer {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}
.bg-layer.show { opacity: 1; }
/* Dark veil so text stays readable; adjust the 0.7 to taste (higher = darker) */
.bg::after {
  content: "";
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) calc(var(--veil, 0.7) * 100%), transparent);
}
main { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) {
  .bg-layer { transition: none; }
}

/* Twitch cards: expandable player */
.link .hint {
  display: block;
  margin-top: .25rem;
  font-size: .8rem;
  color: var(--green);
  font-weight: 600;
}
.link.embeddable.open { border-color: var(--red); }
.link.embeddable.open .hint { color: var(--gold); }
.embed { margin-top: .6rem; }
.embed .frame {
  aspect-ratio: 16 / 9;
  border: 2px solid var(--gold);
  border-radius: 6px;
  overflow: hidden;
  background: #000;
}
.embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.embed-close {
  margin-top: .5rem;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  padding: .25rem 0;
}
.embed-close:hover { color: var(--red); }
.embed-close:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.embed[hidden] { display: none; }

.link .hint[hidden] { display: none; }

/* Galleries */
main.wide { max-width: 62rem; }
.gallery-card { padding: 0; overflow: hidden; }
.gallery-card .cover {
  display: block; width: 100%;
  aspect-ratio: 16 / 7; object-fit: cover;
  border-bottom: 2px solid var(--gold);
}
.gallery-card strong { padding: .9rem 1.25rem 0; }
.gallery-card span { display: block; padding: 0 1.25rem 1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: .75rem;
}
.thumb {
  padding: 0; aspect-ratio: 1; overflow: hidden; cursor: pointer;
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--maroon);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover, .thumb:focus-visible {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--maroon);
  border-color: var(--red);
}
.thumb:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 7, 6, .95);
}
/* The stage has a fixed size (the screen minus margins), so any photo is scaled to fit it */
.lb-stage {
  position: absolute;
  inset: 3.5rem .75rem;
  display: flex; align-items: center; justify-content: center;
}
.lb-stage img {
  display: block;
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 4px;
  opacity: 0;
  transition: opacity .15s;
}
.lb-stage img.loaded { opacity: 1; }
.lb-msg {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted);
  pointer-events: none;
}
.lb-btn {
  position: absolute;
  width: 2.75rem; height: 2.75rem;
  background: rgba(27, 30, 28, .85); color: var(--ink);
  border: 2px solid var(--gold); border-radius: 6px;
  font: inherit; font-size: 1.5rem; line-height: 1;
  cursor: pointer;
}
.lb-btn:hover, .lb-btn:focus-visible { border-color: var(--red); }
.lb-btn:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.lb-close { top: .75rem; right: .75rem; }
.lb-prev { left: .75rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: .75rem; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; top: 1.1rem; left: 1rem; color: var(--muted); font-size: .9rem; }
@media (min-width: 700px) { .lb-stage { inset: 3.5rem 4.5rem; } }
@media (prefers-reduced-motion: reduce) {
  .thumb { transition: none; }
  .lb-stage img { transition: none; }
}

/* Background videos */
.bg-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: none;
}
.bg-layer.is-video .bg-video { display: block; }

/* Keep the dark veil above the slideshow layers (their z-index changes as they swap) */
.bg::after { z-index: 5; }

/* Gallery videos */
.thumb { position: relative; }
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.play-badge {
  position: absolute; right: .4rem; bottom: .4rem;
  width: 1.9rem; height: 1.9rem;
  display: grid; place-items: center;
  padding-left: .1rem;
  background: rgba(14, 17, 15, .82); color: var(--ink);
  border: 2px solid var(--gold); border-radius: 50%;
  font-size: .8rem;
  pointer-events: none;
}
.lb-stage video {
  display: block;
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  border-radius: 4px;
  background: #000;
  opacity: 0;
  transition: opacity .15s;
}
.lb-stage video.loaded { opacity: 1; }
.lb-stage [hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .lb-stage video { transition: none; } }

/* Saving deterrents (see enableProtection in app.js) */
.protect img, .protect video {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}

/* Email card */
button.link { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.link.email-card.open { border-color: var(--red); }
.email-box {
  margin-top: .6rem;
  padding: .9rem 1.25rem;
  background: var(--card);
  border: 2px solid var(--gold);
  border-radius: 6px;
}
.email-box[hidden] { display: none; }
.email-addr { font-weight: 600; word-break: break-all; user-select: text; margin-bottom: .75rem; }
.email-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.email-btn {
  font: inherit; font-size: .9rem; font-weight: 600;
  color: var(--ink); background: transparent;
  border: 2px solid var(--gold); border-radius: 6px;
  padding: .45rem .8rem;
  text-decoration: none; cursor: pointer;
}
.email-btn:hover, .email-btn:focus-visible { border-color: var(--red); }
.email-btn:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

/* Text blocks (Markdown) */
.text-block {
  padding: 1rem 1.25rem;
  border: 2px solid var(--green-deep);
  border-radius: 6px;
  background: var(--card);
  overflow-wrap: anywhere;
}
.text-title { display: block; font-size: 1.05rem; margin-bottom: .35rem; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: .55rem 0; }
.md h3, .md h4, .md h5 { margin: 1rem 0 .3rem; line-height: 1.25; }
.md h3 { font-size: 1.2rem; } .md h4 { font-size: 1.08rem; } .md h5 { font-size: .98rem; color: var(--muted); }
.md ul, .md ol { list-style: revert; display: block; padding-left: 1.4rem; margin: .55rem 0; }
.md li { margin: .15rem 0; }
.md a { color: var(--gold); }
.md a:hover { color: var(--red); }
.md code { background: rgba(0, 0, 0, .35); padding: .08rem .35rem; border-radius: 4px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
.md pre { overflow-x: auto; padding: .7rem .9rem; background: rgba(0, 0, 0, .4); border-radius: 6px; margin: .6rem 0; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: .6rem 0; padding-left: .9rem; border-left: 3px solid var(--gold); color: var(--muted); }
.md hr { border: 0; border-top: 2px solid var(--green-deep); margin: .9rem 0; }

/* Footer */
.site-footer {
  position: relative; z-index: 1;
  width: 100%; max-width: 34rem;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.footer-inner { border-top: 2px solid var(--green-deep); padding-top: 1rem; }
.site-footer .md p { margin: .25rem 0; }
.site-footer .md h3, .site-footer .md h4, .site-footer .md h5 { font-size: .95rem; color: var(--ink); }
