/* Pierlin skin, PHP engine additions. skin.css is the Node skin unchanged; this file only dresses
   what the PHP engine renders differently (the <dialog> popup of public/js/shop.js, links instead
   of client state) and the phone menu. No new look: the prototype's tokens and shapes. */

.pl-skip { position: absolute; left: -9999px; top: 8px; z-index: 400; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; }
.pl-skip:focus { left: 16px; }
[hidden] { display: none !important; }
/* The engine's base sheet (css/shop.css, loaded first for the engine's own views) makes body a flex column. */
body { display: block; min-height: 0; }

/* Phones: the prototype hides the menu under 980 px; a menu button opens it below the header. */
.pl-menu-btn { display: none; }
.pl-mobile-nav { border-top: 1px solid var(--line); padding: 8px 0 16px; }
.pl-mobile-nav a { display: block; padding: 12px 0; font-size: 16px; font-weight: 500; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.pl-mobile-nav a:last-child { border-bottom: none; }
.pl-mobile-nav a[aria-current="page"] { color: var(--ink); }
@media (max-width: 980px) {
  .pl-menu-btn { display: inline-flex; }
  .header-bar { grid-template-columns: auto 1fr; gap: 12px; }
  .header-actions { justify-self: end; gap: 2px; }
}
@media (min-width: 981px) { .pl-mobile-nav { display: none !important; } }
@media (max-width: 560px) {
  .container { padding: 0 16px; }
  .brand-logo { height: 38px; }
  .section { padding: 64px 0; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .footer-grid { gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
  .prod-grid, .prod-grid-3, .prod-grid.pl-cols { gap: 12px; }
  .product-card-body { padding: 14px; }
  .product-card-name { font-size: 16px; }
  .price { font-size: 18px; }
}
@media (max-width: 980px) {
  .prod-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Search overlay (prototype ⌘K). */
.pl-search { position: fixed; inset: 0; z-index: 250; background: rgba(42, 31, 26, 0.6); display: flex; justify-content: center; padding-top: 120px; }
.pl-search-box { background: var(--bg); width: min(640px, 92vw); height: fit-content; border-radius: 20px; padding: 12px; box-shadow: var(--shadow-lg); }
.pl-search-box input { flex: 1; min-width: 0; border: none; background: transparent; outline: none; font-size: 17px; padding: 8px 0; }

/* Cart drawer body (server-rendered by the cart page). */
.pl-drawer-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pl-drawer-content > .drawer-body { flex: 1; }
.drawer-line { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.drawer-line .pl-thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #fff; }
.pl-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Product popup: the engine kit opens a <dialog class="td-dialog">. */
dialog.td-dialog { border: none; margin: auto; padding: 32px; width: min(1000px, calc(100vw - 32px)); max-width: none; height: auto; max-height: calc(100vh - 48px); overflow: auto; background: var(--bg); color: var(--ink); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
dialog.td-dialog::backdrop { background: rgba(42, 31, 26, 0.5); }
.pl-dialog-bar { position: sticky; top: 0; height: 0; display: flex; justify-content: flex-end; z-index: 3; }
.pl-dialog-close { margin: -16px -16px 0 0; background: #fff; border: 1px solid var(--line); }
@media (max-width: 560px) {
  dialog.td-dialog { padding: 20px 16px; width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .pl-dialog-close { margin: -8px -4px 0 0; }
  .td-dialog .pl-product-grid { gap: 20px !important; padding: 0 !important; }
}
.pl-product-grid > * { min-width: 0; }

/* Buy box: quantity stepper and add button on one row, wrapping on phones. */
.pl-buy-row { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; flex-wrap: wrap; }
.pl-buy-row .btn { flex: 1; justify-content: center; min-width: 200px; }
.pl-buy-row .btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input { -moz-appearance: textfield; appearance: textfield; }
.pl-variant-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pl-variant-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pl-variant-pick label { cursor: pointer; }
.pl-variant-pick input:checked + .btn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pl-variant-pick input:focus-visible + .btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-tabs [role="tab"] { padding: 14px 20px; font-size: 14px; font-weight: 500; color: var(--ink-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pl-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pl-tabs-bar { display: flex; gap: 4px; margin-bottom: 28px; border-bottom: 1px solid var(--line); overflow-x: auto; }

/* Shop: sort select and pagination. */
.pl-sort { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; font-size: 13px; font-family: var(--font-mono); letter-spacing: 0.05em; outline: none; }
.pl-sort-form button { display: none; }
.no-js .pl-sort-form button, .pl-sort-form noscript button { display: inline-flex; }
@media (max-width: 980px) {
  .filter-side { gap: 18px; }
  .pl-filters-toggle { display: inline-flex !important; }
  .filter-side.pl-collapsed { display: none; }
}
.pl-filters-toggle { display: none; }

/* Cart and checkout: cards and rows. */
.pl-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.pl-cart-line { padding: 20px; display: grid; grid-template-columns: 100px 1fr auto; gap: 20px; border-bottom: 1px solid var(--line); }
.pl-cart-line:last-child { border-bottom: none; }
@media (max-width: 560px) {
  .pl-cart-line { grid-template-columns: 64px 1fr; gap: 12px; padding: 16px; }
  .pl-cart-line > .pl-cart-amount { grid-column: 2; text-align: left !important; }
  .pl-card { padding: 20px; }
}
.pl-option { display: flex; align-items: center; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; cursor: pointer; }
.pl-option:has(input:checked) { border: 2px solid var(--accent); padding: 17px; }
.pl-option.is-disabled { cursor: not-allowed; opacity: 0.6; }
.pl-option input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-chip { position: relative; }
.pl-chip input { position: absolute; opacity: 0; pointer-events: none; }
.pl-chip span { display: block; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 14px; line-height: 1.3; text-align: center; cursor: pointer; }
.pl-chip input:checked + span { border: 2px solid var(--accent); padding: 9px 13px; background: var(--bg-alt); }
.pl-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.steps button.step { padding: 0; }
@media (max-width: 560px) {
  .steps { gap: 6px; }
  .steps .step { font-size: 12px; gap: 6px; }
  .steps .step-bar { min-width: 8px; }
}
.pl-alert { padding: 14px 18px; border-radius: 12px; font-size: 14px; margin-bottom: 20px; }
.pl-alert-warn { background: rgba(245, 182, 66, 0.15); border: 1px solid var(--gold); }
.pl-alert-error { background: var(--td-color-brand-soft); border: 1px solid var(--accent); color: var(--accent-deep); }
.pl-alert-ok { background: var(--td-color-accent-soft); border: 1px solid var(--green); }

/* Sign-in and sign-up (the prototype's form cards). */
.pl-auth { max-width: 520px; margin: 0 auto; padding: 64px 0 80px; }
.pl-auth-wide { max-width: 760px; }
.pl-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pl-form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .pl-form-grid { grid-template-columns: 1fr; } .pl-auth { padding: 40px 0 64px; } }
.field .pl-error { font-size: 13px; color: var(--accent); }
.pl-check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.pl-check-row input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 3px; flex: none; }
.pl-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.pl-segment { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 4px; background: #fff; margin-bottom: 24px; }
.pl-segment a { padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.pl-segment a[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* Account: status chips. */
.pl-status { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--bg-alt); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.pl-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; font-size: 14px; margin: 0; }
.pl-dl dt { color: var(--ink-soft); }
.pl-dl dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .pl-dl { grid-template-columns: 1fr; gap: 2px; } .pl-dl dd { margin-bottom: 8px; } }

/* Long words in headings never widen the page on phones. */
h1, h2, h3 { overflow-wrap: anywhere; hyphens: auto; }

/* Category tiles with real photos: a soft shade under the name keeps it readable on white packs. */
.cat-tile-bg:has(img)::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(to top, rgba(42, 31, 26, 0.55), rgba(42, 31, 26, 0)); }
@media (max-width: 560px) { .pl-brands-cta { padding: 40px 20px !important; } }

/* Checkout without JavaScript: all steps show, the step buttons do not. */
form[data-pl-checkout]:not(.pl-js) .pl-js-only { display: none !important; }
@media (max-width: 560px) { .pl-pay-grid { grid-template-columns: 1fr !important; } }
/* The closed drawer casts no shadow onto the page edge. */
.drawer:not(.open) { box-shadow: none; visibility: hidden; transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 280ms; }
/* Phones: the floating hero keeps four small decorations at the edges, clear of the headline. */
@media (max-width: 560px) {
  .hero-floating { padding: 92px 0 96px; }
  .hero-floating .float { width: 58px !important; height: 58px !important; }
  .hero-floating .float:nth-child(1) { top: 2% !important; left: 3% !important; }
  .hero-floating .float:nth-child(2) { top: 3% !important; right: 3% !important; }
  .hero-floating .float:nth-child(3) { top: auto !important; bottom: 3% !important; left: 4% !important; }
  .hero-floating .float:nth-child(4) { top: auto !important; bottom: 4% !important; right: 4% !important; }
  .hero-floating .float:nth-child(n+5) { display: none; }
}
@media (max-width: 560px) {
  .product-card-foot > div:first-child { min-width: 0; }
  .product-card-foot .pl-sample { display: block; width: fit-content; margin: 4px 0 0; }
  .product-card-foot .add-btn { width: 34px; height: 34px; }
}
@media (max-width: 560px) {
  .pl-brand-tile { padding: 20px 12px !important; }
  .pl-brand-name { font-size: 22px !important; height: 64px !important; }
}
/* Engine views and blocks inside Pierlin's frame (news, 404, plain text blocks). */
main > .td-page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 48px 32px 80px; }
main > .td-page.td-narrow { max-width: 704px; }
@media (max-width: 560px) { main > .td-page { padding: 32px 16px 64px; } }
.pl-engine-blocks p + p, main > .td-page p + p { margin-top: 0.75em; }

/* Language menu (App\Support\LocaleAlternates). Same shapes as .icon-btn: a pill
   with the current code, a small card below with the client's languages. No JS: <details>. */
.pl-lang { position: relative; }
.pl-lang > summary { list-style: none; cursor: pointer; height: 40px; padding: 0 10px 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink); transition: background 120ms ease; }
.pl-lang > summary::-webkit-details-marker { display: none; }
.pl-lang > summary:hover, .pl-lang[open] > summary { background: var(--bg-alt); }
.pl-lang > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pl-lang[open] > summary svg { transform: rotate(180deg); }
.pl-lang-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 120; min-width: 180px; padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pl-lang-menu a { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 12px; border-radius: calc(var(--radius) - 4px); font-size: 14px; color: var(--ink-soft); }
.pl-lang-menu a:hover { background: var(--bg-alt); color: var(--ink); }
.pl-lang-menu a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.pl-lang-code { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-muted); }
.pl-mobile-nav .pl-mobile-lang { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 16px; }
.pl-mobile-nav .pl-mobile-lang a { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }
.pl-mobile-nav .pl-mobile-lang a[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
@media (max-width: 980px) { .pl-lang { display: none; } }
