﻿:root {
  --parchment: #f1e6c8;
  --parchment-dark: #e3d2a6;
  --ink: #2a1d12;
  --blue: #1c2f6b;
  --blue-dark: #142252;
  --red: #8f2a1c;
  --red-dark: #6e1d12;
  --gold: #d9b04a;
  --border: #7a4a22;
  --blackletter: "UnifrakturMaguntia", "Old English Text MT", serif;
  --gothic: "Grenze Gotisch", "UnifrakturMaguntia", serif;
  --body: "IM Fell English", Georgia, serif;
}

* { box-sizing: border-box; }

html { background: #3b2a1a; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.4;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(60,35,10,.35) 100%),
    #3b2a1a;
  min-height: 100vh;
  padding: 20px 12px;
}

.page {
  position: relative;
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px 132px 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.35), rgba(255,255,255,0) 60%),
    radial-gradient(ellipse at 80% 90%, rgba(150,110,50,.18), rgba(0,0,0,0) 55%),
    var(--parchment);
  border: 3px double var(--border);
  outline: 6px solid var(--parchment-dark);
  outline-offset: -14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- decorations ---------- */
.deco { pointer-events: none; user-select: none; }
.vines-left  { position: absolute; left: 6px;  top: 6px;  width: 118px; mix-blend-mode: multiply; }
.vines-right { position: absolute; right: 6px; top: 6px;  width: 118px; mix-blend-mode: multiply; }

/* ---------- header ---------- */
.top {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "logo login" "tag login";
  align-items: end;
  gap: 0 24px;
  margin-bottom: 18px;
}
.logo {
  grid-area: logo;
  margin: 0;
  display: flex;
  align-items: flex-end;
  font-family: var(--blackletter);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 112px);
  line-height: .9;
  letter-spacing: 1px;
}
.initial {
  height: 1.55em;
  width: auto;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.35);
  margin-right: 2px;
}
.logo-rest { padding-bottom: .12em; }
.tagline {
  grid-area: tag;
  margin: 8px 0 0;
  font-family: var(--gothic);
  font-weight: 700;
  color: var(--red);
  font-size: clamp(18px, 2.4vw, 30px);
}
.login-box {
  grid-area: login;
  align-self: start;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 17px;
}

/* ---------- buttons ---------- */
.btn {
  font-family: var(--gothic);
  font-weight: 500;
  font-size: 22px;
  color: #f6ecd2;
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.35);
  border-radius: 3px;
  padding: 6px 26px;
  cursor: pointer;
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn-blue { background: linear-gradient(var(--blue), var(--blue-dark)); min-width: 160px; }
.btn-red  { background: linear-gradient(#a3341f, var(--red-dark)); width: 100%; font-size: 24px; padding: 10px 12px; }
.btn-small {
  background: linear-gradient(var(--blue), var(--blue-dark));
  font-size: 17px; padding: 2px 16px; margin-top: 6px;
}
.btn[disabled] { opacity: .6; cursor: wait; }

/* ---------- hero + join ---------- */
.hero-row {
  position: relative;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  align-items: stretch;
}
.hero {
  margin: 0;
  border: 2px solid var(--border);
  box-shadow: inset 0 0 0 3px var(--parchment);
  overflow: hidden;
  background: #c9b27c;
}
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 40% center; }

.join {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.08), rgba(0,0,0,0) 70%),
    var(--blue);
  color: #efe6cc;
  border: 3px solid var(--gold);
  outline: 3px solid var(--blue-dark);
  padding: 26px 26px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.join h2 {
  margin: 0 0 6px;
  font-family: var(--gothic);
  font-weight: 700;
  color: var(--gold);
  font-size: clamp(30px, 3.6vw, 44px);
}
.join p { margin: 0 0 16px; }
.join #email {
  width: 100%;
  font-family: var(--body);
  font-size: 19px;
  padding: 10px 14px;
  color: var(--ink);
  background: #f6eedb;
  border: 2px solid var(--gold);
  border-radius: 3px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.25);
}
.join #email:focus { outline: 3px solid var(--gold); outline-offset: 1px; }
.join #email[hidden] { display: none; }
.join-intro strong { color: var(--gold); font-weight: 400; font-style: italic; }
.join input[aria-invalid=true] { border-color: #e06048; }
.chosen { font-size: 16px; margin: 10px 0 12px !important; opacity: .9; }
.chosen strong { color: var(--gold); font-weight: 400; font-style: italic; }
.form-msg { min-height: 1.4em; margin: 10px 0 0 !important; font-style: italic; color: #f3d98c; }
.form-msg.err { color: #ffb4a3; }
.fine { font-size: 16px; opacity: .85; margin: 6px 0 0 !important; }

.monk {
  position: absolute;
  right: -126px;
  bottom: 0;
  width: 116px;
  mix-blend-mode: multiply;
}

/* ---------- tiers ---------- */
.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.tier {
  position: relative;
  display: grid;
  grid-template-columns: 128px 1fr;
  align-items: end;
  min-height: 210px;
  border: 2px solid var(--border);
  background:
    radial-gradient(ellipse at 70% 30%, rgba(255,255,255,.35), rgba(0,0,0,0) 70%),
    #efe2bf;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.tier:hover { transform: translateY(-2px); }
.tier.selected { box-shadow: 0 0 0 3px var(--gold), 0 4px 14px rgba(0,0,0,.25); }
.tier-art { width: 100%; height: auto; max-height: 220px; object-fit: contain; object-position: left bottom; mix-blend-mode: multiply; align-self: end; }
.tier-body { align-self: start; }
.tier-body { padding: 14px 58px 14px 6px; }
.tier h3 {
  margin: 0 0 8px;
  font-family: var(--gothic);
  font-weight: 700;
  font-size: 25px;
  line-height: 1.05;
}
.tier[data-tier=peasant] h3 { color: var(--blue); }
.tier ul { margin: 0; padding-left: 18px; font-size: 17px; }
.tier li { margin: 2px 0; }
.shield { position: absolute; top: 12px; right: 10px; width: 54px; mix-blend-mode: multiply; }
.tier.selected .btn-small { background: linear-gradient(#a3341f, var(--red-dark)); }

/* ---------- feed ---------- */
.feed { margin-top: 22px; }
.feed-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-bottom: 2px solid var(--border); margin-bottom: 12px; }
.feed-head h2 { margin: 0 0 4px; font-family: var(--gothic); font-weight: 700; color: var(--red); font-size: clamp(28px, 3.4vw, 40px); }
.cam-link { font-family: var(--gothic); font-size: 21px; color: var(--blue); text-decoration: none; }
.cam-link:hover { text-decoration: underline; }
.feed-links { display: flex; gap: 20px; flex-wrap: wrap; }
.browse-link { font-family: var(--gothic); font-size: 19px; color: var(--red); margin-top: 4px; }
/* login state on the inner pages (who.js) */
.who { font-family: var(--gothic); font-size: 19px; color: var(--blue); text-decoration: none; }
.who:hover { text-decoration: underline; }
.who strong { color: var(--red); }
/* the purse: potatoes and chickens (purse.js) */
.purse { display: inline-flex; align-items: center; gap: 12px; font-family: var(--gothic); font-size: 20px;
  color: var(--ink); text-decoration: none; }
a.purse:hover { text-decoration: underline; }
.purse-item { display: inline-flex; align-items: center; gap: 4px; }
.purse-item img { height: 1.15em; mix-blend-mode: multiply; }
.form-msg a { color: var(--gold); }
.dot { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: #d1281b;
  box-shadow: 0 0 6px #d1281b; animation: blink 1.2s steps(2, start) infinite; vertical-align: .05em; }
@keyframes blink { to { visibility: hidden; } }
.feed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.post { position: relative; display: block; color: inherit; text-decoration: none;
  border: 2px solid var(--border); background: #efe2bf; }
.post video { display: block; width: 100%; aspect-ratio: 1280 / 704; object-fit: cover; background: #c9b27c;
  border-bottom: 2px solid var(--border); }
.post-meta { padding: 8px 10px 10px; }
.post h3 { margin: 0 0 4px; font-family: var(--gothic); font-weight: 500; font-size: 21px; line-height: 1.1; }
.post p { margin: 0; font-size: 15px; opacity: .8; }
.badge { display: inline-block; font-family: var(--gothic); font-size: 14px; padding: 0 7px; margin-right: 4px;
  background: var(--blue); color: #f6ecd2; border-radius: 2px; }
.badge.serf { background: var(--red); }
.post-cam video { background: #111; }
.live-tag { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.65); color: #fff; font: 600 13px/1 monospace;
  padding: 4px 7px; letter-spacing: 1px; }
.post-cam:hover h3 { text-decoration: underline; }
.feed-note { font-size: 15px; font-style: italic; opacity: .75; text-align: center; margin: 10px 0 0; }
@media (max-width: 1000px) { .feed-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .feed-grid { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px -120px 0;
  padding: 6px 18px 10px;
  border-top: 2px solid var(--border);
  font-size: 17px;
}
.foot p { margin: 0; text-align: center; }
.foot .rabbit { width: 70px; mix-blend-mode: multiply; }
.foot .jester { width: 110px; mix-blend-mode: multiply; }

/* ---------- dialog ---------- */
dialog {
  border: 3px solid var(--gold);
  outline: 3px solid var(--blue-dark);
  background: var(--parchment);
  color: var(--ink);
  padding: 0;
  max-width: min(440px, calc(100vw - 32px));
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
dialog::backdrop { background: rgba(30,18,6,.65); }
.dlg-inner { padding: 22px 26px; text-align: center; }
.dlg-inner h2 { margin: 0 0 10px; font-family: var(--gothic); color: var(--red); font-size: 32px; }
.dlg-inner input[type=email] {
  width: 100%; font: 18px var(--body); padding: 8px 12px; margin: 8px 0;
  border: 2px solid var(--border); background: #fbf5e4;
}
.dlg-inner .tier-line { font-family: var(--gothic); font-size: 24px; color: var(--blue); margin: 4px 0 10px; }
.dlg-inner .fine-dark { font-size: 15px; opacity: .7; font-style: italic; }
.dlg-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.dlg-actions .btn { font-size: 19px; padding: 4px 20px; }
.btn-plain { background: linear-gradient(#8a6a3f, #5d4325); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .page { padding: 20px 24px 0; }
  .vines-left, .vines-right, .monk { display: none; }
  .foot { margin: 10px -22px 0; }
}
@media (max-width: 1000px) {
  .tiers { grid-template-columns: 1fr; }
  .tier { min-height: 0; grid-template-columns: 140px 1fr; }
  .tier ul { columns: 2; }
}
@media (max-width: 860px) {
  .hero-row { grid-template-columns: 1fr; }
  .hero img { height: auto; }
  .top { grid-template-columns: 1fr; grid-template-areas: "logo" "tag" "login"; }
  .login-box { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 6px 14px; margin-top: 12px; }
}
@media (max-width: 520px) {
  body { padding: 0; font-size: 17px; }
  .page { padding: 18px 16px 0; outline: none; border-width: 0; }
  .join { padding: 20px 16px 14px; }
  .foot { flex-wrap: wrap; justify-content: center; margin: 10px -16px 0; }
  .foot .rabbit { display: none; }
  .tier-body { padding-right: 52px; }
  .tier { grid-template-columns: 100px 1fr; }
  .tier ul { columns: 1; }
  .shield { width: 42px; }
}

