/* =====================================================================
   Colors & fonts. Change these to restyle the whole site.
   ===================================================================== */
@font-face { font-family: "Fraktur"; src: url(fonts/fraktur.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fell"; src: url(fonts/fell-regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fell"; font-style: italic; src: url(fonts/fell-italic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Fell SC"; src: url(fonts/fell-sc.woff2) format("woff2"); font-display: swap; }

:root {
  --walnut: #2b1a10;       /* page background */
  --leather: #5a3a22;      /* box title bars */
  --leather-light: #7d5532;
  --parchment: #f3e6c8;    /* main reading area */
  --parchment-deep: #e6d3a8;
  --tan: #c9a874;
  --gold: #c9a13b;
  --gold-light: #ecd27f;
  --ink: #2a1a0e;
  --ink-soft: #6b4e33;
  --crimson: #8c1c1c;
  --fraktur: "Fraktur", "Old English Text MT", serif;
  --fell: "Fell", "IM Fell English", Georgia, serif;
  --fell-sc: "Fell SC", "Fell", Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--fell);
  font-size: 19px;
  line-height: 1.6;
  background-color: var(--walnut);
  /* Bavarian lozenge pattern, done in browns */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='26'%3E%3Cpolygon points='22,0 44,13 22,26 0,13' fill='%23362214'/%3E%3C/svg%3E");
  padding: 18px 10px 40px;
}
a { color: var(--crimson); }
a:hover { color: #b8322a; }
img, video { max-width: 100%; display: block; }

/* ---------- Outer frame ---------- */
#site {
  max-width: 980px;
  margin: 0 auto;
  background: var(--parchment);
  border: 6px double var(--gold);
  outline: 2px solid #120a05;
  box-shadow: 0 0 0 4px var(--leather), 0 10px 40px rgba(0,0,0,.6);
}

/* ---------- Header ---------- */
.masthead {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 22px;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(236,210,127,.25), transparent 60%),
    linear-gradient(#6b4528, #3d2614);
  border-bottom: 3px solid var(--gold);
  color: var(--parchment);
}
.portrait {
  flex: 0 0 auto;
  width: 120px; height: 150px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--gold);
  box-shadow: 0 0 0 2px #2b1a10, 0 0 0 5px var(--gold-light), 0 4px 14px rgba(0,0,0,.5);
  background: var(--tan);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.25); }
.masthead-text { flex: 1; min-width: 0; }
.masthead h1 {
  font-family: var(--fraktur);
  font-weight: 400;
  font-size: clamp(2.3rem, 6vw, 3.6rem);
  line-height: 1.05;
  margin: 0;
  color: var(--gold-light);
  text-shadow: 2px 2px 0 #1c0f07, 0 0 18px rgba(236,210,127,.25);
}
.masthead .subtitle { font-style: italic; color: var(--tan); margin-top: 4px; }
.masthead .crest { font-family: var(--fell-sc); letter-spacing: .12em; font-size: 15px; color: var(--gold); margin-top: 6px; }

/* Lozenge ribbon under the header */
.ribbon {
  height: 14px;
  background-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='14'%3E%3Cpolygon points='10,0 20,7 10,14 0,7' fill='%236b4528'/%3E%3C/svg%3E");
  border-bottom: 2px solid #2b1a10;
}

/* Scrolling ticker (a proper 2000s marquee) */
.ticker {
  overflow: hidden; white-space: nowrap;
  background: #1c0f07; color: var(--gold-light);
  font-family: var(--fell-sc); font-size: 15px; letter-spacing: .08em;
  padding: 4px 0; border-bottom: 2px solid var(--gold);
}
.ticker span { display: inline-block; padding-left: 100%; animation: ticker 32s linear infinite; }
@keyframes ticker { to { transform: translateX(-100%); } }

/* ---------- Two columns ---------- */
.columns { display: flex; gap: 18px; padding: 18px; align-items: flex-start; }
.sidebar { flex: 0 0 210px; display: flex; flex-direction: column; gap: 16px; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* Boxes with title bars, like old portal sites */
.box { background: var(--parchment-deep); border: 2px solid var(--leather); box-shadow: 3px 3px 0 rgba(43,26,16,.35); }
.box-title {
  margin: 0;
  font-family: var(--fell-sc); font-weight: 400; font-size: 17px; letter-spacing: .1em;
  color: var(--gold-light);
  background: linear-gradient(var(--leather-light), var(--leather));
  border-bottom: 2px solid var(--gold);
  padding: 4px 10px;
}
.box-body { padding: 12px 14px; }
.content .box { background: #fbf3dd; }
.content .box-body { padding: 18px 22px; }

.nav { list-style: none; margin: 0; padding: 6px 0; }
.nav a {
  display: block; padding: 5px 12px; text-decoration: none; color: var(--ink);
  font-size: 19px;
}
.nav a::before { content: "\2726  "; color: var(--gold); }
.nav a:hover { background: var(--tan); color: var(--crimson); }
.nav a[aria-current="page"] { background: var(--leather); color: var(--gold-light); }
.nav a[aria-current="page"]::before { color: var(--gold-light); }

.stats { margin: 0; font-size: 16px; }
.stats div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted var(--ink-soft); padding: 3px 0; }
.stats dt { color: var(--ink-soft); }
.stats dd { margin: 0; font-weight: bold; color: var(--crimson); text-align: right; }
.counter-digits {
  font-family: "Courier New", monospace; font-size: 20px; letter-spacing: 3px;
  background: #120a05; color: #7dff6a; padding: 3px 8px; display: inline-block; border: 2px inset #6b4528;
}
.small { font-size: 15px; color: var(--ink-soft); }
.toggle {
  font: inherit; font-size: 15px; cursor: pointer; width: 100%;
  background: linear-gradient(var(--gold-light), var(--gold)); color: var(--ink);
  border: 2px outset var(--gold-light); padding: 4px 8px;
}
.toggle:active { border-style: inset; }

/* ---------- Content typography ---------- */
.box-body h2 { font-family: var(--fraktur); font-weight: 400; font-size: 2.1rem; color: var(--leather); margin: 0 0 6px; line-height: 1.15; }
.content p:first-child { margin-top: 0; }
.content p:last-child { margin-bottom: 0; }
.fleuron { text-align: center; color: var(--gold); font-size: 22px; letter-spacing: .6em; margin: 6px 0; }
.dropcap::first-letter {
  font-family: var(--fraktur); float: left; font-size: 3.6em; line-height: .8; padding: 6px 8px 0 0; color: var(--crimson);
}

.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.links-grid a {
  display: block; text-decoration: none; text-align: center; color: var(--ink);
  border: 2px solid var(--leather); background: var(--parchment); padding: 14px 10px;
}
.links-grid a:hover { background: var(--tan); }
.links-grid strong { display: block; font-family: var(--fraktur); font-weight: 400; font-size: 1.7rem; color: var(--leather); }
.links-grid span { font-size: 16px; font-style: italic; color: var(--ink-soft); }

/* Letters list */
.letter-list { list-style: none; padding: 0; margin: 0; }
.letter-list li { border-bottom: 1px dashed var(--tan); }
.letter-list li:last-child { border-bottom: 0; }
.letter-list a { display: block; padding: 12px 0; text-decoration: none; color: inherit; }
.letter-list .date { font-family: var(--fell-sc); font-size: 14px; letter-spacing: .12em; color: var(--ink-soft); }
.letter-list h3 { font-weight: 400; font-size: 1.4rem; margin: 0; color: var(--crimson); }
.letter-list p { margin: 0; font-style: italic; color: var(--ink-soft); font-size: 17px; }
.seal { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #c0392b, #6e1010); margin-right: 6px; vertical-align: -1px; }

/* A single letter */
.letter .date { font-family: var(--fell-sc); letter-spacing: .12em; color: var(--ink-soft); font-size: 15px; }
.letter .signoff { margin-top: 26px; font-style: italic; }
.letter-nav { display: flex; justify-content: space-between; gap: 12px; font-size: 17px; }

/* Photos */
.gallery { columns: 3 180px; column-gap: 12px; }
.gallery figure {
  margin: 0 0 12px; break-inside: avoid; cursor: zoom-in;
  background: #fff9ea; padding: 7px 7px 4px; border: 1px solid var(--tan); box-shadow: 2px 2px 0 rgba(43,26,16,.25);
}
.gallery img { width: 100%; filter: sepia(.15); }
.gallery figcaption { font-size: 15px; font-style: italic; color: var(--ink-soft); text-align: center; padding-top: 4px; }
.lightbox {
  position: fixed; inset: 0; background: rgba(20, 10, 4, .93); z-index: 20;
  display: none; align-items: center; justify-content: center; flex-direction: column; padding: 16px; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-height: 84vh; width: auto; border: 6px double var(--gold); }
.lightbox p { color: var(--gold-light); font-style: italic; margin: 12px 0 0; text-align: center; }

/* Videos */
.videos { display: grid; gap: 22px; }
.videos figure { margin: 0; }
.videos video { width: 100%; background: #000; border: 4px double var(--gold); }
.videos figcaption { font-style: italic; color: var(--ink-soft); padding-top: 6px; }
.video-placeholder {
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px;
  background: linear-gradient(135deg, var(--leather-light), var(--walnut)); color: var(--gold-light); font-style: italic;
  border: 4px double var(--gold);
}

/* Footer */
.footer {
  text-align: center; font-size: 14px; color: var(--tan); background: #1c0f07;
  border-top: 3px solid var(--gold); padding: 10px 14px;
}
.footer .badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.badge {
  font-family: Verdana, sans-serif; font-size: 10px; line-height: 1; padding: 3px 5px;
  border: 1px solid var(--gold); color: var(--gold-light); background: #3d2614;
}

/* Pixel heart overlay */
#hearts { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; image-rendering: pixelated; }

/* ---------- Phones: sidebar moves above the content ---------- */
@media (max-width: 720px) {
  body { padding: 0; font-size: 18px; }
  #site { border-width: 4px; box-shadow: none; }
  .masthead { padding: 14px; gap: 14px; }
  .portrait { width: 78px; height: 98px; border-width: 3px; }
  .columns { flex-direction: column; padding: 12px; gap: 14px; }
  .sidebar { flex: none; width: 100%; }
  .sidebar .optional { display: none; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav li { flex: 1 1 50%; }
  .content { width: 100%; }
  .content .box-body { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker span { animation: none; padding-left: 12px; }
}
