/* The Kept House — shared stylesheet
   One aesthetic, committed: a warm dark house, lit low.
   No frameworks, no webfonts, no build step. */

:root {
  --bg: #161210;
  --bg-lit: #1d1509;
  --panel: #1e1915;
  --ink: #e6dcc8;
  --ink-dim: #a2957e;
  --pencil: #877a64;
  --pencil-lit: #c0ae83;
  --brass: #c9a35c;
  --rule: #35291d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  transition: background 2.5s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 38rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
  flex: 1;
}

h1, h2 {
  font-weight: normal;
  line-height: 1.25;
}

h1 { font-size: 2rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.3rem; margin: 2.5rem 0 0.75rem; }

p { margin: 0 0 1.25rem; }

a { color: var(--brass); text-decoration: none; border-bottom: 1px solid var(--rule); }
a:hover { border-bottom-color: var(--brass); }

.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1rem;
}

.dim { color: var(--ink-dim); }

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

/* ---- doors (front page & floor plan) ---- */

.doors { list-style: none; margin: 2.5rem 0; }

.doors li { margin-bottom: 1rem; }

.doors a {
  display: block;
  border: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 0.9rem 1.2rem;
  color: var(--ink);
  transition: border-color 0.3s, background 0.3s;
}

.doors a:hover {
  border-color: var(--brass);
  background: var(--panel);
}

.doors .door-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.15rem;
}

.doors .unbuilt {
  display: block;
  border: 1px dashed var(--rule);
  padding: 0.9rem 1.2rem;
  color: var(--pencil);
  font-style: italic;
}

/* ---- logbook ---- */

.entry { margin-bottom: 3rem; }

.entry-head {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.75rem;
}

/* ---- pencil notes on the walls (Room 001) ---- */

.wall-note {
  font-style: italic;
  font-size: 0.88em;
  color: var(--pencil);
  opacity: 0;
  transform: rotate(-0.6deg);
  transition: opacity 2s ease, color 2s ease;
  margin: 0 0 1.25rem 1.5rem;
}

body.lit { background: var(--bg-lit); }

body.lit .wall-note {
  opacity: 1;
  color: var(--pencil-lit);
  text-shadow: 0 0 18px rgba(255, 180, 80, 0.15);
}

/* firelight overlay */
body.lit::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 55% at 50% 88%,
              rgba(255, 170, 70, 0.09), transparent 65%);
  animation: flicker 2.8s infinite ease-in-out;
}

@keyframes flicker {
  0%, 100% { opacity: 0.85; }
  18%      { opacity: 1; }
  37%      { opacity: 0.78; }
  58%      { opacity: 0.96; }
  74%      { opacity: 0.82; }
}

/* ---- the matchbox ---- */

.matchbox {
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 1.1rem 1.3rem;
  margin: 2rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.matchbox button {
  font: inherit;
  font-size: 0.95rem;
  color: var(--brass);
  background: none;
  border: 1px solid var(--brass);
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}

.matchbox button:hover:not(:disabled) {
  background: var(--brass);
  color: var(--bg);
}

.matchbox button:disabled {
  border-color: var(--rule);
  color: var(--pencil);
  cursor: default;
}

.matchbox .count {
  font-size: 0.85rem;
  color: var(--ink-dim);
  font-style: italic;
}

/* the burning match */
.match {
  display: none;
  align-items: flex-end;
  height: 2.4rem;
}

body.lit .match { display: flex; }

.match .stick {
  width: 3px;
  height: 1.6rem;
  background: #6b5236;
  border-radius: 1px;
}

.match .flame {
  width: 11px;
  height: 16px;
  margin-left: -7px;
  margin-bottom: 1.45rem;
  background: radial-gradient(ellipse at 50% 75%,
              #fff3c4 0%, #ffb84d 45%, #e2622b 75%, transparent 100%);
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  animation: flame-dance 0.35s infinite alternate ease-in-out;
}

@keyframes flame-dance {
  from { transform: scaleX(1) translateY(0); }
  to   { transform: scaleX(0.82) translateY(-1.5px); }
}

/* ---- footer ---- */

footer {
  width: 100%;
  max-width: 38rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  font-size: 0.8rem;
  color: var(--ink-dim);
  border-top: 1px solid var(--rule);
}

footer p { margin-bottom: 0.4rem; }

nav.thread {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin-bottom: 3rem;
  color: var(--ink-dim);
}

nav.thread a { color: var(--ink-dim); border-bottom-color: transparent; }
nav.thread a:hover { color: var(--brass); }
