/* recurvehollow.com — the game's parchment UI, in CSS.
   Palette, fonts and textures come straight from the game
   (fpf-first-person-fletcher/scripts/ui/parchment.gd + assets/ui/redesign/tex):
   the 9-slice textures are the game's 3x bakes scaled to 2x, so every
   border-image slice below is (game 9-slice margin + shadow pad) x 2. */

@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=IM+Fell+English:ital@0;1&family=IM+Fell+English+SC&display=swap");

:root {
  color-scheme: light;
  /* paper + ink (Parchment.PAPER / INK / ...) */
  --paper: #f0e2bd;
  --paper-aged: #e4ce9c;
  --paper-shadow: #d0ad72;
  --paper-edge: #b38c50;
  --ink: #4a2c14;
  --ink-body: #3a2510;
  --ink-faded: #6b4a26;
  --ink-faint: #8a6a44;
  --rule: rgba(90, 60, 25, 0.28);
  --rule-strong: rgba(90, 60, 25, 0.5);
  /* accents */
  --wax: #7a1f1c;
  --wax-hi: #8c2420;
  --gold-leaf: #cfa93e;
  --gold-hi: #e9cf74;
  --gold-border: #b3803a;
  --gold-text: #8a6423;
  --victory: #4e8f2a;      /* Parchment.HP_GREEN — the journal's VICTORY */
  --cream: #f0e2bd;
  --cream-muted: #cbb68e;
  /* the world behind the paper */
  --night: #121a12;
  --night-2: #1a2519;

  --display: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --serif: "IM Fell English", Georgia, "Times New Roman", serif;
  --numerals: "Cinzel", Georgia, serif;   /* the game sets ALL numerals in Cinzel */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--night); }
body {
  min-height: 100vh;
  color: var(--cream);
  font: 17px/1.5 var(--serif);
  background:
    radial-gradient(1100px 600px at 50% 0, rgba(233, 207, 116, 0.07), transparent 70%),
    var(--night);
}
a { color: var(--wax); }
img { max-width: 100%; display: block; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* --- header: the wordmark, like the game's title screen -------------------- */
.masthead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 0 8px; }
.masthead .wordmark { width: 210px; height: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.55)); }
.masthead nav { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* --- parchment sheet (Parchment.sheet_panel) -------------------------------- */
/* paper edge 28px + 20px baked shadow hanging outside the box */
.sheet {
  position: relative;
  color: var(--ink-body);
  border: 28px solid transparent;
  border-image: url("/assets/ui/panel_parchment.webp?v=6ccafe5e09") 96 fill / 48px / 20px stretch;
  padding: 2px 6px 6px;
  margin: 20px 0 34px;
}
.sheet h1, .sheet h2, .sheet h3 { color: var(--ink); font-family: var(--display); font-weight: 400; letter-spacing: 0.06em; }
.sheet h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; }
.sheet h2 { font-size: 22px; line-height: 1.2; }
.sheet .lede { color: var(--ink-faded); margin-top: 4px; }
.sheet .hint { color: var(--ink-faint); font-style: italic; font-size: 15px; }
.sheet a { color: var(--wax); }
.sheet hr { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }

/* the menu's wax seal, bottom-centre of the sheet */
.seal {
  width: 58px; height: 58px; margin: 14px auto 0;
  display: grid; place-items: center;
  background: url("/assets/ui/wax_seal.png?v=5addef7fe9") center / contain no-repeat;
  color: var(--cream); font: 600 17px var(--numerals); letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
  user-select: none;
}

/* --- buttons (Parchment.button_boxes / button_primary_boxes) ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 12px solid transparent;
  border-image: url("/assets/ui/btn_normal.png?v=5c90aa10bf") 40 fill / 20px / 8px stretch;
  background: none;
  color: var(--wax); font: 17px var(--display); letter-spacing: 0.12em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-image-source: url("/assets/ui/btn_hover.png?v=d5fd8014a2"); text-decoration: none; }
.btn:active { border-image-source: url("/assets/ui/btn_pressed.png?v=72d63b6304"); }
.btn:focus-visible { outline: 2px solid var(--gold-leaf); outline-offset: 6px; }
.btn.primary, .btn[aria-pressed="true"] {
  border-image-source: url("/assets/ui/btn_primary.png?v=12a5cef4c3"); color: var(--cream);
}
.btn.primary:hover { border-image-source: url("/assets/ui/btn_primary_hover.png?v=57d4ef06f7"); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.small { min-height: 38px; padding: 0 8px; font-size: 15px; letter-spacing: 0.1em; }

/* --- text field (Parchment.field) ------------------------------------------- */
.field {
  border: 11px solid transparent;
  border-image: url("/assets/ui/field_inset.png?v=f30dc5bf6a") 22 fill / 11px stretch;
  background: none; color: var(--ink-body);
  font: 17px var(--serif); padding: 3px 4px; min-height: 44px; min-width: 0;
}
.field::placeholder { color: var(--ink-faint); font-style: italic; }
.field:focus { outline: 2px solid var(--gold-leaf); outline-offset: 2px; }

/* --- chips: journal rows, stat plaques (Parchment.chip) --------------------- */
.chip {
  border: 13px solid transparent;
  border-image: url("/assets/ui/chip_parchment.png?v=21be923626") 26 fill / 13px / 4px stretch;
  color: var(--ink-body);
}

/* --- numbers + tables ------------------------------------------------------- */
.num, td.num, .figure { font-family: var(--numerals); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { padding: 9px 8px; text-align: left; white-space: nowrap; }
th { color: var(--ink-faded); font: 14px var(--display); letter-spacing: 0.08em; border-bottom: 1px solid var(--rule-strong); }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--wax); }
th[aria-sort="descending"]::after { content: " ▾"; }
th[aria-sort="ascending"]::after { content: " ▴"; }
td { border-bottom: 1px solid var(--rule); color: var(--ink-body); }
td.num, th.num { text-align: right; }
td.num { font-size: 15px; }
tr:hover td { background: rgba(176, 140, 80, 0.12); }

.victory { color: var(--victory); font-family: var(--display); letter-spacing: 0.1em; }
.defeat { color: var(--wax); font-family: var(--display); letter-spacing: 0.1em; }
.draw { color: var(--ink-faint); font-family: var(--display); letter-spacing: 0.1em; }

.muted { color: var(--ink-faint); }
.empty { color: var(--ink-faint); font-style: italic; padding: 18px 2px; }
footer.site { color: var(--cream-muted); font-size: 14px; text-align: center; padding: 8px 16px 36px; opacity: 0.8; }
footer.site a { color: var(--cream); }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .sheet { border-width: 20px; border-image-width: 36px; border-image-outset: 16px; padding: 0 2px 4px; }
  .masthead .wordmark { width: 160px; }
  .btn { font-size: 15px; letter-spacing: 0.08em; padding: 0 10px; }
}

/* --- players pages ------------------------------------------------------------ */
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 16px 0 6px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
label.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-faded); font-family: var(--display); letter-spacing: 0.06em; font-size: 15px; }
select.field { min-height: 40px; padding: 0 4px; cursor: pointer; }

.search { position: relative; margin-top: 16px; max-width: 520px; }
.search .field { width: 100%; }
.results { list-style: none; margin-top: 6px; display: grid; gap: 4px; }
.results a { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink-body); }
.results .chip:hover { filter: brightness(1.04) saturate(1.1); }
.results .name { font-family: var(--display); letter-spacing: 0.06em; color: var(--ink); font-size: 18px; }
.results .meta { margin-left: auto; color: var(--ink-faint); font-size: 15px; }

.avatar { flex: none; border-radius: 6px; border: 2px solid var(--paper-edge); background: var(--paper-aged); object-fit: cover; }
.avatar.ph { display: inline-block; }
.who { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); letter-spacing: 0.05em; font-size: 17px; }
.who:hover { color: var(--wax); }
td.rank { color: var(--ink-faint); width: 2.2em; }

.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .meta { color: var(--ink-faded); margin-top: 2px; }
.note { margin-top: 10px; color: var(--ink-faded); font-style: italic; }

.plaques { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 18px; }
.plaque .label { font-family: var(--display); color: var(--ink-faded); letter-spacing: 0.08em; font-size: 14px; }
.plaque .figure { font-size: 26px; color: var(--ink); line-height: 1.2; margin-top: 2px; }
.plaque .sub { color: var(--ink-faint); font-size: 14px; }

.section { margin-top: 26px; }
.section > h2 { margin-bottom: 2px; }
.section > .hint { margin-bottom: 10px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 26px; }

.bars { display: grid; grid-template-columns: minmax(96px, max-content) 1fr max-content; gap: 9px 12px; align-items: center; }
.bars .name { color: var(--ink-body); white-space: nowrap; }
.bars .track { height: 14px; position: relative; background: rgba(90, 60, 25, 0.12); border-radius: 3px; }
.bars .fill { position: absolute; inset: 0 auto 0 0; min-width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-leaf)); box-shadow: inset 0 0 0 1px var(--gold-border); }
.bars .val { text-align: right; color: var(--ink); }

.map-cell { display: flex; align-items: center; gap: 10px; }
.map-cell img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--paper-edge); }

/* the journal's match rows */
.journal { list-style: none; display: grid; gap: 6px; }
.journal .chip { display: flex; align-items: center; gap: 14px; }
.journal .verdict { min-width: 92px; font-size: 19px; }
.journal .head { font-family: var(--display); color: var(--ink); letter-spacing: 0.05em; font-size: 17px; }
.journal .head .figure { font-size: 15px; margin-left: 10px; }
.journal .detail { color: var(--ink-faded); font-size: 15px; }
.journal img { width: 72px; height: 40px; object-fit: cover; border-radius: 4px; border: 1px solid var(--paper-edge); margin-left: auto; flex: none; }

@media (max-width: 640px) {
  .journal .verdict { min-width: 70px; font-size: 16px; }
  .journal img { display: none; }
  .plaque .figure { font-size: 22px; }
}
/* the browser's clear (x) on the search field, inked to match */
input[type="search"]::-webkit-search-cancel-button { filter: sepia(1) saturate(2.2) hue-rotate(-18deg) brightness(0.55); cursor: pointer; }
