/* =========================================================================
   Site shell (#1162): the top bar, the footer's extras and the layout of
   the reading pages. Loaded after /style.css on every page. No scripts:
   the language picker and the phone menu are <details>.
   ========================================================================= */

:root { --bar-h: 64px; }

/* ---------- Top bar ---------- */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--wood-dark);
  border-bottom: 3px solid var(--wood);
  box-shadow: var(--shadow-soft);
}
.top-bar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 1200px;
  height: var(--bar-h);
  margin: 0 auto;
  padding: 0 14px;
}
.top-logo { flex: 0 0 auto; display: block; line-height: 0; }
.top-logo img { width: 54px; height: auto; }
.top-logo:focus-visible, .top-link:focus-visible, .menu-link:focus-visible,
.top-socials a:focus-visible, .footer-socials a:focus-visible,
.lang-pick summary:focus-visible, .menu summary:focus-visible,
.lang-pick li a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.top-nav { display: flex; flex: 1 1 auto; gap: 4px; min-width: 0; }
.top-link, .menu-link {
  padding: 8px 12px;
  border-radius: 999px;
  color: rgba(251, 246, 236, .88);
  font-family: var(--display);
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
}
.top-link:hover, .menu-link:hover { background: rgba(251, 246, 236, .12); color: var(--paper-white); }
.top-link[aria-current="page"], .menu-link[aria-current="page"] { background: var(--gold); color: var(--ink); }

.top-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.top-socials, .footer-socials { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.top-socials a, .footer-socials a {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: rgba(251, 246, 236, .85);
}
.top-socials a:hover, .footer-socials a:hover { background: rgba(251, 246, 236, .14); color: var(--paper-white); }
.top-socials svg, .footer-socials svg { width: 18px; height: 18px; fill: currentColor; }
.top-socials .social-stroke, .footer-socials .social-stroke { fill: none; stroke: currentColor; stroke-width: 2; }

.top-cta { display: inline-block; padding: .5rem 1rem; font-size: .95rem; text-decoration: none; white-space: nowrap; }

/* Language picker */
.lang-pick { position: relative; }
.lang-pick summary, .menu summary {
  display: flex; align-items: center; gap: 6px;
  list-style: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--paper-white);
  color: var(--ink);
  font-family: var(--display);
  font-size: .85rem;
}
.lang-pick summary::-webkit-details-marker, .menu summary::-webkit-details-marker { display: none; }
.lang-pick summary::after { content: '▾'; font-size: .7rem; }
.flag { width: 26px; height: 18px; border-radius: 4px; box-shadow: 0 0 0 1px rgba(43, 33, 22, .2); flex: 0 0 auto; }
.lang-pick ul {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 170px;
  margin: 0; padding: 6px;
  list-style: none;
  background: var(--paper-white);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.lang-pick li a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.lang-pick li a:hover { background: var(--page); }
.lang-pick li a[aria-current="true"] { background: var(--page-deep); font-weight: 800; }

/* Phone menu: hidden on wide screens */
.menu { display: none; position: relative; }
.menu summary { padding: 6px 12px; font-size: 1.1rem; }
.menu-links {
  position: absolute; right: 0; top: calc(100% + 8px);
  display: flex; flex-direction: column; gap: 2px;
  min-width: 200px; padding: 8px;
  background: var(--wood-dark);
  border: 2px solid var(--wood);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.menu-link { display: block; }

/* The five links need ~690px in the longest language; with the icons, the
   picker and the button the bar is full below 1100px, so the links move
   into the menu there. */
@media (max-width: 1099px) {
  .top-nav { display: none; }
  .menu { display: block; }
}
@media (max-width: 759px) {
  .top-bar-inner { gap: 8px; padding: 0 8px; }
  .top-tools { gap: 6px; }
  .top-logo img { width: 42px; }
  .top-cta { padding: .4rem .6rem; font-size: .8rem; }
}
/* Narrow phones: the icons drop to a second row so they stay visible next
   to the button, the picker and the menu. */
@media (max-width: 579px) {
  .top-bar-inner { flex-wrap: wrap; height: auto; padding: 6px 8px; row-gap: 4px; }
  .top-tools { display: contents; }
  .top-logo { order: 1; }
  .top-cta { order: 2; margin-left: auto; }
  .lang-pick { order: 3; }
  .menu { order: 4; }
  .top-socials { order: 5; flex: 0 0 100%; justify-content: center; gap: 14px; }
}
@media (max-width: 359px) {
  .top-cta { padding: .35rem .45rem; font-size: .72rem; }
  .lang-code { display: none; }
}

/* ---------- Footer ---------- */
.site-footer > * + * { margin-top: 8px; }
.footer-socials { justify-content: center; }
.footer-links a { white-space: nowrap; }

/* ---------- Reading pages (#1162): O jogo, Como jogar, FAQ, Sobre ----------
   The title and intro sit on the desk; every section is a sheet of album
   paper, with its painted scene glued on like a photo. */
.reading {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 16px 40px;
}
.reading > * + * { margin-top: 24px; }
/* A link to a section (#attributes) stops below the sticky top bar. */
.reading [id] { scroll-margin-top: 110px; }

.reading-head { text-align: center; }
.reading-head h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.1rem, 7vw, 3rem);
  line-height: 1.05;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, .45);
}
.reading-head p {
  max-width: 60ch;
  margin: 8px auto 0;
  font-size: clamp(1.02rem, 2.4vw, 1.15rem);
  line-height: 1.55;
  color: var(--paper-white);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.reading-head a { color: var(--gold); }

.reading-card {
  padding: clamp(22px, 4vw, 36px) clamp(18px, 4vw, 40px);
  background: var(--page) var(--paper-grain);
  color: var(--ink);
  border-radius: 6px 14px 14px 6px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .35), 0 3px 0 rgba(0, 0, 0, .18), inset 12px 0 18px -14px rgba(0, 0, 0, .3);
}
.reading-card h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  line-height: 1.15;
  color: var(--red);
}
.reading-card p, .reading-card li { font-size: 1.03rem; line-height: 1.6; }
.reading-card p { margin: 0 0 12px; }
.reading-card ul { margin: 0 0 14px; padding-left: 1.3rem; }
.reading-card li + li { margin-top: 4px; }
.reading-card > :last-child { margin-bottom: 0; }
.reading-card a { color: var(--red); }
.reading-card a:focus-visible, .reading-toc a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Posters (Daniel 2026-11-18): text on the pictures ----------
   O jogo, Como jogar and the FAQ: the page header and every section with a
   painted scene show their text on top of it. The picture is a real <img>
   (the CSP allows no inline style) stretched behind the text with
   object-fit: cover. A scrim of dark wood sits between them: clear at the
   top, so the picture shows, and at least .76 from --window down, where the
   text starts (.70 on the header). Measured on every picture at 1280 and
   375 px: body text 6.6:1 or more, headings 4.8:1, the large header titles
   3.8:1 (WCAG AA). No fixed height: a poster grows with its text, and the
   picture grows with it. */
.poster {
  --scrim: 26, 16, 8;
  --window: clamp(110px, 28vw, 220px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: clamp(300px, 60vw, 460px);
  background: var(--wood-dark);
  color: var(--paper-white);
  border-radius: 6px 14px 14px 6px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .35), 0 3px 0 rgba(0, 0, 0, .18);
}
.poster-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center 35%;
}
.poster::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom,
    rgba(var(--scrim), .05) 0,
    rgba(var(--scrim), .45) calc(var(--window) * .6),
    rgba(var(--scrim), .76) var(--window),
    rgba(var(--scrim), .84) 100%);
}
.poster-body {
  padding: var(--window) clamp(18px, 4vw, 40px) clamp(22px, 4vw, 34px);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .65);
}
.poster h1, .poster h2 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--gold);
  text-shadow: 0 2px 5px rgba(0, 0, 0, .7);
}
.poster h2 { margin: 0 0 10px; font-size: clamp(1.4rem, 4vw, 1.8rem); line-height: 1.15; }
.poster p, .poster li { font-size: 1.03rem; line-height: 1.6; }
.poster p { margin: 0 0 12px; }
.poster ul { margin: 0 0 14px; padding-left: 1.3rem; }
.poster li + li { margin-top: 4px; }
.poster-body > :last-child { margin-bottom: 0; }
.poster strong { color: var(--paper-white); }
/* Links in running text stay paper-white (body-text contrast), underlined in gold. */
.poster a { color: var(--paper-white); text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.poster a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* The header picture: the page title and intro, centred on an even scrim
   (the text can sit anywhere on it), a little darker in the middle. */
.page-hero {
  justify-content: center;
  min-height: clamp(260px, 44vw, 400px);
  text-align: center;
  border-radius: 14px;
}
.page-hero::before {
  background:
    radial-gradient(ellipse at center, rgba(var(--scrim), .10) 0, rgba(var(--scrim), 0) 70%),
    linear-gradient(rgba(var(--scrim), .70), rgba(var(--scrim), .70));
}
.page-hero .poster-body { padding: clamp(36px, 7vw, 64px) clamp(18px, 5vw, 48px); }
.page-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2.1rem, 7vw, 3rem);
  line-height: 1.05;
}
.page-hero p {
  max-width: 60ch;
  margin: 8px auto 0;
  font-size: clamp(1.02rem, 2.4vw, 1.15rem);
  line-height: 1.55;
}
.reading-gem { float: right; width: 72px; height: auto; margin: 0 0 8px 12px; }

/* Como jogar: the numbered steps and the list of them. */
.step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  margin-right: .2em;
  border-radius: 50%;
  background: var(--red);
  color: var(--paper-white);
  font-size: .8em;
  vertical-align: .1em;
}
.reading-toc-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--ink);
}
.reading-toc ol { margin: 0; padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; }
.reading-toc li { font-size: 1rem; break-inside: avoid; }
.reading-toc a { color: var(--ink); }
.reading-toc a:hover { color: var(--red); }

/* FAQ: every question on the same sheet, split by a dashed rule. */
.faq-item + .faq-item { margin-top: 20px; padding-top: 20px; border-top: 2px dashed var(--rule); }
.faq-item h2.faq-q { font-size: clamp(1.15rem, 3vw, 1.35rem); }

.reading-card .contact-list { list-style: none; padding-left: 0; }

/* The invite call at the end of every reading page, under the crest. */
.reading > .page-cta { margin-top: 64px; }
.page-cta {
  padding: 0 20px 28px;
  text-align: center;
  background: var(--page) var(--paper-grain);
  color: var(--ink);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.page-cta-crest {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto -26px;
  transform: translateY(-38px);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3));
}
.page-cta h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.5rem, 4.4vw, 2rem);
  color: var(--red);
}
.page-cta p { margin: 6px auto 0; max-width: 46ch; line-height: 1.5; }
.page-cta-gems { font-weight: 800; }
.page-cta-btn { display: inline-block; margin-top: 18px; padding-left: 28px; padding-right: 28px; text-decoration: none; }

/* The gem token beside a line of text (home invite page, the call above). */
.gem-inline { width: 26px; height: auto; vertical-align: -4px; margin-right: 3px; }

/* ---------- News (#1162): the list page and one post ---------- */
.news-index { max-width: none; }
.post-date { margin: 8px 0 0; font-weight: 800; color: var(--paper-white); text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.post-back { margin: 0; text-align: center; }
.post-back a { font-family: var(--display); color: var(--gold); }
.post-back a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
