/* Morrowind Log. Site chrome imitates the game's menus (dark panels, bronze bevels, tan text);
   entries and pages sit on a parchment book page. All drawn in CSS: no game textures or fonts. */

@font-face {
  font-family: "Mystic Cards";
  src: url("../fonts/MysticCards.ttf") format("truetype");
  font-display: swap;
}

:root {
  --font: "Mystic Cards", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;

  /* Game menu text colours (Morrowind.ini [Fonts]: color_normal, _over, _pressed) */
  --ui-text: #caa560;
  --ui-text-hi: #dfc99f;
  --ui-text-press: #f3eddd;
  --ui-muted: #9d875f;
  --panel-bg: rgba(10, 8, 5, 0.86);
  --btn-bg: #0e0b07;
  --btn-bg-hi: #211910;
  --bevel-hi: #d9bf85;
  --bevel-mid: #9a7b45;
  --bevel-lo: #4d3a20;

  /* Page backdrop: ash-haze dusk */
  --backdrop-top: #8b765a;
  --backdrop-bottom: #3b3026;

  /* Book page */
  --parchment-hi: #f1e5c6;
  --parchment: #e6d5ab;
  --parchment-edge: #c9ad76;
  --page-rim: #5c4526;
  --ink: #2c1e10;
  --ink-soft: #5b452c;
  --ink-red: #7e2b15;
  --ink-link: #253170;
  --ink-link-hi: #3a4daf;
  --plate-line: #7b6139;
}

@media (prefers-color-scheme: dark) {
  :root {
    --backdrop-top: #1a140e;
    --backdrop-bottom: #080605;
    --panel-bg: rgba(14, 11, 7, 0.9);
    /* Same parchment, as if read by candlelight */
    --parchment-hi: #d9c9a3;
    --parchment: #cbb88c;
    --parchment-edge: #a88e5b;
    --ink: #24180c;
    --ink-soft: #4d3a24;
  }
  .plate img { filter: sepia(0.15) brightness(0.9); }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--ui-text);
  background-color: var(--backdrop-bottom);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(255, 220, 160, 0.10), transparent 70%),
    linear-gradient(180deg, var(--backdrop-top), var(--backdrop-bottom) 70%);
  background-attachment: fixed;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { color: var(--ui-text-hi); text-underline-offset: 0.18em; }
a:hover { color: var(--ui-text-press); }
:focus-visible { outline: 2px solid var(--ui-text-hi); outline-offset: 2px; }

.skip {
  position: absolute; left: 16px; top: -3rem;
  padding: 0.4rem 0.8rem; background: #000; color: var(--ui-text-hi); z-index: 10;
}
.skip:focus { top: 0.5rem; }

.wrap,
.site-head,
.site-foot {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  padding-inline: 16px;
}

/* ---- Game menu chrome ---------------------------------------------------------------- */

/* Thin bronze bevel: light on the top-left edge, dark on the bottom-right, with a black
   hairline inside and out, like the game's message boxes. */
.panel {
  background: var(--panel-bg);
  border: 2px solid;
  border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
  box-shadow:
    inset 0 0 0 1px #000,
    inset 0 0 0 2px rgba(154, 123, 69, 0.35),
    0 0 0 1px #000,
    0 8px 24px rgba(0, 0, 0, 0.45);
}

.btn {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  line-height: 1.2;
  color: var(--ui-text);
  background: var(--btn-bg);
  border: 1px solid;
  border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi);
  box-shadow: inset 0 0 0 1px #000, 0 0 0 1px #000;
  padding: 0.35em 0.95em 0.3em;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover,
.btn:focus-visible { color: var(--ui-text-hi); background: var(--btn-bg-hi); }
.btn:active { color: var(--ui-text-press); }
.btn.is-current { color: var(--ui-text-hi); }

.site-head { padding-top: 16px; margin-bottom: 1.5rem; }

.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.7rem 1rem;
}

.site-title {
  font-size: 1.9rem;
  line-height: 1.1;
  color: var(--ui-text-hi);
  text-decoration: none;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 #000, 0 0 12px rgba(223, 201, 159, 0.15);
}
.site-title:hover { color: var(--ui-text-press); }

.menu { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.panel-title {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  font-weight: normal;
  color: var(--ui-text-hi);
  text-align: center;
  letter-spacing: 0.03em;
}

.intro { padding: 0.8rem 1.1rem; margin-bottom: 1.25rem; }
.intro p { margin: 0; }

/* Index: one menu panel per night */
.entry-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.1rem; }

.card { padding: 0; }
.card:hover,
.card:focus-within { border-color: var(--ui-text-press) var(--bevel-mid) var(--bevel-mid) var(--ui-text-press); }

.card-link {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 1rem;
  padding: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.card-img {
  display: block;
  align-self: start;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid;
  border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo);
  background: #000;
}
.card-img img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.card-link:hover .card-img img { opacity: 1; }

.card-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.card-day { font-size: 1.35rem; color: var(--ui-text-hi); line-height: 1.2; }
.card-date { font-size: 1rem; color: var(--ui-muted); margin-left: 0.35rem; }
.card-title { font-size: 1.15rem; color: var(--ui-text); }
.card-link:hover .card-title { color: var(--ui-text-press); }
.card-where { font-size: 0.95rem; color: var(--ui-muted); }
.card-summary { margin-top: 0.35rem; font-size: 1rem; color: #d6c39c; }

/* Message box, as for the empty journal and the 404 */
.msgbox {
  max-width: 30rem;
  margin: 3rem auto;
  padding: 1.3rem 1.5rem 1.1rem;
  text-align: center;
}
.msgbox p { margin: 0 0 1rem; font-size: 1.2rem; color: var(--ui-text); }

/* ---- Book page ----------------------------------------------------------------------- */

.book {
  position: relative;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.6;
  padding: clamp(1.25rem, 5vw, 3.25rem) clamp(1.1rem, 6vw, 3.75rem);
  background-color: var(--parchment);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .25 0 0 0 0 .12 .55 0 0 0 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 85% 75% at 50% 45%, var(--parchment-hi) 0%, var(--parchment) 60%, var(--parchment-edge) 100%);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(92, 69, 38, 0.5),
    inset 0 0 60px rgba(120, 84, 34, 0.28),
    0 0 0 1px var(--page-rim),
    0 0 0 3px rgba(0, 0, 0, 0.55),
    0 14px 34px rgba(0, 0, 0, 0.5);
}

/* The gutter of the open book on wide screens */
@media (min-width: 720px) {
  .book {
    box-shadow:
      inset 26px 0 30px -24px rgba(70, 44, 14, 0.55),
      inset 0 0 0 1px rgba(92, 69, 38, 0.5),
      inset 0 0 60px rgba(120, 84, 34, 0.28),
      0 0 0 1px var(--page-rim),
      0 0 0 3px rgba(0, 0, 0, 0.55),
      0 14px 34px rgba(0, 0, 0, 0.5);
  }
}

.book a { color: var(--ink-link); text-decoration-thickness: 1px; }
.book a:hover { color: var(--ink-link-hi); }

.book-head { text-align: center; margin-bottom: 1.5rem; }
.book-head h1,
.journal-head h1 {
  margin: 0;
  font-weight: normal;
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  line-height: 1.2;
  color: var(--ink);
}

.journal-head { text-align: center; margin-bottom: 1.75rem; }
.journal-day {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  line-height: 1;
  color: var(--ink-red);
}
.journal-date { margin: 0.35rem 0 0.9rem; font-size: 1.25rem; color: var(--ink-soft); }
.journal-where { margin: 0.5rem 0 0; font-size: 1rem; color: var(--ink-soft); letter-spacing: 0.02em; }
.journal-where span { color: var(--ink-red); }
.journal-watch { margin: 1rem 0 0; }
/* A game-menu button on the page: keep the menu's gold text, not the book's ink link colour. */
.book a.btn { color: var(--ui-text); text-decoration: none; }
.book a.btn:hover,
.book a.btn:focus-visible { color: var(--ui-text-hi); }
.plate-video { width: 100%; transform: none; }
.plate-video:nth-of-type(even) { transform: none; }
.plate-video video { display: block; width: 100%; height: auto; border: 1px solid var(--ink); background: #000; }
.plate-video figcaption a { color: var(--ink-red); }

/* Rule with a lozenge under the heading */
.journal-head::after,
.book-head::after {
  content: "";
  display: block;
  height: 14px;
  max-width: 18rem;
  margin: 1.1rem auto 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 1 13 7 7 13 1 7z' fill='%237e2b15'/%3E%3C/svg%3E") center / 14px 14px no-repeat,
    linear-gradient(var(--ink-soft), var(--ink-soft)) left center / calc(50% - 14px) 1px no-repeat,
    linear-gradient(var(--ink-soft), var(--ink-soft)) right center / calc(50% - 14px) 1px no-repeat;
}

.book-body > :first-child { margin-top: 0; }
.book-body > :last-child { margin-bottom: 0; }
.book-body p { margin: 0 0 1.05em; hyphens: auto; }
.book-body h2, .book-body h3 { font-weight: normal; color: var(--ink-red); margin: 1.6em 0 0.5em; }
.book-body blockquote { margin: 1.2em 0; padding: 0 0 0 1em; border-left: 2px solid var(--parchment-edge); color: var(--ink-soft); }
.book-body hr { border: 0; height: 1px; background: var(--ink-soft); opacity: 0.5; margin: 2em auto; width: 40%; }

/* A small centred aside, e.g. the sample-entry notice: {: .note} after the paragraph */
.book-body .note { font-size: 0.95rem; color: var(--ink-soft); text-align: center; }

/* Drop cap on the first paragraph of an entry (skipping a leading note) */
.entry-body > p:first-of-type:not(.note)::first-letter,
.entry-body > p.note:first-child + p::first-letter {
  float: left;
  font-size: 3.6em;
  line-height: 0.82;
  margin: 0.06em 0.09em 0 0;
  color: var(--ink-red);
  text-shadow: 1px 1px 0 rgba(255, 244, 214, 0.5);
}

/* Screenshot plates: framed prints pasted onto the page */
.plate {
  width: fit-content;
  max-width: 100%;
  margin: 1.8rem auto;
  padding: 7px;
  background: rgba(255, 248, 228, 0.35);
  border: 1px solid var(--plate-line);
  box-shadow: 0 0 0 3px rgba(255, 246, 222, 0.25), 0 0 0 4px rgba(123, 97, 57, 0.45), 0 4px 10px rgba(60, 38, 10, 0.3);
  transform: rotate(-0.35deg);
}
.plate:nth-of-type(even) { transform: rotate(0.4deg); }
.plate img {
  display: block;
  max-height: min(75vh, 40rem);
  width: auto;
  margin-inline: auto;
  border: 1px solid var(--ink);
  filter: sepia(0.12);
}
.plate figcaption {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
  text-align: center;
  color: var(--ink-soft);
}
/* A plain markdown image in a post gets the same frame */
.book-body p > img:only-child {
  display: block;
  margin: 1.8rem auto;
  padding: 7px;
  border: 1px solid var(--plate-line);
  background: rgba(255, 248, 228, 0.35);
}

/* ---- Entry extras -------------------------------------------------------------------- */

.stat-panel { margin-top: 1.5rem; padding: 1rem 1.25rem 1.1rem; }
.stat-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 2rem;
}
.stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(154, 123, 69, 0.25);
}
.stat-list dt { color: var(--ui-text); }
.stat-list dd { margin: 0; color: var(--ui-text-hi); text-align: right; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; }
.pager-prev::before { content: "\2039\00a0"; }
.pager-next { margin-left: auto; }
.pager-next::after { content: "\00a0\203a"; }

/* ---- Footer -------------------------------------------------------------------------- */

.site-foot { margin-top: 2.5rem; padding-bottom: 16px; }
.foot-panel { padding: 0.7rem 1rem; font-size: 0.9rem; color: var(--ui-muted); }
.foot-panel p { margin: 0.2rem 0; }
.foot-panel a { color: var(--ui-text); }

/* ---- Narrow screens ------------------------------------------------------------------ */

@media (max-width: 600px) {
  body { font-size: 1.0625rem; }
  .site-title { font-size: 1.6rem; }
  .card-link { grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
  .book { font-size: 1.125rem; }
  .plate { transform: none; }
  .plate:nth-of-type(even) { transform: none; }
}
