/* ============================================================
   Hollowreach Adventurers' Guild

   The page is not a website. It is a sheet of guild parchment
   lying on a dark table, with a wax seal pressed into it.
   The seal is the one loud thing; everything else stays quiet
   so the seal keeps its weight.
   ============================================================ */

:root {
  --table:          #2a1d14;
  --table-deep:     #150e09;
  --parchment:      #e7dcc0;
  --parchment-mid:  #dbcda9;
  --parchment-deep: #cbb98d;
  --parchment-edge: #a89468;
  --ink:            #2f2115;
  --ink-soft:       #6d5a42;
  --ink-faint:      #97826a;
  --seal:           #8c1f16;
  --seal-hi:        #b8392c;
  --seal-lo:        #5d1009;
  --gilt:           #b8912f;
  --gilt-hi:        #e0c069;

  --display: 'IM Fell English', Georgia, serif;
  --hand:    'Pirata One', 'IM Fell English', Georgia, serif;
  --body:    'Spectral', Georgia, serif;

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23g)' opacity='0.5'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { background: var(--table-deep); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(184, 145, 47, 0.10), transparent 60%),
    radial-gradient(ellipse at 50% 40%, #34241a 0%, var(--table) 45%, var(--table-deep) 100%);
  background-attachment: fixed;
  padding: 0 16px 80px;
}

/* ---------- the parchment sheet ---------- */

.wrap {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 8px 0 0;
}

.sheet {
  position: relative;
  background-color: var(--parchment);
  background-image:
    radial-gradient(ellipse at 18% 12%, rgba(120, 88, 40, 0.14), transparent 55%),
    radial-gradient(ellipse at 84% 78%, rgba(120, 88, 40, 0.16), transparent 55%),
    linear-gradient(160deg, rgba(255, 250, 232, 0.5), transparent 55%);
  padding: 52px clamp(20px, 5vw, 64px) 64px;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.18) inset,
    0 -28px 44px -30px rgba(90, 62, 26, 0.55) inset,
    0 28px 44px -30px rgba(90, 62, 26, 0.55) inset,
    0 24px 60px rgba(0, 0, 0, 0.55),
    0 3px 10px rgba(0, 0, 0, 0.4);
  border-top: 1px solid rgba(255, 250, 232, 0.4);
}

/* paper grain, painted over the sheet without touching its contents */
.sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.22;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* a gilt rule just inside the edge, the way a charter is ruled */
.sheet::after {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(184, 145, 47, 0.4);
  pointer-events: none;
}

.sheet > * { position: relative; z-index: 1; }

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

.masthead {
  text-align: center;
  padding-bottom: 22px;
  margin-bottom: 12px;
}

.crest { display: block; margin: 0 auto 10px; }

.masthead h1 {
  font-family: var(--hand);
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 1;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(255, 250, 232, 0.6);
}

.masthead h1 a { color: inherit; text-decoration: none; }

.masthead .sub {
  font-family: var(--display);
  font-size: 0.92rem;
  font-style: italic;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ---------- ornamental divider ---------- */

.fleuron {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gilt);
  margin: 8px 0 30px;
}

.fleuron::before, .fleuron::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--parchment-edge), transparent);
}

.fleuron span { font-size: 1.1rem; line-height: 1; color: var(--gilt); }

/* ---------- navigation ---------- */

nav.quills {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 0;
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 16px;
}

nav.quills a {
  padding: 2px 18px;
  color: var(--ink-soft);
  text-decoration: none;
  border-right: 1px solid var(--parchment-edge);
}

nav.quills a:last-child { border-right: 0; }
nav.quills a:hover { color: var(--seal); }

a { color: var(--ink); text-decoration-color: var(--parchment-edge); text-underline-offset: 4px; }
a:hover { text-decoration-color: var(--seal); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 3px;
}

/* ============================================================
   THE SIGNATURE: a wax seal pressed into the parchment
   ============================================================ */

.seal {
  --size: 108px;
  position: relative;
  width: var(--size);
  height: var(--size);
  flex: 0 0 var(--size);
  display: grid;
  place-items: center;
  transform: rotate(-6deg);
  /* irregular edge - wax never sets round */
  border-radius: 47% 53% 52% 48% / 51% 47% 53% 49%;
  background:
    radial-gradient(circle at 34% 28%, var(--seal-hi), var(--seal) 42%, var(--seal-lo) 100%);
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.25) inset,
    0 -6px 12px rgba(0, 0, 0, 0.42) inset,
    0 4px 9px rgba(60, 30, 12, 0.5),
    0 1px 2px rgba(0, 0, 0, 0.4);
}

/* the pressed ring inside the wax */
.seal::before {
  content: '';
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.28);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* ribbon tails escaping from under the wax */
.seal::after {
  content: '';
  position: absolute;
  bottom: -7%;
  left: 50%;
  width: 34%;
  height: 22%;
  transform: translateX(-52%) rotate(8deg);
  border-radius: 0 0 40% 55%;
  background: linear-gradient(160deg, var(--seal-lo), transparent 80%);
  z-index: -1;
  opacity: 0.55;
  filter: blur(0.4px);
}

.seal .rank {
  font-family: var(--display);
  font-size: calc(var(--size) * 0.36);
  line-height: 1;
  color: var(--gilt-hi);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6), 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.seal .word {
  font-family: var(--display);
  font-size: calc(var(--size) * 0.085);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(224, 192, 105, 0.75);
  margin-top: 3px;
}

.seal .inner { text-align: center; position: relative; z-index: 1; }

.seal.sm { --size: 60px; transform: rotate(-5deg); }
.seal.sm .word { display: none; }

/* S and SS are struck in gold, not wax */
.seal.gilt {
  background: radial-gradient(circle at 34% 28%, var(--gilt-hi), var(--gilt) 44%, #6f5416 100%);
}
.seal.gilt .rank { color: #fff6dd; }
.seal.gilt .word { color: rgba(255, 246, 221, 0.7); }
.seal.gilt::after { background: linear-gradient(150deg, #6f5416, transparent 72%); }

/* eligible-but-not-yet-promoted: the impression without the wax */
.seal.pending {
  background: transparent;
  box-shadow: none;
  border: 2px dashed var(--parchment-edge);
  border-radius: 50%;
}
.seal.pending::before, .seal.pending::after { display: none; }
.seal.pending .rank { color: var(--ink-faint); text-shadow: none; }
.seal.pending .word { color: var(--ink-faint); }

/* ---------- ledger entries ---------- */

.entry {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 4px;
  border-bottom: 1px solid rgba(168, 148, 104, 0.45);
}

.entry:hover { background: rgba(203, 185, 141, 0.16); }

.entry .slot {
  font-family: var(--display);
  font-size: 0.9rem;
  color: var(--ink-faint);
  width: 3rem;
  flex: 0 0 3rem;
  text-align: center;
}

.entry .who { flex: 1 1 auto; min-width: 0; }

.entry .who .name {
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1.25;
}

.entry .who .name a { text-decoration: none; }
.entry .who .name a:hover { color: var(--seal); }

.entry .who .meta {
  font-family: var(--display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.entry .pts {
  font-family: var(--display);
  font-size: 1.35rem;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.entry .pts small {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- the ledger rule (progress) ---------- */

.rule {
  margin-top: 8px;
  height: 13px;
  border: 1px solid var(--ink-soft);
  background:
    repeating-linear-gradient(to right, transparent 0 17px, rgba(168, 148, 104, 0.5) 17px 18px),
    rgba(255, 252, 240, 0.35);
  position: relative;
  overflow: hidden;
}

.rule i {
  display: block;
  height: 100%;
  background: linear-gradient(to bottom, var(--seal-hi), var(--seal) 55%, var(--seal-lo));
  box-shadow: 1px 0 3px rgba(93, 16, 9, 0.6);
}

.rule.full { border-color: var(--gilt); box-shadow: 0 0 0 1px rgba(184,145,47,.35); }

.rule.gilt i { background: linear-gradient(to bottom, var(--gilt-hi), var(--gilt) 60%, #6f5416); }

.rule-label {
  font-family: var(--display);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- card & party heads ---------- */

.card-head {
  display: flex;
  gap: 36px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.card-art {
  flex: 0 0 320px;
  max-width: 100%;
  display: block;
  border: 1px solid var(--ink-soft);
  padding: 7px;
  background: linear-gradient(150deg, var(--parchment-mid), var(--parchment-deep));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
}

.card-art img { display: block; width: 100%; height: auto; }

.card-body { flex: 1 1 320px; min-width: 0; }

.card-body h2 {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 400;
  margin: 0 0 2px;
  line-height: 1.05;
}

.eyebrow {
  font-family: var(--display);
  font-size: 0.82rem;
  font-style: italic;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* the first paragraph of the registry gets an illuminated capital */
.illuminated::first-letter {
  font-family: var(--hand);
  font-size: 3.6rem;
  line-height: 0.8;
  float: left;
  margin: 6px 10px 0 0;
  color: var(--seal);
  text-shadow: 1px 1px 0 rgba(184, 145, 47, 0.45);
}

.notice {
  border-left: 3px solid var(--seal);
  background: rgba(140, 31, 22, 0.06);
  padding: 10px 0 10px 18px;
  margin: 22px 0;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
}

/* ---------- requirement checklist ---------- */

.checks { list-style: none; padding: 0; margin: 14px 0 0; }

.checks li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 9px 4px;
  border-bottom: 1px dotted var(--parchment-edge);
}

.checks .box {
  font-family: var(--display);
  font-size: 1.15rem;
  flex: 0 0 1.5rem;
  color: var(--ink-faint);
  line-height: 1;
}

.checks li.met .box { color: var(--seal); }
.checks li.met .label { color: var(--ink-soft); }
.checks .label { flex: 1 1 auto; font-family: var(--display); font-size: 1.05rem; }

.checks .detail {
  font-family: var(--display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.checks .hand {
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border: 1px solid var(--parchment-edge);
  padding: 0 7px;
  white-space: nowrap;
}

/* ---------- section headings ---------- */

h3.section {
  font-family: var(--display);
  font-size: 1.02rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 400;
  margin: 50px 0 6px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink-soft);
  position: relative;
}

h3.section::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 3px;
  border-bottom: 1px solid var(--ink-soft);
}

/* ---------- controls ---------- */

button, .btn {
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(to bottom, rgba(255, 252, 240, 0.6), rgba(203, 185, 141, 0.5));
  color: var(--ink);
  border: 1px solid var(--ink-soft);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.5;
  box-shadow: 0 1px 0 rgba(255, 252, 240, 0.5) inset, 0 2px 4px rgba(60, 30, 12, 0.18);
}

button:hover, .btn:hover {
  background: linear-gradient(to bottom, var(--ink-soft), var(--ink));
  color: var(--parchment);
}

button.wax {
  border-color: var(--seal);
  color: var(--seal);
}
button.wax:hover {
  background: linear-gradient(to bottom, var(--seal-hi), var(--seal-lo));
  color: var(--parchment);
}

button.quiet { border-color: var(--parchment-edge); color: var(--ink-soft); box-shadow: none; }

input[type="text"], input[type="number"], select, textarea {
  font-family: var(--display);
  font-size: 1.05rem;
  background: rgba(255, 252, 240, 0.4);
  border: 0;
  border-bottom: 1px solid var(--ink-soft);
  padding: 6px 4px;
  color: var(--ink);
  width: 100%;
}

label.field { display: block; margin: 18px 0 0; }

label.field > span {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: block;
}

.rank-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.rank-row button { min-width: 72px; font-size: 1.15rem; padding: 12px 8px; letter-spacing: 0.06em; }
.rank-row button[data-danger="1"] { border-color: var(--seal); color: var(--seal); }

.targets { columns: 2; column-gap: 34px; margin-top: 12px; }
@media (max-width: 560px) { .targets { columns: 1; } }

.targets label {
  display: flex;
  gap: 10px;
  align-items: baseline;
  break-inside: avoid;
  padding: 5px 0;
  font-family: var(--display);
  font-size: 1rem;
}

.panel {
  border: 1px solid var(--parchment-edge);
  background: rgba(255, 252, 240, 0.32);
  padding: 22px 24px;
  margin-top: 18px;
  box-shadow: 0 1px 0 rgba(255, 252, 240, 0.6) inset;
}

.panel h4 {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: var(--ink-soft);
}

table.log { width: 100%; border-collapse: collapse; font-family: var(--display); font-size: 0.98rem; }

table.log th {
  text-align: left;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink-soft);
  padding: 6px 12px 6px 0;
}

table.log td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px dotted var(--parchment-edge);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

table.log tr.undone td { color: var(--ink-faint); text-decoration: line-through; }

.flash {
  border: 1px solid var(--seal);
  border-left-width: 5px;
  background: rgba(140, 31, 22, 0.07);
  padding: 12px 18px;
  margin: 22px 0;
  font-family: var(--display);
  font-size: 1.05rem;
}

.muted { color: var(--ink-soft); }
.small { font-size: 0.92rem; }
.measure { max-width: 56ch; }

footer.foot {
  margin-top: 60px;
  padding-top: 18px;
  border-top: 1px solid var(--parchment-edge);
  font-family: var(--display);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--ink-faint);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  body { font-size: 16px; padding: 0 8px 60px; }
  .sheet { padding: 36px 20px 48px; }
  .entry { gap: 14px; }
  .card-art { flex: 1 1 100%; }
}
