/* Shelfmark — the landing page as a library catalog card.
   Typewritten fields (Courier Prime), one red rule, a stamp, a punch hole.
   Source Serif 4 carries the brand voice; DM Sans only for tiny chrome. */

:root {
  --desk: #ece4d4;
  --card: #fdfaf2;
  --card-edge: #d8cfbc;
  --ink: #2c2c2c;
  --ink-typed: #3a3733;
  --ink-soft: #6f6960;
  --ink-faint: #a39c91;
  --rule-red: #c0594b;
  --rule-blue: #b9c4cc;
  --sage: #7b8c6a;
  --rust: #b87a5e;
  --gold: #c99a4f;
  --stamp: #b6473a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: "Courier Prime", monospace;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* paper grain over the desk */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.4 0 0 0 0 0.37 0 0 0 0 0.32 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.desk {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 20px 72px;
}

/* ---------- the main catalog card ---------- */

.catalog-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 6px;
  box-shadow:
    0 1px 0 #fff inset,
    0 12px 30px rgba(60, 50, 30, 0.18),
    0 2px 6px rgba(60, 50, 30, 0.12);
  padding: 34px 40px 64px;
  overflow: hidden;
}

/* the classic red rule */
.catalog-card .red-rule {
  border: 0;
  border-top: 1.5px solid var(--rule-red);
  margin: 18px 0 22px;
}

/* two clear zones: typed fields left, plate right */
.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 44px;
  align-items: start;
}

/* ruled lines live ONLY behind the typed fields, aligned to their 30px grid.
   With 15px type in a 30px line box the baseline sits ~19px down, so the
   rule goes at 21px — just under the text, like a notebook line. */
.entry-fields {
  font-size: 15px;
  line-height: 30px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 21px,
    color-mix(in srgb, var(--rule-blue) 45%, transparent) 21px,
    color-mix(in srgb, var(--rule-blue) 45%, transparent) 22px,
    transparent 22px,
    transparent 30px
  );
}

/* punch hole at the bottom, like the rod hole in a drawer card */
.catalog-card::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 22px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--desk);
  box-shadow: inset 0 1px 3px rgba(60, 50, 30, 0.45), 0 1px 0 #fff;
}

/* card header row: call number + small nav */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.call-no {
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  white-space: pre-line;
}

.card-head nav {
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
}
.card-head nav a {
  color: var(--ink-soft);
  text-decoration: none;
  margin-left: 16px;
  border-bottom: 1px solid var(--card-edge);
}
.card-head nav a:hover,
.card-head nav a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--rule-red);
}

/* main entry */
.entry-title {
  font-family: "Source Serif 4", serif;
  font-weight: 700;
  font-size: clamp(34px, 5.4vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.4px;
  margin: 4px 0 2px;
}

.entry-sub {
  font-size: 16.5px;
  color: var(--ink-typed);
  margin: 6px 0 0;
  max-width: 56ch;
}

.field {
  margin: 0 0 30px;
  color: var(--ink-typed);
}
.field:last-child {
  margin-bottom: 0;
}

.field .tag {
  color: var(--ink-soft);
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 11.5px;
  line-height: 30px;
  display: block;
}

/* card footer: one zone, one grammar — divider, then aligned label rows */
.card-foot {
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px dashed var(--card-edge);
  display: grid;
  gap: 12px;
}

.foot-field {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 0 12px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.foot-tag {
  font-weight: 700;
  letter-spacing: 1.5px;
  font-size: 11.5px;
  line-height: 23px; /* optically aligns with the 13.5px content beside it */
  color: var(--ink-faint);
}

/* numbers drawn as content, not hanging markers, so every footer row
   starts on the same left edge */
.foot-field ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: tracing;
}
.foot-field li {
  counter-increment: tracing;
}
.foot-field li::before {
  content: counter(tracing) ". ";
  font-weight: 700;
}
.foot-field p {
  margin: 0;
}

/* the rubber stamp */
.stamp {
  position: absolute;
  top: 96px;
  right: 36px;
  transform: rotate(7deg);
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 2.5px;
  color: var(--stamp);
  border: 2.5px solid var(--stamp);
  border-radius: 4px;
  padding: 7px 13px;
  opacity: 0.82;
  text-transform: uppercase;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='60'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0.9 0.25 0'/%3E%3C/filter%3E%3Crect width='120' height='60' filter='url(%23r)'/%3E%3C/svg%3E");
  mask-size: cover;
}

/* the plate (hero illustration) */
.plate {
  margin: 4px 0 0;
  text-align: center;
}
.plate img {
  width: 100%;
  height: auto;
  display: block;
}
.plate figcaption {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 8px;
  letter-spacing: 0.5px;
}

/* pending store entries: same register as the other footnotes */
.store-slot {
  color: var(--ink-soft);
}
/* live state: swap the span for <a class="store-slot">App Store ↗</a> */
a.store-slot {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--sage);
}
a.store-slot:hover,
a.store-slot:focus-visible {
  border-bottom-color: var(--rule-red);
}

/* ---------- subject cards (features) ---------- */

.subject-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 34px;
}

.subject-card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 5px;
  box-shadow: 0 5px 16px rgba(60, 50, 30, 0.12);
  padding: 18px 20px 22px;
  font-size: 14.5px;
  color: var(--ink-typed);
}
.subject-card:nth-child(1) { transform: rotate(-0.8deg); }
.subject-card:nth-child(2) { transform: rotate(0.4deg); }
.subject-card:nth-child(3) { transform: rotate(-0.3deg); }

.subject-card .tag {
  color: var(--ink-faint);
  letter-spacing: 1.5px;
  font-size: 12px;
  display: block;
}

.subject-card h2 {
  font-family: "Source Serif 4", serif;
  font-size: 19px;
  font-weight: 600;
  margin: 4px 0 8px;
  border-bottom: 1.5px solid var(--rule-red);
  padding-bottom: 6px;
}
.subject-card:nth-child(2) h2 { border-bottom-color: var(--gold); }
.subject-card:nth-child(3) h2 { border-bottom-color: var(--rust); }

.subject-card p { margin: 0; }

/* ---------- maker's note ---------- */

.makers-note {
  margin: 40px auto 0;
  max-width: 56ch;
  font-size: 15px;
  color: var(--ink-typed);
}
.makers-note .tag {
  color: var(--ink-faint);
  letter-spacing: 1.5px;
  font-size: 12.5px;
  display: block;
  margin-bottom: 6px;
}
.makers-note .sig {
  font-family: "Source Serif 4", serif;
  font-style: italic;
  margin-top: 10px;
}

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

footer.site {
  margin-top: 44px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}
footer.site a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(60, 50, 30, 0.25);
}
footer.site a:hover,
footer.site a:focus-visible { color: var(--ink); border-bottom-color: var(--rule-red); }
footer.site .colophon {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- privacy / prose pages ---------- */

main.prose {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 6px;
  box-shadow: 0 12px 30px rgba(60, 50, 30, 0.16);
  max-width: 760px;
  margin: 0 auto;
  padding: 36px 44px 56px;
}

main.prose .file-label {
  letter-spacing: 2px;
  font-size: 12.5px;
  color: var(--ink-faint);
}

main.prose h1 {
  font-family: "Source Serif 4", serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 1.15;
  margin: 6px 0 2px;
}

main.prose .updated {
  font-size: 13.5px;
  color: var(--ink-faint);
  margin: 0 0 8px;
}

main.prose .red-rule {
  border: 0;
  border-top: 1.5px solid var(--rule-red);
  margin: 14px 0 24px;
}

main.prose h2 {
  font-family: "Source Serif 4", serif;
  font-weight: 600;
  font-size: 20px;
  margin: 34px 0 10px;
}

main.prose p,
main.prose li {
  font-size: 15px;
  color: var(--ink-typed);
}
main.prose li { margin-bottom: 8px; }

main.prose a {
  color: var(--rust);
  text-decoration: none;
  border-bottom: 1px solid var(--card-edge);
}
main.prose a:hover,
main.prose a:focus-visible { border-bottom-color: var(--rust); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .catalog-card {
    animation: settle 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }
  .subject-cards .subject-card {
    animation: settle 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }
  .subject-card:nth-child(1) { animation-delay: 0.10s; }
  .subject-card:nth-child(2) { animation-delay: 0.18s; }
  .subject-card:nth-child(3) { animation-delay: 0.26s; }

  @keyframes settle {
    from { opacity: 0; transform: translateY(10px); }
  }
  /* preserve the hand-placed rotations after animating */
  .subject-card:nth-child(1) { --rot: -0.8deg; }
  .subject-card:nth-child(2) { --rot: 0.4deg; }
  .subject-card:nth-child(3) { --rot: -0.3deg; }
  .subject-cards .subject-card { transform: rotate(var(--rot)); }
}

/* ---------- small screens ---------- */

@media (max-width: 680px) {
  .desk { padding: 24px 12px 56px; }
  .catalog-card { padding: 24px 22px 56px; }
  .stamp { position: static; display: inline-block; margin: 14px 0 0; transform: rotate(-3deg); }
  .entry-grid { grid-template-columns: 1fr; gap: 26px; }
  .plate { width: 78%; margin: 0 auto; order: -1; }
  .subject-cards { grid-template-columns: 1fr; }
}
