/* The Rookery Boys: the house style. Black, charcoal, dark burgundy, old brass; paper, cork, slate and gaslight.
   Every background picture is a ChatGPT plate (assets/plates) or a real photo texture (assets/tex); nothing is drawn. */

:root {
  --soot: #0b0908;
  --char: #1b1816;
  --char-2: #2a2522;
  --burgundy: #5c1820;
  --burgundy-hi: #8b2a33;
  --blood: #7a1f27;
  --brass: #b48f55;
  --brass-hi: #e3c58c;
  --brass-lo: #6f5530;
  --ivory: #ece2cc;
  --paper: #e8dcc2;
  --ink: #1d1712;
  --ink-soft: #4a3d31;
  --pencil: #3b3a3d;
  --chalk: #f1ece2;
  --gas: #ffcf8a;

  --f-title: 'IM Fell English SC', 'IM Fell English', Georgia, serif;
  --f-body: 'IM Fell English', Georgia, 'Times New Roman', serif;
  --f-typed: 'Special Elite', 'Courier New', monospace;
  --f-hand: 'Caveat', 'Segoe Script', cursive;

  --img-paper: url('/assets/tex/paper.jpg?v=bc445a36d1');
  --img-grain: url('/assets/tex/paper-grain.jpg?v=814d03fe15');
  --img-cork: url('/assets/tex/cork.jpg?v=cef7d96cfa');
  --img-brass: url('/assets/tex/brass.jpg?v=3da4fe4683');
  --img-leather: url('/assets/tex/leather.jpg?v=113fb99bc6');
  --img-wood: url('/assets/tex/desk-wood.jpg?v=44063ec90b');
  --img-manila: url('/assets/tex/manila.jpg?v=bc4f31f3f3');

  --ease: cubic-bezier(.2, .8, .25, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-paper: 0 1px 1px rgba(0,0,0,.35), 0 10px 24px -6px rgba(0,0,0,.65), 0 26px 50px -20px rgba(0,0,0,.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--soot);
  color: var(--ivory);
  font: 18px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: rgba(139, 42, 51, .55); color: #fff; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--f-typed); color: var(--ivory); }

/* ---------- the plates behind everything ---------- */
#plates { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--soot); }
#plates .plate {
  position: absolute; inset: 0;
  background: center / cover no-repeat;
  opacity: 0;
  transition: opacity 1.1s var(--ease), transform 1.6s var(--ease-out), filter 1.1s var(--ease);
  will-change: opacity, transform;
}
#plates .plate.on { opacity: 1; }
#plates::after {        /* gaslight vignette over every plate */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 45%, rgba(5, 3, 2, .55) 78%, rgba(5, 3, 2, .9) 100%);
}
#smoke { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: 0; transition: opacity 1.2s ease; z-index: 1; }
#smoke.on { opacity: .9; }
#plates.dim #smoke { opacity: .25; }
#plates.dim .plate.on { filter: brightness(.5) saturate(.8); transform: scale(1.015); }

/* A dark board for anything written straight onto the room (lists, ladders): smoked wood with a brass hairline. */
.board {
  position: relative; padding: 22px 26px 22px;
  background: linear-gradient(180deg, rgba(16, 12, 10, .86), rgba(10, 8, 7, .9)), var(--img-wood) center / 900px auto;
  box-shadow: inset 0 0 0 1px rgba(180, 143, 85, .28), inset 0 1px 0 rgba(255, 220, 160, .07), 0 18px 40px -16px rgba(0,0,0,.9);
  border-radius: 2px;
}

/* ---------- type ---------- */
.title { font-family: var(--f-title); font-weight: 400; letter-spacing: .04em; margin: 0; }
.typed { font-family: var(--f-typed); letter-spacing: .02em; }
.hand { font-family: var(--f-hand); font-weight: 600; }
.smallcaps { font-family: var(--f-title); letter-spacing: .12em; text-transform: none; }
.gilt {
  background: linear-gradient(180deg, #f6e2b3 0%, #d9b574 38%, #9c7740 62%, #e1c287 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* Chromium drops gradient-clipped text that carries its own filter, so the shadow goes on whatever holds it. */
.gilt-hold { filter: drop-shadow(0 1px 0 rgba(0,0,0,.85)) drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
.kicker { font-family: var(--f-typed); font-size: 13px; letter-spacing: .28em; text-transform: uppercase; color: var(--brass); }

/* ---------- paper ---------- */
.paper {
  position: relative;
  color: var(--ink);
  background: var(--img-paper) center / 640px auto, var(--paper);
  background-blend-mode: multiply;
  box-shadow: var(--shadow-paper);
}
.paper::before {   /* the sheet's own light: a little brighter where the lamp falls */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(130% 100% at 30% 0%, rgba(255, 240, 210, .18), transparent 60%),
              linear-gradient(180deg, transparent 70%, rgba(60, 40, 20, .12));
  mix-blend-mode: multiply;
}
.paper.manila { background: var(--img-manila) center / 520px auto, #d8c39a; background-blend-mode: multiply; }
.card {           /* an index card */
  position: relative; color: var(--ink);
  background: var(--img-paper) 30% 40% / 520px auto, #f1e6cc;
  background-blend-mode: multiply;
  box-shadow: 0 1px 1px rgba(0,0,0,.4), 0 8px 18px -6px rgba(0,0,0,.7);
}

/* a pin pushed through the paper */
.tack {
  position: absolute; width: 16px; height: 16px; border-radius: 50%; z-index: 3; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #f3b5a8 0 12%, #a3222c 30%, #5a0d14 72%, #2a0508 100%);
  box-shadow: 0 2px 2px rgba(0,0,0,.55), 2px 5px 6px rgba(0,0,0,.35);
}
.tack.brass { background: radial-gradient(circle at 35% 30%, #fff1c8 0 12%, #d4ad69 32%, #7c5a2a 75%, #3e2b12 100%); }

/* ---------- brass buttons and plates ---------- */
.btn {
  --b1: #f0d9a4; --b2: #b48a4f; --b3: #5e4423;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 38px; padding: 7px 18px 6px;
  font-family: var(--f-title); font-size: 17px; letter-spacing: .07em; color: #170e04;
  background: var(--img-brass) center / 300px auto, linear-gradient(180deg, var(--b1), var(--b2));
  background-blend-mode: soft-light;
  border: 0; border-radius: 3px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 244, 214, .7), inset 0 -2px 0 rgba(60, 40, 15, .55), 0 1px 0 rgba(0,0,0,.6), 0 6px 12px -4px rgba(0,0,0,.7);
  text-shadow: 0 1px 0 rgba(255, 240, 205, .45);
  transition: transform .18s var(--ease), filter .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover { filter: brightness(1.08) saturate(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 rgba(255,244,214,.5), inset 0 -1px 0 rgba(60,40,15,.5), 0 1px 0 rgba(0,0,0,.6), 0 2px 4px -2px rgba(0,0,0,.7); }
.btn:focus-visible { outline: 2px solid var(--gas); outline-offset: 3px; }
.btn.small { min-height: 30px; padding: 4px 12px 3px; font-size: 15px; }
.btn.dark {
  color: var(--brass-hi); text-shadow: 0 1px 0 #000;
  background: linear-gradient(180deg, #2c2420, #15110f);
  box-shadow: inset 0 0 0 1px rgba(180, 143, 85, .55), inset 0 1px 0 rgba(255,220,160,.12), 0 6px 12px -4px rgba(0,0,0,.8);
}
.btn.blood {
  color: #f6e3d6; text-shadow: 0 1px 0 rgba(0,0,0,.6);
  background: linear-gradient(180deg, #8f2b34, #561118);
  box-shadow: inset 0 1px 0 rgba(255, 200, 190, .35), inset 0 -2px 0 rgba(30, 5, 8, .6), 0 6px 12px -4px rgba(0,0,0,.7);
}
.btn[disabled] { filter: grayscale(.6) brightness(.7); cursor: default; transform: none; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: var(--burgundy-hi); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* a brass name plate with engraved letters */
.plaque {
  display: inline-block; padding: 5px 14px 4px; border-radius: 2px;
  font-family: var(--f-title); letter-spacing: .1em; color: #2b1d0c;
  background: var(--img-brass) center / 260px auto, linear-gradient(180deg, #f0d9a4, #b48a4f);
  background-blend-mode: multiply;
  box-shadow: inset 0 1px 0 rgba(255,244,214,.6), inset 0 -1px 0 rgba(50,30,10,.6), 0 2px 4px rgba(0,0,0,.6);
  text-shadow: 0 1px 0 rgba(255, 236, 196, .5);
}

/* ---------- writing on paper (forms) ---------- */
.field { display: grid; gap: 4px; margin: 0 0 14px; }
.field > span { font-family: var(--f-typed); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.line {
  width: 100%; border: 0; border-bottom: 1px solid rgba(40, 28, 18, .55); border-radius: 0;
  background: transparent; color: var(--ink); padding: 4px 2px 3px;
  font: 600 24px/1.2 var(--f-hand);
}
.line:focus { outline: none; border-bottom-color: var(--burgundy); box-shadow: 0 1px 0 var(--burgundy); }
textarea.line {
  resize: vertical; min-height: 120px; line-height: 30px; padding-top: 2px;
  background: repeating-linear-gradient(180deg, transparent 0 29px, rgba(60, 80, 120, .22) 29px 30px);
  border-bottom: 0;
}
textarea.line.typedarea { font: 16px/26px var(--f-typed); background: repeating-linear-gradient(180deg, transparent 0 25px, rgba(60, 80, 120, .18) 25px 26px); }
select.line { font-size: 22px; cursor: pointer; color-scheme: light; }
/* The open list is drawn by the browser: on paper, in plain dark ink (the page's dark scheme made it unreadable). */
select.line option { background: #f3ead6; color: #1d1712; font: 18px/1.4 var(--f-body); }
select.line option:checked { background: #e2cfa8; color: #1d1712; }
.line::placeholder { color: rgba(40, 28, 18, .38); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }

/* ---------- the memo (every dialog) ---------- */
.memo-wrap {
  position: fixed; inset: 0; z-index: 60; display: grid; justify-items: center; align-items: start; padding: 24px 16px;
  background: radial-gradient(circle at 50% 40%, rgba(10, 6, 4, .55), rgba(5, 3, 2, .85));
  animation: memo-dim .35s var(--ease) both; overflow-y: auto;
}
.memo-wrap.out { animation: memo-undim .26s ease-in both; }
.memo {
  width: min(560px, 100%); padding: 26px 32px 24px; transform-origin: 50% 0;
  margin-block: auto;   /* centred when it fits; a memo taller than the screen starts at the top and scrolls */
  animation: memo-in .55s var(--ease-out) both;
  rotate: -.4deg;
}
.memo.wide { width: min(820px, 100%); }
.memo-wrap.out .memo { animation: memo-out .26s ease-in both; }
.memo-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--f-typed); font-size: 12px; letter-spacing: .3em; color: var(--ink-soft); border-bottom: 1px solid rgba(40, 28, 18, .35); padding-bottom: 8px; }
.memo-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-soft); padding: 0 4px; }
.memo-x:hover { color: var(--burgundy); }
.memo-title { font: 400 30px/1.15 var(--f-title); margin: 16px 0 10px; color: var(--ink); letter-spacing: .02em; }
.memo-body { font-size: 18px; color: var(--ink); }
.memo-body p { margin: 0 0 12px; }
.memo-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes memo-dim { from { opacity: 0; } }
@keyframes memo-undim { to { opacity: 0; } }
@keyframes memo-in { from { opacity: 0; transform: translate3d(0, 26px, 0) rotate(1.4deg) scale(.97); } }
@keyframes memo-out { to { opacity: 0; transform: translate3d(0, 14px, 0) rotate(-1deg) scale(.98); } }

/* ---------- pencilled notes in the corner (toasts) ---------- */
#notes { position: fixed; z-index: 80; right: 18px; bottom: 18px; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
#notes .note {
  max-width: min(360px, calc(100vw - 36px)); padding: 10px 16px 9px; pointer-events: auto;
  font: 600 22px/1.2 var(--f-hand); color: var(--ink);
  background: var(--img-paper) center / 420px auto, #f1e6cc;
  background-blend-mode: multiply;
  box-shadow: 0 8px 18px -6px rgba(0,0,0,.75);
  rotate: -1.2deg;
  animation: note-in .5s var(--ease-out) both;
}
#notes .note.bad { color: var(--blood); }
#notes .note.out { animation: note-out .32s ease-in both; }
@keyframes note-in { from { opacity: 0; transform: translate3d(14px, 12px, 0) rotate(3deg); } }
@keyframes note-out { to { opacity: 0; transform: translate3d(10px, 8px, 0); } }

/* ---------- section headings and rows of buttons (every room) ---------- */
.section-title { font: 400 30px/1.1 var(--f-title); letter-spacing: .04em; margin: 0 0 4px; color: #f1e2c3; text-shadow: 0 2px 6px #000; }
.section-sub { margin: 0 0 18px; font-style: italic; color: rgba(236, 226, 204, .7); text-shadow: 0 1px 3px #000; }
.edit-row { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.more-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.more { margin-top: 14px; }

/* ---------- small things ---------- */
.muted { color: var(--ink-soft); }
.empty { font: italic 19px/1.4 var(--f-body); color: rgba(236, 226, 204, .7); text-align: center; padding: 24px 12px; }
.paper .empty, .card .empty { color: var(--ink-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rule { height: 1px; border: 0; background: linear-gradient(90deg, transparent, rgba(180, 143, 85, .6), transparent); margin: 18px 0; }
.stamp {
  display: inline-block; padding: 2px 8px 1px; border: 2px solid currentColor; border-radius: 3px;
  font: 13px/1.2 var(--f-typed); letter-spacing: .14em; text-transform: uppercase; color: var(--blood);
  rotate: -3deg; opacity: .85; mix-blend-mode: multiply;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
