/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }

/* Book-ish dark theme */
:root{
  --bg-deep: #201a14;         /* darker page background */
  --bg-grad: #2a231c;
  --paper:   #fff8ee;         /* card/paper */
  --ink:     #2b241d;         /* main text */
  --muted:   #6e5d4f;         /* labels */
  --edge:    #b89b7a;         /* borders */
  --edge-d:  #8e7357;         /* focus/hover */

  --accent1: #d7b892;         /* button gradient */
  --accent2: #caa77b;

  /* Consistent card size */
  --card-w: clamp(300px, 92vw, 560px);
  --card-h: clamp(360px, 70vh, 480px);

  --radius: 14px;
  --shadow: 0 16px 44px rgba(0,0,0,0.25);
}

html, body { height: 100%; }
body{
  font-family: "Iowan Old Style", Georgia, serif;
  color: var(--ink);
  background:
    radial-gradient(900px 700px at 12% -10%, var(--bg-grad) 0%, var(--bg-deep) 60%, #17120e 100%);
  display: grid;
  place-items: center;
  padding: 20px;
}

/* subtle grain (no external asset) */
body::before{
  content:"";
  position: fixed; inset: 0; pointer-events: none;
  opacity: .08;
  background-image:
    radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,.06) 1px, transparent 1px);
  background-size: 6px 6px, 8px 8px;
  background-position: 0 0, 2px 2px;
}

main{
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
}

/* Card */
.recipe-card{
  width: var(--card-w);
  height: var(--card-h);                /* fixed height */
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: grid;
  grid-template-rows: auto auto 1fr;    /* title, name, details (scrolls) */
  gap: 8px;
  cursor: pointer;
  transition: transform .05s ease, filter .15s ease, box-shadow .15s ease;
}
.recipe-card:hover{ filter: brightness(1.01); }
.recipe-card:active{ transform: translateY(1px); }
.recipe-card:focus-visible{
  outline: 2px solid var(--edge-d);
  outline-offset: 3px;
}

/* Titles */
.book-title{
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  border-bottom: 1px solid var(--edge);
  padding-bottom: 6px;
}
.recipe-name{
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

/* Details */
.recipe-details{
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 14px;
  overflow: auto;                       /* scroll inside if long */
  padding-right: 6px;
}
.recipe-details dt{
  color: var(--muted);
  font-weight: 700;
  font-size: .9rem;
}
.recipe-details dd{
  margin: 0;
  font-size: .98rem;
  line-height: 1.45;
}

/* inner scrollbar */
.recipe-details::-webkit-scrollbar{ width: 8px; }
.recipe-details::-webkit-scrollbar-thumb{
  background: rgba(142,115,87,.45);
  border-radius: 8px;
}
.recipe-details{ scrollbar-width: thin; scrollbar-color: rgba(142,115,87,.45) transparent; }

/* Button + instructions */
.new-recipe-btn{
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  color: #3b2f23;
  background: linear-gradient(180deg, var(--accent1), var(--accent2));
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  transition: transform .05s ease, filter .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.new-recipe-btn:hover{ filter: brightness(1.03); border-color: var(--edge-d); }
.new-recipe-btn:active{ transform: translateY(1px); }

.instructions{
  color: #eaddcf;
  opacity: .9;
  font-size: .85rem;
  text-align: center;
}

/* Noscript fallback block */
.noscript-recipe{
  background: var(--paper);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
  width: var(--card-w);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .recipe-card, .new-recipe-btn{ transition: none; }
}
