/* wordyweapon.com — the game's own palette and its two faces (Scratchy, the hand; Literata, what is printed). */

@font-face {
  font-family: 'Scratchy';
  src: url('fonts/scratchy-regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Literata';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/literata.woff2') format('woff2');
}
@font-face {
  font-family: 'Literata';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/literata-italic.woff2') format('woff2');
}

:root {
  --night: #0d0e12;
  --lamp: #f2a24a;
  --sheet: #f5efe1;
  --ink: #2b2724;
  --ink-soft: #8a8175;
  --rule: #e0d9c8;
  --fill: #4a9fd8;
  --stamp: #a3191f;
  --chalk: #f1e9d8;

  --hand: 'Scratchy', 'Literata', Georgia, serif;
  --prose: 'Literata', Georgia, serif;

  --gutter: clamp(20px, 5vw, 72px);
  --wide: 1360px;
}

* { box-sizing: border-box; }

html { background: var(--night); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--chalk);
  font-family: var(--prose);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.62;
  /* The dark round the lamp, the same cool night the top fades into. */
  background: var(--night);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--fill); outline-offset: 3px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── The top: the game's own menu ─────────────────────────────────────────────────────────────────────────── */

.top {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(40px, 8vh, 84px) var(--gutter) clamp(40px, 9vh, 96px);
  overflow: hidden;
  background: var(--night);
}
.top-desk {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 50%;
}
/* The dark left of the desk, where the list is written. */
.top::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 14, 18, 0.9) 0, rgba(13, 14, 18, 0.62) 26%, rgba(13, 14, 18, 0) 52%),
    linear-gradient(0deg, var(--night) 0, rgba(13, 14, 18, 0) 14%);
  pointer-events: none;
}
.top > :not(.top-desk) { position: relative; z-index: 1; }
.top > .top-desk { z-index: 0; }

.mark {
  display: flex;
  align-items: center;
  width: min(430px, 78vw);
  margin: 0;
  color: var(--chalk);
}
.mark-logo { flex: 1 1 auto; height: auto; }
.mark-two { flex: none; width: 10.5%; margin-left: -1%; overflow: visible; }

.pitch {
  max-width: 27em;
  margin: clamp(20px, 4vh, 36px) 0 0;
  font-size: clamp(17px, 1.35vw, 20px);
  color: var(--chalk);
  text-shadow: 0 1px 12px var(--night);
}

/* The weapon's name on its strip of paper, as the forge shows it: three blanks, written in and rubbed out. */
.strip {
  --c: #6b625a;
  align-self: center;
  width: min(100%, 13.6em);
  margin: clamp(22px, 4vh, 44px) 0 clamp(22px, 4vh, 44px) clamp(0px, 9vw, 170px);
  padding: 0.28em 0.9em 0.42em;
  font-family: var(--hand);
  font-size: clamp(30px, 3.8vw, 62px);
  line-height: 1.22;
  text-align: center;
  color: var(--ink);
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.6));
}
.strip::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sheet);
  transform: rotate(-0.7deg);
  clip-path: polygon(0.7% 0, 0.1% 17%, 0.9% 34%, 0.2% 52%, 1% 70%, 0.3% 88%, 0.8% 100%, 99.4% 100%, 100% 83%, 99.2% 65%, 99.9% 47%, 99.1% 29%, 99.8% 11%, 99.3% 0);
}
.slot {
  display: inline-block;
  box-sizing: content-box;
  /* Every blank keeps one width, wide enough for the longest word written in it: only the words change. */
  width: 2.1em;
  text-align: center;
  white-space: nowrap;
  border-bottom: 3px solid var(--fill);
  transition: border-color 0.2s steps(2, end);
}
.slot:last-child { width: 2.45em; }
.slot.is-written { border-bottom-color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.ink {
  display: inline-block;
  color: color-mix(in srgb, var(--c) 58%, var(--ink));
  clip-path: inset(-0.3em 104% -0.3em -0.1em);
  transition: clip-path 0.34s steps(4, end);
}
.slot.is-written .ink { clip-path: inset(-0.3em -0.1em -0.3em -0.1em); }

.menu { list-style: none; margin: 0; padding: 0; }
.menu a {
  position: relative;
  display: inline-block;
  padding: 0 0 0 1.05em;
  font-family: var(--hand);
  font-size: clamp(40px, 5.2vh, 58px);
  line-height: 1.16;
  text-decoration: none;
  color: rgba(241, 233, 216, 0.6);
}
.menu a:hover, .menu a:focus-visible, .menu .is-first a { color: var(--chalk); }
/* The dash before what is chosen, as the game's menu has it. */
.menu a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 52%;
  width: 0.6em;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
}
.menu .is-first a::before, .menu a:hover::before, .menu a:focus-visible::before { opacity: 1; }
.menu:hover .is-first a:not(:hover) { color: rgba(241, 233, 216, 0.6); }
.menu:hover .is-first a:not(:hover)::before { opacity: 0; }

/* ── A feature: a sheet of animation paper beside a picture, under the lamp ───────────────────────────────── */

main { position: relative; overflow-x: clip; }

.feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(56px, 10vh, 120px) var(--gutter);
}
/* A little light round each sheet, so it does not sit on flat black. */
.feature::before {
  content: '';
  position: absolute;
  inset: 4% -6%;
  background: radial-gradient(closest-side, rgba(104, 118, 152, 0.16), rgba(104, 118, 152, 0.06) 55%, transparent 100%);
  pointer-events: none;
}
.feature > * { position: relative; }
.feature.flip .sheet { order: 2; }
.feature.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); }
.feature.solo { grid-template-columns: minmax(0, 1fr); max-width: 980px; }

.sheet {
  position: relative;
  padding: clamp(26px, 3.2vw, 44px) clamp(24px, 3vw, 42px) clamp(28px, 3.4vw, 46px) clamp(52px, 5vw, 72px);
  color: var(--ink);
}
/* The paper is what tilts; what is written on it stays level. */
.sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 24px 16%, var(--night) 0 6px, transparent 7px),
    radial-gradient(circle at 24px 50%, var(--night) 0 6px, transparent 7px),
    radial-gradient(circle at 24px 84%, var(--night) 0 6px, transparent 7px),
    var(--sheet);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55), 0 2px 0 rgba(0, 0, 0, 0.25);
  transform: rotate(-0.8deg);
}
.feature.flip .sheet::before { transform: rotate(0.7deg); }
.feature.solo .sheet::before { transform: rotate(-0.35deg); }
.sheet > * { position: relative; }

.sheet h2 {
  margin: 0 0 0.25em;
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(40px, 4.4vw, 60px);
  line-height: 1.04;
}
.sheet p { margin: 0.7em 0 0; max-width: 34em; }
.sheet p:first-of-type { margin-top: 0.4em; }

/* A picture: a print on a torn scrap of the same paper, held to the desk by a strip of masking tape. The scrap
   tilts; the print on it stays level, as the sheets' text does. */
.shot {
  margin: 0;
  padding: clamp(9px, 1vw, 14px);
  filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.6));
}
.shot::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sheet);
  transform: rotate(0.9deg);
  clip-path: polygon(
    0.5% 0.4%, 22% 0, 48% 0.5%, 76% 0, 99.6% 0.5%,
    100% 14%, 99.3% 29%, 99.9% 46%, 99.2% 63%, 100% 81%, 99.4% 99.5%,
    71% 100%, 44% 99.4%, 19% 100%, 0.4% 99.5%,
    0 84%, 0.8% 67%, 0.1% 49%, 0.7% 31%, 0 15%
  );
}
.feature.flip .shot::before { transform: rotate(-0.8deg); }
.shot::after {
  content: '';
  position: absolute;
  top: -13px;
  left: 50%;
  width: clamp(84px, 9vw, 124px);
  height: 30px;
  background: rgba(228, 212, 170, 0.82);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateX(-50%) rotate(-2.2deg);
  clip-path: polygon(0 8%, 3% 30%, 0.5% 52%, 3.5% 76%, 1% 100%, 99% 96%, 96.5% 72%, 99.5% 50%, 97% 26%, 100% 2%);
  pointer-events: none;
}
.feature.flip .shot::after { left: 46%; transform: translateX(-50%) rotate(1.8deg); }
.shot a { display: block; cursor: zoom-in; }
.shot img { width: 100%; }

/* A word written into a blank: the hand, on its element's band, over a dashed line. */
.w {
  --c: var(--fill);
  display: inline-block;
  padding: 0 0.36em;
  font-family: var(--hand);
  font-size: 1.5em;
  line-height: 1.02;
  vertical-align: -0.06em;
  color: color-mix(in srgb, var(--c) 46%, var(--ink));
  background: color-mix(in srgb, var(--c) 30%, var(--sheet));
  border-bottom: 2px dashed color-mix(in srgb, var(--c) 62%, var(--ink));
}
.fire { --c: #ff6633; } .ice { --c: #5bb3e6; } .lightning { --c: #e3c400; } .earth { --c: #996633; }
.dark { --c: #9966cc; } .light { --c: #e0c95a; } .poison { --c: #5fbf30; } .physical { --c: #8f8f8f; }

/* ── Name your weapon: the name, with its blanks ──────────────────────────────────────────────────────────── */

.name {
  margin: 0.5em 0 0.1em;
  font-family: var(--hand);
  /* Sized so the whole name, three words written in, stays on one line of its sheet. */
  font-size: clamp(28px, 2.35vw, 36px);
  line-height: 1.3;
}
.blank {
  display: inline-block;
  min-width: 2em;
  padding: 0 0.2em;
  font: inherit;
  line-height: 1;
  text-align: center;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 3px dashed var(--ink-soft);
  cursor: pointer;
}
.blank[data-word] {
  color: color-mix(in srgb, var(--c) 46%, var(--ink));
  background: color-mix(in srgb, var(--c) 30%, var(--sheet));
  border-bottom-color: color-mix(in srgb, var(--c) 62%, var(--ink));
}
.bank { display: flex; flex-wrap: wrap; gap: 10px 12px; margin: 22px 0 0; padding: 0; list-style: none; }
.bank button {
  padding: 2px 14px 4px;
  font-family: var(--hand);
  font-size: 30px;
  line-height: 1.1;
  color: color-mix(in srgb, var(--c) 46%, var(--ink));
  background: color-mix(in srgb, var(--c) 22%, var(--sheet));
  border: 2px solid color-mix(in srgb, var(--c) 55%, var(--ink));
  border-radius: 3px 5px 4px 6px;
  cursor: pointer;
}
.bank button:hover { background: color-mix(in srgb, var(--c) 38%, var(--sheet)); }
.bank button[disabled] { opacity: 0.35; cursor: default; }
.bank .more { align-self: center; font-family: var(--hand); font-size: 30px; line-height: 1.1; color: var(--ink-soft); }

/* ── Questions ────────────────────────────────────────────────────────────────────────────────────────────── */

.asked h3 { margin: 1.3em 0 0; font-family: var(--prose); font-weight: 700; font-size: 1em; }
.asked h3:first-of-type { margin-top: 0.8em; }
.asked p { margin-top: 0.25em; }

/* ── Buttons: the hand, in a box drawn by hand; Play is the red stamp ─────────────────────────────────────── */

.does { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 26px 0 0; }
.btn {
  display: inline-block;
  padding: 4px 22px 7px;
  font-family: var(--hand);
  font-size: 34px;
  line-height: 1.1;
  text-decoration: none;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 4px 7px 5px 8px;
}
.btn:hover { background: rgba(43, 39, 36, 0.07); }
.btn.stamp { color: var(--stamp); border-color: var(--stamp); box-shadow: inset 0 0 0 2px var(--sheet), inset 0 0 0 3.5px var(--stamp); }
.btn.stamp:hover { background: rgba(163, 25, 31, 0.07); }

/* ── A page of its own: the mark and the menu on one line ─────────────────────────────────────────────────── */

/* The foot stays at the bottom of the window when the page is shorter than it. */
.page { display: flex; flex-direction: column; min-height: 100svh; }
.page main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.page .bar, .page .foot { width: 100%; }

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 40px;
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(22px, 4vh, 40px) var(--gutter) 0;
}
.bar .mark { width: min(250px, 58vw); }
.bar .menu { display: flex; flex-wrap: wrap; gap: 0 clamp(14px, 2.4vw, 34px); }
.bar .menu a { font-size: clamp(28px, 3.6vh, 38px); }

/* ── Characters: the names down the left, the one chosen on the sheet ─────────────────────────────────────── */

.roster {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: clamp(40px, 8vh, 96px) var(--gutter) clamp(56px, 10vh, 120px);
}
.roster::before {
  content: '';
  position: absolute;
  inset: 4% -6%;
  background: radial-gradient(closest-side, rgba(104, 118, 152, 0.16), rgba(104, 118, 152, 0.06) 55%, transparent 100%);
  pointer-events: none;
}
.roster > * { position: relative; }

.roster-list { display: flex; flex-direction: column; align-items: flex-start; }
.roster-list button {
  position: relative;
  padding: 0 0 0 1.05em;
  font-family: var(--hand);
  font-size: clamp(28px, 2.7vw, 42px);
  line-height: 1.24;
  text-align: left;
  white-space: nowrap;
  color: rgba(241, 233, 216, 0.6);
  background: none;
  border: 0;
  cursor: pointer;
}
.roster-list button:hover, .roster-list [aria-selected='true'] { color: var(--chalk); }
.roster-list button::before {
  content: '';
  position: absolute;
  left: 0;
  top: 52%;
  width: 0.6em;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
}
.roster-list [aria-selected='true']::before { opacity: 1; }
.lock { width: 0.5em; height: 0.6em; margin-left: 0.12em; vertical-align: -0.02em; overflow: visible; }

/* Every character is laid on the same place on the sheet, so the paper keeps its size as they change. */
.js .who-sheet { display: grid; }
.js .who { grid-area: 1 / 1; }
.js .who:not(.is-shown) { visibility: hidden; }

.who {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(22px, 3.4vw, 52px);
  align-items: center;
}
.who + .who { margin-top: 40px; }
.js .who + .who { margin-top: 0; }
.who .shot { position: relative; }
.who-words p { max-width: 30em; }
.who-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 18px;
  align-items: baseline;
  margin: 1.3em 0 0;
}
.who-facts dt { font-family: var(--hand); font-size: 28px; line-height: 1.1; color: var(--ink-soft); }
.who-facts dd { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0; }

/* Somebody locked: a blank print, a lock drawn on it. */
.unseen {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 9%, var(--sheet));
}
.unseen .lock { width: 30%; height: auto; aspect-ratio: 40 / 48; margin: 0; }
.sheet p.locked {
  display: inline-block;
  margin: 0.5em 0 0;
  padding: 2px 18px 5px;
  font-family: var(--hand);
  font-size: 32px;
  line-height: 1.1;
  color: var(--stamp);
  border: 2.5px solid var(--stamp);
  border-radius: 4px 7px 5px 8px;
  box-shadow: inset 0 0 0 2px var(--sheet), inset 0 0 0 3.5px var(--stamp);
}
.who-words .locked + p { margin-top: 0.7em; }

/* ── The foot ─────────────────────────────────────────────────────────────────────────────────────────────── */

.foot {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 30px var(--gutter) 64px;
  font-size: 15px;
  color: rgba(241, 233, 216, 0.62);
}
.foot p { margin: 0.35em 0; }
.foot a { color: rgba(241, 233, 216, 0.85); }

/* ── Narrow: one column, picture under its sheet ──────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  body { font-size: 17px; }
  .top-desk { object-position: 60% 50%; }
  .top::after {
    background: linear-gradient(180deg, var(--night) 0, rgba(13, 14, 18, 0.86) 30%, rgba(13, 14, 18, 0.15) 58%, rgba(13, 14, 18, 0.8) 100%);
  }
  .menu a { text-shadow: 0 1px 14px var(--night); }
  .strip { margin-left: 0; padding-left: 0.5em; padding-right: 0.5em; font-size: clamp(22px, 6.4vw, 40px); }
  .feature, .feature.flip { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .feature.flip .sheet { order: 0; }
  .roster { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .roster-list { flex-direction: row; flex-wrap: wrap; gap: 0 18px; }
  .roster-list button { font-size: clamp(26px, 6.6vw, 34px); }
  .who { grid-template-columns: minmax(0, 1fr); }
  .who .shot { max-width: 300px; }
  .sheet { padding-left: 46px; }
  .sheet::before {
    background:
      radial-gradient(circle at 18px 16%, var(--night) 0 5px, transparent 6px),
      radial-gradient(circle at 18px 50%, var(--night) 0 5px, transparent 6px),
      radial-gradient(circle at 18px 84%, var(--night) 0 5px, transparent 6px),
      var(--sheet);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slot, .ink { transition: none; }
}
