/*
 * Thimbly – default theme "base" (design system: storefront base theme, .th-store).
 * Loaded after thimbly/tokens.css and thimbly/components.css; this file only adds the page layout.
 * Merchant colours, corners and font arrive as CSS variables from the shop settings (Admin › Design);
 * the components read them through the --ui-* layer, derived colours come from the theme validator.
 */

body.th-store { container-type: inline-size; min-height: 100vh; display: flex; flex-direction: column; }
html { -webkit-text-size-adjust: 100%; }

h1, h2, h3 { margin: 0; }
a { color: var(--ui-primary-text); text-underline-offset: .18em; }
img { height: auto; }

.t-skip { position: absolute; left: var(--space-4); top: -4rem; z-index: 10; padding: var(--space-3) var(--space-4); background: var(--ui-surface); color: var(--ui-text); border-radius: var(--ui-radius); }
.t-skip:focus { top: var(--space-4); }

.th-wrap { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-4); }
.th-main { flex: 1; padding-top: var(--space-6); padding-bottom: var(--space-16); }
.th-main:focus { outline: none; }
.th-main > * + * { margin-top: var(--space-6); }
.th-h1 { font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -0.005em; }
.th-h2 { font-size: 20px; line-height: 28px; font-weight: 700; }
.th-narrow { max-width: 480px; }
.th-medium { max-width: 720px; }

/* Header: brand, navigation, account and cart; the navigation collapses into the menu button below 900 px. */
.th-store .t-header { position: relative; }
.th-store .t-header__brand { display: flex; flex-direction: column; justify-content: center; color: var(--ui-text); text-decoration: none; font-weight: 700; font-size: 18px; line-height: 24px; letter-spacing: .02em; margin-right: var(--space-4); }
.th-store .t-header__brand small { font-weight: 400; font-size: 13px; line-height: 18px; color: var(--ui-text-muted); letter-spacing: 0; }
.th-spacer { flex: 1; }
/* Currency switcher (only in shops with further currencies): a compact native select. */
.th-currency { display: flex; align-items: center; margin-right: var(--space-2); }
.th-currency select { min-height: 32px; padding: 0 var(--space-2); border: 1px solid var(--ui-border); border-radius: var(--radius-sm); background: var(--ui-surface); color: var(--ui-text); font: inherit; font-size: 13px; font-weight: 600; }
/* Language switcher (only in shops with several languages): short codes, the current one highlighted. */
.th-languages { display: flex; gap: 2px; margin-right: var(--space-2); }
.th-languages a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 0 var(--space-1, 4px); border-radius: var(--radius-sm); color: var(--ui-text-muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-decoration: none; }
.th-languages a:hover { color: var(--ui-text); background: var(--ui-surface); }
.th-languages a[aria-current] { color: var(--ui-text); text-decoration: underline; text-underline-offset: 4px; }
.th-store .t-header[data-open] .t-nav { display: flex; flex-direction: column; position: absolute; left: 0; right: 0; top: 100%; z-index: 5; padding: var(--space-2) var(--space-4) var(--space-4); background: var(--ui-surface); border-bottom: 1px solid var(--ui-border); box-shadow: var(--shadow-md); }

/* Footer: shop, legal links (mandatory), copyright and the "powered by" note. */
.th-store .t-footer { margin-top: auto; }
.th-store .t-footer ul { list-style: none; margin: 0; padding: 0; }
.th-store .t-footer li a { display: inline-flex; align-items: center; min-height: 32px; color: var(--ui-text); }
.th-store .t-footer__base { max-width: var(--content-max); margin: 0 auto; padding: var(--space-4); border-top: 1px solid var(--ui-border); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; color: var(--ui-text-muted); }

/* Home and product grid */
.th-hero { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-8) 0; max-width: 46rem; }
.th-hero p { margin: 0; }
.th-lead { font-size: 18px; line-height: 28px; color: var(--ui-text-muted); }
.th-highlights { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.th-highlights li { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-4); border-radius: var(--ui-radius); background: var(--ui-sunken); }

/* Sections of the theme editor (ADR-053) */
/* Video section (ADR-058) */
.th-video { margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.th-video video, .th-video iframe, .th-video__play { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--ui-radius); background: var(--ui-sunken); }
.th-video__play { display: flex; flex-direction: column; gap: var(--space-2); align-items: center; justify-content: center; cursor: pointer; background-size: cover; background-position: center; color: var(--ui-text); }
.th-video__play small { background: var(--ui-surface); padding: 2px var(--space-2); border-radius: var(--ui-radius-sm); }
/* Theme settings (ADR-057): heading font, card style, button labels, colour schemes per section. */
body.th-store { overflow-x: clip; }
.th-store .th-h1, .th-store .th-h2, .th-store h1, .th-store h2, .th-store h3, .th-store .t-header__brand { font-family: var(--font-heading, var(--ui-font)); }
.th-store .t-pcard__img { box-shadow: var(--card-shadow, none); border-radius: var(--ui-radius); overflow: hidden; }
.th-store .t-btn { text-transform: var(--button-transform, none); }
/* The tokens of the design system (thimbly/components.css, .th-store) derived again from the scheme's colours. */
.th-scheme {
  --ui-primary: var(--color-primary);
  --ui-on-primary: var(--color-on-primary);
  /* hover/active: emitted by the theme validator (OKLCH lightness moved away from on-primary, each ≥ 4.5:1);
     the fallback darkens, which is right for the common light-label-on-dark-primary case */
  --ui-primary-hover: var(--color-primary-hover, color-mix(in oklab, var(--color-primary) 84%, #000));
  --ui-primary-active: var(--color-primary-active, color-mix(in oklab, var(--color-primary) 72%, #000));
  --ui-primary-text: var(--color-primary-text, var(--color-primary)); /* validator emits --color-primary-text when primary < 4.5:1 on bg */
  --ui-primary-soft: color-mix(in oklab, var(--color-primary) 8%, var(--color-bg));
  --ui-bg: var(--color-bg); --ui-surface: var(--color-surface);
  --ui-sunken: color-mix(in oklab, var(--color-text) 4%, var(--color-surface));
  --ui-text: var(--color-text);
  --ui-text-muted: color-mix(in oklab, var(--color-text) 72%, var(--color-bg));
  --ui-border: color-mix(in oklab, var(--color-text) 14%, var(--color-bg));
  --ui-border-strong: color-mix(in oklab, var(--color-text) 58%, var(--color-bg));
  --ui-focus: var(--color-text);
  --ui-success: var(--sf-success); --ui-success-soft: var(--sf-success-soft); --ui-warning: var(--sf-warning); --ui-warning-soft: var(--sf-warning-soft);
  --ui-danger: var(--sf-danger); --ui-danger-hover: var(--red-800); --ui-danger-soft: var(--sf-danger-soft); --ui-on-danger: #ffffff;
  --ui-info: var(--sf-info); --ui-info-soft: var(--sf-info-soft);
  --ui-radius: var(--radius); --ui-radius-sm: calc(var(--radius) / 2); --ui-radius-lg: calc(var(--radius) * 1.5);
  --ui-font: var(--font-body); --ui-font-display: var(--font-body);
  font-family: var(--ui-font); color: var(--ui-text); background: var(--ui-bg);
}
.th-scheme { background: var(--ui-bg); color: var(--ui-text); margin-inline: calc(50% - 50vw); padding: var(--section-gap, var(--space-12)) calc(50vw - 50%); }
.th-scheme > :first-child { margin-top: 0; }
.th-header--sticky { position: sticky; top: 0; z-index: 20; }
.th-logo { display: block; max-width: 100%; height: auto; }
.th-dropdown { position: relative; }
.th-dropdown summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-dropdown summary::-webkit-details-marker { display: none; }
.th-dropdown ul { list-style: none; margin: 0; padding: var(--space-2); position: absolute; top: 100%; left: 0; z-index: 10; min-width: 200px; background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); box-shadow: var(--shadow-md); }
.th-dropdown ul a { display: block; padding: var(--space-2); }
.th-announcement { padding: .6rem 1rem; text-align: center; font-size: 14px; }
.th-announcement a { color: inherit; }
.th-announcement--primary { background: var(--color-primary); color: var(--color-on-primary, #fff); }
.th-announcement--neutral { background: var(--ui-sunken); color: var(--ui-text); }
.th-social { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3); }
@media (min-width: 900px) { .th-product--media-right .th-product__media { order: 2; } .th-product--media-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); } }
.th-collapsible { border-top: 1px solid var(--ui-border); border-bottom: 1px solid var(--ui-border); padding: var(--space-3) 0; }
.th-collapsible + .th-collapsible { border-top: 0; }
.th-collapsible summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.th-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.th-chips a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--space-3); border-radius: 999px; border: 1px solid var(--ui-border); color: var(--ui-text); text-decoration: none; font-size: 14px; }
.th-chips a[aria-current] { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary, #fff); }
.th-search { display: flex; flex-wrap: wrap; gap: var(--space-2); max-width: 40rem; }
.th-search .t-input { flex: 1 1 16rem; }
.th-main > .th-section, .th-main > section + section, .th-main > .th-scheme { margin-top: var(--section-gap, var(--space-12)); }
.th-section__head { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: baseline; justify-content: space-between; }
.th-hero--center { align-items: center; text-align: center; margin-inline: auto; }
.th-hero--image { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: center; }
@media (min-width: 900px) { .th-hero--image { grid-template-columns: 1fr 1fr; } }
.th-hero__text { display: flex; flex-direction: column; gap: var(--space-4); }
.th-hero__img, .th-imagetext img, .th-tile img { width: 100%; height: auto; border-radius: var(--ui-radius); object-fit: cover; }
.th-hero__img { aspect-ratio: 3 / 2; height: auto; }
.th-imagetext { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: center; }
@media (min-width: 900px) { .th-imagetext { grid-template-columns: 1fr 1fr; } .th-imagetext--right img { order: 2; } }
.th-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.th-tile { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border-radius: var(--ui-radius); background: var(--ui-sunken); color: var(--ui-text); text-decoration: none; font-weight: 600; }
.th-tile:hover { text-decoration: underline; }
.th-quotes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.th-quotes figure { margin: 0; padding: var(--space-6); border-radius: var(--ui-radius); background: var(--ui-sunken); display: flex; flex-direction: column; gap: var(--space-3); }
.th-quotes blockquote { margin: 0; font-size: 17px; line-height: 26px; }
.th-quotes blockquote p { margin: 0; }
.th-faq { display: flex; flex-direction: column; border-top: 1px solid var(--ui-border); }
.th-faq details { border-bottom: 1px solid var(--ui-border); padding: var(--space-3) 0; }
.th-faq summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.th-faq details > div { padding-top: var(--space-2); }
.th-gap--small { height: var(--space-4); } .th-gap--medium { height: var(--space-8); } .th-gap--large { height: var(--space-16, 64px); }
.th-gap { display: flex; align-items: center; }
.th-gap hr { width: 100%; border: 0; border-top: 1px solid var(--ui-border); margin: 0; }
.th-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-8) var(--space-4); grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.t-pcard__img img { width: 100%; height: 100%; object-fit: cover; }

/* Product page */
.th-product { display: grid; gap: var(--space-8); grid-template-columns: 1fr; align-items: start; }
@container (min-width: 900px) {
    .th-product--media { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-12); }
    .th-product__media { position: sticky; top: var(--space-4); }
}
.th-product__media { display: grid; gap: var(--space-2); }
.th-product__media img { width: 100%; border-radius: var(--ui-radius-lg); }
.th-product__info { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; max-width: 720px; }
.th-product__head { display: flex; flex-direction: column; gap: var(--space-2); }
.th-product__head p { margin: 0; }
.th-buy { display: flex; flex-wrap: nowrap; gap: var(--space-3); align-items: center; }
.th-buy .t-btn { flex: 1; }
.t-qty input { min-height: 42px; }
.t-qty input, .t-affix input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
:is(.t-qty, .t-affix) input::-webkit-outer-spin-button, :is(.t-qty, .t-affix) input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.th-status { margin: 0; min-height: 24px; }
/* Stock notice (ADR-066) */
.th-stock { margin: 0; display: flex; gap: var(--space-1); align-items: center; font-size: 14px; line-height: 20px; font-weight: 600; }
.th-stock--ok { color: var(--ui-success); }
.th-stock--low, .th-stock--backorder { color: var(--ui-warning); }
.th-stock--out { color: var(--ui-danger); }
.th-group-label { margin: var(--space-2) 0 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ui-text-muted); }
.th-livebox-total { font-size: 24px; line-height: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* The live price box sticks to the bottom on small screens only (design system Configurator). */
@container (min-width: 900px) { .t-livebox { position: static; } }

/* Rich text written by the merchant (product descriptions, legal pages) */
.t-prose h2, .t-prose h3 { margin: var(--space-6) 0 var(--space-2); }
.t-prose table { border-collapse: collapse; width: 100%; margin: 0 0 var(--space-4); font-size: 15px; }
.t-prose th, .t-prose td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--ui-border); vertical-align: top; }
.t-prose code { overflow-wrap: anywhere; }
.t-prose img { border-radius: var(--ui-radius); }

/* Cart */
.th-cart { display: grid; gap: var(--space-8); grid-template-columns: 1fr; align-items: start; }
@container (min-width: 880px) { .th-cart { grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-10); } }
.th-cart .t-cartline:last-child { border-bottom: 1px solid var(--ui-border); }
.t-cartline h3 a { color: inherit; }
.t-cartline__placeholder { width: 100%; height: 100%; background: var(--ui-sunken); }
.t-cartline__img img { width: 100%; height: 100%; object-fit: cover; }
.th-cartline-price { text-align: right; margin-left: auto; }

/* Checkout and order */
/* Notes spanning the summary (VAT, tax-free delivery) wrap; amounts keep their nowrap. The column gap becomes
   padding so that the line above the total runs through. */
.t-summary dl { column-gap: 0; }
.t-summary dd { padding-left: var(--space-4); }
.t-summary dd.is-vat { white-space: normal; text-align: left; padding-left: 0; }
.t-checkout__side { display: flex; flex-direction: column; gap: var(--space-4); }
.t-summary .t-cartline { grid-template-columns: 1fr; padding: var(--space-3) 0; }
.t-summary .t-cartline:first-child { border-top: 0; }
.th-address { font-style: normal; }
.th-details { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0; }
.th-details dt { font-weight: 600; }
.th-details dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* QR code for a bank transfer: always dark on white so that banking apps can read it (also in dark mode) */
.th-payment-qr { display: flex; align-items: center; gap: var(--space-4); margin: 0; }
.th-payment-qr__code { flex: none; width: 132px; padding: 6px; background: #fff; border-radius: var(--radius-sm); line-height: 0; }
.th-payment-qr__code svg { width: 100%; height: auto; }
.th-payment-qr figcaption { font-size: 14px; line-height: 20px; color: var(--text-muted); }
@media (max-width: 30rem) { .th-payment-qr { flex-direction: column; align-items: flex-start; } }
.th-columns { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Withdrawal function: a link with an icon in the footer and on order pages */
.th-withdraw { display: inline-flex; align-items: center; gap: 6px; }

/* Customer account */
.th-account-nav { display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center; border-bottom: 1px solid var(--ui-border); padding-bottom: var(--space-2); }
.th-account-nav a { display: inline-flex; align-items: center; min-height: var(--target-min); padding: 0 var(--space-3); border-radius: var(--ui-radius); color: var(--ui-text); text-decoration: none; font-weight: 500; }
.th-account-nav a:hover { background: var(--ui-sunken); }
.th-account-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--ui-primary); border-radius: 0; }
.th-account-nav form { margin: 0 0 0 auto; }
.th-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.th-tracking__title { margin-top: var(--space-4); font-size: var(--text-base, 1rem); }
.th-list > li { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; justify-content: space-between; }
.th-form { display: flex; flex-direction: column; gap: var(--space-4); }

/* Newsletter sign-up (section and footer block): address and button in one row, wrapping in narrow columns. */
.th-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.th-newsletter__form { display: flex; flex-direction: column; gap: var(--space-2); }
.th-newsletter__row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.th-newsletter__row .t-input { flex: 1 1 12rem; min-width: 0; }
.th-newsletter .t-choice { font-size: 14px; line-height: 20px; padding: 4px 0; }
.th-newsletter-section { padding: var(--space-8); border-radius: var(--ui-radius); background: var(--ui-sunken); }
.th-newsletter-section--center { text-align: center; margin-inline: auto; }
.th-newsletter-section--center .th-newsletter__row { justify-content: center; }
.th-newsletter-section--center .t-choice { text-align: left; }
.th-preview-note { padding: var(--space-4); border: 2px dashed var(--ui-border-strong); border-radius: var(--ui-radius); color: var(--ui-text-muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
