/* ===========================================================
   The Sho-Sho Society
   A newspaper of 1915, had there been an internet in 1915.
   Fonts are self-hosted: the site needs no network at all.
   =========================================================== */

@font-face {
  font-family: 'IM Fell English';
  src: url('../fonts/im-fell-english-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IM Fell English';
  src: url('../fonts/im-fell-english-latin-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'IM Fell English SC';
  src: url('../fonts/im-fell-english-sc-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Special Elite';
  src: url('../fonts/special-elite-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --paper:      #f0e5c9;
  --paper-2:    #e8dab6;
  --paper-3:    #ded0a8;
  --ink:        #241a10;
  --ink-soft:   #5e4c33;
  --ink-faint:  #8a7a5e;
  --oxide:      #8e2318;   /* the second colour on a two-colour press */
  --olive:      #4a5530;
  --rule:       #241a10;

  --display: 'IM Fell English SC', 'Times New Roman', serif;
  --body:    'IM Fell English', Georgia, 'Times New Roman', serif;
  --type:    'Special Elite', 'Courier New', monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.12rem;
  line-height: 1.58;
  color: var(--ink);
  background-color: var(--paper-3);
  /* Paper grain, drawn in the browser. No image file, no network. */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* The sheet the paper is printed on */
.masthead, nav.menu, .userbar, main, footer { position: relative; z-index: 1; }

a { color: var(--oxide); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--oxide);
  outline-offset: 2px;
}
img { max-width: 100%; height: auto; display: block; }

/* ----------------------------------------------------- masthead */

.masthead {
  text-align: center;
  background: var(--paper);
  padding: 14px 14px 0;
  border-bottom: 1px solid var(--rule);
  box-shadow: inset 0 0 90px rgba(90, 62, 24, 0.14);
}
/* The classic thick-over-thin rule of a period masthead */
.masthead-rule {
  height: 0;
  border-top: 5px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 3px;
  max-width: 1040px;
  margin: 0 auto 12px;
}
.masthead h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.1rem, 7vw, 4.6rem);
  line-height: 1;
  margin: 0;
  letter-spacing: 0.02em;
}
.masthead .tagline {
  font-style: italic;
  margin: 0.45rem 0 0.6rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.dateline {
  font-family: var(--type);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 5px 6px;
  border-top: 1px solid var(--rule);
  border-bottom: 3px double var(--rule);
}

/* --------------------------------------------------------- nav */

nav.menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  background: var(--ink);
  padding: 0;
}
nav.menu a {
  color: var(--paper);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.12rem;
  letter-spacing: 0.06em;
  padding: 9px 20px;
  border-right: 1px solid rgba(240, 229, 201, 0.22);
}
nav.menu a:first-child { border-left: 1px solid rgba(240, 229, 201, 0.22); }
nav.menu a:hover, nav.menu a:focus { background: var(--oxide); color: #fff6e0; }
nav.menu a.active { background: var(--paper); color: var(--ink); }

.userbar {
  text-align: center;
  font-family: var(--type);
  font-size: 0.84rem;
  padding: 6px 10px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
}

/* ------------------------------------------------------- layout */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px 18px 54px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 24px 26px;
  margin: 0 0 26px;
  box-shadow: inset 0 0 70px rgba(100, 70, 28, 0.09);
}
.card-tight { padding: 10px; }

.card h2, .card h3, .card h4 {
  font-family: var(--display);
  font-weight: 400;
  margin-top: 0;
  line-height: 1.15;
}
.card h2 {
  font-size: 1.95rem;
  margin-bottom: 0.7rem;
  padding-bottom: 6px;
  border-bottom: 3px double var(--rule);
}
.card h3 { font-size: 1.35rem; margin-bottom: 0.4rem; }

/* Two and three column page furniture */
.col-two  { display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.col-three{ display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid     { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* Newspaper text: real columns with a hairline rule between them */
.columns {
  column-count: 2;
  column-gap: 30px;
  column-rule: 1px solid var(--ink-faint);
  text-align: justify;
  hyphens: auto;
}
.columns p { margin-top: 0; }
@media (max-width: 720px) { .columns { column-count: 1; } }

/* The lead paragraph gets a drop cap, as a page of 1915 would */
.lead::first-letter {
  float: left;
  font-family: var(--display);
  font-size: 3.5em;
  line-height: 0.78;
  padding: 0.06em 0.09em 0 0;
  color: var(--oxide);
}
.lead { text-indent: 0; }

/* ------------------------------------------------------ the hero */

.hero { text-align: center; padding: 38px 26px 34px; }
.hero h2 {
  font-size: clamp(1.8rem, 4.4vw, 2.9rem);
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0.2rem;
}
/* A stacked "deck" under the headline, in the period manner */
.deck {
  font-family: var(--display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: inline-block;
  padding: 5px 20px;
  margin: 10px 0 16px;
}
.hero p { max-width: 640px; margin: 0.6rem auto; }

/* ------------------------------------------------------ elements */

.btn {
  display: inline-block;
  font-family: var(--display);
  font-size: 1.06rem;
  letter-spacing: 0.04em;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: inset 0 0 0 3px var(--paper-2), inset 0 0 0 4px var(--rule);
  padding: 10px 22px;
  cursor: pointer;
  text-decoration: none;
  margin: 6px 8px 6px 0;
  transition: background 120ms linear, color 120ms linear;
}
.btn:hover, .btn:focus { background: var(--ink); color: var(--paper); box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px var(--paper-2); }
.btn.primary { background: var(--oxide); color: #fdf3dd; box-shadow: inset 0 0 0 3px var(--oxide), inset 0 0 0 4px #fdf3dd; }
.btn.primary:hover, .btn.primary:focus { background: var(--ink); box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px #fdf3dd; }
.btn.alt { background: var(--olive); color: #f3f0de; box-shadow: inset 0 0 0 3px var(--olive), inset 0 0 0 4px #f3f0de; }
.btn.alt:hover, .btn.alt:focus { background: var(--ink); box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px #f3f0de; }

input, textarea, select {
  width: 100%;
  font-family: var(--type);
  font-size: 0.95rem;
  padding: 9px;
  background: #fbf4e2;
  border: 1px solid var(--rule);
  color: var(--ink);
  margin: 5px 0 14px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
label { font-family: var(--display); font-size: 1.04rem; letter-spacing: 0.02em; }
.check { display: flex; gap: 9px; align-items: flex-start; font-family: var(--body); font-size: 0.98rem; }
.check input { width: auto; margin-top: 5px; }

/* A rubber stamp, struck a little crooked */
.stamp {
  display: inline-block;
  border: 2px solid var(--oxide);
  outline: 1px solid var(--oxide);
  outline-offset: 2px;
  color: var(--oxide);
  font-family: var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
  padding: 3px 12px;
  transform: rotate(-2.2deg);
  margin-bottom: 12px;
  opacity: 0.88;
}

/* Fleuron: the printer's ornament used as a divider */
.fleuron {
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.5rem;
  line-height: 1;
  margin: 18px 0;
}
.fleuron::before, .fleuron::after {
  content: "";
  display: inline-block;
  width: 70px;
  vertical-align: middle;
  margin: 0 14px;
  border-top: 1px solid var(--ink-faint);
}

/* ------------------------------------------------- photographs */

figure { margin: 0; }
.photo {
  position: relative;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  padding: 9px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  overflow: hidden;
}
.photo img { width: 100%; height: 100%; object-fit: cover; filter: sepia(0.55) contrast(1.12) brightness(0.98); }
/* A halftone dot screen over the image, as a period press would print it */
.photo.halftone::after {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  background-image: radial-gradient(circle at center, rgba(36, 26, 16, 0.5) 34%, transparent 35%);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
  opacity: 0.55;
}
.photo.empty {
  background-image: repeating-linear-gradient(45deg, var(--paper-2) 0 10px, var(--paper-3) 10px 20px);
}
.caption {
  font-family: var(--type);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: left;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--ink-faint);
  color: var(--ink-soft);
}
.caption strong { font-family: var(--display); font-size: 0.92rem; letter-spacing: 0.02em; }

/* ------------------------------------------------------- bits */

.typed, .meta { font-family: var(--type); }
.meta { font-size: 0.8rem; color: var(--ink-soft); }

.notice {
  border: 1px solid var(--oxide);
  border-left-width: 6px;
  background: #f6e3cc;
  padding: 12px 16px;
  font-size: 0.99rem;
  margin: 0 0 20px;
}
.notice strong { font-family: var(--display); letter-spacing: 0.02em; }

.notes { padding-left: 1.1em; }
.notes li { margin-bottom: 0.55rem; }
.notes strong { font-family: var(--display); letter-spacing: 0.02em; }

.post { border-top: 1px solid var(--ink-faint); padding: 14px 0; }
.post:first-child { border-top: none; }
.post h3 { margin-bottom: 2px; }
.reply { margin-left: 26px; border-left: 3px double var(--ink-faint); padding-left: 14px; }

table.specs { width: 100%; border-collapse: collapse; font-size: 1rem; }
table.specs th, table.specs td { border-bottom: 1px solid var(--ink-faint); padding: 7px 4px; text-align: left; vertical-align: top; }
table.specs th { width: 38%; font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; }
table.specs tr:last-child th, table.specs tr:last-child td { border-bottom: none; }

.listing { display: grid; grid-template-columns: 132px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--ink-faint); }
.listing:first-child { border-top: none; }
.listing .thumb {
  width: 132px; height: 98px;
  background: var(--paper-3);
  border: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-size: 0.9rem; text-align: center;
  background-image: repeating-linear-gradient(45deg, var(--paper-2) 0 8px, var(--paper-3) 8px 16px);
}
.price { font-family: var(--display); font-size: 1.3rem; color: var(--oxide); }

.pill {
  display: inline-block;
  font-family: var(--type);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--ink);
  padding: 1px 7px;
  margin: 0 5px 4px 0;
  background: var(--paper-2);
}

.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px double var(--rule); }
.timeline li { padding: 0 0 20px 22px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -8px; top: 8px;
  width: 11px; height: 11px; background: var(--oxide); border: 1px solid var(--rule);
}
.timeline .year { font-family: var(--display); font-size: 1.22rem; letter-spacing: 0.03em; }

.msg-ok  { color: var(--olive); font-family: var(--type); font-size: 0.9rem; }
.msg-err { color: var(--oxide); font-family: var(--type); font-size: 0.9rem; }
.hidden  { display: none !important; }

footer {
  text-align: center;
  font-family: var(--type);
  font-size: 0.79rem;
  line-height: 1.7;
  padding: 22px 16px 30px;
  background: var(--paper);
  border-top: 5px solid var(--rule);
  box-shadow: inset 0 6px 0 var(--paper), inset 0 7px 0 var(--rule);
  color: var(--ink-soft);
}
footer .fleuron { margin: 4px 0 12px; font-size: 1.2rem; }

/* ===================================================== the game */

.game-wrap { position: relative; line-height: 0; }
#gameCanvas {
  display: block;
  width: 100%;
  height: 72vh;
  min-height: 430px;
  background: #a8b8c4;
  border: 1px solid var(--rule);
  cursor: crosshair;
}

.hud {
  position: absolute; left: 14px; right: 14px; top: 12px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 18px;
  font-family: var(--type); font-size: 0.84rem; line-height: 1.5;
  color: #fdf3dd; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.85);
  pointer-events: none;
}
.hud .warn { color: #ffc96b; }
.hud .ticker { width: 100%; text-align: center; font-style: italic; font-size: 0.95rem; }

.crosshair {
  position: absolute; left: 50%; top: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  pointer-events: none; opacity: 0;
  transition: opacity 140ms linear;
}
.crosshair::before, .crosshair::after {
  content: ""; position: absolute; background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.9);
}
.crosshair::before { left: 9px; top: 0; width: 2px; height: 20px; }
.crosshair::after  { top: 9px; left: 0; height: 2px; width: 20px; }

.hit-marker {
  position: absolute; left: 50%; top: 50%;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  pointer-events: none; opacity: 0;
  transition: opacity 90ms linear;
  background:
    linear-gradient(45deg, transparent 44%, #fff 44% 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #fff 44% 56%, transparent 56%);
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.dir-indicator {
  position: absolute; left: 50%; top: 50%;
  width: 190px; height: 190px; margin: -95px 0 0 -95px;
  pointer-events: none; opacity: 0;
  transition: opacity 260ms linear;
}
.dir-indicator span {
  position: absolute; left: 50%; top: 4px; margin-left: -13px;
  width: 0; height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-bottom: 17px solid rgba(190, 48, 32, 0.92);
}

.hurt-flash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(140, 24, 14, 0.95) 100%);
}

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26, 18, 8, 0.74);
  padding: 20px; line-height: 1.58;
}
.overlay-card { max-width: 560px; margin: 0; text-align: center; }
.overlay-card .stamp { transform: rotate(-2deg); }

/* -------------------------------------------------- responsive */

@media (max-width: 700px) {
  body { font-size: 1.06rem; }
  .dateline { flex-direction: column; text-align: center; gap: 2px; }
  nav.menu a { padding: 8px 13px; font-size: 1rem; }
  .card { padding: 18px 16px; }
  .reply { margin-left: 10px; }
  .listing { grid-template-columns: 1fr; }
  .listing .thumb { width: 100%; height: 130px; }
  #gameCanvas { height: 58vh; min-height: 340px; }
  .hud { font-size: 0.76rem; left: 8px; right: 8px; }
  .fleuron::before, .fleuron::after { width: 34px; margin: 0 8px; }
}

@media print {
  nav.menu, .userbar, .game-wrap, .btn { display: none; }
  body { background: #fff; }
  .card { border: 1px solid #000; box-shadow: none; }
}

/* ============================================ plates and parts keys */

.plate-fig { margin: 0 0 4px; }
.plate-wrap {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 10px 8px 4px;
  box-shadow: inset 0 0 60px rgba(100, 70, 28, 0.08);
}
.plate-wrap svg { display: block; width: 100%; height: auto; }
.plate-hint { display: block; margin-top: 3px; font-style: italic; }

.parts-key {
  list-style: none;
  margin: 18px 0 6px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0 24px;
}
.parts-key li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 6px;
  border-bottom: 1px solid rgba(138, 122, 94, 0.45);
  cursor: pointer;
  font-size: 0.97rem;
  line-height: 1.4;
  transition: background 0.15s;
}
.parts-key li:focus { outline: 2px solid var(--oxide); outline-offset: 1px; }
.parts-key li.is-active, .parts-key li:hover { background: #f6e3cc; }
.pk-num {
  flex: 0 0 auto;
  width: 1.75em; height: 1.75em;
  border: 1.5px solid var(--oxide);
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--type);
  font-size: 0.8rem;
  line-height: 1;
  color: var(--ink);
  background: #f6ecd2;
  transition: background 0.15s, color 0.15s;
}
.parts-key li.is-active .pk-num, .parts-key li:hover .pk-num { background: var(--oxide); color: #fff6e2; }
.pk-text strong { font-family: var(--display); font-weight: 400; letter-spacing: 0.02em; }
.plate-trade { margin: 10px 0 0; }
.plate-more { margin: 6px 0 0; text-align: right; font-family: var(--display); font-size: 1.05rem; }

@media (max-width: 700px) {
  .parts-key { grid-template-columns: 1fr; }
  .plate-wrap { padding: 6px 2px 2px; }
  /* the drawing shrinks on a phone; the numbers must not */
  svg.plate .callout .badge, svg.plate .callout .num {
    transform-box: fill-box; transform-origin: center; transform: scale(1.6);
  }
}
