/* ------------------------------------------------------------------
   Jan's Recipes -- styled after the original index cards.
   Palette sampled directly from the scans:
     paper #faf2e2   rule line #2a9bb0   ink #1f231f
     stove teal #2aa5b6   brass #debd45
   ------------------------------------------------------------------ */

:root {
  --paper:      #faf2e2;
  --paper-deep: #f2e7cf;
  --card:       #fdf8ec;
  --ink:        #232622;
  --ink-soft:   #5c5f57;
  --rule:       #2a9bb0;
  --rule-faint: rgba(42, 155, 176, .30);
  --teal:       #21808f;
  --brass:      #b8941f;
  --edge:       rgba(90, 74, 44, .18);

  --lh:         2.05rem;     /* the ruled-line pitch; everything is a multiple */
  --font-body:   'Lora', Georgia, 'Times New Roman', serif;
  --font-script: 'Petit Formal Script', 'Lora', cursive;
  --font-hand:   'Parisienne', 'Petit Formal Script', cursive;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 3rem;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: var(--lh);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,.55), transparent 55%),
    radial-gradient(circle at 82% 78%, rgba(184,148,31,.07), transparent 50%);
  background-attachment: fixed;
}

a { color: var(--teal); }
a:hover { color: var(--brass); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px;
  background: var(--card); padding: .5rem 1rem; z-index: 10;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---------------------------------------------------------- masthead */

.masthead {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1.25rem;
  text-align: center;
}

.masthead .eyebrow {
  margin: 0;
  font-family: var(--font-script);
  font-size: 1.35rem;
  color: var(--ink-soft);
}

.masthead h1 {
  margin: .1rem 0 .35rem;
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(3rem, 14vw, 4.5rem);
  line-height: 1.05;
  color: var(--teal);
}

.masthead .tagline {
  margin: 0;
  font-size: .95rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------ filter */

.filter {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem 1.5rem;
}

.filter input {
  width: 100%;
  padding: .7rem .95rem;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: .4rem;
  box-shadow: inset 0 1px 2px rgba(90, 74, 44, .07);
}
.filter input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.count {
  margin: .45rem 0 0;
  min-height: 1.1rem;
  font-size: .85rem;
  line-height: 1.1rem;
  color: var(--ink-soft);
}

/* ------------------------------------------------------- index grid */

.index {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.cat { margin: 0 0 2.25rem; }
.cat[hidden] { display: none; }

.cat h2 {
  margin: 0 0 .85rem;
  padding-bottom: .3rem;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--teal);
  border-bottom: 1px solid var(--rule-faint);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile[hidden] { display: none; }

.tile a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  min-height: 3.4rem;
  padding: .7rem .95rem;
  text-decoration: none;
  color: var(--ink);
  background-color: var(--card);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent 1.34rem,
    var(--rule-faint) 1.34rem, var(--rule-faint) calc(1.34rem + 1px));
  border: 1px solid var(--edge);
  border-radius: .35rem;
  box-shadow: 0 1px 2px rgba(90, 74, 44, .10);
  transition: transform .12s ease, box-shadow .12s ease;
}

.tile a:hover,
.tile a:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(90, 74, 44, .16);
  color: var(--ink);
}

.tile-name {
  font-family: var(--font-hand);
  font-size: 1.7rem;
  line-height: 1.25;
  color: var(--ink);
}

.tile-serves {
  flex: none;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.no-results {
  margin: 1rem 0 2rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* --------------------------------------------------------- recipe */

.topbar {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1.25rem .25rem;
  font-size: .9rem;
}
.topbar a { text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

.card {
  max-width: 44rem;
  margin: .5rem auto 0;
  padding: 1.5rem 1.25rem 2rem;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: .5rem;
  box-shadow: 0 2px 14px rgba(90, 74, 44, .13);
}

.card-head {
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--rule-faint);
}

.line-cookin,
.line-kitchen {
  margin: 0;
  line-height: 1.35;
}
.line-kitchen { margin-top: .35rem; }

.script {
  font-family: var(--font-script);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.hand {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  color: var(--ink);
  border-bottom: 1px solid var(--rule-faint);
}

.hand.name {
  display: block;
  margin-top: .2rem;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  line-height: 1.1;
  color: var(--teal);
  border-bottom: none;
}

.serves {
  margin: .75rem 0 0;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* Ruled sections. Every element inside is a whole multiple of --lh so the
   text keeps sitting on the rules, wrapped lines included. */

.sect {
  margin: 0 0 var(--lh);
  padding: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0, transparent calc(var(--lh) - 1px),
    var(--rule-faint) calc(var(--lh) - 1px), var(--rule-faint) var(--lh));
  background-origin: content-box;
  background-clip: content-box;
}

.sect h2 {
  margin: 0;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: 1.3rem;
  line-height: var(--lh);
  color: var(--teal);
}

.sect p,
.sect ul { margin: 0 0 var(--lh); }
.sect > *:last-child { margin-bottom: 0; }

.sect ul {
  padding-left: 0;
  list-style: none;
}

.sect li {
  margin: 0;
  line-height: var(--lh);
  padding-left: 1.4rem;
  text-indent: -1.4rem;
}

.sect li::before {
  content: "\00b7";
  display: inline-block;
  width: 1.4rem;
  text-indent: 0;
  font-weight: 600;
  color: var(--teal);
  text-align: center;
}

.sect code {
  font-family: var(--font-body);
  font-style: italic;
}

/* ----------------------------------------------------------- notes */

.notes {
  margin: calc(var(--lh) * 1.5) 0 0;
  padding: .1rem 0 .1rem 1rem;
  font-size: .93rem;
  line-height: 1.65;
  color: var(--ink-soft);
  border-left: 3px solid var(--brass);
}

.notes h2 {
  margin: 0 0 .4rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .12em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--brass);
}

.notes ul { margin: 0; padding-left: 1.1rem; }
.notes li { margin: 0 0 .4rem; }
.notes p { margin: 0 0 .4rem; }
.notes > *:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------- scans */

.scans { margin: 2.25rem 0 0; }

.scans h2 {
  margin: 0 0 .9rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .12em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.scans figure { margin: 0 0 1.25rem; }

.scans img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--edge);
  border-radius: .3rem;
  box-shadow: 0 2px 8px rgba(90, 74, 44, .18);
  background: var(--paper-deep);
}

.scans figcaption {
  margin-top: .4rem;
  font-size: .8rem;
  line-height: 1.4;
  font-style: italic;
  color: var(--ink-soft);
}

/* ----------------------------------------------------------- pager */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 44rem;
  margin: 1.5rem auto 0;
  padding: 0 1.25rem;
}

.pager a {
  flex: 1 1 0;
  padding: .7rem .9rem;
  font-size: .95rem;
  line-height: 1.35;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: .35rem;
}
.pager a:hover { border-color: var(--teal); }

.pager span {
  display: block;
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.pager .next { text-align: right; }

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

.foot {
  max-width: 44rem;
  margin: 2.5rem auto 0;
  padding: 1.25rem;
  text-align: center;
  font-size: .82rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink-soft);
}
.foot p { margin: 0; }

/* -------------------------------------------------------- wider screens */

@media (min-width: 34rem) {
  .grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 2rem 2.25rem 2.5rem; }
  .scans { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .scans h2 { grid-column: 1 / -1; margin-bottom: 0; }
  .scans figure { margin-bottom: 0; }
}

@media (min-width: 48rem) {
  body { font-size: 1.09375rem; }
  .masthead { padding-top: 3.5rem; }
}

/* --------------------------------------------------------------- print */

@media print {
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .topbar, .pager, .filter, .scans, .foot, .skip { display: none; }
  .card {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }
  .sect { background-image: none; }
  .sect, .notes { break-inside: avoid; }
  .hand, .hand.name, .cat h2, .sect h2 { color: #000; }
  a { color: #000; text-decoration: none; }
}

/* ------------------------------------------------------ motion & focus */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
