@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');

:root {
  color-scheme: light;
  --ink: #292722;
  --muted: #77736a;
  --paper: #f5f1e8;
  --line: #ded8cb;
  --accent: #a64b3c;
  --board: #c7b99f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
}
.site-header, main, .site-footer {
  width: min(1160px, calc(100% - 40px));
  margin-inline: auto;
}
.site-header {
  min-height: 260px;
  padding: 58px 0 42px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font: 500 11px/1.4 "DM Mono", monospace;
  letter-spacing: .12em;
}
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 500;
  letter-spacing: -.035em;
}
h1 { font-size: clamp(42px, 7vw, 76px); margin: 0; }
h2 { font-size: clamp(30px, 4vw, 43px); margin: 0; }
.intro { color: var(--muted); font-size: 16px; margin: 14px 0 0; }
.top-link, .text-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid #9b9385;
  padding-bottom: 5px;
  font-size: 13px;
  white-space: nowrap;
}
.top-link:hover, .text-link:hover { color: var(--accent); border-color: var(--accent); }

.editor-section, .pinboard-section {
  padding: 34px 0 64px;
  border-top: 1px solid var(--line);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
}
.section-description { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.editor-frame-wrap {
  height: min(76vh, 760px);
  min-height: 480px;
  background: #fff;
  border: 1px solid #d6d0c4;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 35px #30291c12;
}
.twine-frame { display: block; width: 100%; height: 100%; border: 0; background: white; }
.editor-note { margin: 11px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.story-count {
  color: var(--muted);
  font: 11px "DM Mono", monospace;
  white-space: nowrap;
}
.pinboard {
  min-height: 310px;
  padding: clamp(22px, 4vw, 48px);
  border: 1px solid #b7a98f;
  border-radius: 8px;
  background-color: var(--board);
  background-image:
    radial-gradient(#6e604b22 .7px, transparent .7px),
    linear-gradient(135deg, #ffffff15, transparent 45%, #54432b12);
  background-size: 7px 7px, auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 215px), 1fr));
  align-items: start;
  gap: clamp(22px, 3.4vw, 42px);
  box-shadow: inset 0 2px 8px #4b3a2518, 0 12px 28px #30291c12;
}
.pin-note {
  --note: #fff4cf;
  position: relative;
  display: block;
  min-height: 300px;
  padding: 14px 14px 17px;
  color: #302d27;
  text-decoration: none;
  background: var(--note);
  box-shadow: 2px 7px 13px #392d1c35;
  transform: rotate(var(--tilt, -1deg));
  transition: transform .2s ease, box-shadow .2s ease;
}
.pin-note:nth-child(3n + 2) { --tilt: 1.4deg; }
.pin-note:nth-child(3n) { --tilt: -1.8deg; }
.pin-note:hover, .pin-note:focus-visible {
  z-index: 2;
  transform: translateY(-8px) rotate(0deg);
  box-shadow: 4px 16px 24px #392d1c42;
  outline: 2px solid #fff9;
  outline-offset: 3px;
}
.pin {
  position: absolute;
  z-index: 3;
  top: -9px;
  left: calc(50% - 8px);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f8b2a2, #a83f32 60%, #71291f);
  box-shadow: 1px 2px 3px #38251f77;
}
.cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--cover, #8b8877);
  color: #fff;
  position: relative;
  isolation: isolate;
}
.cover::before, .cover::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
}
.cover::before {
  background: linear-gradient(145deg, #ffffff40, transparent 45%, #00000040);
}
.cover::after {
  border: 1px solid #ffffff55;
  inset: 9px;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-title {
  max-width: 85%;
  padding: 12px;
  text-align: center;
  font: 600 clamp(18px, 2vw, 25px)/1.08 Fraunces, Georgia, serif;
  text-shadow: 0 2px 9px #0008;
}
.note-meta { padding: 13px 2px 0; }
.note-title { margin: 0; font: 600 19px/1.2 Fraunces, Georgia, serif; }
.note-description { margin: 7px 0 11px; color: #625b4f; font-size: 12px; line-height: 1.5; }
.note-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.note-tag {
  padding: 4px 6px;
  border: 1px solid #766b553d;
  border-radius: 2px;
  color: #675e50;
  font: 9px "DM Mono", monospace;
  text-transform: uppercase;
}
.loading, .empty { color: #554a3b; grid-column: 1 / -1; text-align: center; padding: 45px 10px; }
.board-footer { color: #6f604b; text-align: center; font: 10px "DM Mono", monospace; letter-spacing: .08em; margin: 16px 0 0; }
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 34px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font: 10px "DM Mono", monospace;
}
@media (max-width: 650px) {
  .site-header { min-height: 0; padding: 42px 0 30px; display: block; }
  .top-link { display: inline-block; margin-top: 20px; }
  .section-heading { align-items: start; flex-direction: column; }
  .editor-frame-wrap { height: 68vh; min-height: 420px; }
  .pinboard { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 22px 16px; gap: 22px 15px; }
  .pin-note { min-height: 250px; padding: 10px; }
  .note-title { font-size: 16px; }
  .site-footer { flex-direction: column; }
}
@media (max-width: 390px) {
  .pinboard { grid-template-columns: 1fr; padding: 25px; }
  .pin-note { min-height: 290px; }
}
