/* ==========================================================================
   WFRP 2 Character Generator - Old World theme
   Grim parchment on a dark tavern table: blood red, tarnished brass, iron ink.
   ========================================================================== */

:root {
  --night:        #110d0a;
  --night-2:      #1f1712;
  --parchment:    #eee0bf;
  --parchment-2:  #e2cfa6;
  --parchment-3:  #cdb383;
  --ink:          #2a1c12;
  --ink-soft:     #5a4632;
  --blood:        #7a1c16;
  --blood-bright: #a1261d;
  --brass:        #8f6f35;
  --brass-light:  #c9a45a;
  --rule:         rgba(58, 38, 22, .28);

  --font-body:    "IM Fell English", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-caps:    "IM Fell English SC", "IM Fell English", Palatino, Georgia, serif;
  --font-display: "Pirata One", "UnifrakturCook", "Old English Text MT", "IM Fell English", Georgia, serif;
}
* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  padding: 28px 16px 48px;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(161, 38, 29, .28), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(143, 111, 53, .16), transparent 60%),
    repeating-linear-gradient(90deg, rgba(255,255,255,.012) 0 2px, transparent 2px 7px),
    linear-gradient(var(--night-2), var(--night));
  background-attachment: fixed;
}

/* ---- The parchment sheet ------------------------------------------------ */

.sheet {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: 18px clamp(18px, 4vw, 56px) 28px;
  background-color: var(--parchment);
  background-image:
    radial-gradient(ellipse at 12% 8%,  rgba(120, 80, 30, .16), transparent 38%),
    radial-gradient(ellipse at 90% 30%, rgba(120, 80, 30, .12), transparent 30%),
    radial-gradient(ellipse at 30% 85%, rgba(110, 70, 25, .14), transparent 35%),
    radial-gradient(ellipse at 75% 95%, rgba(90, 50, 20, .18), transparent 30%),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(90, 55, 20, .30) 100%);
  border: 1px solid #6b4f25;
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 6px rgba(238, 224, 191, .9),
    inset 0 0 0 7px rgba(122, 28, 22, .55),
    inset 0 0 60px rgba(80, 45, 15, .35),
    0 0 0 1px rgba(0,0,0,.6),
    0 24px 60px rgba(0,0,0,.65);
}

/* ---- Masthead ----------------------------------------------------------- */

.masthead {
  text-align: center;
  padding-bottom: 10px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--blood);
  position: relative;
}
.masthead::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  border-bottom: 1px solid var(--brass);
}
.masthead .logo img {
  display: block;
  width: min(460px, 100%);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 4px 6px rgba(40, 20, 5, .35));
}
.tagline {
  margin: 4px 0 0;
  font-family: var(--font-caps);
  letter-spacing: .18em;
  color: var(--blood);
  font-size: .95rem;
}
.tagline span { color: var(--ink-soft); }

/* ---- Typography --------------------------------------------------------- */

h1, .page-heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.1;
  color: var(--blood);
  text-align: center;
  margin: 8px 0 18px;
  text-shadow: 0 1px 0 rgba(255, 245, 220, .6);
}

a { color: var(--blood); text-decoration-color: rgba(122, 28, 22, .4); text-underline-offset: 3px; }
a:hover { color: var(--blood-bright); text-decoration-color: currentColor; }

b, strong { font-family: var(--font-caps); font-weight: 400; color: var(--blood); letter-spacing: .04em; font-size: 1.1em; }

p { margin: .6em 0; }

.lede { font-size: 1.12rem; text-align: center; max-width: 42em; margin: 0 auto 20px; }
.note { color: var(--ink-soft); font-style: italic; text-align: center; max-width: 44em; margin: 18px auto; }

/* ---- Buttons & fields --------------------------------------------------- */

input[type=submit], .button {
  display: inline-block;
  font-family: var(--font-caps);
  font-size: 1.05rem;
  letter-spacing: .08em;
  color: #f4e6c4;
  background: linear-gradient(#9a241c, #6e1813);
  border: 1px solid #3d0c09;
  border-radius: 2px;
  padding: 7px 20px 8px;
  margin: 8px 6px 8px 0;
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(201, 164, 90, .55), 0 2px 0 #3d0c09, 0 3px 8px rgba(40, 10, 5, .35);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
  transition: filter .15s ease, transform .15s ease;
}
input[type=submit]:hover, .button:hover { filter: brightness(1.15); color: #fff4d8; }
input[type=submit]:active, .button:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px rgba(201, 164, 90, .55), 0 1px 0 #3d0c09; }

input[type=text] {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px dotted var(--ink-soft);
  padding: 1px 3px;
  max-width: 100%;
}
td input[type=text] { width: 100%; min-width: 3.5em; }
input[type=text]:focus { outline: none; background: rgba(255, 250, 235, .55); border-bottom: 1px solid var(--blood); }

select {
  font: inherit;
  color: var(--ink);
  background-color: rgba(255, 248, 230, .55);
  border: 1px solid var(--brass);
  border-radius: 2px;
  padding: 3px 6px;
  max-width: 100%;
}
select:focus { outline: 2px solid rgba(122, 28, 22, .35); outline-offset: 1px; }

/* ---- Tables (the character sheet) --------------------------------------- */

table { border-collapse: collapse; width: 100%; margin: 10px 0 14px; }
th, td { padding: 4px 8px; vertical-align: top; }
th {
  font-family: var(--font-caps);
  font-weight: 400;
  color: var(--blood);
  letter-spacing: .03em;
  white-space: nowrap;
}

table[border="1"] {
  width: calc(100% - 8px);
  margin-inline: 4px;
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 2px var(--parchment), 0 0 0 3px var(--ink);
  background: rgba(255, 250, 235, .22);
}
table[border="1"] th, table[border="1"] td { border: 1px solid var(--rule); }
table[border="1"] th { background: rgba(122, 28, 22, .07); }

/* Wide tables scroll inside the sheet on small screens instead of breaking it. */
.content { overflow-x: auto; }

.content > ul, td ul { margin: 4px 0 12px; padding-left: 1.3em; }
li::marker { color: var(--blood); content: "\2720  "; font-size: .8em; }
li { padding: 1px 0; }

/* ---- Home page ---------------------------------------------------------- */

.map-frame {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 18px;
  padding: 10px;
  background: #d8c095;
  border: 1px solid var(--ink);
  box-shadow: inset 0 0 0 4px var(--parchment), inset 0 0 0 5px var(--brass), 0 8px 18px rgba(50, 25, 5, .35);
  overflow-x: auto;
}
.map-frame img {
  display: block;
  max-width: none;          /* the image map needs the picture at its real size */
  filter: sepia(.55) contrast(1.05);
  mix-blend-mode: multiply;
}

nav.regions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 22px;
}
nav.regions a {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--parchment);
  text-decoration: none;
  padding: 4px 18px 6px;
  background: linear-gradient(#8a2019, #641611);
  border: 1px solid #3d0c09;
  box-shadow: inset 0 0 0 1px rgba(201, 164, 90, .55), 0 3px 8px rgba(40, 10, 5, .3);
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%);
  padding-inline: 28px;
  transition: filter .15s ease;
}
nav.regions a:hover { filter: brightness(1.2); }

.contact img { vertical-align: middle; mix-blend-mode: multiply; }

/* ---- Region form -------------------------------------------------------- */

.nation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
}
.nation-form fieldset {
  margin: 0;
  padding: 10px 18px 16px;
  border: 1px solid var(--brass);
  background: rgba(255, 250, 235, .25);
  box-shadow: inset 0 0 0 3px rgba(238, 224, 191, .6), inset 0 0 0 4px rgba(143, 111, 53, .35);
}
.nation-form legend {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--blood);
  padding: 0 8px;
}
.nation-form label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
  font-family: var(--font-caps);
  letter-spacing: .04em;
}
.nation-form select { flex: 1 1 auto; min-width: 0; max-width: 16em; }
.nation-form .actions { grid-column: 1 / -1; text-align: center; }
.nation-form .actions input[type=submit] { font-size: 1.25rem; padding: 9px 34px 10px; }

@media (max-width: 640px) {
  .nation-form { grid-template-columns: 1fr; }
}

/* ---- Character pages ---------------------------------------------------- */

body.character .content form { margin: 6px 0 18px; }
body.character .content > b { display: block; margin-top: 16px; }
body.character td > b { display: inline; }
/* The legacy markup wraps the career-exit forms in unclosed <ul>s; neutralise them. */
body.character .content ul:not(td ul) { margin: 6px 0; padding: 0; }
body.character .content ul:not(td ul) select { margin-right: 4px; }
body.character .new-npc { margin: 22px 0 0; padding-top: 16px; border-top: 1px dashed var(--rule); }

/* Stat block: numbers read like a printed profile */
body.character table[border="1"] td { font-variant-numeric: tabular-nums; }

/* ---- Changelog ---------------------------------------------------------- */

body.changelog table { font-size: .95rem; }
body.changelog pre { white-space: pre-wrap; font: inherit; margin: 0; }
body.changelog td:first-child { font-family: var(--font-caps); color: var(--blood); white-space: nowrap; }

/* ---- Footer ------------------------------------------------------------- */

.colophon {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--brass);
  text-align: center;
  font-size: .9rem;
  color: var(--ink-soft);
}
.colophon nav { font-family: var(--font-caps); letter-spacing: .05em; margin-bottom: 4px; }
.colophon nav a { margin: 0 6px; }
.colophon p { margin: 2px 0; }
.colophon .disclaimer { font-size: .72rem; max-width: 60em; margin: 8px auto 0; line-height: 1.35; opacity: .85; }

/* ---- Printable sheet ---------------------------------------------------- */

body.printable { background: #3a2c20; }

@media print {
  body, body.printable { background: none; padding: 0; font-size: 11pt; }
  .sheet { max-width: none; border: 0; box-shadow: none; background: none; padding: 0; }
  .masthead .logo img { width: 260px; filter: none; }
  .tagline, .colophon nav, .colophon .disclaimer, form, .new-npc { display: none; }
  .content { overflow: visible; }
  table[border="1"] { background: none; }
}
