/* Figurary: a reading room after hours. Lamp-green walls, a walnut card catalog, typed index cards. */
@font-face { font-family: 'IM Fell English'; src: url('/fonts/im-fell-english-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IM Fell English'; font-style: italic; src: url('/fonts/im-fell-english-latin-400-italic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Spectral'; src: url('/fonts/spectral-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Spectral'; font-style: italic; src: url('/fonts/spectral-latin-400-italic.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Spectral'; font-weight: 600; src: url('/fonts/spectral-latin-600-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('/fonts/courier-prime-latin-400-normal.woff2') format('woff2'); font-display: swap; }

:root {
  --room: #0c302a;        /* the walls: the green of the logo's ground */
  --room-2: #134a40;
  --lamp: #e9d9a6;        /* text under a reading lamp */
  --lamp-dim: #b9b089;
  --brass: #c9973a;
  --brass-hi: #ecc56a;
  --walnut: #4a2c17;
  --walnut-2: #6b4224;
  --stock: #fbf7ea;       /* index card stock */
  --ink: #23201b;
  --ink-soft: #5d574c;
  --red-rule: #a8323e;    /* the red line at the top of a catalog card */
  --blue-rule: #c9d8e8;
  --display: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --text: 'Spectral', Georgia, serif;
  --typed: 'Courier Prime', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 70% 55% at 75% 18%, rgba(236, 197, 106, .13), transparent 70%),
    linear-gradient(180deg, var(--room) 0%, #0a2924 100%);
  background-color: var(--room);
  color: var(--lamp);
  font: 400 1.125rem/1.65 var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--brass-hi); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: #fff1c7; }
:focus-visible { outline: 3px solid var(--brass-hi); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--stock); color: var(--ink); padding: .5rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header */
.top {
  max-width: 1180px; margin: 0 auto; padding: 1.4rem clamp(1rem, 4vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--lamp); text-decoration: none; font: 400 1.7rem/1 var(--display); letter-spacing: .01em; }
.brand img { border-radius: 10px; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.top nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.8rem); }
.top nav a { color: var(--lamp-dim); text-decoration: none; font-size: 1rem; }
.top nav a:hover { color: var(--lamp); text-decoration: underline; }

main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }

/* ---------- hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center; padding: clamp(2rem, 6vw, 5rem) 0 clamp(3rem, 7vw, 6rem);
}
h1 {
  font: 400 clamp(3.6rem, 9vw, 7.4rem)/.92 var(--display); margin: 0 0 1.6rem; letter-spacing: -.01em;
  color: var(--lamp); text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.6; max-width: 34ch; margin: 0 0 1rem; }
.lede.quiet { color: var(--lamp-dim); font-style: italic; }

/* ---------- the catalog drawer: the one memorable thing on the page */
.cabinet { position: relative; padding-top: 3.5rem; scroll-margin-top: 1rem; }
.drawer { position: relative; }
.drawer-well {
  position: relative; height: 3.2rem; margin: 0 6% -1px;
  background: linear-gradient(180deg, #1d120a 0%, #2c1a0d 100%);
  border-radius: 6px 6px 0 0; display: flex; justify-content: space-around; align-items: flex-end; padding: 0 12%;
  box-shadow: inset 0 10px 18px rgba(0,0,0,.55);
}
.divider { width: 30%; height: 2.4rem; background: #d8cfb6; border-radius: 4px 4px 0 0; opacity: .5; }
.drawer-front {
  position: relative; z-index: 2; order: 3;
  background:
    repeating-linear-gradient(92deg, rgba(255,255,255,.035) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, var(--walnut-2), var(--walnut));
  border-radius: 8px; height: 7rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .7rem;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 -1px 0 rgba(0,0,0,.4) inset, 0 24px 40px rgba(0,0,0,.45);
}
.drawer { display: flex; flex-direction: column; }
.drawer-well { order: 2; }
.plate {
  display: grid; justify-items: center; min-width: 7.5rem; padding: .35rem .9rem;
  background: linear-gradient(180deg, var(--brass-hi), var(--brass) 55%, #9c7226);
  border-radius: 3px; color: #2a1c08; font: 400 .95rem/1.15 var(--typed);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 2px 3px rgba(0,0,0,.5);
}
.pull {
  width: 4.6rem; height: 1.5rem; border-radius: 0 0 2.4rem 2.4rem; border: 4px solid var(--brass); border-top: 0;
  box-shadow: 0 3px 3px rgba(0,0,0,.45);
}

.card {
  order: 1; position: relative; z-index: 1; margin: 0 9% -2.2rem;
  background:
    linear-gradient(var(--red-rule), var(--red-rule)) 0 4.35rem / 100% 2px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 1.55rem, var(--blue-rule) 1.55rem calc(1.55rem + 1px)) 0 4.4rem / 100% calc(100% - 4.4rem) no-repeat,
    var(--stock);
  color: var(--ink); font: 400 .98rem/1.55rem var(--typed);
  border-radius: 3px; padding: 1.1rem 1.4rem 3.6rem;
  box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 14px 30px rgba(0,0,0,.35);
}
.card::after { /* the rod hole every catalog card has at the bottom */
  content: ''; position: absolute; left: 50%; bottom: .9rem; width: .85rem; height: .85rem; margin-left: -.42rem;
  border-radius: 50%; background: #3a2412; box-shadow: inset 0 1px 2px rgba(0,0,0,.6);
}
.card-head { display: grid; grid-template-columns: 4.4rem 1fr; align-items: start; min-height: 3.2rem; }
.call { font: 400 .95rem/1.25 var(--typed); color: var(--ink-soft); }
.card h2, .blank-card h2 { font: 400 1.18rem/1.35 var(--typed); margin: .1rem 0 0; color: var(--ink); }
.card-body { padding-left: 4.4rem; padding-top: .45rem; }
.card-body p { margin: 0 0 0; }
.card-body p + p { margin-top: 0; }
.subjects { color: var(--ink-soft); }

.try { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .5rem; margin-top: 1.55rem; }
.try select {
  font: inherit; color: var(--ink); background: transparent; border: 0; border-bottom: 2px dotted var(--red-rule);
  padding: 0 1.1rem 0 .1rem; appearance: none; cursor: pointer; border-radius: 0;
  background-image: linear-gradient(45deg, transparent 50%, var(--red-rule) 50%), linear-gradient(135deg, var(--red-rule) 50%, transparent 50%);
  background-position: calc(100% - .55rem) 55%, calc(100% - .2rem) 55%; background-size: .35rem .35rem; background-repeat: no-repeat;
}
.try output { flex-basis: 100%; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.try output b { font: 400 2.1rem/3.1rem var(--display); color: var(--red-rule); }
.try output small { font-size: .88rem; color: var(--ink-soft); }

.borrow {
  display: inline-block; margin: 1.3rem 0 0 4.4rem; padding: .5rem 1.1rem;
  background: var(--room); color: var(--lamp); border-radius: 3px; text-decoration: none;
  font: 400 1rem/1.4 var(--typed); box-shadow: 0 2px 0 #061a17;
}
.borrow:hover { background: var(--room-2); color: #fff; }
.borrow.inline { margin-left: 0; }
.stamp {
  position: absolute; right: 1.2rem; bottom: 3.3rem; transform: rotate(-8deg);
  border: 2px solid rgba(168, 50, 62, .75); color: rgba(168, 50, 62, .8); border-radius: 4px; padding: .1rem .55rem;
  font: 400 .95rem/1.3 var(--display); font-style: italic; letter-spacing: .02em;
}

/* One orchestrated moment: the drawer slides out and the card lifts. */
@media (prefers-reduced-motion: no-preference) {
  .drawer-front { animation: pull 900ms cubic-bezier(.2,.7,.2,1) 200ms both; }
  .card { animation: lift 900ms cubic-bezier(.2,.8,.2,1) 650ms both; }
  @keyframes pull { from { transform: translateY(-1.6rem) scale(.97); } to { transform: none; } }
  @keyframes lift { from { transform: translateY(6.5rem); opacity: .0; } 30% { opacity: 1; } to { transform: none; } }
}

/* ---------- house rules */
.rules { padding: clamp(2.5rem, 6vw, 4.5rem) 0; border-top: 1px solid rgba(201, 151, 58, .35); }
.rules > h2, .write h2.section { font: 400 clamp(2rem, 4vw, 2.8rem)/1.1 var(--display); margin: 0 0 2rem; color: var(--lamp); }
.rule-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.5rem, 4vw, 3.5rem); }
.rule-list h3 { font: 400 1.45rem/1.25 var(--display); margin: 0 0 .6rem; color: var(--brass-hi); }
.rule-list p { margin: 0; color: var(--lamp-dim); max-width: 36ch; }

/* ---------- the blank card */
.write { padding: 1rem 0 clamp(3rem, 7vw, 5.5rem); display: flex; justify-content: center; }
.blank-card {
  width: min(100%, 38rem); transform: rotate(-1.2deg);
  background:
    linear-gradient(var(--red-rule), var(--red-rule)) 0 4.35rem / 100% 2px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 1.55rem, var(--blue-rule) 1.55rem calc(1.55rem + 1px)) 0 4.4rem / 100% calc(100% - 4.4rem) no-repeat,
    var(--stock);
  color: var(--ink); font: 400 .98rem/1.55rem var(--typed);
  border-radius: 3px; padding: 1.1rem 1.4rem 1.6rem; box-shadow: 0 14px 30px rgba(0,0,0,.35);
}
.blank-card .card-body p + p { margin-top: 1.55rem; }

/* ---------- colophon */
.colophon {
  max-width: 1180px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
  border-top: 1px solid rgba(201, 151, 58, .35); color: var(--lamp-dim); font-size: .95rem;
}
.colophon p { margin: 0 0 .4rem; max-width: 70ch; }

/* ---------- small screens */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .rule-list { grid-template-columns: 1fr; }
  .card { margin: 0 3% -2.2rem; }
}
@media (max-width: 480px) {
  .card, .blank-card { padding-left: 1rem; padding-right: 1rem; }
  .card-head { grid-template-columns: 3.6rem 1fr; }
  .card-body { padding-left: 0; }
  .borrow { margin-left: 0; }
  .stamp { bottom: 3.75rem; right: .7rem; font-size: .8rem; }
  .cabinet { padding-top: 1rem; }
}
