:root {
  --desk: #ece6da;
  --card: #ffffff;
  --ink: #2a2824;
  --muted: #6b665f;
  --link: #9a4420;
  --accent: #b4532a;
  --tape: rgba(255, 226, 122, 0.7);
  --dot: rgba(60, 45, 25, 0.14);
  --shadow: rgba(60, 45, 25, 0.14);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #1d1c19;
    --card: #2c2a25;
    --ink: #efebe2;
    --muted: #a7a195;
    --link: #f0a27c;
    --accent: #f0a27c;
    --tape: rgba(217, 194, 90, 0.55);
    --dot: rgba(255, 255, 255, 0.12);
    --shadow: rgba(0, 0, 0, 0.4);
  }
}
:root[data-theme="dark"] {
  --desk: #1d1c19;
  --card: #2c2a25;
  --ink: #efebe2;
  --muted: #a7a195;
  --link: #f0a27c;
  --accent: #f0a27c;
  --tape: rgba(217, 194, 90, 0.55);
  --dot: rgba(255, 255, 255, 0.12);
  --shadow: rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.7 Inter, -apple-system, "Segoe UI", sans-serif;
  background-color: var(--desk);
  background-image: radial-gradient(var(--dot) 0.6px, transparent 0.6px);
  background-size: 18px 18px;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 56px; }

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 18px;
  padding: 24px 0;
}
h1, h2, .name { font-family: Caveat, "Segoe Print", "Bradley Hand", cursive; }
h1 { font-size: 52px; line-height: 1.1; margin: 8px 0 24px; font-weight: 700; }
.name { font-size: 36px; font-weight: 700; line-height: 1.1; margin: 0; color: var(--ink); text-decoration: none; }
a.name:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 26px; }
.card {
  position: relative;
  display: block;
  background: var(--card);
  border-radius: 4px;
  padding: 22px 20px 18px;
  box-shadow: 0 4px 12px var(--shadow);
  text-decoration: none;
  color: var(--ink);
}
.card:nth-child(4n+1) { transform: rotate(0.8deg); }
.card:nth-child(4n+2) { transform: rotate(-0.9deg); }
.card:nth-child(4n+3) { transform: rotate(0.4deg); }
.card:nth-child(4n+4) { transform: rotate(-0.5deg); }
.card:hover, .card:focus-visible { transform: rotate(0) translateY(-2px); box-shadow: 0 8px 20px var(--shadow); }
.card:focus-visible, .pager a:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}
.card::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 70px;
  height: 20px;
  margin-left: -35px;
  background: var(--tape);
  transform: rotate(-2deg);
}
.card .date, .date { font-size: 13px; color: var(--muted); }
.card h2 { font-size: 30px; line-height: 1.1; margin: 4px 0 8px; font-weight: 700; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }

.sheet {
  position: relative;
  background: var(--card);
  border-radius: 4px;
  padding: 36px 40px 32px;
  max-width: 680px;
  margin: 16px auto 0;
  box-shadow: 0 6px 18px var(--shadow);
  transform: rotate(-0.3deg);
  overflow-wrap: anywhere;
}
.sheet::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 90px;
  height: 22px;
  margin-left: -45px;
  background: var(--tape);
  transform: rotate(-2deg);
}
.sheet > .date { margin: 0; }
.sheet h1 { font-size: 54px; margin: 6px 0 16px; }
.sheet p, .sheet ul, .sheet ol, .sheet blockquote, .sheet pre, .sheet table { margin: 0 0 16px; }
.sheet h2 { font-family: Inter, -apple-system, sans-serif; font-size: 22px; font-weight: 600; line-height: 1.25; margin: 28px 0 10px; }
.sheet blockquote { border-left: 3px solid var(--link); padding-left: 14px; color: var(--muted); }
.sheet code { font-size: 0.9em; background: var(--desk); padding: 1px 4px; border-radius: 3px; }
.sheet pre { background: var(--desk); padding: 12px 14px; border-radius: 4px; overflow-x: auto; font-size: 14px; line-height: 1.5; }
.sheet pre code { background: none; padding: 0; }
.sheet img { max-width: 100%; height: auto; display: block; }
.sheet table { border-collapse: collapse; max-width: 100%; display: block; overflow-x: auto; }
.sheet th, .sheet td { border: 1px solid var(--muted); padding: 4px 8px; text-align: left; }
.sheet a { color: var(--link); }

.pager { margin-top: 28px; display: flex; justify-content: space-between; gap: 16px; font-size: 15px; }
.pager a { color: var(--link); text-decoration: none; font-weight: 600; }

@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform 0.15s ease, box-shadow 0.15s ease; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 16px 48px; }
  .name { font-size: 30px; }
  .sheet { padding: 28px 22px; }
  .sheet h1 { font-size: 42px; }
}
