/* Section 4 — « La Carte » : the official syllabus as a printed brasserie menu card.
   All rules scoped under #carte, all classes prefixed .carte-. Tokens from base.css only. */

#carte { overflow: hidden; overflow: clip; }

/* ------------------------------------------------------------------ heading */
#carte .carte-head { text-align: center; max-width: 820px; margin: 0 auto clamp(56px, 8vw, 104px); }
#carte .carte-head .lead { margin: 0 auto; }
#carte .carte-head .eyebrow::after { content: ""; width: 28px; height: 1px; background: var(--brass-deco); }

/* ------------------------------------------------------------------ stage + card */
#carte .carte-stage { position: relative; max-width: 820px; margin: 0 auto; perspective: 1600px; }
#carte .carte-card {
  --carte-rx: 0deg; --carte-ry: 0deg; --carte-sx: 50%; --carte-sy: 0%;
  position: relative; isolation: isolate;
  background: var(--paper-2);
  border-radius: 6px;
  padding: clamp(64px, 8vw, 104px) clamp(26px, 7.5vw, 92px) clamp(64px, 8vw, 96px);
  box-shadow: 0 0 0 1px var(--line), 0 1px 1px rgba(60, 30, 20, .05), 0 22px 40px -12px rgba(60, 30, 20, .16), 0 60px 120px -40px rgba(74, 15, 29, .22);
  transform: rotateX(var(--carte-rx)) rotateY(var(--carte-ry));
  transform-origin: 50% 50%;
  transition: transform .9s var(--ease-out), box-shadow .6s var(--ease);
}
#carte .carte-card.is-tilt { transition: box-shadow .6s var(--ease); will-change: transform; }

/* paper: warm vignette, faint laid lines and noise */
#carte .carte-paper {
  position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% 40%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(140% 100% at 50% 50%, rgba(201, 164, 92, 0) 60%, rgba(201, 164, 92, .16) 100%),
    repeating-linear-gradient(0deg, rgba(138, 101, 38, .025) 0 1px, transparent 1px 5px);
}
#carte .carte-paper::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: .09; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .18 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* moving sheen (desktop tilt only) */
#carte .carte-sheen {
  position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; opacity: 0;
  background:
    radial-gradient(520px circle at var(--carte-sx) var(--carte-sy), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 60%),
    linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(221, 187, 120, .10) 48%, rgba(255, 255, 255, 0) 66%);
  mix-blend-mode: soft-light;
  transition: opacity .7s var(--ease);
}
#carte .carte-card.is-tilt .carte-sheen { opacity: 1; }

/* double hairline frame + corner flourishes */
#carte .carte-frame { position: absolute; inset: clamp(10px, 1.8vw, 18px); border: 1px solid var(--brass-deco); pointer-events: none; z-index: 0; }
#carte .carte-frame::before { content: ""; position: absolute; inset: 5px; border: 1px solid var(--brass-deco); opacity: .55; }
#carte .carte-corner { position: absolute; width: clamp(28px, 4vw, 40px); height: auto; fill: none; stroke: var(--brass-deco); stroke-width: 1.4; stroke-linecap: round; }
#carte .carte-corner circle { fill: var(--brass-deco); stroke: none; }
#carte .carte-corner-tl { top: 10px; left: 10px; }
#carte .carte-corner-tr { top: 10px; right: 10px; transform: scaleX(-1); }
#carte .carte-corner-bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
#carte .carte-corner-br { bottom: 10px; right: 10px; transform: scale(-1, -1); }

/* wax seal (top right) */
#carte .carte-seal {
  position: absolute; z-index: 4; top: -26px; right: clamp(-34px, -2.6vw, -10px);
  width: clamp(76px, 11vw, 116px); height: auto; transform: rotate(-11deg);
  filter: drop-shadow(0 6px 10px rgba(74, 15, 29, .28)) drop-shadow(0 1px 1px rgba(74, 15, 29, .35));
}
#carte .carte-seal-wax { fill: var(--wine); }
#carte .carte-seal-ring { fill: none; stroke: var(--wine-deep); stroke-width: 2; opacity: .55; }
#carte .carte-seal-ring2 { stroke: var(--rose); stroke-width: .8; opacity: .4; }
#carte .carte-seal-mono { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 30px; letter-spacing: -1px; fill: var(--wine-deep); stroke: rgba(240, 163, 179, .45); stroke-width: .6; }
#carte .carte-seal-hi { fill: none; stroke: rgba(255, 255, 255, .28); stroke-width: 3; stroke-linecap: round; }

/* brass stamp (bottom left, desktop) */
#carte .carte-stamp {
  position: absolute; z-index: 4; left: -40px; bottom: -36px; width: 112px; height: auto;
  transform: rotate(-16deg); fill: none; stroke: var(--brass-deco); stroke-width: 1.6; opacity: .9;
  display: none;
}
#carte .carte-stamp-thin { stroke-width: .8; }
#carte .carte-stamp-txt { fill: var(--brass); stroke: none; font: 700 8.4px/1 var(--sans); letter-spacing: .5px; }
#carte .carte-stamp-num { fill: var(--brass); stroke: none; font-family: var(--serif); font-style: italic; font-size: 22px; }
@media (min-width: 900px) { #carte .carte-stamp { display: block; } }

/* ------------------------------------------------------------------ masthead */
#carte .carte-mast { position: relative; z-index: 1; text-align: center; }
#carte .carte-cloche { width: clamp(64px, 8vw, 84px); height: auto; margin: 0 auto 14px; fill: none; stroke: var(--brass-deco); stroke-width: 1.6; stroke-linecap: round; }
#carte .carte-kicker { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--brass); }
#carte .carte-title {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(64px, 13vw, 132px); line-height: .92; letter-spacing: -.035em; color: var(--ink);
  font-optical-sizing: auto; font-variation-settings: "SOFT" 100, "WONK" 1;
}
#carte .carte-sub { margin: 12px 0 0; font-family: var(--serif); font-size: clamp(17px, 1.8vw, 21px); letter-spacing: .02em; color: var(--muted); }
#carte .carte-orn { display: flex; align-items: center; gap: 12px; max-width: 280px; margin: 22px auto; }
#carte .carte-orn span { flex: 1; height: 1px; background: var(--brass-deco); opacity: .8; }
#carte .carte-orn svg { width: 40px; height: 12px; flex: none; fill: none; stroke: var(--brass-deco); stroke-width: 1.2; }
#carte .carte-meta { margin: 0; font-size: 14.5px; color: var(--muted); letter-spacing: .01em; }
#carte .carte-meta .num { color: var(--ink); font-size: 17px; }

/* ------------------------------------------------------------------ list header */
#carte .carte-tools { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: clamp(40px, 6vw, 64px); padding-bottom: 6px; border-bottom: 1px solid var(--ink); }
#carte .carte-colhead { font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--brass); }
#carte .carte-all {
  min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--wine);
  font-family: var(--serif); font-style: italic; font-size: 17px;
  text-decoration: underline; text-decoration-color: var(--brass-deco); text-decoration-thickness: 1px; text-underline-offset: 5px;
  transition: color .2s, text-decoration-color .2s;
}
#carte .carte-all:hover { color: var(--wine-hover); text-decoration-color: currentColor; }
html.no-js #carte .carte-all { display: none; }

/* ------------------------------------------------------------------ courses */
#carte .carte-courses { position: relative; z-index: 1; list-style: none; margin: 0; padding: 0; }
#carte .carte-course { border-bottom: 1px solid var(--line-strong); }
#carte .carte-course:last-child { border-bottom: 3px double var(--line-strong); }
#carte .carte-ch { margin: 0; font: inherit; }
#carte .carte-btn {
  position: relative; width: 100%; display: flex; align-items: center; gap: clamp(12px, 2.2vw, 22px);
  min-height: 84px; padding: 20px 2px; border: 0; background: none; color: var(--ink); text-align: left;
  -webkit-tap-highlight-color: transparent;
}
#carte .carte-btn:focus-visible { outline-offset: 2px; }

/* roman numeral medallion */
#carte .carte-roman {
  position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--brass-deco);
  font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--brass); letter-spacing: .02em;
  transition: background-color .45s var(--ease), color .45s var(--ease), border-color .45s var(--ease);
}
#carte .carte-roman::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 1px dashed var(--brass-deco); opacity: 0; transform: scale(.7) rotate(-40deg);
  transition: opacity .5s var(--ease), transform .8s var(--ease-out);
}
#carte .carte-btn:hover .carte-roman { border-color: var(--wine); color: var(--wine); }
#carte .is-open .carte-roman { background: var(--wine); border-color: var(--wine); color: #fff; }
#carte .is-open .carte-roman::after { opacity: 1; transform: none; }

/* name ........ count */
#carte .carte-line {
  flex: 1; min-width: 0; display: grid; align-items: baseline; column-gap: 12px; row-gap: 4px;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "name name name" "tag dots count";
}
#carte .carte-name { grid-area: name; font-family: var(--serif); font-weight: 400; font-size: clamp(21px, 2.6vw, 30px); line-height: 1.15; letter-spacing: -.015em; transition: color .3s var(--ease); }
#carte .carte-tag { grid-area: tag; font-size: 13.5px; color: var(--muted); letter-spacing: .01em; white-space: nowrap; }
#carte .carte-dots {
  grid-area: dots; align-self: end; height: 3px; margin-bottom: 6px; min-width: 16px;
  background-image: radial-gradient(circle, var(--brass-deco) 1px, transparent 1.3px);
  background-size: 7px 3px; background-repeat: repeat-x; background-position: left center;
  transition: opacity .3s;
}
#carte .carte-count { grid-area: count; white-space: nowrap; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted); }
#carte .carte-count .num { font-style: normal; font-size: clamp(21px, 2.4vw, 26px); color: var(--ink); margin-right: 3px; }
#carte .carte-btn:hover .carte-name, #carte .is-open .carte-name { color: var(--wine); }

@media (min-width: 640px) {
  #carte .carte-line { grid-template-columns: auto 1fr auto; grid-template-areas: "name dots count" "tag . ."; }
  #carte .carte-dots { margin-bottom: 7px; }
}

/* plus / minus */
#carte .carte-ico { position: relative; flex: none; width: 22px; height: 22px; color: var(--wine); }
#carte .carte-ico::before, #carte .carte-ico::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1.6px; margin: -.8px 0 0 -7px; background: currentColor; border-radius: 2px; transition: transform .5s var(--ease-out); }
#carte .carte-ico::after { transform: rotate(90deg); }
#carte .is-open .carte-ico::after { transform: rotate(0deg); }
#carte .is-open .carte-ico::before { transform: rotate(180deg); }
html.no-js #carte .carte-ico { display: none; }

/* ------------------------------------------------------------------ unfolding panel */
#carte .carte-panel {
  display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows .45s var(--ease-out), visibility 0s linear .45s;
}
#carte .is-open .carte-panel { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .45s var(--ease-out), visibility 0s; }
/* « Tout déplier / replier »: snap all panels at once (no layout animation on five panels) */
#carte.carte-is-bulk .carte-panel { transition: none; }
html.no-js #carte .carte-panel { grid-template-rows: 1fr; visibility: visible; }
#carte .carte-panel-in { min-height: 0; overflow: hidden; }
#carte .carte-cols { display: grid; gap: 26px; margin-top: 2px; }
@media (min-width: 640px) {
  #carte .carte-panel-in { padding-left: calc(48px + clamp(12px, 2.2vw, 22px)); }
  #carte .carte-cols { grid-template-columns: 1.15fr 1fr; gap: clamp(24px, 4vw, 48px); }
}
#carte .carte-label { margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); }
#carte .carte-branches, #carte .carte-lessons { list-style: none; margin: 0; padding: 0; }
#carte .carte-branches li { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px dotted var(--line-strong); font-size: 16px; line-height: 1.45; }
#carte .carte-branches li:last-child { border-bottom: 0; }
#carte .carte-bn { flex: none; min-width: 22px; font-style: italic; font-size: 17px; color: var(--wine); }
#carte .carte-lessons li { position: relative; padding: 7px 0 7px 22px; font-family: var(--serif); font-style: italic; font-size: 17.5px; line-height: 1.35; }
#carte .carte-lessons li::before { content: ""; position: absolute; left: 2px; top: 15px; width: 6px; height: 6px; border: 1px solid var(--brass-deco); transform: rotate(45deg); }
#carte .carte-exam { margin: 22px 0 30px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); }
#carte .carte-exam .num { color: var(--ink); font-size: 17px; }

/* staggered serving of the lines (opacity/transform only) */
#carte .carte-branches li, #carte .carte-lessons li, #carte .carte-exam { opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease), transform .7s var(--ease-out); }
#carte .is-open .carte-branches li, #carte .is-open .carte-lessons li, #carte .is-open .carte-exam { opacity: 1; transform: none; transition-delay: calc(.12s + var(--carte-i, 0) * 45ms); }
html.no-js #carte .carte-branches li, html.no-js #carte .carte-lessons li, html.no-js #carte .carte-exam { opacity: 1; transform: none; }

/* ------------------------------------------------------------------ card footer */
#carte .carte-foot { position: relative; z-index: 1; margin-top: clamp(36px, 5vw, 56px); text-align: center; }
#carte .carte-foot .carte-orn { margin-top: 0; }
#carte .carte-served { margin: 0 auto; max-width: 32em; font-family: var(--serif); font-size: clamp(17px, 1.9vw, 20px); line-height: 1.5; color: var(--ink); }
#carte .carte-served em { color: var(--wine); }
#carte .carte-fine { margin: 14px auto 0; max-width: 34em; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* ------------------------------------------------------------------ mobile: flat, (almost) full width */
@media (max-width: 559px) {
  #carte .carte-stage { margin-left: calc(var(--gutter) * -1 + 8px); margin-right: calc(var(--gutter) * -1 + 8px); perspective: none; }
  #carte .carte-card { border-radius: 4px; padding-left: 22px; padding-right: 22px; transform: none; }
  #carte .carte-roman { width: 40px; height: 40px; font-size: 15px; }
  #carte .carte-seal { top: -18px; right: 6px; }
  #carte .carte-btn { min-height: 76px; padding: 18px 0; }
}

@media (prefers-reduced-motion: reduce) {
  #carte .carte-card { transform: none !important; }
  #carte .carte-sheen { display: none; }
}
@media print {
  #carte .carte-panel { grid-template-rows: 1fr; visibility: visible; }
  #carte .carte-branches li, #carte .carte-lessons li, #carte .carte-exam { opacity: 1; transform: none; }
}
