/* Recipe Drawer — a kitchen made of CSS.
   Sections: base · shelf (header) · counter · cabinet & drawers ·
   index cards · notebook paper · corkboard (photos & notes) · forms */

:root {
  --wood-light: #c98f5a;
  --wood: #a86a3d;
  --wood-dark: #6e4223;
  --brass: #d8b45a;
  --paper: #fffdf5;
  --rule: #b9d3ee;
  --margin: #f08a8a;
  --ink: #2f2a25;
  --sticky: #fff27a;
  --tomato: #d9534f;
  --hand: "Patrick Hand", "Klee One", "Comic Sans MS", cursive;
  --line: 1.9rem; /* notebook line height */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font: 1.15rem/1.5 var(--hand);
  /* subway-tile backsplash */
  background-color: #f4efe6;
  background-image:
    linear-gradient(#e2d9ca 2px, transparent 2px),
    linear-gradient(90deg, #e2d9ca 2px, transparent 2px);
  background-size: 80px 40px;
}

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
h1, h2 { font-weight: 600; line-height: 1.2; }
a { color: #2a5d9f; }

.btn {
  display: inline-block;
  padding: .35rem 1rem;
  border: 2px solid var(--ink);
  border-radius: .6rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.danger { background: #ffe3e0; color: #8c1d18; }

/* ---------- shelf (site header) ---------- */

.shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1.5rem;
  background: linear-gradient(var(--wood-light), var(--wood));
  border-bottom: 8px solid var(--wood-dark);
  box-shadow: 0 6px 10px rgb(0 0 0 / .2);
}
.brand {
  font-size: 1.6rem;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  padding: .1rem .9rem;
  transform: rotate(-2deg);
  box-shadow: 2px 2px 4px rgb(0 0 0 / .3);
}
.shelf nav { display: flex; gap: 1rem; align-items: center; }
.lang-switch a {
  color: #fff;
  margin-left: .5rem;
  text-decoration: none;
  opacity: .75;
}
.lang-switch a[aria-current] { opacity: 1; text-decoration: underline wavy; }

.site-footer { text-align: center; padding: 2rem; opacity: .6; }

/* ---------- counter (search) ---------- */

.counter {
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: .5rem;
  /* a speckled stone countertop */
  background:
    radial-gradient(circle at 20% 30%, rgb(0 0 0 / .05) 1px, transparent 2px) 0 0 / 14px 14px,
    radial-gradient(circle at 70% 60%, rgb(0 0 0 / .06) 1px, transparent 2px) 0 0 / 22px 22px,
    #fbfaf7;
  border-bottom: 14px solid #cfc6b8;
  box-shadow: 0 8px 14px rgb(0 0 0 / .15);
}
.counter h1 { margin: 0; font-size: 2.2rem; }
.counter p { margin: .2rem 0 1rem; }
.search {
  width: 100%;
  padding: .6rem 1rem;
  font: inherit;
  border: 2px dashed var(--wood);
  border-radius: 2rem;
  background: #fff;
}
#search-results:not(:empty) { margin-top: 1rem; }

/* ---------- cabinet & drawers ---------- */

.cabinet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  padding: 1rem;
  background: var(--wood-dark);
  border-radius: .6rem;
  box-shadow: inset 0 0 0 6px #5a361c, 0 10px 20px rgb(0 0 0 / .3);
}
.drawer[open] { grid-column: 1 / -1; } /* an open drawer gets the full width */

.drawer-front {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 110px;
  list-style: none; /* hide the default <details> triangle */
  cursor: pointer;
  border-radius: .4rem;
  /* wood grain: soft stripes over a warm gradient */
  background:
    repeating-linear-gradient(92deg, rgb(255 255 255 / .05) 0 3px, transparent 3px 11px),
    repeating-linear-gradient(88deg, rgb(0 0 0 / .05) 0 2px, transparent 2px 17px),
    linear-gradient(var(--wood-light), var(--wood));
  box-shadow: inset 0 0 0 4px rgb(0 0 0 / .12), inset 0 -6px 0 rgb(0 0 0 / .15);
  transition: transform .2s ease, box-shadow .2s ease;
}
.drawer-front::-webkit-details-marker { display: none; }
.drawer-front:hover { transform: translateY(-3px) scale(1.01); }
.drawer[open] .drawer-front {
  transform: translateY(4px) scale(1.02);
  box-shadow: inset 0 0 0 4px rgb(0 0 0 / .12), 0 10px 18px rgb(0 0 0 / .4);
}

.label-plate {
  position: absolute;
  top: 14px;
  padding: .1rem 1rem;
  background: var(--paper);
  border: 3px solid var(--brass);
  border-radius: 3px;
  box-shadow: 0 1px 2px rgb(0 0 0 / .4);
}
.knob {
  width: 34px;
  height: 34px;
  margin-top: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d0, var(--brass) 45%, #8a6a20);
  box-shadow: 0 4px 5px rgb(0 0 0 / .45);
}
.count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  min-width: 1.8rem;
  text-align: center;
  color: #fff;
  background: rgb(0 0 0 / .3);
  border-radius: 1rem;
  font-size: .95rem;
}

.drawer-inside {
  margin-top: .5rem;
  padding: 1rem;
  border-radius: 0 0 .4rem .4rem;
  background: linear-gradient(#3d2512, #55331a);
  box-shadow: inset 0 10px 12px rgb(0 0 0 / .5);
  animation: slide-out .3s ease-out;
}
.drawer-inside:empty { min-height: 4rem; }
.drawer-inside .empty { color: #f3e3cf; }
@keyframes slide-out {
  from { opacity: 0; transform: translateY(-14px); }
}

/* ---------- index cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.index-card {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .6rem .8rem 1rem;
  color: var(--ink);
  text-decoration: none;
  /* a red top rule and blue lines, like a real index card */
  background:
    linear-gradient(var(--margin), var(--margin)) 0 2.2rem / 100% 2px no-repeat,
    repeating-linear-gradient(transparent 0 calc(1.5rem - 1px), var(--rule) calc(1.5rem - 1px) 1.5rem) 0 2.5rem,
    #fff;
  box-shadow: 2px 3px 6px rgb(0 0 0 / .3);
  transform: rotate(-1deg);
  transition: transform .15s;
}
.index-card:nth-child(even) { transform: rotate(1.2deg); }
.index-card:hover { transform: rotate(0) translateY(-4px) scale(1.03); z-index: 1; }
.index-card img { width: 100%; height: 110px; object-fit: cover; order: 3; }
.index-card strong { font-size: 1.25rem; }
.card-drawer { font-size: .85rem; opacity: .6; }
.empty { margin: 0; opacity: .8; }

/* ---------- notebook paper ---------- */

.back { text-decoration: none; }

.recipe-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 800px) {
  .recipe-layout { grid-template-columns: 1fr; }
}

.notebook {
  position: relative;
  padding: var(--line) 2rem var(--line) 5rem;
  line-height: var(--line);
  background:
    /* three punched holes */
    radial-gradient(circle, #f4efe6 9px, transparent 10px) 1.1rem 3rem / 26px 34% repeat-y,
    /* red margin */
    linear-gradient(90deg, transparent 3.8rem, var(--margin) 3.8rem, var(--margin) calc(3.8rem + 2px), transparent 0),
    /* blue lines */
    repeating-linear-gradient(transparent 0 calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px) var(--line)),
    var(--paper);
  box-shadow: 0 2px 4px rgb(0 0 0 / .15), 0 12px 24px rgb(0 0 0 / .12);
}
.notebook h1 { margin: 0; font-size: 2.3rem; line-height: calc(var(--line) * 2); }
.notebook .summary { margin: 0 0 var(--line); font-style: italic; }
.notebook .rich h1 { font-size: 1.5rem; line-height: var(--line); margin: var(--line) 0 0; }
.notebook .rich ul, .notebook .rich ol { margin: 0; }
.notebook .rich blockquote { margin: 0 0 0 1rem; padding-left: 1rem; border-left: 3px solid var(--brass); }
.notebook .rich pre { margin: 0; white-space: pre-wrap; font-family: ui-monospace, monospace; }

.tag {
  display: inline-block;
  padding: 0 .8rem;
  background: var(--sticky);
  transform: rotate(-3deg);
  box-shadow: 1px 1px 2px rgb(0 0 0 / .2);
}

.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-top: calc(var(--line) * 2);
}
.recipe-actions small { flex: 1; opacity: .6; }

/* cook mode (Stimulus checklist controller) */
.cook-tip { margin: 0; font-size: .95rem; color: var(--wood); }
.link-button { margin-left: .5rem; padding: 0; border: none; background: none; font: inherit; color: #2a5d9f; text-decoration: underline; cursor: pointer; }
.notebook [data-checklist-target="body"] li { cursor: pointer; }
.notebook li.checked { text-decoration: line-through 2px var(--margin); opacity: .55; }

/* ---------- corkboard: photos & sticky notes ---------- */

.corkboard {
  padding: 1rem;
  border: 10px solid var(--wood);
  border-radius: .3rem;
  background:
    radial-gradient(circle at 30% 40%, rgb(80 40 10 / .25) 1px, transparent 2px) 0 0 / 9px 9px,
    radial-gradient(circle at 60% 70%, rgb(255 255 255 / .15) 1px, transparent 2px) 0 0 / 13px 13px,
    #c89a6a;
}
.corkboard h2 {
  display: inline-block;
  margin: 0 0 .8rem;
  padding: 0 .6rem;
  background: var(--paper);
  transform: rotate(-2deg);
}
.corkboard section + section { margin-top: 1.5rem; }

.photos, .notes { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }

.polaroid {
  position: relative;
  width: 140px;
  margin: 0;
  padding: .5rem .5rem 1.6rem;
  background: #fff;
  box-shadow: 2px 4px 8px rgb(0 0 0 / .35);
  transform: rotate(-3deg);
}
.polaroid:nth-child(even) { transform: rotate(2.5deg); }
/* a strip of tape on top */
.polaroid::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 35%;
  width: 60px;
  height: 20px;
  background: rgb(255 248 200 / .75);
  transform: rotate(-4deg);
}
.polaroid img { display: block; width: 100%; height: 110px; object-fit: cover; }
.polaroid figcaption { position: absolute; bottom: 2px; left: .5rem; right: .5rem; font-size: .9rem; text-align: center; }

.sticky-note {
  position: relative;
  width: 100%;
  padding: .8rem 1rem .4rem;
  background: var(--sticky);
  box-shadow: 2px 4px 6px rgb(0 0 0 / .25);
  transform: rotate(-1deg);
}
.sticky-note:nth-child(even) { transform: rotate(1deg); background: #ffd1dc; }
.sticky-note p { margin: 0; white-space: pre-line; }
.sticky-note small { opacity: .6; }

.remove {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: var(--tomato); /* looks like a push pin */
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 1px 2px 3px rgb(0 0 0 / .4);
  opacity: .85;
}
.remove:hover { opacity: 1; transform: scale(1.1); }

.pin-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* let long file names shrink */
  gap: .5rem;
  padding: .8rem;
  background: rgb(255 253 245 / .9);
}
.pin-form input[type="text"], .pin-form textarea { width: 100%; font: inherit; padding: .3rem .5rem; }
.upload-preview { display: flex; flex-wrap: wrap; gap: .4rem; }
.upload-preview:empty { display: none; }
.upload-preview img { width: 56px; height: 56px; object-fit: cover; border: 3px solid #fff; box-shadow: 1px 1px 3px rgb(0 0 0 / .3); }
.file-label input { display: block; max-width: 100%; font-size: .9rem; }

/* htmx adds .htmx-request while a request is running */
.htmx-request .btn, .btn.htmx-request { opacity: .5; pointer-events: none; }

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

.recipe-form { display: grid; gap: var(--line); }
.recipe-form label { display: grid; }
.recipe-form input[type="text"], .recipe-form select {
  font: inherit;
  padding: .2rem .5rem;
  border: none;
  border-bottom: 2px dashed var(--wood);
  background: transparent;
}
.recipe-form trix-editor {
  min-height: 18rem;
  background: rgb(255 255 255 / .6);
  border: 2px dashed var(--wood);
  line-height: 1.6;
}
.recipe-form trix-toolbar .trix-button-group--file-tools { display: none; } /* attachments off */
.form-actions { display: flex; gap: 1.5rem; justify-content: flex-end; align-items: center; }
.error { margin: 0; color: #8c1d18; background: #ffe3e0; padding: 0 .8rem; }

/* ---------- login, logout & import ---------- */

.nav-link { color: #fff; text-decoration: none; }
.nav-link:hover { text-decoration: underline wavy; }
.logout { margin: 0; }
.logout .link-button { margin: 0; color: #fff; opacity: .75; text-decoration: none; }
.logout .link-button:hover { opacity: 1; text-decoration: underline wavy; }

.login-form { display: grid; gap: var(--line); max-width: 32rem; margin: 2rem auto; }
.login-form label { display: grid; }
.login-form input, .import-form input {
  font: inherit;
  padding: .2rem .5rem;
  border: none;
  border-bottom: 2px dashed var(--wood);
  background: transparent;
}

.import-page { max-width: 46rem; margin: 0 auto; }
.import-page h2 { margin: var(--line) 0 0; font-size: 1.5rem; line-height: var(--line); }
.import-page p { margin: 0 0 var(--line); }
.import-form { display: flex; gap: 1rem; align-items: center; margin-bottom: var(--line); }
.import-form input { flex: 1; min-width: 0; }
.bookmarklet { cursor: grab; background: var(--sticky); }

.notice { margin: 0; background: var(--sticky); padding: 0 .8rem; }
.source { margin: 0; overflow-wrap: anywhere; }
.import-photo { margin: 0; display: flex; gap: 1rem; align-items: center; }
.import-photo img { width: 120px; height: 90px; object-fit: cover; border: 4px solid #fff; box-shadow: 1px 1px 3px rgb(0 0 0 / .3); }
.shelf nav { flex-wrap: wrap; }
.shelf nav > *, .lang-switch a { white-space: nowrap; }
