/* Merchant Adventurer – shared styles for every page of this site.
   Linked as style.css?v=N : raise N in every page when this file changes
   (the /tabletop/ .htaccess lets browsers keep CSS for a year). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid #f4d35e; outline-offset: 3px; }

/* ───────────────────────── Front page ───────────────────────── */
.home {
  --khaki: #a3965e;
  --green: #07420d;
  --cream: #f1e8c0;
  --blue: #2c5f96;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vh, 40px) clamp(16px, 4vw, 64px);
  background: radial-gradient(ellipse at 38% 45%, #b8ab72 0%, var(--khaki) 45%, #8d8150 100%) fixed;
  color: var(--green);
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
}
.hero {
  width: 100%;
  max-width: 1320px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, clamp(320px, 30vw, 440px));
  align-items: center;
  gap: clamp(24px, 5vw, 88px);
}
.box {
  position: relative;
  display: block;
  justify-self: center;
  width: min(100%, calc((100vh - 96px) * 833 / 723));
  max-width: 860px;
  aspect-ratio: 833 / 723;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.box img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 14px rgba(40, 32, 8, .38));
  transition: opacity .35s ease, transform .35s ease;
}
.box .back { opacity: 0; transform: scale(.94); }
.box.flipped .front, .box:focus-visible .front { opacity: 0; transform: scale(.94); }
.box.flipped .back, .box:focus-visible .back { opacity: 1; transform: none; }
@media (hover: hover) {
  .box:hover .front { opacity: 0; transform: scale(.94); }
  .box:hover .back { opacity: 1; transform: none; }
}
.panel { text-align: center; }
.home h1 {
  margin: 0;
  font-size: clamp(30px, 3.1vw, 46px);
  line-height: 1.05;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.rule {
  width: 72%;
  height: 0;
  margin: clamp(10px, 1.6vh, 16px) auto;
  border: 0;
  border-top: 3px double var(--green);
  opacity: .75;
}
.tag {
  margin: 0 auto;
  max-width: 34em;
  font-size: clamp(15px, 1.15vw, 17.5px);
  line-height: 1.45;
  font-weight: bold;
  color: #2b2508;
}
.nw { white-space: nowrap; }
.tag + .tag { margin-top: .5em; font-style: italic; }
.links {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.25vh, 12px);
  margin-top: clamp(14px, 2.4vh, 24px);
}
.links a {
  display: block;
  padding: clamp(8px, 1.35vh, 12px) 16px;
  border: 2px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: var(--cream);
  font-size: clamp(16px, 1.45vw, 21px);
  font-weight: bold;
  letter-spacing: .05em;
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(30, 24, 4, .35);
  transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.links a:hover { background: var(--blue); border-color: var(--blue); color: #fff; transform: translateY(-1px); }
.links a:active { transform: translateY(2px); box-shadow: none; }
.links a.play { font-size: clamp(18px, 1.7vw, 24px); background: #0b5a14; }
.links a.play:hover { background: var(--blue); }
.links a.unavailable {
  background: rgba(7, 66, 13, .08);
  border-style: dashed;
  color: var(--green);
  box-shadow: none;
}
.links a.unavailable:hover { background: var(--blue); border-color: var(--blue); border-style: solid; color: #fff; }
.links .pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(7px, 1.25vh, 12px); }

@media (max-width: 860px), (orientation: portrait) and (max-width: 1000px) {
  .home { align-items: flex-start; }
  .hero { grid-template-columns: 1fr; gap: 12px; max-width: 520px; }
  .box { width: min(100%, 440px); }
}
@media (max-width: 420px) { .links .pair { grid-template-columns: 1fr; } }

/* ─────────────── Notebook pages (manual, rankings, notes) ─────────────── */
.paper-page {
  --desk: #b38b60;
  --paper: #fff;
  --rule: #9fb4ee;
  --ink: #111;
  --link: #1433c9;
  --lh: 25px;
  --fs: 20px;
  --margin: 100px;
  --gap: 10px;
  --wide: 900px;
  padding: 20px 12px 40px;
  min-height: 100vh;
  background: var(--desk);
  color: var(--ink);
}
.paper {
  position: relative;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 40px 0;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .22);
}
.paper::before {               /* red margin line */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--margin);
  width: 2px;
  background: rgba(255, 0, 0, .6);
}
.sheet {
  padding: 0 16px 0 calc(var(--margin) + var(--gap));
  font: bold var(--fs) / var(--lh) "Courier New", Courier, monospace;
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(var(--lh) - 1px),
    var(--rule) calc(var(--lh) - 1px), var(--rule) var(--lh));
  overflow-wrap: break-word;
}
.sheet h1, .sheet h2, .sheet h3, .sheet p, .sheet ul, .sheet ol, .sheet nav, .sheet section {
  margin: 0;
  padding: 0;
  font: inherit;
}
.sheet ul, .sheet ol { list-style: none; }
.sheet h1 { display: inline; font-style: italic; }
.sheet a { color: var(--link); text-decoration: none; }
.sheet a:hover, .sheet a:focus-visible { text-decoration: underline; text-decoration-thickness: 2px; }
.sheet [aria-current] { color: var(--ink); text-decoration: underline; }
.sheet .gap, .sheet section, .sheet .cols { margin-top: var(--lh); }
.sheet .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.sheet .cols.years { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sheet .cols section:nth-child(-n+2), .sheet .cols.years section { margin-top: 0; }
.sheet .cols.years { row-gap: var(--lh); }

/* piece pictures sit in the notebook margin */
.piece { position: relative; }
.piece figure {
  position: absolute;
  top: 0;
  left: calc(-1 * (var(--margin) + var(--gap)));
  width: var(--margin);
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.piece figure img { display: block; width: auto; height: calc(var(--lh) * 3 - 9px); max-width: 84px; object-fit: contain; }
.piece figure.two img { height: calc(var(--lh) * 2 - 8px); }

/* rankings: yellow legal pad */
.legal { --desk: #ad6863; --paper: #f3e776; --rule: #3fcfae; }
.legal .paper { padding-top: 65px; }
.legal .paper::before { left: calc(var(--margin) - 15px); box-shadow: 5px 0 0 rgba(255, 0, 0, .6); }
.legal .sheet { padding-left: var(--margin); }
.legal .binding {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  z-index: 1;
  background: linear-gradient(90deg, #5c280d 25%, #4e220c 25%, #4e220c 50%, #5c280d 50%, #5c280d 75%, #4e220c 75%) 0 0 / 50px 50px;
}

/* designer's notes: same white notebook paper as the manual, on the page's own
   original diagonal brown / silver / yellow gradient (do not simplify it) */
.notes {
  --desk: #501609;
  background: repeating-linear-gradient(135deg, #501609, #501609, #CCCCCC, #FFF784, #CCCCCC, #501609, #501609) no-repeat center center fixed;
}

@media (max-width: 760px) {
  .paper-page { --lh: 22px; --fs: 15px; --margin: 34px; --gap: 8px; padding: 8px 6px 24px; }
  .sheet { padding-right: 10px; }
  .sheet .cols { grid-template-columns: 1fr; }
  .sheet .cols section:nth-child(2) { margin-top: var(--lh); }
  .sheet .cols.years { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .piece figure { position: static; width: auto; flex-direction: row; justify-content: flex-start; gap: 10px; height: calc(var(--lh) * 2); align-items: center; }
  .piece figure img, .piece figure.two img { height: calc(var(--lh) * 2 - 6px); }
  .legal { --margin: 30px; }
  .legal .paper::before { left: 14px; }
}
@media print {
  .paper-page { background: none; padding: 0; }
  .paper { box-shadow: none; }
}
