/* Good Luck Alliance — one stylesheet for the whole public site and admin.
 *
 * Dark only, on purpose: the palette is chosen by the site, not by the reader's
 * system preference. Texture is painted with gradients rather than images so
 * nothing here makes a second request and the content security policy stays
 * unchanged.
 *
 * Layout is a single centred column. The only two-column layout is the tips
 * page, where the contents list sticks beside the text on wide screens and
 * folds into a <details> block on narrow ones.
 */

/* Bebas Neue, SIL OFL, latin subset. The versioned filename is the cache-buster:
 * static files are immutable, and a font URL inside this stylesheet cannot carry
 * the stylesheet's query fingerprint. */
@font-face {
  font-family: "Bebas Neue";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/bebas-neue-latin-v16.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  --bg: #12100e;
  --bg-deep: #0c0a08;
  --surface: #1a1713;
  --surface-2: #221d17;
  --ink: #f0e9dc;
  --ink-soft: #b9ae9a;
  --ink-dim: #9a9080;
  --line: #3b3327;
  --line-soft: #2a241c;
  --brass: #d9b558;
  --brass-bright: #f0d488;
  --brass-dim: #a8863a;
  --brass-ink: #17120a;
  --oxblood: #a13232;
  --oxblood-bright: #c94747;
  --notice-bg: #211a10;
  --notice-line: #6b5327;
  --danger: #f08b8b;
  --discord: #5865f2;
  --discord-hover: #4752c4;
  --glow-brass: rgba(217, 181, 88, .20);
  --glow-oxblood: rgba(161, 50, 50, .18);
  --radius: 3px;
  --cut: 14px;
  --wrap: 62rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --display: "Bebas Neue", var(--font);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line) var(--bg);
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(70rem 34rem at 50% -16%, var(--glow-brass), transparent 62%),
    radial-gradient(46rem 30rem at 92% 6%, var(--glow-oxblood), transparent 64%),
    radial-gradient(60rem 44rem at 8% 42%, rgba(161, 50, 50, .06), transparent 70%),
    radial-gradient(90rem 40rem at 50% 120%, rgba(217, 181, 88, .05), transparent 70%);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  /* Glows must never introduce a horizontal scrollbar. */
  overflow-x: clip;
}

@media (min-width: 900px) {
  body { background-attachment: fixed; }
}

::selection { background: var(--brass); color: var(--brass-ink); }

a { color: var(--brass); text-underline-offset: 3px; }
a:hover { color: var(--brass-bright); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brass); color: var(--brass-ink);
  padding: .6rem 1rem; z-index: 60;
  font-weight: 700;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ------------------------------------------------------------------ shape */

/* Angular corners for non-interactive panels. Interactive controls stay
 * rectangular so their focus ring is never clipped. */
.panel {
  background: var(--surface);
  border: 0;
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
}

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding-top: .8rem;
  padding-bottom: .8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { color: var(--ink); }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 2.3rem; height: 2.3rem;
  background: linear-gradient(140deg, var(--brass-bright), var(--brass-dim));
  color: var(--brass-ink);
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .04em;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 62% 100%, 0 100%);
  filter: drop-shadow(0 0 10px rgba(217, 181, 88, .35));
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.brand-name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.brand-sub {
  font-family: var(--mono);
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .24em;
  color: var(--brass);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-family: var(--mono);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  padding: .2rem 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--brass); border-bottom-color: var(--brass-dim); }
.site-nav .nav-admin {
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  border-radius: var(--radius);
  padding: .28rem .6rem;
}
.site-nav .nav-admin:hover {
  color: var(--brass-bright);
  border-color: var(--brass);
  background: color-mix(in srgb, var(--brass) 10%, transparent);
}

.inline-form { display: inline; margin: 0; }

.discord-button {
  display: inline-block;
  background: linear-gradient(135deg, var(--discord), var(--discord-hover));
  color: #fff;
  text-decoration: none;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .5rem .9rem;
  border-radius: var(--radius);
  line-height: 1.2;
  box-shadow: 0 8px 24px -10px rgba(88, 101, 242, .8);
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.discord-button:hover {
  background: linear-gradient(135deg, #6571f5, var(--discord-hover));
  color: #fff;
  box-shadow: 0 10px 28px -8px rgba(88, 101, 242, .95);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------------ main */

main { padding: 2.75rem 1.25rem 4.5rem; min-height: 60vh; }

.page-head { margin-bottom: 2.2rem; }
.page-head h1 {
  margin: 0 0 .5rem;
  font-family: var(--display);
  font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem);
  line-height: .95;
  letter-spacing: .015em;
  text-transform: uppercase;
  font-weight: 400;
}
.kicker {
  margin: 0 0 .7rem;
  font-family: var(--mono);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .26em;
  color: var(--brass);
}
.lede { color: var(--ink-soft); margin: 0; max-width: 46rem; }

/* ------------------------------------------------------------- home hero */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: clamp(1.75rem, 4vw, 3.5rem);
  background: linear-gradient(155deg, #1d1712, #14110e 62%);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 0 80px -34px var(--brass);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
  animation: rise-in .7s cubic-bezier(.22, .7, .2, 1) backwards;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(46px);
  opacity: .55;
  pointer-events: none;
  animation: ember-drift 18s ease-in-out infinite alternate;
}
.hero::before {
  top: -12rem;
  left: -6rem;
  background: radial-gradient(circle, rgba(217, 181, 88, .40), transparent 68%);
}
.hero::after {
  right: -8rem;
  bottom: -14rem;
  background: radial-gradient(circle, rgba(161, 50, 50, .38), transparent 70%);
  animation-delay: -7s;
}

.hero-title {
  margin: .2rem 0 .45rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.9rem, 1.6rem + 6vw, 6.25rem);
  line-height: .92;
  letter-spacing: .015em;
  text-transform: uppercase;
  color: var(--ink); /* fallback when background-clip is unavailable */
  overflow-wrap: break-word;
}
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .hero-title {
    background-image: linear-gradient(100deg, var(--brass-bright), var(--brass) 58%, #e7a94e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}
.hero-title a { color: inherit; text-decoration: none; }
.hero-title a:hover {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-underline-offset: .08em;
}
.hero-excerpt { max-width: 42rem; margin: .5rem 0 0; color: var(--ink-soft); font-size: 1.05rem; }
.hero-cta { margin-top: 1.15rem; }

.empty-state-cta { margin: 1rem 0 0; text-align: center; }

@media (forced-colors: active) {
  .hero-title {
    background-image: none;
    color: CanvasText;
    -webkit-text-fill-color: currentColor;
  }
}
.meta { color: var(--ink-dim); font-size: .82rem; font-family: var(--mono); letter-spacing: .04em; margin: .3rem 0 .6rem; }
.section-label {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--brass);
  margin: 2.75rem 0 1.1rem;
}
.section-label::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--brass);
  flex: none;
}

.button {
  display: inline-block;
  background: var(--brass);
  color: var(--brass-ink);
  border: 1px solid var(--brass);
  padding: .55rem 1.05rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.button:hover { background: var(--brass-bright); border-color: var(--brass-bright); color: var(--brass-ink); }
.button-quiet { background: transparent; color: var(--brass); border-color: var(--brass-dim); }
.button-quiet:hover { background: color-mix(in srgb, var(--brass) 12%, transparent); color: var(--brass-bright); border-color: var(--brass); }
.button-danger { background: var(--oxblood); border-color: var(--oxblood); color: #fff; }
.button-danger:hover { background: var(--oxblood-bright); border-color: var(--oxblood-bright); color: #fff; }

.link-button {
  background: none; border: 0; padding: 0; margin: 0;
  color: var(--brass); font: inherit; font-size: .82rem; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-button:hover { color: var(--brass-bright); }

/* --------------------------------------------------------------- notices */

.notice-block {
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.1rem;
  background: var(--notice-bg);
  box-shadow: inset 0 0 0 1px var(--notice-line), inset 0 0 60px -30px var(--brass);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
}
.notice-block .section-label { margin-top: 0; }
.notice + .notice { border-top: 1px solid var(--notice-line); padding-top: .9rem; margin-top: .9rem; }
.notice h3 { margin: 0 0 .15rem; font-size: 1.15rem; font-weight: 700; }
.notice h3 a { color: var(--ink); text-decoration: none; }
.notice h3 a:hover { color: var(--brass-bright); text-decoration: underline; }
.notice p { margin: .2rem 0 0; }

/* ------------------------------------------------------------- tips link */

.tips-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.2rem 1.5rem;
  margin: 2.25rem 0 0;
  background: linear-gradient(100deg, var(--surface-2), var(--surface));
  box-shadow: inset 0 0 0 1px var(--line), inset 3px 0 0 var(--oxblood);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
}
.tips-callout h2 { margin: 0 0 .15rem; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
.tips-callout p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* ----------------------------------------------------------------- posts */

.post-list { list-style: none; margin: 0; padding: 0; }

.post-card {
  padding: 1.1rem 1.4rem;
  margin-bottom: .75rem;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), inset 2px 0 0 var(--line);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
  transition: box-shadow .18s ease, transform .18s ease, filter .18s ease;
  animation: rise-in .45s cubic-bezier(.22, .7, .2, 1) backwards;
}
.post-card:focus-within {
  box-shadow:
    inset 0 0 0 1px var(--brass-dim),
    inset 2px 0 0 var(--brass),
    inset 0 0 28px -12px var(--brass);
  transform: translateY(-3px);
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .45));
}
@media (hover: hover) and (pointer: fine) {
  .post-card:hover {
    box-shadow:
      inset 0 0 0 1px var(--brass-dim),
      inset 2px 0 0 var(--brass),
      inset 0 0 28px -12px var(--brass);
    transform: translateY(-3px);
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .45));
  }
}
.post-list .post-card:nth-child(1) { animation-delay: .02s; }
.post-list .post-card:nth-child(2) { animation-delay: .05s; }
.post-list .post-card:nth-child(3) { animation-delay: .08s; }
.post-list .post-card:nth-child(4) { animation-delay: .11s; }
.post-list .post-card:nth-child(5) { animation-delay: .14s; }
.post-list .post-card:nth-child(6) { animation-delay: .17s; }
.post-card h2, .post-card h3 { margin: 0 0 .1rem; font-size: 1.18rem; font-weight: 700; letter-spacing: -.005em; }
.post-card h2 a, .post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h2 a:hover, .post-card h3 a:hover { color: var(--brass-bright); text-decoration: underline; }
.post-card p { margin: 0; color: var(--ink-soft); }

.empty-state {
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  text-align: center;
}

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  background: color-mix(in srgb, var(--oxblood) 24%, transparent);
  border: 1px solid var(--oxblood);
  color: #f3c9c9;
  border-radius: 2px;
  padding: .15rem .55rem;
  margin: 0 0 .6rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.pager-status { color: var(--ink-dim); font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; }

.back-link { margin-top: 2.5rem; }

/* ----------------------------------------------------------------- prose */

.prose { max-width: 44rem; }
.prose h2 {
  margin: 2.4rem 0 .7rem;
  padding-bottom: .45rem;
  font-size: 1.42rem;
  font-weight: 750;
  letter-spacing: .005em;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 6rem;
}
.prose h3 { margin: 1.9rem 0 .5rem; font-size: 1.18rem; font-weight: 700; scroll-margin-top: 6rem; }
.prose h4 { margin: 1.55rem 0 .4rem; font-size: 1rem; font-weight: 700; color: var(--brass); scroll-margin-top: 6rem; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.prose li { margin: .25rem 0; }
.prose li::marker { color: var(--brass-dim); }
.prose blockquote {
  margin: 0 0 1rem;
  padding: .5rem 0 .5rem 1.1rem;
  border-left: 2px solid var(--brass-dim);
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--brass) 5%, transparent);
}
.prose pre {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-left: 2px solid var(--brass-dim);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .86rem;
  color: var(--ink);
}
.prose code { font-family: var(--mono); font-size: .9em; color: var(--brass-bright); }
.prose pre code { color: inherit; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.prose table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 0 0 1.1rem;
  border-collapse: collapse;
  font-size: .95rem;
}
.prose th,
.prose td {
  padding: .5rem .65rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--surface-2);
  color: var(--brass);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--brass) 3%, transparent); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.25rem 0; }
.prose a { overflow-wrap: anywhere; }

.heading-link {
  margin-left: .55rem;
  font-family: var(--mono);
  font-size: .72em;
  font-weight: 400;
  color: var(--brass-dim);
  text-decoration: none;
  opacity: .55;
}
.heading-link:hover { opacity: 1; color: var(--brass-bright); }

/* ------------------------------------------------------------ tips layout */

.tips-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

.toc {
  position: sticky;
  top: 5.75rem;
  max-height: calc(100vh - 7.5rem);
  overflow-y: auto;
  border-left: 2px solid var(--brass-dim);
  padding-left: 1rem;
  font-size: .9rem;
}
.toc summary {
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 600;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--brass);
  margin-bottom: .6rem;
  list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc ul ul { padding-left: .9rem; }
.toc li { margin: .25rem 0; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--brass-bright); text-decoration: underline; }
.toc a[aria-current="true"] {
  color: var(--brass);
  font-weight: 600;
  box-shadow: -1rem 0 0 -0.85rem var(--brass);
}

.toc-search {
  width: 100%;
  margin: 0 0 .85rem;
  padding: .45rem .6rem;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .78rem;
}
.toc-search::placeholder { color: var(--ink-dim); }
.toc-search:focus { border-color: var(--brass-dim); outline: none; box-shadow: 0 0 0 2px var(--brass-dim); }

.toc-empty { color: var(--ink-dim); font-size: .82rem; margin: .6rem 0 0; }

@media (max-width: 900px) {
  .tips-layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--line);
    border-left: 2px solid var(--brass-dim);
    border-radius: var(--radius);
    padding: .9rem 1.1rem;
    background: var(--surface);
  }
  .toc summary { margin-bottom: .6rem; }
}

/* --------------------------------------------------------- reading aids */

.reading-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 50;
  pointer-events: none;
  background: transparent;
}
.reading-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--oxblood), var(--brass));
}

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  z-index: 45;
  background: var(--surface-2);
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 1.05rem;
  cursor: pointer;
}
.to-top:hover { background: var(--brass); color: var(--brass-ink); }
.to-top[hidden] { display: none; }

/* ------------------------------------------------------------------ forms */

main > .narrow { margin-left: auto; margin-right: auto; }

.narrow h1 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .015em;
  font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  line-height: .98;
}

.narrow {
  max-width: 26rem;
  padding: 1.6rem 1.5rem;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
}

.stack { display: flex; flex-direction: column; gap: .55rem; }
.stack label { font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-top: .8rem; }
.stack input[type="text"], .stack input[type="password"], .stack textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .6rem .75rem;
  width: 100%;
}
.stack input:focus, .stack textarea:focus { outline: 2px solid var(--brass-dim); outline-offset: 1px; border-color: var(--brass-dim); }
.stack textarea { resize: vertical; }
.stack .button { margin-top: 1rem; align-self: flex-start; }

.hint { color: var(--ink-dim); font-size: .82rem; font-weight: 400; letter-spacing: 0; text-transform: none; }
.hint code { font-family: var(--mono); color: var(--brass); }

/* The native file control is the one browser widget that ignores the palette
 * and paints a light button, so it is styled explicitly. */
.stack input[type="file"] { color: var(--ink-soft); font: inherit; }
.stack input[type="file"]::file-selector-button {
  margin-right: .8rem;
  padding: .45rem .8rem;
  background: var(--surface-2);
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  border-radius: var(--radius);
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  cursor: pointer;
}
.stack input[type="file"]::file-selector-button:hover {
  background: var(--brass);
  color: var(--brass-ink);
}

.form-error {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  padding: .7rem .9rem;
}
.form-error:has(+ .stack) { margin-bottom: .5rem; }

.flash {
  background: var(--notice-bg);
  border: 1px solid var(--notice-line);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  margin-bottom: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------- admin area */

.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.table-scroll { overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: .7rem .65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th {
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--brass);
  border-bottom-color: var(--brass-dim);
}
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--brass) 4%, transparent); }
.row-actions { display: flex; gap: .5rem .9rem; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }
.row-actions .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: .2rem .45rem;
  border: 1px solid transparent;
  border-radius: 3px;
  text-decoration: none;
}
.row-actions .link-button:hover,
.row-actions .link-button:focus-visible {
  border-color: var(--line);
  background: var(--surface-2);
}
.row-actions .link-button:disabled {
  color: var(--ink-dim);
  cursor: not-allowed;
  text-decoration: none;
  opacity: .6;
}
.order-actions { flex-wrap: nowrap; gap: .4rem; }

.status {
  display: inline-block;
  font-family: var(--mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .12rem .5rem;
  border-radius: 2px;
  border: 1px solid var(--line);
}
.status-published { background: color-mix(in srgb, var(--brass) 16%, transparent); border-color: var(--brass-dim); color: var(--brass-bright); }
.status-draft { color: var(--ink-dim); }

.editor-form { max-width: 60rem; }

/* The rich editor surface is revealed only by editor.js. Without JavaScript the
 * source textarea below stays visible and editable. */
.editor { display: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.editor-form[data-mode="rich"] .editor { display: block; }
.editor-form[data-mode="rich"] .source-label,
.editor-form[data-mode="rich"] .source-editor { display: none; }
.editor-form[data-mode="source"] .editor { display: none; }

.source-label {
  display: block;
  margin-top: 1rem;
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
}
.source-editor {
  width: 100%;
  min-height: 22rem;
  margin-top: .4rem;
  padding: .9rem 1rem;
  background: var(--bg-deep);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .86rem;
  line-height: 1.55;
  resize: vertical;
}
.source-editor:focus { outline: 2px solid var(--brass-dim); outline-offset: 1px; border-color: var(--brass-dim); }

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .3rem;
  padding: .55rem .65rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.editor-select {
  margin-right: .25rem;
  padding: .3rem .45rem;
  height: 2.25rem;
  font: inherit;
  line-height: 1.2;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.editor-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.25rem;
  padding: .3rem .55rem;
  font: inherit;
  line-height: 1.2;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.editor-toolbar button:hover,
.editor-toolbar button:focus-visible {
  color: var(--brass-bright);
  border-color: var(--line);
}
.editor-toolbar button.is-active {
  color: var(--brass-bright);
  background: var(--surface);
  border-color: var(--brass-dim);
}
.editor-surface {
  min-height: 22rem;
  padding: 1rem;
  font-size: 1rem;
}
.editor-surface .ProseMirror { min-height: 20rem; outline: none; }
.editor-surface .ProseMirror > * + * { margin-top: .75rem; }
.editor-surface .ProseMirror h2,
.editor-surface .ProseMirror h3,
.editor-surface .ProseMirror h4 { color: var(--ink); }
.editor-surface .ProseMirror a { color: var(--brass); }
.editor-surface .ProseMirror img { max-width: 100%; height: auto; }
.editor-surface .ProseMirror blockquote {
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--brass-dim);
  color: var(--ink-soft);
}
.editor-surface .ProseMirror pre {
  padding: .75rem;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}
.editor-surface .ProseMirror table { width: 100%; border-collapse: collapse; }
.editor-surface .ProseMirror th,
.editor-surface .ProseMirror td {
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  vertical-align: top;
}
.editor-surface .ProseMirror th { background: var(--surface-2); text-align: left; }
.editor-surface .ProseMirror hr { border: 0; border-top: 1px solid var(--line); }
.editor-surface .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  height: 0;
  color: var(--ink-dim);
  pointer-events: none;
}
.editor-file-input { display: none; }

.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.2rem; }

.danger-zone {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: .8rem;
  align-items: center;
  flex-wrap: wrap;
}

.upload-form { max-width: 32rem; margin-bottom: 2.5rem; }

.media-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 1rem;
}
.media-card {
  padding: .75rem;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
}
.media-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg-deep);
}
.media-card p { margin: .3rem 0; font-size: .8rem; }
.copy-field {
  width: 100%;
  font-family: var(--mono);
  font-size: .72rem;
  padding: .3rem .4rem;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-deep);
  color: var(--ink-soft);
  margin: .3rem 0;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(217, 181, 88, .05), transparent 70%);
  color: var(--ink-dim);
  font-size: .8rem;
  padding: 1.6rem 0;
}
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--ink-soft); }
.footer-inner a:hover { color: var(--brass); }

/* ------------------------------------------------------------- mobile nav */

@media (max-width: 640px) {
  body { font-size: 16px; }

  /* A sticky header must not eat the screen. Flex-wrap gives three rows on a
     phone (brand, button, navigation), so the header becomes a two-row grid:
     brand and Discord button, then the navigation across the full width. This is
     deterministic; flex-wrap depended on text width. */
  .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: .6rem;
    row-gap: .5rem;
    padding-top: .65rem;
    padding-bottom: .55rem;
  }
  .brand { grid-column: 1; grid-row: 1; min-width: 0; }
  .brand-name { font-size: .92rem; }
  .brand-sub { display: none; }
  .brand-mark { width: 2rem; height: 2rem; font-size: .74rem; }
  .discord-button {
    grid-column: 2; grid-row: 1;
    padding: .38rem .65rem;
    font-size: .7rem;
    white-space: nowrap;
  }
  .site-nav { grid-column: 1 / -1; grid-row: 2; margin-left: 0; gap: .95rem; }
  .site-nav a { font-size: .7rem; }

  main { padding-top: 1.75rem; }
  .hero { padding: 1.4rem 1.15rem; }
  .hero-title { font-size: clamp(2.25rem, 1.5rem + 8vw, 3.6rem); }
  .hero::before,
  .hero::after { filter: blur(30px); opacity: .38; }
  .admin-head { flex-direction: column; align-items: flex-start; }
  .admin-table { font-size: .8rem; }
  .admin-table th, .admin-table td { padding: .55rem .4rem; }
  .row-actions { gap: .35rem .55rem; }
  .row-actions .link-button { min-height: 1.7rem; padding: .15rem .35rem; }
  .post-card { padding: .95rem 1.1rem; }
}

/* ---------------------------------------------------------------- motion */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(1.25rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ember-drift {
  from { transform: translate3d(-3%, 1%, 0) scale(1); opacity: .45; }
  to   { transform: translate3d(3%, -2%, 0) scale(1.12); opacity: .70; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .hero::before,
  .hero::after { animation: none; }
  .post-card:hover,
  .post-card:focus-within { transform: none; filter: none; }
  .discord-button:hover { transform: none; }
}

/* ---------------------------------------------------------- editor (TipTap)
 *
 * TipTap is headless, so the toolbar and surface styling are ours and live with
 * the rest of the site. The bundle is a built asset committed to
 * static/editor.js.
 */
