/* Local Guild Software: placeholder guild hall */

:root {
  /* The hall: navy, always */
  --navy: #0f1b30;
  --navy-2: #182842;
  --hall-ink: #eef1f6;
  --hall-ink-2: #bcc6d6;
  --gold: #d8b45f;
  --gold-line: rgba(216, 180, 95, 0.55);

  /* Stone: soft grey */
  --stone: #d9dde3;
  --stone-panel: #eef0f3;
  --stone-ink: #0f1b30;
  --stone-ink-2: #3a4558;
  --stone-rule: #b4bcc8;
  --stone-frame: #b8923a;

  --display: "Alegreya Sans SC", "Fira Sans", system-ui, sans-serif;
  --text: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --margin: clamp(16px, 4vw, 56px);
  --pad-section: clamp(72px, 8vw, 120px);
  color-scheme: light;
}

/* Dark mode dims the stone; the bands keep their order */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stone: #c9ced6;
    --stone-panel: #e3e6eb;
    --stone-rule: #a7afbc;
    color-scheme: dark;
  }
}

/* data-theme pins a theme for design review */
:root[data-theme="dark"] {
  --stone: #c9ced6;
  --stone-panel: #e3e6eb;
  --stone-rule: #a7afbc;
  color-scheme: dark;
}

/* Band roles: every section picks one */
.band-hall  { --bg: var(--navy);  --ink: var(--hall-ink);  --ink-2: var(--hall-ink-2);  --accent: var(--gold);       --panel: var(--navy-2);      --rule: #2b3d5c;          --frame: var(--gold-line); }
.band-stone { --bg: var(--stone); --ink: var(--stone-ink); --ink-2: var(--stone-ink-2); --accent: var(--stone-ink);  --panel: var(--stone-panel); --rule: var(--stone-rule); --frame: var(--stone-frame); }
[class*="band-"] { background: var(--bg); color: var(--ink); }

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

body {
  margin: 0;
  background: var(--navy);
  color: var(--hall-ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3, p, ol, ul { margin: 0; }
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  text-wrap: balance;
}
h2 { font-size: clamp(2.5rem, 5.6vw, 5rem); }
p { text-wrap: pretty; }

a { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute;
  left: var(--margin);
  top: -100px;
  background: var(--accent, var(--gold));
  color: var(--navy);
  padding: 8px 16px;
  z-index: 10;
}
.skip:focus { top: 12px; }

.eyebrow {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-wrap: balance;
}
/* Rule, text, rule: the device under the logo */
.eyebrow::before,
.eyebrow::after,
.ledgers caption::before,
.ledgers caption span::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: currentColor;
  vertical-align: middle;
  opacity: 0.7;
}
.eyebrow::before, .ledgers caption::before { margin-right: 12px; }
.eyebrow::after { margin-left: 12px; }
.ledgers caption span::before { margin-right: 12px; }
.nw { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.ornament {
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
}

/* Buttons: gold on the navy hall */
.button {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 4px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease;
}
.button:hover { background: #e6c675; }
.button:active { transform: translateY(1px); }
.button-small { min-height: 44px; padding: 0 18px; font-size: 1rem; }

.text-link {
  font-weight: 500;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--accent);
}
.text-link:hover { color: var(--accent); }

/* Bar */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 32px;
  padding: 20px var(--margin);
}
.bar-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.bar-name img { display: block; width: 34px; height: 34px; }
.bar ul { display: flex; gap: 28px; list-style: none; padding: 0; }
.bar nav a { display: inline-block; padding: 10px 0; text-decoration: none; font-weight: 500; }
.bar nav a:hover { color: var(--accent); }

/* Hero: the hall */
.hero { padding: clamp(8px, 1.5vw, 24px) var(--margin) clamp(48px, 5vw, 72px); }
.hall {
  border: 1px solid var(--frame);
  outline: 1px solid var(--frame);
  outline-offset: -12px;
  padding: clamp(48px, 4vw, 64px) clamp(28px, 6vw, 96px);
  text-align: center;
}
.hero h1 { margin-top: 24px; line-height: 0; }
.hero-logo {
  display: block;
  margin: 0 auto;
  width: min(100%, 440px);
  height: auto;
}
.hero-lede {
  margin: 20px auto 0;
  max-width: 28ch;
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}
.hero-sub {
  margin: 8px auto 0;
  max-width: 36rem;
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  color: var(--ink-2);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 16px 32px;
  margin-top: 28px;
}

/* Section heads */
.charters, .dues, .founders { padding: var(--pad-section) var(--margin); }
.section-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px clamp(32px, 6vw, 96px);
  align-items: end;
}
.section-head p { max-width: 28rem; color: var(--ink-2); }

/* Charters */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 2.4vw, 36px);
  margin-top: 56px;
}
.charter {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--frame);
  outline: 1px solid var(--frame);
  outline-offset: -6px;
  padding: 11px;
}
.charter-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  background: var(--navy);
  color: var(--hall-ink);
  border-radius: 2px;
  padding: 20px 24px;
}
.charter-top h3 {
  font-size: clamp(1.75rem, 2.8vw, 2.5rem);
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}
.cost {
  flex: none;
  color: var(--gold);
  font-weight: 600;
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}
.cost span { font-weight: 400; font-size: 1rem; color: var(--hall-ink-2); }
.charter-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 24px 14px;
  color: var(--stone-ink);
}
.charter-type {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 16px;
  text-wrap: balance;
}
.charter-type [aria-hidden] { margin: 0 6px; }
.charter-body p + p { margin-top: 12px; }
.charter-body .flavor {
  margin-top: 20px;
  font-style: italic;
  color: var(--ink-2);
}
.charter-body .charter-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 24px;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 1rem;
  color: var(--ink-2);
}

.namer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 16px 0 20px;
}
.namer label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.1em;
}
.namer input {
  font: inherit;
  font-size: 1.0625rem;
  color: var(--stone-ink);
  background: #fff;
  border: 1px solid var(--stone-ink-2);
  border-radius: 4px;
  padding: 0 14px;
  min-height: 48px;
  width: min(100%, 18rem);
}
.namer input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.namer input::placeholder { color: var(--ink-2); }

/* Dues */
.ledgers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px clamp(32px, 6vw, 96px);
  margin-top: 56px;
}
.ledgers table { border-collapse: collapse; width: 100%; table-layout: fixed; }
.ledgers caption {
  text-align: left;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: 0.06em;
  padding-bottom: 8px;
  color: var(--accent);
}
.ledgers caption span {
  font-family: var(--text);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0;
  color: var(--ink-2);
  margin-left: 8px;
}
.ledgers th, .ledgers td {
  padding: 16px 0;
  text-align: left;
  vertical-align: baseline;
  border-top: 1px solid var(--rule);
}
.ledgers tr:last-child th, .ledgers tr:last-child td { border-bottom: 1px solid var(--rule); }
.ledgers th { width: 38%; font-weight: 600; padding-right: 16px; }
.ledgers .what { color: var(--ink-2); font-size: 1rem; padding-right: 16px; }
.ledgers .amt {
  width: 4.5rem;
  text-align: right;
  font-weight: 600;
  font-size: 1.375rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.full-charter {
  display: grid;
  grid-template-columns: minmax(0, 4fr) auto minmax(0, 5fr);
  gap: 16px clamp(24px, 4vw, 64px);
  align-items: end;
  margin-top: 56px;
  background: var(--panel);
  border: 1px solid var(--frame);
  outline: 1px solid var(--frame);
  outline-offset: -10px;
  padding: clamp(32px, 4vw, 56px);
}
.full-charter h3 { margin-top: 8px; font-size: clamp(2.25rem, 4vw, 3.5rem); letter-spacing: 0.04em; }
.suite-price {
  font-weight: 600;
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.suite-price span { font-weight: 400; font-size: 1.125rem; color: var(--ink-2); }
.suite-extra { margin-top: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.suite-price, .suite-extra { white-space: nowrap; }
.suite-text { color: var(--ink-2); max-width: 26rem; }

/* Founders: framed like the charters, the photo above a navy name bar */
.founder-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 2.4vw, 36px);
  margin-top: 56px;
  padding: 0;
  list-style: none;
}
.founder {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--frame);
  outline: 1px solid var(--frame);
  outline-offset: -6px;
  padding: 11px;
}
.portrait {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 2px 2px 0 0;
  background: var(--navy);
  cursor: pointer;
}
.portrait picture { display: block; }
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px 2px 0 0;
}
.portrait-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 12px;
  border: 1px solid var(--gold-line);
  border-radius: 2px;
  background: var(--navy);
  color: var(--gold);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.1em;
  line-height: 1.2;
}
.portrait:hover .portrait-hint,
.portrait[aria-expanded="true"] .portrait-hint { background: var(--gold); color: var(--navy); }
.founder-bar {
  flex: 1;
  background: var(--navy);
  color: var(--hall-ink);
  border-radius: 0 0 2px 2px;
  padding: 16px 20px 18px;
}
.founder-bar h3 { font-size: clamp(1.5rem, 2.2vw, 2rem); letter-spacing: 0.04em; }
.founder-title {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.1em;
  color: var(--gold);
}
.founder-role { margin-top: 2px; font-size: 1rem; color: var(--hall-ink-2); }

/* Character sheets: popovers in the founders' frame */
.sheet {
  position: fixed;
  inset: auto;
  z-index: 20; /* only matters without native popover support */
  margin: 0;
  width: min(25rem, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 11px;
  background: var(--stone-panel);
  color: var(--stone-ink);
  border: 1px solid var(--stone-frame);
  outline: 1px solid var(--stone-frame);
  outline-offset: -6px;
  box-shadow: 0 18px 48px rgba(15, 27, 48, 0.35);
  font-size: 1rem;
  line-height: 1.45;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 16px;
  background: var(--navy);
  color: var(--hall-ink);
  border-radius: 2px;
}
.sheet-thumb { flex: none; border: 1px solid var(--gold-line); }
.sheet-thumb img { display: block; width: 48px; height: 60px; object-fit: cover; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-name { font-family: var(--display); font-weight: 800; font-size: 1.75rem; letter-spacing: 0.04em; line-height: 1; }
.sheet-class {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  line-height: 1.2;
  text-wrap: balance;
}
.sheet-align { margin-top: 2px; font-size: 0.9375rem; color: var(--hall-ink-2); }
.sheet-close {
  flex: none;
  align-self: flex-start;
  width: 44px;
  height: 44px;
  border: 1px solid var(--gold-line);
  border-radius: 2px;
  background: transparent;
  color: var(--hall-ink);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.sheet-close:hover { color: var(--gold); }
.sheet-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sheet-body { padding: 16px 10px 8px; }
.sheet dl { margin: 0; display: grid; gap: 6px; }
.sheet dd { margin: 0; }
.sheet-vitals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sheet-abilities { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sheet .sheet-abilities { margin-top: 10px; }
.sheet-vitals > div,
.sheet-abilities > div {
  border: 1px solid var(--stone-ink-2);
  border-radius: 3px;
  text-align: center;
  padding: 6px 4px;
  background: #fff;
}
.sheet dt {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--stone-ink-2);
  line-height: 1.2;
}
.sheet abbr { text-decoration: none; }
.sheet-vitals dd { font-size: 1.375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-abilities dd { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sheet-abilities dd span {
  display: block;
  margin: 4px auto 0;
  width: fit-content;
  padding: 0 6px;
  border: 1px solid var(--stone-rule);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
}
.sheet-label {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid var(--stone-rule);
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  color: var(--stone-ink-2);
}
.sheet-body > p:not(.sheet-label) { margin-top: 4px; }
.sheet-weapons { list-style: none; padding: 0; margin: 4px 0 0; }
.sheet-weapons li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.sheet-weapons li span:last-child { flex: none; font-variant-numeric: tabular-nums; color: var(--stone-ink-2); }
@media (prefers-reduced-motion: no-preference) {
  .sheet:popover-open { animation: sheet-in 140ms ease-out; }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(4px); } }

/* Close */
.close {
  padding: var(--pad-section) var(--margin);
  text-align: center;
}
.close h2 { margin-top: 24px; font-size: clamp(2.75rem, 7vw, 6.5rem); letter-spacing: 0.035em; }
.close p:not(.ornament) { margin: 24px auto 0; max-width: 30rem; color: var(--ink-2); text-wrap: balance; }
.close .button { margin-top: 36px; }

/* Footer */
.foot { padding: 48px var(--margin) 40px; }
.foot-name {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  letter-spacing: 0.06em;
  line-height: 1;
}
.foot-name img { display: block; width: 64px; height: auto; }
.foot-line {
  margin-top: 16px;
  font-size: 1rem;
  color: var(--ink-2);
}

/* Tablet */
@media (max-width: 960px) {
  .section-head,
  .cards,
  .ledgers,
  .full-charter { grid-template-columns: 1fr; }
}

/* Tablet: one founder per row like the charters, photo beside the name bar */
@media (min-width: 641px) and (max-width: 960px) {
  .founder-list { grid-template-columns: 1fr; }
  .founder { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .portrait, .portrait img { border-radius: 2px 0 0 2px; }
  .founder-bar { border-radius: 0 2px 2px 0; padding: 24px 28px; }
}

/* Narrow header: nav on a second row, the hero's button stands in for the bar's */
@media (max-width: 900px) {
  .bar { gap: 10px 16px; }
  .bar nav { flex-basis: 100%; }
  .bar ul { gap: 24px; }
  .bar .button { display: none; }
}

/* Phone */
@media (max-width: 640px) {
  body { font-size: 1.0625rem; }
  .bar { padding-top: 16px; padding-bottom: 16px; }
  .bar-name { font-size: 1.125rem; letter-spacing: 0.04em; white-space: nowrap; }
  .hall { outline-offset: -8px; padding-left: 20px; padding-right: 20px; }
  .eyebrow { font-size: 0.9375rem; letter-spacing: 0.1em; }
  .charter-type > .nw { display: block; }
  .charter-type [aria-hidden] { display: none; }
  .ledgers table { table-layout: auto; }
  .ledgers th { width: auto; min-width: min(9.5rem, 40vw); white-space: nowrap; }
  .ledgers caption span { white-space: nowrap; }
  .ledgers .amt { width: auto; }
  .founder-list { grid-template-columns: 1fr; }
  /* Character sheets become a bottom sheet */
  .sheet {
    inset: auto 0 0 0;
    width: 100%;
    max-height: 85dvh;
    border-radius: 8px 8px 0 0;
  }
  .sheet::backdrop { background: rgba(15, 27, 48, 0.55); }
  .charter-top, .charter-body { padding-left: 18px; padding-right: 18px; }
}

/* Smallest phones: abilities in two rows */
@media (max-width: 360px) {
  .sheet-abilities { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
