/* Phones and touch screens (mobile review 2026-11-02, docs/mobile-review-2026-11-02.md).
   Loaded last. Two rules run through it:
   - Every tap target is at least 44 px tall (Apple HIG; WCAG 2.2 asks for 24). Links grow in height, not in
     look: the extra space is padding above and below the words, and drawn underlines keep their distance.
   - Below 768 px, blocks that were built for a wide screen take a compact form, so a page stays easy to take in. */

/* ==== Tap targets: touch screens and everything below 960 px ==== */
@media (max-width: 959px), (pointer: coarse) {
  /* Text links and the film link: 44 px tall; the drawn underline stays 6 px under the words */
  a.st-more,
  .st-film .btn,
  a.btn.st-film,
  .st-wine__buy a.st-more.st-cart,
  .woocommerce-cart-form .st-coupon-toggle {
    min-height: 44px !important;
    padding-top: 11px !important;
    padding-bottom: 11px !important;
    background-position: left bottom 5px !important;
  }
  .st-opening a.btn.st-film { background-position: 22px bottom 5px !important; }
  a.st-more::after,
  .st-film .btn::after,
  a.btn.st-film::after { bottom: 5px; }

  /* A link alone in a facts line (phone, e-mail on Kontakt, Impressum, Heuriger hours): taller hit area, same line */
  dl.st-facts dd > a:only-child {
    display: inline-block;
    padding: 10px 0;
    margin: -10px 0;
  }

  /* Footer lists: a link line is 44 px; a note under a link (hours, "auch per WhatsApp") stays close to it */
  .site-footer .st-plain li:has(> a) { padding: 0; }
  .site-footer .st-plain li > a {
    display: inline-block;
    padding: 10px 0;
  }
  .site-footer .st-plain li:has(> a) + li.st-footer-note { margin-top: -8px; }
  /* Base line: copyright · legal links · credit */
  .st-footer-base a {
    display: inline-block;
    padding: 12px 0;
  }

  /* Speisekarte tabs */
  .st-menu .nav-tabs > li > a,
  .st-menu .tab-container .nav-tabs > li > a {
    min-height: 44px;
    padding: 15px 0 8px !important;
  }

  /* Shop pagination: shop.css (small print, 44 px targets at every width) */

  /* Cart: "Entfernen", the wine's name and "Versandkosten berechnen" get a 44 px hit area on the same line */
  .woocommerce-cart-form .product-remove a.remove,
  .woocommerce-cart-form .product-data__name > a,
  .cart_totals a.shipping-calculator-button {
    display: inline-block;
    padding: 12px 0 !important;
    margin: -12px 0 !important;
  }
  .woocommerce-cart-form .product-remove a.remove {
    width: auto !important;
    height: auto !important;            /* WooCommerce sizes the remove link to one em */
    line-height: 20px !important;
  }

  /* Breadcrumb links */
  .breadcrumb a,
  .woocommerce-breadcrumb a {
    display: inline-block;
    padding: 12px 0;
    margin: -12px 0;
  }

  /* Film loop controls: the pause icon in openings, the "Video anhalten" word on bands and half pages */
  .vc_row.st-opening .st-loop-toggle {
    width: 44px;
    height: 44px;
  }
  .vc_row.st-opening .st-loop-toggle::before { left: 17px; }
  .vc_row.st-opening .st-loop-toggle::after { left: 24px; }
  .vc_row.st-opening .st-loop-toggle[aria-pressed="true"]::before { left: 18px; }
  .st-loop-frame .st-loop-toggle {
    min-height: 44px;
    padding: 0 0 0 12px;
    bottom: 5px;
  }
}

/* ==== Header (below 960 px): search and cart are 44 px squares beside the menu button ==== */
@media (max-width: 959px) {
  .mobile-additional-icons .mobile-additional-icon {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
  }
  /* the count stands beside the bag inside the square */
  .mobile-additional-icons .mobile-shopping-cart .cart-icon-container { position: relative; }
}

/* ==== Phone numbers in page text read as links, like the e-mail address beside them (the footer keeps its plain
   links) ==== */
.post-content .uncode_text_column :is(p, dd, li) > a.st-nowrap[href^="tel:"] {
  color: var(--st-cream);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(236, 228, 214, .38);
  text-underline-offset: .22em;
}
.post-content .uncode_text_column :is(p, dd, li) > a.st-nowrap[href^="tel:"]:hover { text-decoration-color: var(--st-gold); }

/* ==== Mobile menu (below 960 px): one face, no false chevrons, and a quick block under the items ==== */
.st-menu-quick { display: none; }
@media (max-width: 959px) {
  /* the submenu in Literata, one step smaller and softer than its parent; no "›", which promised another level.
     #masthead: Uncode's mobile menu size (30 px, eight classes of :not() chains) otherwise wins over 1.3125rem */
  html body #masthead .main-menu-container .menu-smart .drop-menu li > a,
  html body #masthead .main-menu-container .menu-smart .drop-menu a span {
    font-family: var(--st-serif) !important;
    font-size: 1.3125rem !important;
    font-weight: 430 !important;
    letter-spacing: 0 !important;
    line-height: 1.3 !important;
  }
  /* the items themselves at the size uncode.css means (28 px on a phone, 38 px on a tablet); the same Uncode rule
     pinned them at 30 px */
  html body #masthead .main-menu-container .menu-smart > li > a {
    font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.5rem) !important;
  }
  /* the list starts on the parent's edge (Uncode indents it 41 px, on no line of the page) */
  html body .main-menu-container .menu-smart .drop-menu li > a {
    padding-top: 9px !important;
    padding-bottom: 9px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
  }
  .main-menu-container .menu-smart .drop-menu a .fa-dropdown,
  .main-menu-container .menu-smart .drop-menu a i[class*="fa-angle"],
  .main-menu-container .menu-smart > li > a .fa-dropdown { display: none !important; }
  .main-menu-container .menu-smart .drop-menu { padding-bottom: 14px !important; }

  /* Weingut: the word is a link; the chevron beside it is its own 44 px button (strommer.js) and turns over while
     the list is open */
  .main-menu-container .menu-smart > li:has(> .st-sub-toggle) {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
  }
  .main-menu-container .menu-smart > li > .st-sub-toggle + ul { flex: 0 0 100%; }
  .st-sub-toggle {
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--st-cream-soft);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .st-sub-toggle svg {
    width: clamp(18px, 12px + 1.2vw, 22px);   /* grows with the word: 18 px on a phone, 21 px at 768 */
    height: clamp(18px, 12px + 1.2vw, 22px);
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
    translate: 0 2px;   /* on the middle of the word's x-height, not of its line box */
    transition: rotate var(--st-standard) var(--st-ease);
  }
  .st-sub-toggle[aria-expanded="true"] svg { rotate: -180deg; }
  .st-sub-toggle:focus:not(:focus-visible) { outline: 0; }
  .st-sub-toggle:focus-visible { outline-offset: -6px; }   /* the ring stays inside the button, clear of the word */

  /* one mark, on the page you are on: a section's word carries it only while its list is closed */
  .main-menu-container .menu-smart > li:is(.current-menu-ancestor, .current_page_parent):has(> .st-sub-toggle[aria-expanded="true"]) > a {
    text-decoration: none !important;
  }
  html body #masthead .main-menu-container .menu-smart .drop-menu li.current-menu-item > a {
    color: var(--st-cream) !important;
    text-decoration: underline 1px var(--st-gold) !important;
    text-underline-offset: .28em;
  }

  /* Heuriger hours, "Anrufen" and "Route planen" (inc/menu.php): what a phone visitor opens a winery's menu for */
  .st-menu-quick {
    display: block;
    margin-top: var(--st-space-l);
    max-width: 34rem;
  }
  .st-menu-quick__label {
    margin: 0 0 6px;
    font: 460 var(--st-fs-meta)/1.4 var(--st-sans);
    letter-spacing: .012em;
    color: var(--st-cream-soft);
  }
  .st-menu-quick__line {
    margin: 0;
    font: 460 var(--st-fs-ui)/1.5 var(--st-sans);
    letter-spacing: .012em;
    color: var(--st-cream);
  }
  .st-menu-quick__line--soft { color: var(--st-cream-soft); }
  .st-menu-quick__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
    margin-top: 22px;
  }
  /* it arrives with the items: after the last one (motion.css staggers them by 30 ms) */
  .st-menu-quick { transition: opacity var(--st-exit) var(--st-ease-exit), translate var(--st-exit) var(--st-ease-exit); }
  html:not(.st-menu-open) .st-menu-quick { opacity: 0; translate: 0 8px; }
  html.st-menu-open .st-menu-quick {
    transition: opacity var(--st-standard) var(--st-ease), translate var(--st-standard) var(--st-ease);
    transition-delay: 300ms;
  }
}
@media (max-width: 959px) and (prefers-reduced-motion: reduce) {
  html:not(.st-menu-open) .st-menu-quick { translate: none; }
  html.st-menu-open .st-menu-quick { transition: none; }
}

/* ==== Openings without a film link (Heuriger, shop): the pause icon closes the block on the right margin, a
   control in the corner rather than a stray line under the first button ==== */
@media (max-width: 959px) {
  .vc_row.st-opening .wpb_column.st-opening-aside:not(:has(.st-film)) .uncont {
    justify-content: flex-end;
    margin-top: 6px;
  }
  .vc_row.st-opening .wpb_column.st-opening-aside:not(:has(.st-film)) .st-loop-toggle { margin-right: -12px !important; }
}

/* ==== Speisekarte tabs on phones: the row runs to the window edge (the WPBakery wrappers clipped it at the
   margin, so the fourth tab was hidden), a fade says there is more; strommer.js drops the fade at the end ==== */
@media (max-width: 767px) {
  .st-menu .vc_tta-tabs-container,
  .st-menu .vc_tta-tabs-scroller { overflow: visible !important; }
  .st-menu .nav-tabs > li > a,
  .st-menu .tab-container .nav-tabs > li > a { margin-right: 24px !important; }
  .st-menu .nav-tabs {
    scroll-padding-inline-end: 64px;      /* a chosen tab scrolls clear of the fade */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent);
  }
  .st-menu .nav-tabs.st-tabs-end {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* ==== Family (home) on phones: drawing beside name and line, three short rows instead of two screens ==== */
@media (max-width: 767px) {
  ul.st-portraits { gap: var(--st-space-m); }
  ul.st-portraits > li {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-rows: auto 1fr;           /* the drawing's extra height goes under the text, not between name and line */
    column-gap: 18px;
    align-items: start;
  }
  ul.st-portraits img {
    grid-row: 1 / span 2;
    width: 112px !important;
    margin: -8px 0 0 -8px;          /* the drawings have air on their left and top */
  }
  ul.st-portraits h3 {
    grid-column: 2;
    font-size: 1.3rem !important;
    margin: 0 0 6px !important;
  }
  ul.st-portraits p {
    grid-column: 2;
    margin: 0 !important;
    font-size: 1rem;
    line-height: 1.55;
  }
  ul.st-portraits > li > br { display: none; }   /* wpautop's line break after the drawing would take a grid cell */
}

/* ==== Wine shelf (home) on phones: one wine per line, the plate on the left, name, note, price and the cart
   link on the right, like a wine list ==== */
@media (max-width: 600px) {
  ul.st-wines,
  ul.st-wines:has(> li:nth-child(2):last-child),
  ul.st-wines:has(> li:nth-child(3):last-child) {
    grid-template-columns: minmax(0, 1fr) !important;
    row-gap: var(--st-space-m);
  }
  .st-wine {
    display: grid;
    grid-template-columns: 38% minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    column-gap: 18px;
  }
  /* The plate's height comes from its ratio. Safari does not resolve the image's height: 100% against a height that
     comes only from aspect-ratio (it fell back to the image's height attribute: a bottle drawn two to four times too
     large, mostly out of the plate), so the image is laid over the plate absolutely. */
  .st-wine > .st-plate {
    grid-row: 1 / span 3;
    align-self: start;
    position: relative;
    height: auto;
    aspect-ratio: 3 / 4;
  }
  .st-wine > .st-plate img {
    position: absolute;
    inset: 0;
  }
  .st-wine__name {
    grid-column: 2;
    margin: 2px 0 6px !important;
  }
  .st-wine__meta {
    grid-column: 2;
    margin: 0 0 14px !important;
  }
  .st-wine__buy {
    grid-column: 2;
    align-self: end;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 2px;
  }
}

/* ==== Product names: no hyphen in a word that fits on a line of its own ("Welschriesling 2023" breaks before the
   year, not inside the name); long compounds such as "Geschenkgutschein" still break ==== */
.tmb-woocommerce .t-entry-title,
.tmb-woocommerce .t-entry-title a {
  hyphenate-limit-chars: 15 6 6;
}

/* ==== Product page on phones: the breadcrumb is the way back, so it leaves out the current wine (the h1 below
   names it) ==== */
@media (max-width: 767px) {
  .single-product .breadcrumb > li:last-child:not(:first-child),
  .single-product .woocommerce-breadcrumb .breadcrumb-last { display: none; }
}

/* ==== Rhythm below 960 px (2026-11-03): no photo directly under another photo, no doubled gaps ==== */

/* Chapters on phones: 72 px instead of 88 (the clamp's floor was set for wider screens) */
@media (max-width: 599px) {
  :root { --st-section: 72px; }
}

@media (max-width: 959px) {
  /* Half rows put the photo first (components.css). Where that photo would land right under the previous photo
     (Heuriger after its film opening), st-half--text-first on the row puts the text first */
  .vc_row.st-half.st-half--text-first > .row > .row-inner > .wpb_column:is(.st-bleed-l, .st-bleed-r) { order: 1; }

  /* A photo that only works beside its text: shown from 960 px. Used where stacking cannot avoid two photos in a
     row (Geschichte: film band, then the Grundstein portrait) */
  .vc_row.st-grid > .row > .row-inner > .wpb_column.st-wide-only { display: none !important; }

  /* The first chapter after a film opening: the opening's foot is already dark space (its bottom padding and fade) */
  .vc_row.st-opening + .vc_row.st-section > .row-parent { padding-top: var(--st-space-m) !important; }

  /* Footer: the last chapter's bottom space already separates it; the footer adds less before the emblem */
  .vc_row.st-footer > .row-parent { padding-top: var(--st-space-l) !important; }

  /* Product page: the product row's bottom padding is the gap to "Weitere Weine"; the related row adds none */
  .vc_row.st-product.st-related > .row { padding-top: 0 !important; }

  /* Speisekarte: one column is long, so the panes do not share one cell here (that kept the tallest pane's height
     and left a screen of empty space under "Süßes"); only the chosen pane takes room */
  .st-menu .tab-content > .tab-pane:not(.active) {
    max-height: 0;
    overflow: hidden;
  }
}

/* ==== The Weingut chevron button exists for the mobile menu only ==== */
.st-sub-toggle { display: none; }
@media (max-width: 959px) {
  .main-menu-container .st-sub-toggle { display: inline-flex; }
}
@media (max-width: 959px) and (hover: hover) {
  .st-sub-toggle:hover { color: var(--st-cream); }
}
@media (prefers-reduced-motion: reduce) {
  .st-sub-toggle svg { transition: none; }
}
