/* Public site shell. Loaded only by pages that opt in with $tyme_public_shell
   (see includes/public_shell.php); builder/editor pages never load this file.
   Colours come from the shared --olc-* theme tokens; the blue bar and accent
   echo the original cross-bar artwork. */
:root {
  --tyme-bar: #01063e;
  --tyme-bar-line: #1722b8;
  --tyme-bar-label: #aab6ff;
  --tyme-accent: #1f2fd6;
  --tyme-accent-hover: #3347ff;
  --tyme-focus: #ffcc4d;
  --tyme-serif: Georgia, "Times New Roman", serif;
}
:root[data-theme=light] {
  --tyme-focus: #a14b00;
}

body.site { margin: 0; font: 1rem/1.6 Arial, Helvetica, sans-serif; overflow-wrap: break-word; }
.site *, .site *::before, .site *::after { box-sizing: border-box; }
.site :focus-visible { outline: 3px solid var(--tyme-focus); outline-offset: 2px; }
.site-skip { position: absolute; left: .5rem; top: -4rem; z-index: 10; padding: .5rem .75rem; background: var(--olc-bg); color: var(--olc-fg); border: 2px solid var(--tyme-focus); }
.site-skip:focus { top: .5rem; }

/* ---- Header ---- */
/* One compact bar on the neutral theme background; blue identity comes from the
   rule below it, the Play action and the footer. Enhancements (.nav-enhanced)
   are added by public_site.js; without it the full navigation stays visible. */
.site-header { background: var(--olc-bg); border-bottom: 3px solid var(--tyme-bar-line); }
.site-bar { max-width: 80rem; margin: 0 auto; padding: .5rem .75rem; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
.site-brand { flex: 0 0 auto; display: block; line-height: 0; width: 20rem; max-width: 100%; }
.site-brand img { display: block; width: 100%; height: auto; }
.site-controls { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.site-play, .site-menu-button, .site-controls .olc-toggle {
  min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: bold; text-decoration: none; margin: 0; border-radius: 4px;
}
.site .site-play:link, .site .site-play:visited { background: var(--tyme-accent); color: #fff; border: 1px solid var(--tyme-bar-label); padding: 0 1rem; text-decoration: none; }
.site .site-play:hover { background: var(--tyme-accent-hover); color: #fff; }
.site-controls .olc-toggle, .site-menu-button { float: none; padding: 0 .6rem; }
.site-menu-button { display: none; margin-left: auto; }
.site-account { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 .25rem; align-items: center; }
.site-account a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 .4rem; font-weight: bold; }

.site-nav { flex: 1 1 100%; }
.site-nav-theme { display: none; }
.site-nav-theme .olc-toggle { float: none; margin: 0; padding: 0 .75rem; min-height: 2.75rem; font: inherit; font-weight: bold; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav-list { display: flex; flex-wrap: wrap; gap: 0 .25rem; }
.site-nav-group { position: relative; }
.site-nav-account { display: none; }
.site-nav-toggle { display: none; }
.site-nav-label { display: block; color: var(--olc-muted); font-size: .8125rem; font-weight: bold; text-transform: uppercase; letter-spacing: .06em; padding: .5rem .5rem 0; }
.site-nav-group > ul { display: flex; flex-wrap: wrap; }
.site .site-nav a:link, .site .site-nav a:visited { display: inline-flex; }
.site .site-nav a:link, .site .site-nav a:visited, .site .site-nav-toggle {
  align-items: center; min-height: 2.75rem; padding: 0 .6rem; border: 0; background: none;
  color: var(--olc-fg); font: inherit; font-weight: bold; text-decoration: none; cursor: pointer;
}
.site .site-nav a:hover, .site .site-nav-toggle:hover { color: var(--olc-link); text-decoration: underline; text-underline-offset: 4px; }
.site-nav-toggle::after { content: ""; margin-left: .4rem; border: .3rem solid transparent; border-top-color: currentColor; border-bottom-width: 0; }
.site-nav-toggle[aria-expanded=true]::after { transform: rotate(180deg); }

/* Menu mode (below the desktop breakpoint): one Menu disclosure; all choices are
   sections inside it. Page scroll handles overflow; the header is never fixed. */
@media (max-width: 63.99rem) {
  .nav-enhanced .site-menu-button { display: inline-flex; }
  .nav-enhanced .site-controls .olc-toggle { display: none; }
  .nav-enhanced .site-nav-theme { display: block; }
  .nav-enhanced .site-nav { display: none; }
  .nav-enhanced .site-nav.is-open { display: block; border-top: 1px solid var(--olc-border); padding-top: .5rem; }
  .site-nav-list { display: grid; grid-template-columns: 1fr; gap: .25rem; }
  .nav-enhanced .site-nav-account { display: block; }
  .nav-enhanced .site-account-profile { display: none; }
  .site-nav-label { border-bottom: 1px solid var(--olc-border); padding: .25rem; }
  .site-nav-group > ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .site .site-nav a:link, .site .site-nav a:visited { display: flex; padding: .5rem .25rem; }
  .site-controls .olc-toggle { margin-left: 0; }
}

/* Desktop: one row; groups are disclosure buttons with dropdown panels. */
@media (min-width: 64rem) {
  /* DOM order is brand, controls, nav and so is the paint order: no flex `order`. */
  .site-controls { flex: 0 0 auto; }
  .site-nav { flex: 1 1 auto; margin-left: auto; min-width: 0; }
  .site-nav-list { justify-content: flex-end; }
  .nav-enhanced .site-nav-label { display: none; }
  .nav-enhanced .site-nav-toggle { display: inline-flex; }
  .nav-enhanced .site-nav-group > ul {
    display: none; position: absolute; z-index: 20; top: 100%; left: 0; min-width: 12rem; max-height: 70vh; overflow-y: auto;
    flex-direction: column; background: var(--olc-panel); border: 1px solid var(--olc-btn-border); border-radius: 4px; padding: .25rem 0; box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  }
  .nav-enhanced .site-nav-group-last > ul { left: auto; right: 0; }
  .nav-enhanced .site-nav-group.is-open > ul { display: flex; }
  .nav-enhanced .site-nav-group > ul a:link, .nav-enhanced .site-nav-group > ul a:visited { display: flex; }
}

/* ---- Main / footer ---- */
.site-main { max-width: 80rem; margin: 0 auto; padding: 1.5rem .75rem 3rem; }
/* Legacy page content keeps its markup; inside the shell it takes the full
   column and scrolls itself rather than widening the page. */
.site-main .content { margin: 0; padding: 0; max-width: none; overflow-x: auto; }
.site-footer { border-top: 3px solid var(--tyme-bar-line); background: var(--tyme-bar); color: #dfe3ff; padding: 1rem .75rem; text-align: center; font-size: .9rem; }
.site-footer p { margin: .25rem 0; }
.site .site-footer a:link, .site .site-footer a:visited { color: #fff; }

/* ---- Shared public content ---- */
.pub h1, .pub h2 { font-family: var(--tyme-serif); line-height: 1.2; }
.pub h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 .75rem; }
.pub h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); margin: 0 0 .75rem; }
.pub p { max-width: 42rem; }
.pub-lead { font-size: 1.2rem; color: var(--olc-fg); }
.pub-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.pub .btn:link, .pub .btn:visited {
  display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: .5rem 1.5rem;
  border: 1px solid var(--olc-btn-border); border-radius: 4px; background: var(--olc-btn); color: var(--olc-fg);
  font-weight: bold; text-decoration: none; text-align: center;
}
.pub .btn:hover { background: var(--olc-row); text-decoration: underline; text-underline-offset: 4px; }
.pub .btn-primary:link, .pub .btn-primary:visited { background: var(--tyme-accent); border-color: var(--tyme-bar-label); color: #fff; }
.pub .btn-primary:hover { background: var(--tyme-accent-hover); color: #fff; }
.pub-section { margin-top: 2.5rem; }

/* Landing hero and closing: unboxed headline, lede, actions */
.pub-hero { padding: 1.5rem 0 2rem; }
.pub-hero p { max-width: 40rem; }
.pub-closing { border-top: 1px solid var(--olc-border); padding-top: 1.5rem; }
/* Home */
@media (min-width: 64rem) {
  .home-body { display: grid; grid-template-columns: minmax(0, 42rem) minmax(16rem, 24rem); gap: 0 4rem; align-items: start; }
  .home-mud { grid-column: 2; grid-row: 1; }
  .home-lore { grid-column: 1; grid-row: 1; }
}
.home-lore p { font-size: 1.0625rem; }
.home-lore p:first-of-type { font-style: italic; }
.home-close p { font-family: var(--tyme-serif); font-size: 1.25rem; }

/* Cards: whole card is the link (Play picker, Connect alternatives) */
.pub-cards { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); max-width: 56rem; }
.pub .card:link, .pub .card:visited {
  display: flex; flex-direction: column; gap: .25rem; height: 100%; min-height: 4.5rem; padding: 1rem 1.25rem;
  border: 1px solid var(--olc-btn-border); border-radius: 4px; background: var(--olc-panel); color: var(--olc-fg); text-decoration: none;
}
.pub .card:hover { border-color: var(--tyme-accent-hover); background: var(--olc-row); }
.card-title { font-weight: bold; font-size: 1.125rem; color: var(--olc-link); }
.card-text { color: var(--olc-muted); font-size: .95rem; font-weight: normal; }
.pub .card:hover .card-title { text-decoration: underline; text-underline-offset: 4px; }

/* Play / Connect states */
.play-note { color: var(--olc-muted); }
.play-selection-error, .play-db-error { max-width: 42rem; padding: .75rem 1rem; border: 1px solid var(--olc-err); border-left-width: 4px; border-radius: 4px; color: var(--olc-err); background: var(--olc-panel); }
.play-no-pfile, .play-guest-note { max-width: 42rem; }

/* Legacy forms (login etc.) inside the shell: comfortable touch targets. */
.site-main .content input:not([type=checkbox], [type=radio], [type=submit], [type=reset], [type=button], [type=image], [type=hidden]) { min-height: 2.75rem; width: 100%; max-width: 20rem; font: inherit; }
.site-main .content input[type=submit], .site-main .content input[type=reset] { min-height: 2.75rem; min-width: 5rem; font: inherit; }

/* Who list: the shell does not load the legacy screen/handheld sheets, so carry their .who row
   foreground and size (the rows sit on the legacy black table, whatever the page theme). */
.site-main .who { color: #00CECE; font-size: 1em; }
@media (max-device-width: 480px) { .site-main .who { font-size: 1.2em; } }

/* Board reading pages: their legacy fixed-width tables wrap inside the column instead of scrolling sideways. */
.site-main .board-reading table { max-width: 100%; }
.site-main .board-reading td { overflow-wrap: anywhere; }

/* ---- Players directory, personal pages and the personal-page form ---- */
.player-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; }
.pub .player-tabs .btn.is-current:link, .pub .player-tabs .btn.is-current:visited { background: var(--olc-row); border-color: var(--tyme-accent-hover); border-bottom-width: 3px; }
.player-categories { margin-top: 0; }
.player-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.player-list a { display: flex; align-items: center; min-height: 2.75rem; padding: 0 1rem; border: 1px solid var(--olc-border); border-radius: 4px; background: var(--olc-panel); font-weight: bold; overflow-wrap: anywhere; }
.player-list a:hover { border-color: var(--tyme-accent-hover); background: var(--olc-row); }
.player-note { max-width: 42rem; }
.player-back { margin: 0 0 1rem; }
.player-back a { display: inline-flex; align-items: center; min-height: 2.75rem; }

.player-profile { display: grid; gap: 1.5rem 2.5rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.player-head { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.player-head h1 { margin: 0; overflow-wrap: anywhere; }
.player-photo { display: block; line-height: 0; flex: 0 0 auto; }
.player-photo img { display: block; width: 130px; height: 130px; object-fit: cover; border: 1px solid var(--olc-btn-border); border-radius: 4px; background: var(--olc-panel); }
.player-profile h2 { font-size: 1.25rem; margin: 0 0 .5rem; }
.player-facts section + section { margin-top: 1.5rem; }
.player-facts dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; }
.player-facts dt { color: var(--olc-muted); font-weight: bold; }
.player-facts dd { margin: 0; overflow-wrap: anywhere; }
.player-facts p { margin: 0; overflow-wrap: anywhere; }
/* Biography is player-written and may carry its own markup: show it as written, contained in the column. */
.player-bio > div { max-width: 46rem; overflow-x: auto; overflow-wrap: anywhere; line-height: 1.6; }
.player-bio img { max-width: 100%; height: auto; }
.player-bio table { max-width: 100%; }
@media (min-width: 48rem) {
  .player-head { grid-column: 1 / -1; }
  .player-profile { grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); }
  .player-profile.no-facts { grid-template-columns: minmax(0, 1fr); }
}

/* Personal-page form: legacy fixed-width fields stack on narrow screens; its inline focus/blur
   colours (#666 / #000) would leave dark text on black in the light theme, so the theme colours win. */
.player-edit table { width: 100%; max-width: 44rem; border-spacing: 0 .5rem; }
.player-edit td:first-child { white-space: nowrap; padding-right: 1rem; }
.player-edit input[type=text] { width: 100% !important; max-width: 100% !important; background: var(--olc-field) !important; color: var(--olc-fg) !important; }
.player-edit input[type=text]:focus, .player-edit textarea:focus { background: var(--olc-row) !important; }
.player-edit textarea { width: 100%; max-width: 44rem; min-height: 12rem; background: var(--olc-field); color: var(--olc-fg); border: 1px solid var(--olc-border); font: inherit; }
@media (max-width: 40rem) {
  .player-edit td { display: block; }
  .player-edit td:first-child { white-space: normal; padding-bottom: 0; }
}
