/* L'Ardoise: a chalkboard (slate) menu in a wooden frame. */
:root {
  --slate: #1f2623;
  --slate-2: #273029;
  --slate-3: #313b35;
  --wood: #6b4a2b;
  --wood-dark: #4a3220;
  --chalk: #f2efe6;
  --chalk-dim: #b9b5aa;
  --chalk-faint: rgba(242, 239, 230, .12);
  --orange: #f4b020;
  --red: #f36b4f;
  --green: #7fd1b9;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 9px),
    var(--wood);
}

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(0px, 2.5vw, 32px);
  color: var(--chalk);
  font: 400 1.05rem/1.55 "Nunito", system-ui, sans-serif;
  background: transparent;
}

.board {
  position: relative;
  max-width: 1440px;
  min-height: calc(100vh - 2 * clamp(0px, 2.5vw, 32px));
  margin: 0 auto;
  padding: 0 var(--gutter) 64px;
  background:
    radial-gradient(ellipse at 15% 5%, rgba(255,255,255,.06), transparent 45%),
    radial-gradient(ellipse at 85% 70%, rgba(255,255,255,.04), transparent 50%),
    var(--slate);
  border-radius: 6px;
  box-shadow:
    0 0 0 3px var(--wood-dark),
    0 20px 50px rgba(0,0,0,.45),
    inset 0 0 60px rgba(0,0,0,.55);
}

h1, h2, h3, .bases a { font-family: "Caveat", cursive; }

a { color: inherit; }
:focus-visible { outline: 2px dashed var(--orange); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- Masthead ---- */
.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 5vw, 56px) 0 8px;
  text-align: center;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand h1 {
  margin: 0;
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .03em;
  text-shadow: 0 0 2px rgba(242,239,230,.5);
}
.logo { width: clamp(40px, 6vw, 64px); height: auto; transform: rotate(-12deg); transition: transform .4s; }
.brand:hover .logo { transform: rotate(8deg) scale(1.08); }
.tagline { margin: 6px 0 0; color: var(--chalk-dim); }

.settings {
  position: absolute; top: 16px; right: 16px;
  padding: 6px; opacity: .3; transition: opacity .2s, transform .4s;
}
.settings:hover, .settings:focus-visible { opacity: .85; transform: rotate(90deg); }
.settings img { width: 22px; height: 22px; display: block; }

/* ---- Toolbar: search + base links ---- */
.toolbar {
  display: flex;
  justify-content: center;
  margin: 24px 0 8px;
}
.search {
  position: relative;
  width: min(560px, 100%);
}
.search svg {
  position: absolute; left: 14px; top: 50%; translate: 0 -50%;
  width: 18px; height: 18px;
  fill: none; stroke: var(--chalk-dim); stroke-width: 2; stroke-linecap: round;
}
.search input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  color: var(--chalk);
  font: inherit;
  background: var(--slate-2);
  border: 1px solid var(--chalk-faint);
  border-radius: 999px;
  transition: border-color .2s, background .2s;
}
.search input::placeholder { color: var(--chalk-dim); opacity: .7; }
.search input:focus { outline: none; border-color: var(--orange); background: var(--slate-3); }

#menu { transition: opacity .15s; }
.toolbar:has(.htmx-request) + #menu { opacity: .5; }

.bases {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter);
  background: color-mix(in srgb, var(--slate) 88%, transparent);
  backdrop-filter: blur(6px);
}
.bases a {
  padding: 2px 14px;
  font-size: 1.35rem;
  text-decoration: none;
  text-transform: capitalize;
  color: var(--orange);
  border: 1px solid rgba(244,176,32,.35);
  border-radius: 999px;
  transition: background .2s;
}
.bases a:hover { background: rgba(244,176,32,.12); }
.bases small { font-family: "Nunito", sans-serif; font-size: .75rem; color: var(--chalk-dim); }

/* ---- Sections & cards ---- */
section { margin-top: clamp(24px, 4vw, 48px); }

.base {
  margin: 0 0 12px;
  color: var(--orange);
  font-size: clamp(2rem, 3.5vw, 2.6rem);
  border-bottom: 2px dashed rgba(244,176,32,.45);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 12px clamp(16px, 2.5vw, 32px);
  align-items: start;
}

.pizza {
  display: flex;
  flex-direction: column;
  padding: 14px 16px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background .2s, border-color .2s;
}
.pizza:hover { background: rgba(255,255,255,.025); border-color: var(--chalk-faint); }
.pizza.open { background: var(--slate-2); border-color: var(--chalk-faint); }

.title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.pizza h3 { margin: 0; font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--red); }
.veggie {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 0 8px;
}

.ingredients { margin: 6px 0 0; }
.toppings { margin: 2px 0 0; color: var(--chalk-dim); font-size: .95rem; }

.steps {
  margin: 14px 0 4px;
  padding: 12px 14px 12px 36px;
  background: var(--slate-3);
  border-radius: 8px;
  animation: chalk-in .25s ease-out;
}
.steps li + li { margin-top: 6px; }
.steps li::marker { color: var(--orange); font-weight: 600; }
.steps.none { padding-left: 14px; color: var(--chalk-dim); font-style: italic; }

.toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0 -8px;
  padding: 4px 8px;
  color: var(--chalk-dim);
  font: 600 .9rem "Nunito", sans-serif;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: color .2s, background .2s;
}
.toggle:hover { color: var(--chalk); background: var(--chalk-faint); }
.chevron { display: inline-block; font-size: 1.2em; line-height: 1; transition: transform .2s; }
.open .chevron { transform: rotate(90deg); }
.toggle.htmx-request { opacity: .6; cursor: progress; }

.empty { text-align: center; color: var(--chalk-dim); margin-top: 64px; font-size: 1.1rem; }

@keyframes chalk-in { from { opacity: 0; transform: translateY(-4px); } }

@media (max-width: 600px) {
  .board { border-radius: 0; box-shadow: inset 0 0 40px rgba(0,0,0,.5); }
  .settings { top: 8px; right: 8px; }
  .pizza { padding-inline: 4px; }
  .pizza.open { padding-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ======================= Admin ======================= */
.admin .board { max-width: 1100px; }

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--chalk-faint);
}
.admin-brand { font: 700 2rem "Caveat", cursive; text-decoration: none; }
.admin-brand span { font: 600 .75rem "Nunito", sans-serif; color: var(--orange); text-transform: uppercase; letter-spacing: .1em; }
.link { color: var(--chalk-dim); text-decoration: none; font-size: .95rem; }
.link:hover { color: var(--chalk); }

.admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 16px;
}
.admin-title h1 { margin: 0; font-size: 2.6rem; color: var(--orange); line-height: 1; }
.admin-title small { font: 400 1rem "Nunito", sans-serif; color: var(--chalk-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  color: var(--chalk);
  font: 600 .9rem "Nunito", sans-serif;
  text-decoration: none;
  background: var(--slate-3);
  border: 1px solid var(--chalk-faint);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #3b4640; }
.btn.primary { color: #1f1a10; background: var(--orange); border-color: var(--orange); }
.btn.primary:hover { background: #ffc23d; }
.btn.danger { color: var(--red); background: transparent; border-color: rgba(243,107,79,.35); }
.btn.danger:hover { background: rgba(243,107,79,.12); }

.toast {
  margin: 20px 0 0;
  padding: 10px 14px;
  color: var(--green);
  background: rgba(127,209,185,.08);
  border: 1px solid rgba(127,209,185,.35);
  border-radius: 8px;
  animation: chalk-in .25s ease-out;
}

/* Table: rows become cards on narrow screens. */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
  padding: 8px 12px;
  color: var(--chalk-dim);
  font-size: .8rem;
  font-weight: 600;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--chalk-faint);
}
.admin-table td { padding: 12px; border-bottom: 1px solid var(--chalk-faint); vertical-align: middle; }
.admin-table tr { transition: opacity .2s; }
.admin-table tr.htmx-swapping { opacity: 0; }
.admin-table tbody tr:hover { background: rgba(255,255,255,.02); }
.admin-table .name { font: 700 1.5rem "Caveat", cursive; color: var(--red); text-decoration: none; margin-right: 6px; }
.admin-table .name:hover { text-decoration: underline; }
.admin-table .dim { color: var(--chalk-dim); font-size: .95rem; }
.admin-table .cap { text-transform: capitalize; }
.admin-table .actions { text-align: right; white-space: nowrap; }
.admin-table .actions .btn + .btn { margin-left: 8px; }

@media (max-width: 760px) {
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; }
  .admin-table tr { padding: 12px 0; border-bottom: 1px solid var(--chalk-faint); }
  .admin-table td { padding: 2px 0; border: 0; }
  .admin-table td[data-label="Base"]::before,
  .admin-table td[data-label="Recette"]::before { content: attr(data-label) " : "; color: var(--chalk-dim); text-transform: none; }
  .admin-table .actions { text-align: left; margin-top: 8px; }
}

/* Form */
.pizza-form { max-width: 680px; display: grid; gap: 22px; padding-bottom: 24px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.opt { color: var(--chalk-dim); font-weight: 400; font-size: .85rem; margin-left: 4px; }
.field input:not([type=radio]), .field textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--chalk);
  font: inherit;
  background: var(--slate-2);
  border: 1px solid var(--chalk-faint);
  border-radius: 8px;
  resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--orange); background: var(--slate-3); }
.field.invalid input, .field.invalid textarea { border-color: var(--red); }
.hint { margin: 0; color: var(--chalk-dim); font-size: .85rem; }
.error { margin: 0; color: var(--red); font-size: .9rem; font-weight: 600; }

.segmented { display: inline-flex; width: fit-content; background: var(--slate-2); border: 1px solid var(--chalk-faint); border-radius: 999px; padding: 3px; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 6px 18px; border-radius: 999px; cursor: pointer; text-transform: capitalize; color: var(--chalk-dim); transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--orange); color: #1f1a10; font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px dashed var(--orange); outline-offset: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; width: fit-content; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; }
.switch .track { position: relative; width: 42px; height: 24px; background: var(--slate-3); border: 1px solid var(--chalk-faint); border-radius: 999px; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: var(--chalk-dim); border-radius: 50%; transition: transform .2s, background .2s; }
.switch input:checked + .track { background: rgba(127,209,185,.3); border-color: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--green); }
.switch input:focus-visible + .track { outline: 2px dashed var(--orange); outline-offset: 2px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; border-top: 1px solid var(--chalk-faint); }
