/* Inkhause global layer. Tokens (--c-*, --f-*, --r-*, --btn-*) come from
   snippets/design-tokens.liquid; this file holds only global resets and the
   shared components (links, focus rings, form fields, pagination, chips,
   flash alert, motion). Section CSS lives with the sections.
   Fonts are linked from layout/theme.liquid (no @import). */

*, *::before, *::after { box-sizing: border-box; }

:root {
  line-height: 1.5;
  color: var(--c-ink, #0e0e0e);
  /* Legacy aliases for stylesheets that still read the old palette.
     Remove once nothing references --adi-*. */
  --adi-black: var(--c-ink);
  --adi-white: var(--c-white);
  --adi-gray-100: var(--c-cream);
  --adi-gray-200: var(--c-line);
  --adi-gray-500: var(--c-gray);
  --adi-red: var(--c-danger);
}

html {
  /* overflow-x: clip (not hidden) so position: sticky keeps working. */
  overflow-x: clip;
}

body {
  margin: 0;
  overflow-x: clip;
  max-width: 100%;
  background: var(--c-cream);
  color: var(--c-ink);
  font-family: var(--f-body);
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { text-align: right; font-family: var(--f-ar), var(--f-body); }

button, input, select, textarea { font-family: inherit; }

.container {
  max-width: var(--container, 1440px);
  margin-inline: auto;
  padding-inline: var(--gutter, 64px);
}

/* ---- Links ---- */
a { color: inherit; }
.rte a, .link { color: var(--c-blue); text-underline-offset: 3px; }
.rte a:hover, .link:hover { text-decoration-thickness: 2px; }

/* ---- Focus ring (keyboard only) ---- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-blue);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, button:focus-visible, [role="button"]:focus-visible { border-radius: inherit; }

/* ---- RTL: mirror directional glyphs ---- */
[dir="rtl"] .icon-flip-rtl { transform: scaleX(-1); }

/* ---- Buttons: disabled / busy ---- */
.btn { transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease; }
.btn:hover { opacity: .9; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* ---- Form fields ---- */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="search"],
input[type="number"], input[type="url"], input[type="date"], input[type="time"], select, textarea,
.field {
  width: 100%;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-input);
  background: var(--c-white);
  color: var(--c-ink);
  font: 400 15px/1.4 var(--f-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--c-gray); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--c-gray); }
input:focus, select:focus, textarea:focus {
  border-color: var(--c-ink);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-blue) 25%, transparent);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--c-blue); }
input[aria-invalid="true"], .field--error { border-color: var(--c-danger); }
.field-label { font-size: 14px; font-weight: 600; color: var(--c-ink); }
.field-error { margin: 6px 0 0; font-size: 13px; color: var(--c-danger); }
select {
  appearance: none; -webkit-appearance: none;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6862' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
}
[dir="rtl"] select { background-position: left 16px center; }

/* ---- Pagination (snippets/paginate.liquid) ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 40px; }
.pagination__pages { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pagination__page, .pagination__step {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 42px; height: 42px; padding-inline: 14px;
  border: 1px solid var(--c-line); border-radius: 999px;
  background: transparent; color: var(--c-ink);
  font-size: 15px; font-weight: 500; text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.pagination__page:hover, .pagination__step:hover { border-color: var(--c-ink); background: var(--c-white); }
.pagination__page--current, .pagination__page--current:hover { background: var(--c-yellow); border-color: var(--c-yellow); font-weight: 700; }
.pagination__step--off { opacity: .4; pointer-events: none; }
.pagination__ellipsis { padding-inline: 4px; color: var(--c-gray); }

/* ---- Chips: tags + status (account pages) ---- */
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border: 1px solid var(--c-line); border-radius: 999px;
  background: var(--c-paper); color: var(--c-ink);
  font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1.3;
}
.status-chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border: 1px solid transparent; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; line-height: 1.3;
  background: var(--c-neutral-bg); color: var(--c-ink);
}
.status-chip--success { background: var(--c-success-bg); color: var(--c-success-fg); }
.status-chip--warning { background: var(--c-warning-bg); border-color: var(--c-yellow); color: var(--c-ink); }
.status-chip--neutral { background: var(--c-neutral-bg); color: var(--c-ink); }
.status-chip--danger { background: color-mix(in srgb, var(--c-danger) 14%, var(--c-white)); color: var(--c-danger); }
html[dir="rtl"] .chip, html[dir="rtl"] .status-chip { letter-spacing: 0; }

/* ---- Visually hidden helper ---- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Cart badge bump ------------------------------------------------------
   Brief pulse on the header cart pill right after a successful add. */
.cart-link.cx-cart-bump { animation: cxCartBump .4s ease; }
@keyframes cxCartBump {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ===================================================================
   Shared flash alert (server flash in layout/theme.liquid + client
   showFlash() in theme.js). Tokenised: paper card, 28px radius, ink OK pill.
   =================================================================== */
@keyframes flash-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes flash-pop-in { from { opacity: 0; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.js-flash-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: color-mix(in srgb, var(--c-ink) 45%, transparent);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: flash-fade-in .15s ease;
}
.js-flash {
  position: relative; width: 100%; max-width: 26rem;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
  padding: 36px 32px 28px;
  border-radius: var(--r-card);
  box-shadow: 0 24px 60px color-mix(in srgb, var(--c-ink) 25%, transparent);
  background: var(--c-paper); color: var(--c-ink);
  animation: flash-pop-in .2s ease;
}
.js-flash__icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.js-flash--error .js-flash__icon { background: color-mix(in srgb, var(--c-danger) 14%, var(--c-white)); color: var(--c-danger); }
.js-flash--success .js-flash__icon { background: var(--c-success-bg); color: var(--c-success-fg); }
.js-flash--info .js-flash__icon { background: color-mix(in srgb, var(--c-blue) 14%, var(--c-white)); color: var(--c-blue); }
.js-flash__msg { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.5; }
.js-flash__close {
  position: absolute; top: 14px; inset-inline-end: 14px;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: inherit; cursor: pointer; opacity: .55;
  transition: opacity .15s ease, background .15s ease;
}
.js-flash__close:hover { opacity: 1; background: color-mix(in srgb, var(--c-ink) 8%, transparent); }
.js-flash__ok {
  border: 0; cursor: pointer; border-radius: 999px; padding: 12px 40px;
  background: var(--c-ink); color: var(--c-cream);
  font: 600 15px var(--f-body); transition: opacity .15s ease;
}
.js-flash__ok:hover { opacity: .88; }

/* ---- Section scroll reveal (JS adds .cx-reveal; opacity only so fixed
   descendants keep their containing block) ---- */
.cx-reveal { opacity: 0; transition: opacity .7s ease; }
.cx-reveal.is-visible { opacity: 1; }

/* ---- Scroll-driven animations (native; theme.js skips its observer when supported) ---- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    #cxMain > :not(script):not(noscript):not(.js-flash-backdrop) {
      animation: cxSectionIn linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
    body::before {
      content: "";
      position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 9999;
      background: var(--c-blue);
      transform-origin: 0 50%;
      pointer-events: none;
      animation: cxScrollProgress linear both;
      animation-timeline: scroll(root block);
    }
    [dir="rtl"] body::before { transform-origin: 100% 50%; }
  }
}
@keyframes cxSectionIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cxScrollProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 767px) {
  .container { padding-inline: var(--gutter-m, 20px); }
  .js-flash { padding: 32px 24px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .cart-link.cx-cart-bump { animation: none !important; transition: none !important; }
  .cx-reveal { opacity: 1; transition: none; }
  .btn, input, select, textarea { transition: none; }
}

/* Mobile: tighter vertical spacing on the content pages (About, Contact, Preorder, Reserve). */
@media (max-width: 767px) {
  section.page,
  section[class^="ctc-"],
  section[class^="pre-"],
  section.rsvf-page { padding-top: 8px !important; padding-bottom: 24px !important; }
  section[class^="ssp-"] { padding-top: 16px !important; padding-bottom: 16px !important; }
  section.hb.cx-cta-banner.hb--boxed { padding-top: 16px !important; padding-bottom: 24px !important; }
}

/* Mobile: Contact, Preorder and Reserve pages - drop the banner intro text, and on Contact / Preorder
   also the form card's heading and intro line. */
@media (max-width: 767px) {
  body[data-template="page.contact"] .page-banner__lead,
  body[data-template="page.preorder"] .page-banner__lead,
  body[data-template="reserve"] .page-banner__lead { display: none; }
  .cx-contact .cf-card > .cf-title,
  .cx-contact .cf-card > .cf-hint,
  .cx-preorder .cf-card > .cf-title,
  .cx-preorder .cf-card > .cf-hint { display: none; }
}
