/* Section 6 — « Le texte exact » (id #loi). Signature interaction: the brass loupe.
   Every rule is scoped under #loi and every class is prefixed .loi-… */

#loi { overflow: hidden; }
#loi svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ header */
#loi .loi-head { display: grid; gap: 22px; margin-bottom: clamp(40px, 6vw, 72px); }
#loi .loi-head .h2 { margin-bottom: 0; max-width: 12em; }
#loi .loi-hint { display: flex; align-items: flex-start; gap: 10px; margin: 22px 0 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
#loi .loi-hint svg { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--brass); }
@media (min-width: 900px) {
  #loi .loi-head { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: end; gap: 64px; }
}

/* ------------------------------------------------------------------ bar: example chooser + mobile view switch */
#loi .loi-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
#loi .loi-specs { display: flex; flex-wrap: wrap; gap: 8px; }
#loi .loi-spec-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px 0 7px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--muted); font-size: 15px; font-weight: 600; transition: background-color .3s, color .3s, border-color .3s; }
#loi .loi-spec-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--brass-deco); color: var(--brass); font-style: italic; font-size: 13px; transition: color .3s, border-color .3s; }
#loi .loi-spec-btn:hover { color: var(--ink); border-color: var(--ink); }
#loi .loi-spec-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
#loi .loi-spec-btn[aria-pressed="true"] .loi-spec-n { color: var(--brass-light); border-color: var(--brass-light); }

#loi .loi-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; width: 100%; padding: 4px; border-radius: 999px; background: var(--linen); box-shadow: inset 0 0 0 1px var(--line); }
#loi .loi-switch-thumb { position: absolute; top: 4px; left: 4px; width: calc(50% - 4px); height: calc(100% - 8px); border-radius: 999px; background: var(--card); box-shadow: 0 1px 2px rgba(60, 30, 20, .08), 0 6px 16px rgba(60, 30, 20, .10); transition: transform .5s var(--ease-out); }
#loi .loi-stage[data-view="law"] .loi-switch-thumb { transform: translateX(100%); }
#loi .loi-switch-btn { position: relative; z-index: 1; min-height: 44px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 15px; font-weight: 650; transition: color .3s; }
#loi .loi-switch-btn[aria-pressed="true"] { color: var(--ink); }
html.no-js #loi .loi-switch, html.no-js #loi .loi-specs { display: none; }
@media (min-width: 900px) { #loi .loi-switch { display: none; } }

/* ------------------------------------------------------------------ the two panels */
#loi .loi-cols { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
@media (max-width: 899.98px) {
  #loi .loi-stage[data-view="law"] .loi-lesson, #loi .loi-stage[data-view="simple"] .loi-folio-wrap { display: none; }
}
@media (min-width: 900px) {
  #loi .loi-cols { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: clamp(56px, 6.5vw, 96px); align-items: center; }
}
#loi .loi-enter { animation: loi-in .6s var(--ease-out) both; }
@keyframes loi-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#loi .loi-kicker { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--brass); }
#loi .loi-kicker span { color: var(--muted); }
#loi .loi-kicker svg { width: 18px; height: 18px; }

/* lesson card — the app screen */
#loi .loi-lesson { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 22px 20px; box-shadow: var(--shadow-hi); }
@media (min-width: 900px) { #loi .loi-lesson { border-radius: var(--r-xl); padding: 34px 36px 28px; } }
#loi .loi-lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 650; color: var(--muted); }
#loi .loi-lesson-theme { display: inline-flex; align-items: center; gap: 8px; }
#loi .loi-lesson-theme i { width: 8px; height: 8px; border-radius: 50%; background: var(--wine); }
#loi .loi-lesson-prog { display: inline-flex; gap: 4px; }
#loi .loi-lesson-prog i { width: 14px; height: 4px; border-radius: 2px; background: var(--line); }
#loi .loi-lesson-prog i.on { background: var(--wine); }
#loi .loi-lesson .loi-kicker { margin-bottom: 14px; }
#loi .loi-text { margin: 0; font-size: 18px; line-height: 1.95; color: var(--ink); }
@media (min-width: 900px) { #loi .loi-text { font-size: 20px; } }
#loi .loi-text strong { font-weight: 700; }

/* highlighted phrase: brass underline, fills bordeaux-rosé when active */
#loi .loi-ph { cursor: pointer; padding: 3px 2px; margin: 0 -2px; border-radius: 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background-color: transparent; background-image: linear-gradient(var(--brass-deco), var(--brass-deco)); background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 2px;
  transition: background-color .35s var(--ease), color .35s; -webkit-tap-highlight-color: transparent; }
#loi .loi-ph[aria-pressed="true"] { background-color: var(--wine-soft); background-image: linear-gradient(var(--wine), var(--wine)); color: var(--wine-deep); }
@media (hover: hover) { #loi .loi-ph:hover { background-color: var(--wine-soft); } }
#loi .loi-src { display: inline-flex; align-items: center; gap: 8px; margin: 22px 0 0; padding: 6px 14px 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 13.5px; font-weight: 650; color: var(--brass); }
#loi .loi-src svg { width: 16px; height: 16px; }
#loi .loi-lesson-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
#loi .loi-lesson-foot span + span::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 14px 2px 0; border-radius: 50%; background: var(--brass-deco); vertical-align: middle; }

/* law folio — a sheet on a small stack of sheets */
#loi .loi-folio-wrap { position: relative; isolation: isolate; }
#loi .loi-folio-wrap::before, #loi .loi-folio-wrap::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: var(--r-lg); border: 1px solid var(--line); }
#loi .loi-folio-wrap::before { background: var(--linen); transform: rotate(1.6deg) translate(6px, 8px); }
#loi .loi-folio-wrap::after { background: var(--paper); transform: rotate(-1deg) translate(-4px, 5px); }
#loi .loi-folio { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px 22px 18px 30px; box-shadow: var(--shadow-hi); }
@media (min-width: 900px) { #loi .loi-folio { padding: 40px 48px 30px 60px; } }
/* double margin rule, like legal paper */
#loi .loi-folio::before { content: ""; position: absolute; top: 0; bottom: 0; left: 14px; width: 4px; border-left: 1px solid var(--wine-soft); border-right: 1px solid var(--wine-soft); pointer-events: none; }
@media (min-width: 900px) { #loi .loi-folio::before { left: 26px; } }
#loi .loi-folio:focus { outline: none; }
#loi .loi-folio:focus-visible { outline: 3px solid var(--wine); outline-offset: 3px; }
#loi .loi-folio-head { padding: 0 72px 18px 0; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) { #loi .loi-folio-head { padding-right: 110px; } }
#loi .loi-folio-title { margin: 10px 0 0; font-family: var(--serif); font-size: 15.5px; line-height: 1.4; color: var(--ink); }
#loi .loi-folio-title span { display: block; margin-top: 6px; font-family: var(--sans); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); }
#loi .loi-art { display: flex; align-items: baseline; gap: 12px; margin: 0 0 16px; }
#loi .loi-art-n { font-family: var(--serif); font-size: clamp(38px, 4vw, 52px); line-height: 1; letter-spacing: -.03em; font-weight: 400; color: var(--ink); }
#loi .loi-art-l { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--brass); }

#loi .loi-qwrap { position: relative; }
#loi .loi-quote { margin: 0; font-family: var(--serif); font-size: clamp(19px, 1.85vw, 23px); line-height: 1.66; letter-spacing: -.005em; color: var(--ink); font-variation-settings: "SOFT" 50; transition: color .45s var(--ease); }
#loi .loi-quote::before { content: "«\00a0"; color: var(--brass); }
#loi .loi-quote::after { content: "\00a0»"; color: var(--brass); }
#loi .loi-quote.has-on { color: var(--muted); }
#loi .loi-mk { color: inherit; background-color: transparent; padding: 1px 1px; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background-image: linear-gradient(var(--line-strong), var(--line-strong)); background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 1px;
  transition: background-color .45s var(--ease), color .45s var(--ease); }
#loi .loi-mk.is-on { color: var(--wine); background-color: var(--wine-soft); background-image: linear-gradient(var(--brass-deco), var(--brass-deco)); background-size: 100% 2px; }
#loi .loi-cite { margin: 18px 0 0; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--brass); }

/* the loupe */
#loi .loi-lens { --lz: 112px; position: absolute; left: 0; top: 0; z-index: 2; width: var(--lz); height: var(--lz); pointer-events: none; opacity: 0;
  transform: translate(var(--lx, 0px), var(--ly, 0px)); transition: transform .8s var(--ease-out), opacity .45s; will-change: transform; }
@media (min-width: 900px) { #loi .loi-lens { --lz: 148px; } }
#loi .loi-lens.is-on { opacity: 1; }
#loi .loi-lens-in { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; background: var(--card); box-shadow: 0 14px 34px rgba(60, 30, 20, .22), 0 2px 6px rgba(60, 30, 20, .12); }
#loi .loi-lens-in::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 38%), radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 62%, rgba(201, 164, 92, .16) 100%); pointer-events: none; }
#loi .loi-lens .loi-quote { position: absolute; left: 0; top: 0; transform-origin: 0 0; transition: transform .8s var(--ease-out), color .45s; will-change: transform; }
#loi .loi-lens-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#loi .loi-lens-ring circle { stroke: var(--brass-deco); stroke-width: 6; }
#loi .loi-lens-ring circle.t { stroke-width: 1.2; opacity: .8; }
#loi .loi-lens-ring .g { stroke: #fff; stroke-width: 4; opacity: .75; }
#loi .loi-lens-handle { position: absolute; left: 84%; top: 84%; width: 34%; height: 34%; overflow: visible; }
#loi .loi-lens-handle path { stroke: var(--brass-deco); stroke-width: 9; }
#loi .loi-lens-handle path.t { stroke: var(--brass); stroke-width: 13; stroke-linecap: butt; }

/* brass wire from the phrase to the loupe (desktop) */
#loi .loi-wire { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; display: none; }
@media (min-width: 900px) { #loi .loi-wire { display: block; } }
#loi .loi-wire-p { stroke: var(--brass-deco); stroke-width: 1.25; transition: stroke-dashoffset .9s var(--ease-out); }
#loi .loi-wire circle { fill: var(--paper-2); stroke: var(--brass-deco); stroke-width: 1.25; transition: opacity .4s; }
#loi .loi-wire.is-off { opacity: 0; }

/* folio foot: back (mobile) + step through passages */
#loi .loi-folio-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--line); }
#loi .loi-back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 14px 0 6px; margin-left: -6px; border: 0; border-radius: 999px; background: transparent; color: var(--wine); font-size: 15px; font-weight: 650; }
#loi .loi-back svg { width: 20px; height: 20px; stroke-width: 2; }
#loi .loi-back:hover { background: var(--wine-soft); }
@media (min-width: 900px) { #loi .loi-back { display: none; } }
html.no-js #loi .loi-back, html.no-js #loi .loi-step { display: none; }
#loi .loi-step { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
#loi .loi-step-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); transition: border-color .25s, background-color .25s; }
#loi .loi-step-btn:hover { border-color: var(--ink); }
#loi .loi-step-btn svg { width: 18px; height: 18px; stroke-width: 2; }
#loi .loi-step-n { min-width: 4.2em; text-align: center; font-size: 16px; color: var(--muted); }
#loi .loi-step-n b { font-weight: 500; color: var(--ink); }

/* seal ornament */
#loi .loi-seal { position: absolute; top: 16px; right: 16px; width: 66px; height: 66px; color: var(--brass-deco); transform: rotate(var(--rot, 0deg)); transition: transform 1.4s var(--ease-out); }
@media (min-width: 900px) { #loi .loi-seal { top: 26px; right: 30px; width: 96px; height: 96px; } }
#loi .loi-seal circle { stroke-width: 1; }
#loi .loi-seal circle.t { stroke-dasharray: 1.5 3; }
#loi .loi-seal text { fill: var(--brass); stroke: none; font-family: var(--sans); font-size: 6.4px; font-weight: 700; letter-spacing: .4px; }
#loi .loi-seal text.c { fill: var(--brass-deco); font-family: var(--serif); font-size: 34px; font-weight: 400; letter-spacing: 0; }

/* ------------------------------------------------------------------ glossary demo */
#loi .loi-gl { display: grid; gap: 28px; margin-top: clamp(72px, 10vw, 128px); padding-top: clamp(40px, 6vw, 64px); border-top: 1px solid var(--line); }
@media (min-width: 900px) { #loi .loi-gl { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(56px, 6.5vw, 96px); align-items: center; } }
#loi .loi-gl-k { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px; font-style: italic; font-size: 17px; color: var(--brass); }
#loi .loi-gl-k span { font-style: normal; font-size: clamp(52px, 6vw, 72px); line-height: .9; letter-spacing: -.04em; color: var(--wine); }
#loi .loi-gl-intro .muted { margin: 0; max-width: 30em; }
#loi .loi-gl-box { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 22px; box-shadow: var(--shadow); }
@media (min-width: 900px) { #loi .loi-gl-box { padding: 36px 40px; } }
#loi .loi-gl-text { margin: 0; font-size: 18px; line-height: 1.95; color: var(--ink); }
#loi .loi-gw { position: relative; padding: 0 2px; margin: 0 -2px; border: 0; border-radius: 4px; background: transparent; font: inherit; color: inherit; line-height: inherit;
  text-decoration: underline dotted var(--brass); text-decoration-thickness: 2px; text-underline-offset: 5px; transition: background-color .25s, color .25s; }
#loi .loi-gw::after { content: ""; position: absolute; left: -4px; right: -4px; top: -10px; bottom: -10px; }
#loi .loi-gw:hover, #loi .loi-gw[aria-expanded="true"] { background: var(--wine-soft); color: var(--wine-deep); }

#loi .loi-pop { position: absolute; z-index: 6; left: 0; top: 0; width: min(340px, calc(100% - 24px)); padding: 18px 54px 18px 20px; border-radius: 16px; background: var(--night-2); color: var(--on-night); box-shadow: 0 24px 50px rgba(20, 16, 15, .32), 0 2px 6px rgba(20, 16, 15, .2);
  transform: translate(var(--px, 0px), calc(var(--py, 0px) + 8px)); opacity: 0; transition: opacity .3s, transform .45s var(--ease-out); }
#loi .loi-pop.is-open { opacity: 1; transform: translate(var(--px, 0px), var(--py, 0px)); }
#loi .loi-pop::before { content: ""; position: absolute; top: -6px; left: calc(var(--ax, 40px) - 7px); width: 14px; height: 14px; background: var(--night-2); border-radius: 2px; transform: rotate(45deg); }
#loi .loi-pop:focus { outline: none; }
#loi .loi-pop:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; }
#loi .loi-pop-t { margin: 0 0 6px; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.2; color: var(--brass-light); }
#loi .loi-pop-d { margin: 0; font-size: 15.5px; line-height: 1.55; }
#loi .loi-pop-s { margin: 12px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--on-night-muted); }
#loi .loi-pop-x { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--on-night); }
#loi .loi-pop-x:hover { background: rgba(245, 238, 231, .1); }
#loi .loi-pop-x:focus-visible { outline-color: var(--rose); }
#loi .loi-pop-x svg { width: 18px; height: 18px; stroke-width: 2; }
html.no-js #loi .loi-pop { display: block; position: static; width: auto; margin-top: 14px; opacity: 1; transform: none; }
html.no-js #loi .loi-pop::before, html.no-js #loi .loi-pop-x { display: none; }

/* ------------------------------------------------------------------ sources */
#loi .loi-srcs { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: clamp(48px, 6vw, 72px); }
#loi .loi-srcs-k { margin: 0; font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--muted); }
#loi .loi-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
#loi .loi-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px 0 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14.5px; color: var(--ink); }
#loi .loi-chip b { font-weight: 700; }
#loi .loi-chip svg { flex: none; width: 18px; height: 18px; color: var(--brass); }

@media (prefers-reduced-motion: reduce) {
  #loi .loi-lens, #loi .loi-lens .loi-quote, #loi .loi-wire-p, #loi .loi-seal, #loi .loi-pop, #loi .loi-switch-thumb { transition: none; }
  #loi .loi-enter { animation: none; }
}
