/* International cart (lane INTL-S1): drawer, cart view, header button, product page Add button, cart page.
 * A static file on purpose: linked from <head> by Layout.astro only while intl.checkout is on, so with the flag off no
 * page, stylesheet or bundle changes. Tokens come from src/styles/tokens.css; .btn from store.scss. */

/* from IntlCart.astro */
.icart-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
html.icart-lock { overflow: hidden; }

/* drawer: bottom sheet on a phone, right-hand panel from 720px */
.icart-dialog { width: 100%; max-width: none; max-height: 92dvh; margin: auto 0 0; padding: 0; border: 0; border-radius: 12px 12px 0 0; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-float); overflow: hidden; }
.icart-dialog[open] { display: flex; flex-direction: column; }
.icart-dialog::backdrop { background: var(--scrim); }
.icart-panel { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; padding-bottom: env(safe-area-inset-bottom); }
.icart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.icart-head h2 { margin: 0; font-size: var(--fs-lg); line-height: var(--lh-tight); color: var(--navy); }
.icart-x { display: grid; place-items: center; width: 44px; height: 44px; background: none; border: 0; color: var(--navy); cursor: pointer; border-radius: var(--radius); }
.icart-x:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.icart-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
@media (min-width: 720px) {
  .icart-dialog { width: 420px; height: 100dvh; max-height: none; margin: 0 0 0 auto; border-radius: 0; }
}

/* one view = drawer body or the cart page: show only the block for data-state */
.icart-view [data-when] { display: none; }
.icart-view[data-state="empty"] [data-when="empty"],
.icart-view[data-state="loading"] [data-when="loading"],
.icart-view[data-state="error"] [data-when="error"],
.icart-view[data-state="ready"] [data-when="ready"] { display: block; }
.icart-empty, .icart-error { padding: 32px 0; text-align: center; }
.icart-empty p, .icart-error p { margin: 0 0 16px; color: var(--sub); }
.icart-loading { padding: 32px 0; color: var(--sub); text-align: center; margin: 0; }

.icart-lines { list-style: none; margin: 0; padding: 0; }
.icart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; grid-template-areas: "thumb info total" "thumb qty remove"; gap: 6px 12px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line); }
.icart-thumb { grid-area: thumb; width: 72px; height: 72px; background: var(--washi); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.icart-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.icart-info { grid-area: info; min-width: 0; }
.icart-name { display: block; color: var(--navy); font-weight: 600; font-size: var(--fs-sm); line-height: var(--lh-snug); text-decoration: none; overflow-wrap: anywhere; }
.icart-name:hover { color: var(--gold-text); text-decoration: underline; }
.icart-meta, .icart-unit { margin: 2px 0 0; color: var(--sub); font-size: var(--fs-xs); line-height: var(--lh-snug); }
.icart-warn { margin: 6px 0 0; padding: 6px 8px; background: var(--error-soft); color: var(--error); border-radius: var(--radius); font-size: var(--fs-xs); font-weight: 600; }
.icart-total { grid-area: total; margin: 0; color: var(--ink); font-weight: 700; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.icart-qty { grid-area: qty; display: inline-flex; align-items: center; justify-self: start; border: 1px solid var(--control-border); border-radius: var(--radius); background: var(--paper); }
.icart-step { width: 44px; height: 44px; background: none; border: 0; color: var(--navy); font-size: 20px; line-height: 1; cursor: pointer; }
.icart-step:focus-visible, .icart-remove:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.icart-n { min-width: 32px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.icart-remove { grid-area: remove; justify-self: end; min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--sub); font: inherit; font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.icart-remove:hover { color: var(--gold-text); }

.icart-sum { padding-top: 16px; }
.icart-sum-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 8px; font-size: var(--fs-md); color: var(--navy); }
.icart-sum-row strong { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.icart-note { margin: 0 0 6px; color: var(--sub); font-size: var(--fs-xs); line-height: var(--lh-snug); }
.icart-free { color: inherit; font-weight: 600; }
.icart-msg { margin: 8px 0; padding: 8px 10px; background: var(--warning-soft); color: var(--low-stock); border-radius: var(--radius); font-size: var(--fs-sm); }
.icart-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.icart-go { margin-top: 12px; min-height: 52px; }
.icart-go:disabled { opacity: 0.5; cursor: not-allowed; }
.icart-link { display: block; margin-top: 8px; padding: 12px 0; text-align: center; color: var(--navy); font-size: var(--fs-sm); text-decoration: underline; text-underline-offset: 3px; }

/* the cart page: lines and summary side by side from 900px */
.icart-page { padding: 24px 0 64px; }
.icart-page h1 { margin: 0 0 16px; font-size: var(--fs-2xl); color: var(--navy); }
@media (min-width: 900px) {
  .icart-view[data-mode="page"][data-state="ready"] [data-when="ready"] { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
  .icart-view[data-mode="page"] .icart-sum { position: sticky; top: calc(var(--headerHeight, 76px) + 16px); padding: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
  .icart-view[data-mode="page"] .icart-line { grid-template-columns: 96px minmax(0, 1fr) auto auto; grid-template-areas: "thumb info qty total" "thumb info remove remove"; }
  .icart-view[data-mode="page"] .icart-thumb { width: 96px; height: 96px; }
  .icart-view[data-mode="page"] .icart-thumb img { width: 100%; }
}

/* header button (IntlCartButton) and the product page Add button */
.icart-add { gap: 8px; }
.icart-add:disabled { opacity: 0.55; cursor: not-allowed; }
@media (prefers-reduced-motion: no-preference) {
  .icart-dialog[open] { animation: icart-in 0.2s ease-out; }
  @keyframes icart-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @media (min-width: 720px) { @keyframes icart-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } } }
}

/* from IntlCartButton.astro */
.icart-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 44px; height: 48px; padding: 0 4px; color: var(--navy); text-decoration: none; font-size: var(--fs-icon-label); font-weight: 500; line-height: 1.2; white-space: nowrap; }
.icart-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.icart-btn-icon { position: relative; display: inline-flex; }
.icart-count { position: absolute; top: -6px; right: -10px; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-full); background: var(--navy); color: var(--paper); font-size: 11px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.icart-count[hidden] { display: none; }
.icart-btn--desktop { flex-direction: row; min-width: 36px; height: 44px; padding: 0 2px; }
.header-nav .nav-cart-item { display: flex; align-items: center; margin-right: -4px; }
/* Greek labels are the longest: keep the Japanese-store link in the language menu and footer until there is room for the cart */
@media (min-width: 1200px) and (max-width: 1359px) { html[lang="el"] .header-nav .nav-store-item { display: none; } }
.icart-btn--desktop:hover { color: var(--gold-text); }

/* from index.astro */
.icart-crumb { margin: 0 0 8px; font-size: var(--fs-sm); }
.icart-crumb a { color: var(--sub); text-decoration: underline; text-underline-offset: 3px; }
