/* Layout and page styles for the WFRP sites, on top of tokens.css and components.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 24px; background: var(--paper); color: var(--ink); }
a { color: var(--copper-ink); }
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0; }
.wf-display { font-family: var(--font-display); font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--copper); color: var(--on-copper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- App shell: side menu + main ---- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.shell .wf-sidenav { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { padding: var(--space-8) var(--space-12); max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-8); flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 48px; }
.page-head p { margin: 4px 0 0; color: var(--ink-muted); }
.menu-toggle { display: none; }
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .shell .wf-sidenav { position: fixed; z-index: 20; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .shell.menu-open .wf-sidenav { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .menu-toggle { display: inline-flex; position: sticky; top: 0; z-index: 10; margin: var(--space-3); }
  .main { padding: var(--space-4); }
  .page-head h1 { font-size: 30px; line-height: 36px; }
}

/* ---- Grids and sections ---- */
.grid { display: grid; gap: var(--space-6); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }
.section { margin-top: var(--space-8); }
.section > h2, .panel > h2 { font-size: 22px; line-height: 28px; font-weight: 700; margin-bottom: var(--space-4); display: flex; align-items: center; gap: var(--space-3); justify-content: space-between; }
.panel { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); min-width: 0; }
.panel + .panel { margin-top: var(--space-6); }
.panel h3 { font-size: 16px; font-weight: 700; margin: var(--space-4) 0 var(--space-2); }
.panel > :first-child { margin-top: 0; }
.stack > * + * { margin-top: var(--space-4); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; line-height: 20px; }
.up { color: var(--sage); } .down { color: var(--blood); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.empty { color: var(--ink-muted); padding: var(--space-4) 0; }
dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--space-4); margin: 0; font-size: 15px; }
dl.facts dt { color: var(--ink-muted); }
dl.facts dd { margin: 0; font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: var(--space-6); flex-wrap: wrap; }
.tabs a { padding: 10px var(--space-4); text-decoration: none; color: var(--ink-muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--copper); }
.tabs a:hover { color: var(--ink); }
form.inline { display: inline; }
.form { display: grid; gap: var(--space-4); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); align-items: end; }
select.wf-input { appearance: auto; }
.wf-btn[disabled] { opacity: .5; cursor: not-allowed; }
.wf-btn-danger { background: var(--blood-soft); color: var(--blood); border-color: var(--blood); }
details.more summary { cursor: pointer; font-weight: 700; color: var(--copper-ink); }
details.more[open] summary { margin-bottom: var(--space-3); }
.wf-chart { width: 100%; height: auto; display: block; }
.wf-spark { display: block; }
.flash { margin-bottom: var(--space-6); }
.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv-list li:last-child { border-bottom: 0; }
.bar { height: 8px; background: var(--paper-sunken); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--copper); }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 96px; }
.hours span { background: var(--turquoise); border-radius: 2px 2px 0 0; min-height: 2px; }
.hours-labels { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 11px; color: var(--ink-muted); text-align: center; }

/* ---- Search box in the page head ---- */
.head-search { width: min(520px, 100%); }

/* ---- Character cards (Exchange home) ---- */
.char-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.char-card-head { background: var(--logo-black); color: #F3EBDD; padding: var(--space-4) var(--space-6); display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.char-card-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 32px; color: #F3EBDD; }
.char-card-head .wf-overline { color: var(--gold); }
.char-card-body { padding: var(--space-6); display: grid; gap: var(--space-4); }
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-6); }
.box { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-6); }
.box h3 { font-size: 12px; line-height: 16px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin: 0 0 var(--space-3); font-weight: 700; }
.box .big { font-size: 30px; line-height: 36px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---- Market ---- */
.ticker { display: flex; gap: var(--space-6); overflow: hidden; white-space: nowrap; background: var(--logo-black); color: #F3EBDD; padding: 8px var(--space-6); font-family: var(--font-mono); font-size: 13px; border-radius: var(--radius-md); margin-bottom: var(--space-6); }
.ticker-track { display: inline-flex; gap: var(--space-8); animation: tick 60s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker b { color: var(--gold); margin-right: 6px; }
.ticker .up { color: #9DB592; } .ticker .down { color: #F08A86; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }
.board td .wf-spark { margin-left: auto; }
.news-item { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item h3 { font-family: var(--font-display); font-weight: 400; font-size: 20px; line-height: 26px; margin: 4px 0; }
.news-item p { margin: 4px 0 0; }
.ledger-head { text-align: center; border-bottom: 3px double var(--line-strong); padding-bottom: var(--space-3); margin-bottom: var(--space-4); }
.ledger-head .wf-display { font-size: 34px; line-height: 40px; }

/* ---- Public site ---- */
.site-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) var(--space-12); border-bottom: 1px solid var(--line); background: var(--paper-raised); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.site-top .brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--ink); font-weight: 800; }
.site-top .brand img { width: 44px; height: 44px; }
.site-nav { display: flex; gap: var(--space-4); flex-wrap: wrap; align-items: center; }
.site-nav a { text-decoration: none; color: var(--ink-muted); font-weight: 600; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.site-main { max-width: 1120px; margin: 0 auto; padding: var(--space-12) var(--space-6); }
.prose { max-width: 720px; font-size: 17px; line-height: 28px; }
.prose h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 48px; margin-bottom: var(--space-6); }
.prose h2 { font-size: 24px; line-height: 30px; margin: var(--space-8) 0 var(--space-3); scroll-margin-top: 96px; }
.prose h3 { font-size: 19px; margin: var(--space-6) 0 var(--space-2); }
.prose li { margin: 4px 0; }
.prose blockquote { margin: var(--space-4) 0; padding-left: var(--space-4); border-left: 3px solid var(--gold); color: var(--ink-muted); }
.prose code { font-family: var(--font-mono); font-size: 14px; background: var(--paper-sunken); padding: 1px 5px; border-radius: 2px; }
.doc-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-12); }
.doc-toc { position: sticky; top: 96px; align-self: start; font-size: 14px; }
.doc-toc a { display: block; padding: 4px 0; color: var(--ink-muted); text-decoration: none; }
.doc-toc a:hover { color: var(--ink); }
@media (max-width: 860px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } .doc-toc { position: static; } .site-top { padding: var(--space-3) var(--space-4); } }
.hero { position: relative; min-height: 78vh; display: grid; place-items: center; text-align: center; padding: var(--space-16) var(--space-6); background: radial-gradient(ellipse at 50% 120%, #7a3a16 0%, #1F5A60 45%, #0D1416 85%); color: #F3EBDD; overflow: hidden; }
.hero img.logo { width: min(420px, 80vw); height: auto; }
.hero p.lede { font-size: 20px; line-height: 30px; max-width: 620px; margin: var(--space-6) auto; color: #F3EBDD; }
.hero .row { justify-content: center; }
.hero .status { font-family: var(--font-mono); font-size: 14px; color: #C9D6D4; margin-top: var(--space-4); }
.reasons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.reasons h3 { font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 30px; margin-bottom: var(--space-2); }
@media (max-width: 760px) { .reasons { grid-template-columns: minmax(0, 1fr); } }
.poster { background: #E9D9B8; color: #2A1D12; border: 1px solid #B89D6E; border-radius: 2px; padding: var(--space-6); text-align: center; box-shadow: 0 2px 0 rgba(0,0,0,.15); font-family: Georgia, serif; }
.poster .wanted { font-family: var(--font-display); font-size: 40px; line-height: 44px; letter-spacing: .04em; }
.poster .name { font-family: var(--font-display); font-size: 24px; margin: var(--space-3) 0; }
.poster .reward { font-family: var(--font-display); font-size: 22px; margin-top: var(--space-3); }
.site-foot { border-top: 1px solid var(--line); padding: var(--space-8) var(--space-6); text-align: center; color: var(--ink-muted); font-size: 14px; }
.site-foot a { color: var(--ink-muted); }

/* Buttons that are links */
a.wf-btn { text-decoration: none; }
.site-nav a.wf-btn-primary, .site-nav a.wf-btn-primary:hover { color: var(--on-copper); }

/* Exchange: which character you're playing as */
.acting { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-sunken); }
.acting b { font-size: 16px; }
.acting a { font-size: 14px; font-weight: 700; }
.acting-as { margin: 0; }
.choose-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-6); }
.char-card.current { outline: 2px solid var(--copper); }

/* Ticket transcripts (staff /tickets/{id}, Exchange /tickets/{id}) */
.tx-people ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); }
.tx-people li { display: flex; align-items: center; gap: var(--space-2); }
.tx-people img, .tx-head img { width: 20px; height: 20px; max-width: 20px; object-fit: cover; border-radius: 50%; flex: none; background: var(--line); }
.tx-msg { padding: var(--space-3) 0 0; }
.tx-msg + .tx-msg:not(.tx-cont) { border-top: 1px solid var(--line); margin-top: var(--space-3); }
.tx-cont { padding-top: var(--space-2); }
.tx-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: 4px; }
.tx-body, .tx-fields, .tx-img, .tx-gone { margin-left: 28px; }
.tx-body { overflow-wrap: anywhere; }
.tx-bot .tx-body, .tx-fields { border-left: 3px solid var(--line); padding-left: var(--space-3); color: var(--ink-muted); }
.tx-creator .tx-head b { color: var(--copper-ink); }
.tx-fields { margin-top: 4px; margin-bottom: 0; }
.tx-fields dt { font-weight: 700; color: var(--ink); }
.tx-fields dd { margin: 0 0 var(--space-2); }
.tx-img { display: inline-block; margin-top: var(--space-2); }
.tx-img img { max-width: 160px; max-height: 120px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.tx-gone { margin-top: 4px; }
.tx-pager { display: flex; gap: var(--space-4); align-items: center; margin-top: var(--space-4); }
