/* Svift base styles: tokens, reset, layout, header, footer, buttons, cards, forms.
   Modules add assets/css/<module>.css via $styles[] in their templates and reuse these variables. */

:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --navy: #0b2545;
  --blue: #0a74d6;
  --blue-hover: #0862b5;
  --teal: #00bcd4;
  --ok: #1f8a4c;
  --warn: #b25e00;
  --danger: #c4301c;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", Roboto, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 980px;
  --container: 1120px;
  --gutter: 22px;
  --header-h: 56px;
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, .04);
  --ease: cubic-bezier(.25, .1, .25, 1);
}

/* ---------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1 0 auto; }
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); margin: 0 0 .5em; line-height: 1.1; letter-spacing: -.02em; }
h1 { font-size: clamp(34px, 6vw, 56px); font-weight: 700; }
h2 { font-size: clamp(26px, 4vw, 40px); font-weight: 700; }
h3 { font-size: 21px; font-weight: 600; }
p { margin: 0 0 1em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 32px 0; }

/* ---------- utilities */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.lead { font-size: clamp(19px, 2.4vw, 24px); line-height: 1.35; color: var(--text-2); max-width: 40em; }
.muted { color: var(--text-2); }
.small { font-size: 14px; }
.section { padding: clamp(48px, 8vw, 96px) 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; border: 0 !important; min-width: 0 !important; min-height: 0 !important; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: var(--radius-pill); }
.skip-link:focus { top: 8px; }

/* ---------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 251, 253, .82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; gap: 28px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand img { height: 32px; width: auto; }
.main-nav { display: flex; gap: 28px; margin-right: auto; }
.main-nav a, .lang-switch a { color: var(--text); font-size: 14px; }
.main-nav a:hover { color: var(--blue); text-decoration: none; }
.header-tools { display: flex; align-items: center; gap: 14px; }
.cart-link { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; color: var(--text); border-radius: 50%; }
.cart-link:hover { background: var(--surface-alt); text-decoration: none; }
.cart-count {
  position: absolute; top: 1px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--radius-pill); background: var(--blue); color: #fff;
  font-size: 11px; font-weight: 600; line-height: 17px; text-align: center;
}
.cart-count.is-empty { display: none; }
.lang-switch { display: flex; gap: 2px; padding: 2px; background: var(--surface-alt); border-radius: var(--radius-pill); }
.lang-switch a { padding: 4px 9px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 500; color: var(--text-2); }
.lang-switch a:hover { color: var(--text); text-decoration: none; }
.lang-switch a[aria-current] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- footer */
.site-footer { margin-top: 72px; padding: 28px 0 22px; border-top: 1px solid var(--line-soft); color: var(--text-2); font-size: 12px; }
.site-footer p { margin: 0; }
.footer-copy { margin-bottom: 18px !important; }
.footer-legal a { color: var(--text-3); font-size: 11px; }
.footer-legal a:hover { color: var(--text-2); }
.footer-sep { margin: 0 8px; color: var(--text-3); }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 22px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  background: var(--blue); color: #fff;
  font-size: 17px; font-weight: 400; line-height: 1.2; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { background: var(--blue-hover); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; }
.btn-secondary { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-secondary:hover { background: var(--blue); color: #fff; }
.btn-quiet { background: var(--surface-alt); color: var(--text); }
.btn-quiet:hover { background: var(--line-soft); }
.btn-small { min-height: 32px; padding: 5px 14px; font-size: 14px; }
.link-arrow::after { content: " \203A"; }

/* ---------- cards */
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; border: 1px solid var(--line-soft); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; color: var(--text-2); }
.input, input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 116, 214, .18); }
textarea { min-height: 140px; resize: vertical; }
.form-error { color: var(--danger); font-size: 14px; }
.notice { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--surface-alt); }
.notice-ok { background: #e9f6ee; color: var(--ok); }
.notice-error { background: #fdecea; color: var(--danger); }

/* ---------- home skeleton */
.home-intro { padding: clamp(64px, 12vw, 140px) 0 clamp(40px, 8vw, 96px); text-align: center; }
.home-intro .lead { margin: 0 auto 28px; }
.home-intro .actions { justify-content: center; }

/* ---------- error page */
.error-page { padding: clamp(56px, 10vw, 120px) var(--gutter); text-align: center; }
.error-page .lead { margin: 0 auto 28px; }
.error-page .actions { justify-content: center; }
.error-code { font-size: 15px; font-weight: 600; letter-spacing: .08em; color: var(--teal); margin-bottom: 8px; }
.error-debug { text-align: left; font-size: 12px; overflow: auto; background: var(--surface-alt); padding: 16px; border-radius: var(--radius-sm); max-height: 420px; }

/* ---------- G20: phone ergonomics (<= 700px). Text >= 17/15/13 px, touch targets >= 44 px with >= 8 px between,
   fields 16px+ (no iOS zoom on focus) and >= 48 px high. Desktop is untouched. */
@media (max-width: 700px) {
  /* header: row 1 = logo + cart + languages, row 2 = menu as large pills.
     The logo takes only the room left after cart + languages (flex-basis 0, shrinks down to ~70 px on 320),
     so row 1 never wraps; the menu row scrolls sideways (no bar) and fades at the right edge only where it can overflow. */
  .header-inner { flex-wrap: wrap; gap: 0 8px; padding-top: 6px; }
  .brand { flex: 1 1 0; min-width: 0; min-height: 44px; margin-right: 0; }
  .brand img { width: 100%; max-width: 103px; height: auto; }
  .header-tools { flex: 0 0 auto; gap: 8px; }
  .cart-link { width: 44px; height: 44px; }
  .cart-count { top: 2px; right: 0; min-width: 19px; height: 19px; line-height: 19px; font-size: 13px; }
  .lang-switch { gap: 8px; padding: 0; background: none; }
  .lang-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
    padding: 0 6px; font-size: 15px; }
  .lang-switch a[aria-current] { background: var(--surface-alt); box-shadow: none; }
  /* 4 px inner padding (pulled back with a negative margin) keeps the focus ring of the first/last pill unclipped */
  .main-nav { order: 3; width: calc(100% + 8px); margin: 0 -4px; gap: 8px; padding: 4px 4px 10px; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px;
    border-radius: var(--radius-pill); background: var(--surface-alt); font-size: 17px; white-space: nowrap; }

  /* text */
  .small, .form-error, .field label { font-size: 15px; }

  /* footer: readable text, links with a 44 px tap area */
  .site-footer { margin-top: 56px; padding: 24px 0 20px; font-size: 15px; line-height: 1.5; }
  .footer-copy { margin-bottom: 8px !important; }
  .footer-legal a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; font-size: 15px; color: var(--text-2); }

  /* buttons and fields */
  .btn { min-height: 48px; padding: 12px 24px; }
  .btn-small { min-height: 44px; padding: 8px 18px; font-size: 15px; }
  .input, input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
    min-height: 48px; font-size: 17px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; flex: none; }
  .actions { gap: 12px; }
}
@media (max-width: 374px) {
  :root { --gutter: 16px; }
}
/* below 360 px the RU/LV pills may not fit: fade the right edge as a scroll hint (extra end padding keeps the last pill readable when scrolled) */
@media (max-width: 359px) {
  .main-nav { padding-right: 28px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
