/* tokens */
:root {
  --ground:      #0d0906;
  --rail:        #120c07;
  --rail-edge:   rgba(233,189,118,.22);
  --surface:     #1a120a;
  --surface-2:   #221709;
  --hairline:    rgba(233,189,118,.22);
  --ink:         #f2e5c8;
  --ink-mid:     #b49b72;
  --ink-dim:     #b49b72;
  --accent:      #e9bd76;
  --tint:        #e9bd76;
  --on-accent:   #0d0906;
  --ok:          #3fb950;
  --danger:      #ef8f7a; /* must match kit/shell.css (the one dark danger red) */
  --idle:        #7d8999;
  --shadow:      0 1px var(--space-2) rgba(0,0,0,.4), 0 var(--space-8) var(--space-24) -12px rgba(0,0,0,.6);
  --photo-opacity: .84;
  --r-card: 13px; /* local card radius: the shared set has no exact 13px primitive */
  --r-nav:  var(--radius-10);
  --r-tile: var(--radius-11);
  --f-display: "Cinzel", Georgia, serif;
  --f-body:    "Segoe UI Variable Text", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, system-ui, sans-serif;
  --f-mono:    ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #f4f7fb; --rail: #ffffff; --rail-edge: #e3e9f1;
    --surface: #ffffff; --surface-2: #f3f6fa; --hairline: #e3e9f1;
    --ink: #0f1720; --ink-mid: #46525f; --ink-dim: #5d6b7a;
    --accent: #8a5a12; --tint: #8a5a12; --on-accent: #fff; --ok: #1a7f37; --idle: #5d6b7a;
    --danger: #b42318; /* the light danger red, the same on the lab and admin */
    --shadow: 0 1px var(--space-2) rgba(16,24,40,.06), 0 var(--space-10) var(--space-24) -14px rgba(16,24,40,.18);
    /* A soft tavern in light mode too; the band's fade to var(--ground) keeps the title legible. */
    --photo-opacity: .22;
  }
}
:root[data-theme="light"] {
  --ground: #f4f7fb; --rail: #ffffff; --rail-edge: #e3e9f1;
  --surface: #ffffff; --surface-2: #f3f6fa; --hairline: #e3e9f1;
  --ink: #0f1720; --ink-mid: #46525f; --ink-dim: #5d6b7a;
  --accent: #8a5a12; --tint: #8a5a12; --on-accent: #fff; --ok: #1a7f37; --idle: #5d6b7a;
  --danger: #b42318; /* the light danger red, the same on the lab and admin */
  --shadow: 0 1px var(--space-2) rgba(16,24,40,.06), 0 var(--space-10) var(--space-24) -14px rgba(16,24,40,.18);
  --photo-opacity: .22;
}

/* base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-body); font-size: var(--font-size-14); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
svg { display: block; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
:where(a, button, input):focus-visible {
  outline: var(--space-2) solid var(--accent); outline-offset: var(--space-2); border-radius: var(--radius-6);
}
.shell { position: relative; display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100%; }
.view[hidden] { display: none !important; }

/* rail */
.rail {
  background: var(--rail); border-right: 1px solid var(--rail-edge);
  padding: var(--space-22) var(--space-16) var(--space-18); display: flex; flex-direction: column; gap: 26px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: var(--space-12); padding: 0 var(--space-6); }
.brand img { width: 36px; height: 36px; flex: none; }
.brand__name {
  font-family: var(--f-display); font-size: var(--font-size-18); font-weight: 600;
  letter-spacing: -.015em; line-height: 1.15;
}
.brand__sub { font-family: var(--f-mono); font-size: var(--font-size-11); color: var(--ink-dim); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__item {
  min-height: 44px;
  display: flex; align-items: center; gap: var(--space-12); width: 100%;
  padding: var(--space-9) var(--space-12); border: 0; border-radius: var(--r-nav);
  background: none; color: var(--ink-mid); font: inherit; font-weight: 500;
  text-align: left; cursor: pointer;
}
.nav__item svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav__item:hover { background: var(--surface-2); color: var(--ink); }
.nav__item[aria-current="true"] {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--ink); font-weight: 600;
}
.nav__item[aria-current="true"] svg { color: var(--accent); opacity: 1; }
.nav__count { margin-left: auto; font-family: var(--f-mono); font-size: var(--font-size-11); color: var(--idle); }
/* On the hover and current tints the grey is too faint (under 4.5:1): the counts go up a step. */
.nav__item:hover .nav__count, .nav__item[aria-current="true"] .nav__count { color: var(--ink-mid); }

.rail__foot { margin-top: auto; padding: 0 var(--space-8); }
.rail__quote {
  font-family: var(--f-display); font-style: italic; font-size: var(--font-size-13-5);
  color: var(--ink-dim);
}
.rail__rule { width: var(--space-22); height: var(--space-2); background: var(--hairline); margin-top: var(--space-12); border-radius: var(--radius-2); }

/* main */
.main { position: relative; padding: var(--space-22) 34px 56px; min-width: 0; }
.band {
  position: absolute; top: 0; left: 252px; right: 0; height: 300px;
  z-index: 0; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 46%, rgba(0,0,0,.55) 76%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 46%, rgba(0,0,0,.55) 76%, transparent 100%);
}
.band img {
  /* The tavern hall (20.06 Room Art): keep the hearth and the balcony in frame. */
  width: 100%; height: 100%; object-fit: cover; object-position: 48% 45%;
  opacity: var(--photo-opacity);
}
.band::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to right,
      color-mix(in srgb, var(--ground) 86%, transparent) 0%,
      color-mix(in srgb, var(--ground) 58%, transparent) 32%,
      color-mix(in srgb, var(--ground) 30%, transparent) 62%,
      color-mix(in srgb, var(--ground) 12%, transparent) 100%),
    linear-gradient(to bottom,
      color-mix(in srgb, var(--ground) 34%, transparent) 0%,
      transparent 38%,
      color-mix(in srgb, var(--ground) 72%, transparent) 100%);
}

.topbar { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-16); }
.themer {
  margin-left: auto; display: flex; gap: var(--space-2); padding: 3px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--hairline); border-radius: var(--radius-999);
}
.themer button {
  min-width: 44px; min-height: 44px; border: 0; border-radius: var(--radius-999);
  background: none; color: var(--accent); cursor: pointer;
  display: grid; place-items: center;
}
.themer button svg { width: 15px; height: 15px; }
.themer button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* hero */
.hero { position: relative; z-index: 1; margin: 44px 0 34px; }
/* photo-backing: text over a photo needs a solid backing */
.hero__title {
  font-family: var(--f-display); font-weight: 600;
  /* 32px floor is a page-specific display size; shared type tokens have no exact match. */
  font-size: clamp(32px, 4.2vw, 44px); letter-spacing: -.028em;
  line-height: 1.04; margin: 0; text-wrap: balance; overflow-wrap: anywhere;
  /* A name with stacked combining marks can't paint over the lines around it. */
  overflow: hidden;
  background-color: var(--surface, var(--bg)); color: var(--ink);
  border-radius: var(--radius-12); padding: .5em .75em;
}
.hero__title em { font-style: italic; color: var(--accent); }
.hero__sub { margin: 11px 0 0; color: var(--ink); font-size: var(--font-size-15); max-width: 58ch;
  background-color: var(--surface, var(--bg));
  border-radius: var(--radius-12); padding: .5em .75em; }

/* cards */
.grid {
  position: relative; z-index: 1; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: var(--space-14);
}
.card {
  display: flex; gap: 15px; padding: 17px; min-width: 0;
  border-radius: var(--r-card);
  background-color: var(--surface);
  background-image: linear-gradient(118deg,
    color-mix(in srgb, var(--tint) 20%, transparent) 0%, transparent 60%);
  border: 1px solid color-mix(in srgb, var(--tint) 22%, var(--hairline));
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease;
}
a.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tint) 55%, var(--hairline));
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--tint) 35%, transparent), 0 var(--space-10) var(--space-30) -12px color-mix(in srgb, var(--tint) 45%, transparent); }
.card { position: relative; overflow: hidden; }
.card__motif { position: absolute; right: -12px; bottom: -16px; width: 76px; height: 76px; color: var(--tint);
  opacity: .08; transform: rotate(-12deg); pointer-events: none; transition: opacity .16s ease; }
a.card:hover .card__motif { opacity: .14; }
.card__desc { padding-right: 40px; }
.card__icon {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-tile);
  display: grid; place-items: center; color: var(--tint);
  background: color-mix(in srgb, var(--tint) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tint) 26%, transparent);
}
.card__icon svg { width: 23px; height: 23px; }
.card__body { min-width: 0; flex: 1 1 auto; }
.card__name {
  font-family: var(--f-display); font-size: 16.5px; font-weight: 600;
  letter-spacing: -.015em; display: flex; align-items: center; gap: var(--space-9); flex-wrap: wrap;
}
.card__desc { color: var(--ink-dim); font-size: var(--font-size-13); margin-top: var(--space-4); }
/* DRAFT:BEGIN */
.card__meta { display: block; font-family: var(--f-mono); font-size: var(--font-size-11); color: var(--idle); margin-top: 3px; }
/* DRAFT:END */
.card__points { margin: 11px 0 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.card__points li { position: relative; padding-left: 17px; color: var(--ink-dim); font-size: 12.8px; }
.card__points li::before {
  content: ""; position: absolute; left: var(--space-2); top: .6em;
  width: 5px; height: 5px; border-radius: var(--radius-999); background: var(--tint); opacity: .8;
}
.card__cta {
  display: inline-flex; align-items: center; gap: var(--space-8); margin-top: var(--space-14);
  font-weight: 600; font-size: var(--font-size-13-5); color: var(--tint);
}
.card__cta svg { width: 15px; height: 15px; transition: transform .16s ease; }
a.card:hover .card__cta svg { transform: translateX(3px); }

/* each room in its own colour (the registry's), the same as its page in the Player Hub */
/* --tint-d / --tint-l are set on each card from /assets/kit/rooms.css (var(--room-<id>) and var(--room-<id>-light)) */
.card--r { --tint: var(--tint-d, #e9bd76); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .card--r { --tint: var(--tint-l, #8a5a12); }
}
:root[data-theme="light"] .card--r { --tint: var(--tint-l, #8a5a12); }
/* feedback: the form opened by "Send word to the Guild" on any page (?feedback=1&from=) */
.fb { border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--surface); color: var(--ink);
      padding: var(--space-20); width: min(520px, calc(100vw - var(--space-32))); box-shadow: var(--shadow); }
.fb::backdrop { background: rgba(0, 0, 0, .65); }
.fb__label { display: block; font-size: var(--font-size-13-5); font-weight: 600; margin: 0 0 var(--space-6); color: var(--ink); }
.fb h2 { font-family: var(--f-display); font-size: var(--font-size-20); font-weight: 600; margin: 0 0 var(--space-4); }
.fb p { color: var(--ink-mid); font-size: var(--font-size-13-5); margin: 0 0 var(--space-12); }
.fb fieldset { border: 0; padding: 0; margin: 0 0 var(--space-12); display: flex; gap: var(--space-8); flex-wrap: wrap; }
.fb legend { font-size: var(--font-size-12-5); color: var(--ink-dim); margin-bottom: var(--space-6); padding: 0; }
.fb fieldset label { display: inline-flex; align-items: center; gap: var(--space-8); min-height: 44px; padding: 0 var(--space-14); border: 1px solid var(--hairline);
      border-radius: var(--radius-10); cursor: pointer; font-size: var(--font-size-14); }
/* tap-box: 44px hit area (22 content + 2x2 border + 2x9 padding) */
.fb fieldset input[type=radio] { appearance: none; -webkit-appearance: none; box-sizing: content-box; width: var(--space-22); height: var(--space-22); padding: var(--space-9); margin: 0;
      border: var(--space-2) solid var(--hairline); border-radius: 50%; background: transparent; background-clip: content-box; cursor: pointer; flex: none; }
.fb fieldset input[type=radio]:checked { border-color: var(--accent); background-color: var(--accent); }
.fb fieldset input[type=radio]:focus-visible { outline: var(--space-2) solid var(--accent); outline-offset: var(--space-2); }
@media (max-width: 560px) { .fb fieldset { display: grid; grid-template-columns: 1fr 1fr; } .fb fieldset label { justify-content: center; } }
.fb fieldset label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.fb textarea { width: 100%; min-height: 130px; resize: vertical; font: inherit; font-size: var(--font-size-15); color: var(--ink); background: var(--surface-2);
      border: 1px solid var(--hairline); border-radius: var(--radius-9, 9px); padding: var(--space-10) var(--space-12); box-sizing: border-box; }
.fb textarea:focus { border-color: var(--accent); outline: none; }
.fb__about { font-size: var(--font-size-12-5); color: var(--ink-dim); overflow-wrap: anywhere; margin: var(--space-8) 0 0; }
.fb__row { display: flex; gap: var(--space-10); align-items: center; flex-wrap: wrap; margin-top: var(--space-14); }
.fb__ghost { font: inherit; font-weight: 600; font-size: var(--font-size-13-5); border: 1px solid var(--hairline); border-radius: var(--radius-9, 9px); padding: var(--space-9) var(--space-12);
      background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
      min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.fb__msg { font-size: var(--font-size-13-5); margin: var(--space-10) 0 0; color: var(--ink-mid); min-height: 1em; }
.fb__msg--err { color: var(--danger); }
.foot a { color: var(--accent); }

.rooms-heading { font-family: var(--f-display); font-size: var(--font-size-15); font-weight: 600; color: var(--ink-mid); margin: var(--space-22) 0 var(--space-10); position: relative; z-index: 1; }
.rooms-group:first-child > .rooms-heading { margin-top: 0; }
.rooms-group { min-width: 0; }

/* a card with nothing behind it yet says so, and is not a link */
.card--soon {
  background-image: none; border-style: dashed;
  border-color: var(--hairline); box-shadow: none;
}
.card--soon .card__icon { background: none; border-color: var(--hairline); color: var(--idle); }
.card--soon .card__name { color: var(--ink-mid); }

.badge {
  font-family: var(--f-body); font-size: var(--font-size-10); font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--idle);
  border: 1px solid var(--hairline); border-radius: var(--radius-999); padding: var(--space-2) var(--space-8);
}
.badge--live {
  color: var(--ok); border-color: color-mix(in srgb, var(--ok) 44%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.foot {
  position: relative; z-index: 1; margin-top: var(--space-30); padding-top: var(--space-16);
  border-top: 1px solid var(--hairline); color: var(--idle); font-size: var(--font-size-12);
  display: flex; gap: var(--space-10); flex-wrap: wrap;
}
.foot code { font-family: var(--f-mono); }
.foot__fb { display: inline-flex; align-items: center; min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  a.card:hover { transform: none; }
}
@media (max-width: 900px) {
  /* The rail as tall as its cards; main takes the rest (a short page left a blank band under the rail). */
  .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .rail { position: static; height: auto; }
  .rail__foot { display: none; }
  .main { padding: var(--space-18) var(--space-18) 44px; }
  .band { position: relative; left: auto; height: 200px; }
  /* Dim the photo on smaller screens. */
  .band img { opacity: calc(var(--photo-opacity) * .72); }
  .hero { margin: var(--space-28) 0 var(--space-24); }
}

/* the Guild Hall: the sign-in card in the rail, and the rooms it opens */
.guild {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-card);
  box-shadow: var(--shadow); padding: var(--space-14) var(--space-14) var(--space-16); display: flex; flex-direction: column; gap: var(--space-10);
}
.guild__head { display: flex; align-items: center; gap: var(--space-10); flex-wrap: wrap; }
.guild__head > svg { width: var(--space-20); height: var(--space-20); color: var(--accent); flex: none; }
.guild__title { font-family: var(--f-display); font-size: var(--font-size-16); font-weight: 600; letter-spacing: -.01em; }
.guild p { margin: 0; color: var(--ink-mid); font-size: var(--font-size-13); }
.guild form { display: flex; flex-direction: column; gap: var(--space-8); margin: 0; }
.guild label { display: flex; flex-direction: column; gap: 3px; font-size: var(--font-size-12); color: var(--ink-dim); }
.guild input {
  font: inherit; font-size: var(--font-size-14); color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: var(--radius-8); padding: var(--space-8) var(--space-10); min-width: 0; width: 100%;
  min-height: 44px;
}
.guild input:focus { border-color: var(--accent); outline: none; }
.guild__btn {
  font: inherit; font-weight: 600; font-size: var(--font-size-13-5); border: 0; border-radius: var(--radius-9, 9px); padding: var(--space-9) var(--space-12); cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.guild__btn:disabled { opacity: .6; cursor: default; }
.guild__link {
  background: none; border: 0; padding: 0; font: inherit; font-size: var(--font-size-12-5); color: var(--accent);
  cursor: pointer; text-align: left;
  min-height: 44px; display: inline-flex; align-items: center;
}
.guild__links { display: flex; flex-wrap: wrap; gap: var(--space-12, 12px); }
.notice--denied {
  min-width: 0; max-width: 100%; padding: var(--space-12);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--accent);
  border-radius: var(--radius-8); overflow-wrap: anywhere;
}
.notice--denied h3 { margin: 0 0 var(--space-8); font: inherit; font-weight: 700; }
.guild .notice--denied p { margin: 0 0 var(--space-8); color: var(--ink); font-size: inherit; }
.notice--denied a { color: var(--accent); }
.guild__msg { font-size: var(--font-size-12-5); color: var(--ink-mid); min-height: 0; }
.guild p.guild__msg--err:not(:empty), .guild p.guild__go { margin-bottom: var(--space-8); }
.guild .guild__msg--err { color: var(--danger); }
.guild input:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
@media (max-width: 900px) {
  .guild.guild--in { padding: var(--space-10) var(--space-14); }
  body.signed-in .band { display: none; }
  body.signed-in .shell { grid-template-rows: auto 1fr; }
  .guild.guild--in .guild__head > svg, .guild.guild--in .guild__title { display: none; }
  .guild.guild--in #guild-body { display: flex; align-items: center; justify-content: space-between; gap: var(--space-12); flex-wrap: wrap; }
}
@media (pointer: coarse), (max-width: 860px) {
  .nav__item {
  min-height: 44px; min-height: 44px; }
  .guild input { font-size: var(--font-size-16); }
}
/* The rail's section list is only worth showing when there is more than one. */
.nav:has(.nav__item:only-child) { display: none; }
.intro { max-width: 38rem; position: relative; z-index: 1; }
.intro p { color: var(--ink-mid); font-size: var(--font-size-15); line-height: 1.6; margin: 0 0 var(--space-12); }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { position: fixed; left: var(--space-8); top: var(--space-8); z-index: 10000; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-16); background: var(--surface); color: var(--ink); border: var(--space-2) solid var(--accent); border-radius: var(--radius-8); text-decoration: none; }

@media (max-width: 600px) {
  .band { position: relative; left: auto; height: 160px; max-height: 160px; }
}
