/* ==================================================================
   LANGUAGE SWITCHER — reachable at every width, and big enough to press

   Loaded after ux.css (handle af-ux is this sheet's dependency), so
   these rules win on source order without needing !important, except
   where ux.css itself used !important. Everything here was measured
   with real device emulation - Emulation.setDeviceMetricsOverride -
   rather than by resizing a window, because the window on the build
   machine floors at 500px and never reaches a phone.

   Three faults, all of them on every page of the shop:

   1. At 1024 and 1280 the switcher was not merely awkward, it was off
      the screen. The announcement bar is a nowrap flex row from 900px
      up; its four items at 17px need 1133px of room, its five need
      1426px. At vw=1024 .af-lang measured left=1021 right=1100 - the
      whole control 76px past the right edge - and because html and
      body are overflow-x:clip the page could not be scrolled to reach
      it. On a tablet in landscape and on a 1280 laptop there was no
      way to change language at all.

   2. On a phone the open menu ran off the right edge: at 390px the
      menu measured left=268 right=452, +62px past the viewport, and
      each option +56px. The cause is a rule in ux.css that flips the
      menu to left:0 below 768px on the assumption that the switcher
      sits at the left end of a wrapped row. It does not - measured at
      390px it sits at x=268 - so left:0 pushed the menu outward
      instead of pulling it in.

   3. The control was 79x30 and each option 172x36, both under the
      44px floor, and the language code inside an option rendered at
      11.9px. That last one is not a typo in a size: ux.css sets the
      code to .85em, so it is permanently whatever the row happens to
      be, minus 15%. Sizes that matter are set in px here for exactly
      that reason.

   Audience: older smallholders, mostly on phones, often outdoors.
   44px is the floor, 48px the target, and nothing informative is
   allowed under 15px.
   ================================================================== */

/* ------------------------------------------------------------------
   1. THE BAR MUST NEVER CARRY THE SWITCHER OFF-SCREEN

   Measured content widths at 17px, the size ux.css settled on for
   legibility:  hours 358, shipping 352, own-production 222, contact
   207, switcher ~100 after the enlargement below; 24px gaps and a
   gutter of roughly 3% of the viewport on each side.

     five items need 1428px   ->  one row only from 1500px
     four items need 1163px   ->  one row only from 1200px
     three items need  761px  ->  one row from 768px

   So the two hide-thresholds ux.css already established are kept in
   the same order of importance the previous pass chose - production
   claim first, then opening hours - and simply moved to the widths
   where the bar can actually hold them. Nothing is hidden at a width
   where it fits today; every width where these take effect is a width
   that currently clips the switcher off the screen entirely.

   flex-wrap:wrap underneath is the failsafe. If a translation or a
   later copy change makes a row longer than the measurements above,
   the bar gains a line instead of throwing the language control out
   of the viewport again.
   ------------------------------------------------------------------ */
.af-announce__inner{
  flex-wrap:wrap!important;
  row-gap:8px;
  align-content:center;
}

/* Five items need 1500px. Below that the production claim stands down;
   it is the one message of the four that asks for nothing. */
@media (max-width:1499px){
  .af-announce__item--made{display:none!important}
}

/* Four items need 1200px. Below that the opening hours stand down -
   they are also on the contact page, and the shipping threshold and
   the way to reach a human are what move an order. */
@media (max-width:1199px){
  .af-announce__item--hours{display:none!important}
}

/* Hungarian is the long language on this site, so the same threshold
   that fits in Romanian wraps in Hungarian. Measured at 17px:

     item            RO    EN    HU
     opening hours  358   365   395
     free shipping  352   315   410
     contact        207   233   227
     four items    1181  1176  1297
     five items    1447  1433  1539

   Setting one threshold to the longest language would cost Romanian -
   the shop's first language and nearly all of its traffic - two
   messages at widths where it has the room for them. So the thresholds
   move with the language instead. This can only ever hide more, never
   show something back at a width where it does not fit.
   ------------------------------------------------------------------ */
@media (max-width:1579px){
  html[lang|="hu"] .af-announce__item--made{display:none!important}
}
@media (max-width:1339px){
  html[lang|="hu"] .af-announce__item--hours{display:none!important}
}

/* ------------------------------------------------------------------
   2. THE BUTTON — a control you can hit

   79x30 measured at every width. 48px tall and at least 48 wide now,
   which is the project's preferred target rather than the 44px floor,
   because this is pressed with a thumb on a phone held one-handed.

   The font is also restated as longhands. ux.css declares
   `font:600 12px/1 inherit` on this button, and `inherit` is not a
   valid family in the font shorthand, so the browser drops the whole
   declaration - which is why the code rendered at 14px and at normal
   weight rather than the 12px/600 that rule appears to ask for. The
   size was wrong in both directions: the intended 12px is illegible
   and the accidental 14px is still under the site's 16-17px body.
   ------------------------------------------------------------------ */
.af-lang{
  position:relative;
  flex:0 0 auto;
}

.af-lang__btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  min-height:48px;
  min-width:48px;
  padding:0 14px;
  border-radius:12px;
  /* .24 alpha on near-black is a hairline at arm's length; this has to
     read as a pressable edge to someone who is not looking for it. */
  border:1px solid rgba(255,255,255,.38);
  background:rgba(255,255,255,.12);
  color:#fff;
  font-family:inherit;
  font-size:16px;
  font-weight:600;
  line-height:1;
  letter-spacing:.04em;
  cursor:pointer;
}

.af-lang__btn:hover{background:rgba(255,255,255,.22)}

/* The open state is worth showing on the button itself: with the menu
   pinned to the bar on a phone (below) it no longer hangs off the
   button, so the button has to say it is the thing that opened it. */
.af-lang[data-open="true"] .af-lang__btn{
  background:rgba(255,255,255,.24);
  border-color:rgba(255,255,255,.62);
}

/* Icons grow with the button - a 14px globe inside a 48px control
   reads as a speck. */
.af-lang__globe{width:18px;height:18px;flex:none;opacity:.85}
.af-lang__chev{width:10px;flex:none;opacity:.8}

.af-lang__cur{
  font-size:16px;
  font-weight:600;
  font-variant-numeric:tabular-nums;
}

/* ------------------------------------------------------------------
   3. THE MENU, ON A PHONE — pinned to the bar, not to the button

   Below 768px the menu stops being a popover hanging off a 100px-wide
   button near the right edge and becomes a panel inset 16px from both
   sides of the announcement bar itself. .af-lang goes position:static
   so the bar is the containing block, which makes the panel's position
   arithmetic independent of where the button happens to land after the
   bar wraps. The previous approach - right:0, or left:0 below 768 -
   is only ever as safe as the button's own x position, and the button
   moves with the copy in the bar and with the language of the page.

   Capped at 360px so it does not stretch into a banner at 767px.
   ------------------------------------------------------------------ */
.af-lang__menu{
  position:absolute;
  z-index:1200;
  min-width:216px;
  padding:6px;
  background:#fff;
  border:1px solid rgba(0,0,0,.12);
  border-radius:14px;
  box-shadow:0 18px 44px -12px rgba(0,0,0,.34);
  /* Closed means gone, not merely invisible. opacity:0 alone left the
     three language links in the tab order and in the accessibility
     tree on every page - and, because their own computed opacity is 1,
     they counted as visible overflowing elements even while shut. */
  visibility:hidden;
  opacity:0;
  transform:translateY(-6px);
  pointer-events:none;
  transition:opacity .25s cubic-bezier(.2,.6,.2,1),
             transform .35s cubic-bezier(.16,1,.3,1),
             visibility 0s linear .25s;
}

.af-lang[data-open="true"] .af-lang__menu{
  visibility:visible;
  opacity:1;
  transform:none;
  pointer-events:auto;
  transition:opacity .25s cubic-bezier(.2,.6,.2,1),
             transform .35s cubic-bezier(.16,1,.3,1),
             visibility 0s;
}

@media (max-width:767px){
  .af-lang{position:static}

  .af-announce__inner{position:relative}

  .af-lang__menu{
    top:calc(100% + 10px);
    right:16px;
    left:auto;
    width:calc(100% - 32px);
    max-width:360px;
  }
}

/* From 768px up the bar is wide, the button has hundreds of pixels of
   clear space to its left, and a popover hung off the control is the
   better reading of the interaction. Measured button right edges with
   the bar fixed above: 743 at 768, 807 at 834, 1097 at 1024, 1849 at
   1920 - the widest the panel can be is 360, so it always clears the
   left edge. max-width is kept as a belt on top of that. */
@media (min-width:768px){
  .af-lang__menu{
    top:calc(100% + 10px);
    right:0;
    left:auto;
    max-width:calc(100vw - 32px);
  }
}

/* ------------------------------------------------------------------
   4. THE OPTIONS — 172x36 before, and an 11.9px code inside them

   56px rows on a phone, 48px from tablet up. Three rows is a short
   list, so the extra height costs nothing and buys a target that can
   be hit while walking.

   Sizes in px, not em. The code was .85em of whatever the row was,
   which is how it arrived at 11.9px; naming the size stops the next
   change to the row from dragging it back under the 13px floor.
   ------------------------------------------------------------------ */
.af-lang__opt{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  min-height:48px;
  padding:0 12px;
  border-radius:10px;
  color:#1d1d1f!important;
  font-size:16px;
  font-weight:500;
  text-decoration:none!important;
}

.af-lang__name{font-size:16px}

.af-lang__code{
  margin-left:auto;
  /* 11.9px -> 15px, and #6e6e73 -> #55565a: 4.9:1 on white was a pass
     on paper and a squint in a field. #55565a is 6.6:1. */
  font-size:15px;
  font-weight:600;
  color:#55565a;
  letter-spacing:.04em;
}

.af-lang__tick{width:18px;height:18px;flex:none}

/* The pressed language should be legible as the pressed one without
   relying on the tick alone - a 2px-stroke tick is not a colour-blind
   -safe signal on its own, and weight plus ground is. */
.af-lang__opt[aria-current="true"]{
  background:#f1f7ef;
  font-weight:600;
}

.af-lang__opt:hover,
.af-lang__opt:focus-visible{background:#e8f2e4}

@media (max-width:767px){
  .af-lang__opt{min-height:56px;padding:0 14px}
  .af-lang__name{font-size:17px}
  .af-lang__code{font-size:16px}
}

/* ------------------------------------------------------------------
   5. FOCUS

   Kept from ux.css and restated because the radii changed: a 2px ring
   at the new offsets, white on the dark bar and green on the panel.
   ------------------------------------------------------------------ */
.af-lang__btn:focus-visible{outline:2px solid #fff;outline-offset:2px}
.af-lang__opt:focus-visible{outline:2px solid #1b5e20;outline-offset:-2px}

@media (prefers-reduced-motion:reduce){
  .af-lang__btn,
  .af-lang__chev,
  .af-lang__menu,
  .af-lang__opt{transition:none!important}
}
