/* The language switch. One state, html[lang], read by two controls: a flag pill with a small menu at the right
   of the header on wide screens, and a two-way segment at the foot of the phone menu. The flags are the two
   national marks drawn as plain SVG, no emoji. The prototype's copy stays Romanian; the switch marks and keeps
   the reader's choice (showroom.js). */
.lang { position: relative; }
.lang summary { list-style: none; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: var(--step--1); font-weight: 600; line-height: 1; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color var(--t-fast); }
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { border-color: var(--ink); }
.lang summary [data-l] { display: inline-flex; align-items: center; gap: 0.5rem; }
html[lang="ro"] .lang [data-l="en"], html[lang="en"] .lang [data-l="ro"] { display: none; }
.lang .chev { width: 14px; height: 14px; transition: transform 400ms var(--ease-lift); }
.lang[open] .chev { transform: rotate(180deg); }
.flag { flex: none; width: 20px; height: 14px; border-radius: 3px; box-shadow: 0 0 0 1px oklch(1 0 0 / 0.18); }
.lang-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 45; min-width: 184px; display: grid; gap: 2px; padding: var(--s-2); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-float); animation: lang-in 260ms var(--ease-lift); }
.lang-menu :is(button, a), .lang-seg :is(button, a) { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.6rem 0.75rem; border: 0; border-radius: 9px; background: none; font: inherit; font-size: var(--step--1); font-weight: 600; color: var(--ink); text-align: left; transition: background var(--t-fast), color var(--t-fast); }
.lang-menu :is(button, a):hover { background: oklch(1 0 0 / 0.07); }
html[lang="en"] .lang-menu [data-lang="en"], html[lang="ro"] .lang-menu [data-lang="ro"] { background: oklch(1 0 0 / 0.1); }
/* The chosen row carries a mark at its end. */
.lang-menu :is(button, a)::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0; transition: opacity var(--t-fast); }
html[lang="en"] .lang-menu [data-lang="en"]::after, html[lang="ro"] .lang-menu [data-lang="ro"]::after { opacity: 1; }
@keyframes lang-in { from { opacity: 0; transform: translateY(-6px); } }
.lang-seg { display: none; }

@media (max-width: 900px) {
  .lang { display: none; }
  .lang-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-pill); }
  .lang-seg :is(button, a) { justify-content: center; min-height: 44px; border-radius: var(--radius-pill); }
  html[lang="en"] .lang-seg [data-lang="en"], html[lang="ro"] .lang-seg [data-lang="ro"] { background: var(--ink); color: var(--paper); }
  html[lang="en"] .lang-seg [data-lang="en"] .flag, html[lang="ro"] .lang-seg [data-lang="ro"] .flag { box-shadow: none; }
}

/* The map drawer, a <dialog>: the browser owns focus, Escape and the backdrop. On a wide screen it stands at the
   right edge, the page dimmed behind it; on a phone it is a sheet that rises from the bottom, the X at its right. */
.mapbox { position: fixed; inset: 0 0 0 auto; width: min(520px, 100%); height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); background: var(--paper); color: var(--ink); box-shadow: var(--shadow-float); }
.mapbox[open] { display: grid; grid-template-rows: auto 1fr; animation: map-in 560ms var(--ease-lift); }
.mapbox::backdrop { background: oklch(0.1 0.005 268 / 0.55); animation: fade-in 360ms var(--ease-out); }
.mapbox.closing { animation: map-out 360ms var(--ease-lift) forwards; }
.mapbox.closing::backdrop { animation: fade-out 360ms var(--ease-out) forwards; }
.mapbox-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.mapbox-head h3 { font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.mapbox-head p { margin-top: 0.2rem; font-size: var(--step--1); color: var(--ink-2); }
.mapbox-head .btn { padding: 0.55rem 1rem; }
.mapbox-head .btn .icon { width: 16px; height: 16px; }
.mapbox-x { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); color: var(--ink); transition: border-color var(--t-fast), transform 500ms var(--ease-lift); }
.mapbox-x:hover { border-color: var(--ink); transform: rotate(90deg); }
.mapbox-x svg { width: 18px; height: 18px; }
.mapbox iframe { width: 100%; height: 100%; border: 0; background: var(--paper-2); }
@keyframes map-in { from { opacity: 0; transform: translateX(48px); } }
@keyframes map-out { to { opacity: 0; transform: translateX(48px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* The photo viewer (SiteLightbox), a <dialog> over the whole screen: the photo on black, the counter and the X above it,
   a step on each side. The page under it does not scroll while it is open. */
html:has(.lightbox[open]) { overflow: hidden; }
.lightbox { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--black); color: var(--on-black); overscroll-behavior: contain; }
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); animation: fade-in 260ms var(--ease-out); }
.lightbox::backdrop { background: var(--black); }
.lb-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-3); padding: calc(var(--s-3) + env(safe-area-inset-top)) var(--s-4) var(--s-3); }
.lb-count { font-size: var(--step--1); font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-title { max-width: 60ch; overflow: hidden; font-size: var(--step--1); color: var(--on-black-2); text-overflow: ellipsis; white-space: nowrap; }
.lb-x, .lb-step { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid oklch(1 0 0 / 0.28); border-radius: 50%; background: oklch(0.14 0 0 / 0.6); color: var(--on-black); cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast), transform 500ms var(--ease-lift); }
.lb-x { justify-self: end; }
.lb-x:hover, .lb-step:hover { border-color: var(--on-black); background: oklch(0.24 0 0 / 0.8); }
.lb-x:active, .lb-step:active { transform: scale(0.94); }
.lb-x:focus-visible, .lb-step:focus-visible { outline-color: var(--on-black); }
.lb-x .icon, .lb-step .icon { width: 20px; height: 20px; }
/* The photo is laid inside the stage minus its insets (--lb-x at the sides, --lb-b below): it keeps its own size when it is
   smaller, and shrinks to fit when it is larger. It is never stretched past its pixels and never cropped. */
.lb-stage { --lb-x: 0px; --lb-b: calc(var(--s-4) + env(safe-area-inset-bottom)); position: relative; min-height: 0; overflow: hidden; touch-action: pan-y; user-select: none; }
.lb-stage img { position: absolute; inset: 0 var(--lb-x) var(--lb-b); width: auto; height: auto; max-width: calc(100% - 2 * var(--lb-x)); max-height: calc(100% - var(--lb-b)); margin: auto; object-fit: contain; animation: shot-in 280ms var(--ease-out); }
.lb-acts { display: flex; justify-self: end; gap: var(--s-2); }
.lb-step { position: absolute; top: 50%; transform: translateY(-50%); }
.lb-step:active { transform: translateY(-50%) scale(0.94); }
.lb-prev { left: var(--s-3); }
.lb-next { right: var(--s-3); }
/* From a tablet up the arrows sit beside the photo, never on it (below 641 px they move under it). */
@media (min-width: 641px) {
  .lb-stage { --lb-x: calc(48px + var(--s-6)); --lb-b: var(--s-5); }
  .lb-prev { left: var(--s-5); }
  .lb-next { right: var(--s-5); }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox[open], .lb-stage img { animation: none; }
  .lb-x, .lb-step { transition: none; }
}

@media (max-width: 640px) {
  .lb-title { display: none; }
  .lb-bar { grid-template-columns: 1fr auto; }
  .lb-step { top: auto; bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); transform: none; }
  .lb-step:active { transform: scale(0.94); }
  .lb-stage { --lb-b: calc(48px + var(--s-6) + env(safe-area-inset-bottom)); }
  .mapbox { inset: auto 0 0; width: 100%; height: 84dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; }
  .mapbox[open] { animation-name: sheet-in; }
  .mapbox.closing { animation-name: sheet-out; }
  .mapbox-head { grid-template-columns: minmax(0, 1fr) auto; padding-left: var(--s-4); }
  .mapbox-head .btn { grid-row: 2; grid-column: 1 / -1; justify-self: start; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
}
