/* TruScan 2.0 shell: header pill, More menu, phone top bar, menu sheet, tab bar, result
   action bar and footer. Values are copied from docs/design/truscan-2.0/screens
   (Navigation, Home, Home-Mobile, Scan-Mobile, Home-Light). Colours come from tokens.css. */

:root body { padding-top: 0; }
.ts-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header: a sticky floating pill. */
.ts-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 16px 24px 0;
  background: none;
  border: 0;
}
.ts-bar {
  box-sizing: border-box;
  max-width: 1230px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 8px 8px 20px;
  border-radius: 999px;
  background: var(--nav-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--nav-border);
  box-shadow: var(--nav-shadow);
  font-family: var(--font-sans);
  line-height: normal;
}
.ts-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-right: 8px;
  color: var(--text);
  text-decoration: none;
}
.ts-brand:hover { color: var(--text); }
.ts-mark path { fill: var(--logo); }
.ts-brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }

.ts-nav-primary {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  font-size: 15px;
  font-weight: 500;
}
.ts-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--nav-text);
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.ts-nav-link:hover { color: var(--text); background: var(--nav-hover); }
.ts-nav-link[aria-current="page"],
.ts-more[data-section-current] > summary,
.ts-more[open] > summary { color: var(--text); background: var(--nav-active); }
.ts-count {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--count-bg);
  color: var(--nav-text);
  font-size: 12px;
}

/* More: a native disclosure, enhanced by navigation.js. */
.ts-more { position: relative; }
.ts-more > summary { gap: 6px; list-style: none; }
.ts-more > summary::-webkit-details-marker { display: none; }
.ts-more > summary::marker { content: ""; }
.ts-chevron { transition: transform .2s; }
.ts-more[open] .ts-chevron { transform: rotate(180deg); }
.ts-more-menu {
  box-sizing: border-box;
  position: absolute;
  z-index: 40;
  top: 57px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: 28px;
  background: var(--menu-bg);
  border: 1px solid var(--menu-border);
  box-shadow: var(--menu-shadow);
  font-weight: 400;
}
.ts-more-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 6px; }
.ts-more-group { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.ts-more-label { margin: 0; padding: 6px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ts-more-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border-radius: 14px;
  color: var(--menu-item);
  text-decoration: none;
  transition: background .2s;
}
.ts-more-item-icon { flex-direction: row; gap: 10px; align-items: center; }
.ts-more-item:hover, .ts-more-plain:hover { color: var(--menu-item); background: var(--menu-hover); }
.ts-more-item[aria-current="page"], .ts-more-plain[aria-current="page"] { background: var(--nav-active); }
.ts-more-text { display: flex; flex-direction: column; gap: 2px; }
.ts-more-title { font-size: 15px; font-weight: 600; }
.ts-more-desc { font-size: 13px; color: var(--muted); }
.ts-more-icon {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--raised);
  border: 1px solid var(--menu-icon-border);
}
.ts-more-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--menu-foot);
  font-size: 14px;
}
.ts-more-plain { padding: 10px; border-radius: 12px; color: var(--text-2); text-decoration: none; transition: background .2s; }

.ts-tools { display: flex; gap: 6px; align-items: center; }
.ts-theme-slot { display: none; }
.ts-icon-btn {
  box-sizing: border-box;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--icon-btn-bg);
  border: 1px solid var(--icon-btn-border);
  color: var(--icon-btn-color);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.ts-icon-btn:hover { color: var(--icon-btn-color); background: var(--btn-2-hover-bg); border-color: var(--btn-2-hover-border); }
.ts-menu-toggle { color: var(--text); }
.ts-menu-toggle[hidden] { display: none; }

/* Phone menu sheet: More, theme and Telegram. */
.ts-sheet {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--sheet-bg);
  color: var(--text);
  font-family: var(--font-sans);
  overscroll-behavior: contain;
}
.ts-sheet[open] { display: flex; flex-direction: column; }
.ts-sheet::backdrop { background: var(--sheet-bg); }
.ts-sheet-top { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top)) 14px 14px; }
.ts-sheet-top .ts-brand { gap: 8px; margin: 0; }
.ts-sheet-top .ts-brand-name { font-size: 17px; }
.ts-sheet-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--sheet-close-bg);
  border: 0;
  color: var(--text);
  cursor: pointer;
}
.ts-sheet-links { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 4px 14px; overflow-y: auto; }
.ts-sheet-label { margin: 0; padding: 12px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ts-sheet-label ~ .ts-sheet-label { padding-top: 14px; }
.ts-sheet-link { padding: 10px; font-size: 20px; font-weight: 600; color: var(--text); text-decoration: none; border-radius: 14px; }
.ts-sheet-link:hover { color: var(--text); background: var(--menu-hover); }
.ts-sheet-link[aria-current="page"] { background: var(--nav-active); }
.ts-sheet-plain { font-size: 16px; font-weight: 400; color: var(--text-2); }
.ts-sheet-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--sheet-line);
}
.ts-theme-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border-radius: 999px;
  background: var(--switch-bg);
  font-size: 14px;
  font-weight: 600;
}
.ts-theme-switch button {
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--switch-text);
  font: inherit;
  cursor: pointer;
}
.ts-theme-switch button[aria-pressed="true"] { background: var(--switch-active); color: var(--text); }
.ts-sheet-telegram {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--btn-2-border);
  font-size: 14px;
  color: var(--text-2);
  text-decoration: none;
}
.ts-sheet-telegram:hover { color: var(--text); }

/* Phone tab bar: the four destinations. */
.ts-tabbar { display: none; }

/* Footer: identical on every page. */
.ts-footer {
  box-sizing: border-box;
  width: 100%;
  max-width: 1248px;
  margin: 0 auto;
  padding: 120px 24px 48px;
  background: none;
  border: 0;
  font-family: var(--font-sans);
  line-height: normal;
}
.ts-footer-main { display: flex; flex-wrap: wrap; gap: 40px; padding-bottom: 48px; }
.ts-footer-brand { flex: 2 1 280px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ts-footer-brand .ts-brand { margin: 0; }
.ts-footer-tagline { margin: 0; max-width: 300px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.ts-footer-social { display: flex; gap: 8px; }
/* A bordered link in the design, so the box is 44px plus its border. */
.ts-footer-social .ts-icon-btn { box-sizing: content-box; background: var(--footer-icon-bg); }
.ts-footer-col { flex: 1 1 140px; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.ts-footer-head { margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.ts-flink { padding: 8px 0; color: var(--text-2); text-decoration: none; }
.ts-flink:hover { color: var(--text); }
.ts-footer-base {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 899px) {
  .ts-header { padding: 12px 16px 0; }
  .ts-footer { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .ts-bar { flex-wrap: nowrap; gap: 8px; height: 60px; padding: 0 8px 0 16px; }
  .ts-bar > .ts-brand { gap: 9px; margin-right: auto; }
  .ts-bar > .ts-brand .ts-mark { width: 24px; height: 24px; }
  .ts-bar > .ts-brand .ts-brand-name { font-size: 18px; }
  .ts-nav-primary, .ts-tools > .ts-theme-toggle { display: none; }

  .ts-tabbar {
    box-sizing: border-box;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    align-items: stretch;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 8px env(safe-area-inset-bottom);
    background: var(--bar-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--bar-border);
    box-shadow: var(--bar-shadow);
    font-family: var(--font-sans);
    line-height: normal;
  }
  html.has-bar .ts-tabbar { display: none; }
  .ts-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--tab);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color .2s;
  }
  .ts-tab:hover { color: var(--text); }
  .ts-tab-icon { width: 52px; height: 28px; display: grid; place-items: center; border-radius: 999px; }
  .ts-tab[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .ts-tab[aria-current="page"] .ts-tab-icon { background: var(--tab-active-bg); }
  .ts-tab[aria-current="page"] svg { stroke-width: 2; }

  /* On a scan result the action bar replaces the tab bar. */
  .mobile-bar.ts-action-bar {
    box-sizing: border-box;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    height: calc(84px + env(safe-area-inset-bottom));
    margin: 0;
    padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--bar-border);
    border-radius: 0;
    background: var(--bar-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--bar-shadow);
    font-family: var(--font-sans);
  }
  .ts-action-bar > button {
    box-sizing: border-box;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    height: 48px;
    min-height: 48px;
    margin: 0;
    padding: 0 12px;
    border-radius: 999px;
    font: inherit;
    font-size: 15px;
    cursor: pointer;
    box-shadow: none;
  }
  .ts-action-bar > .ts-action-save { flex: 1; background: var(--btn-2-bg); border: 1px solid var(--btn-2-border); color: var(--text); font-weight: 500; }
  .ts-action-bar > .ts-action-rescan { flex: 0 0 48px; width: 48px; padding: 0; border-radius: 50%; background: var(--btn-2-bg); border: 1px solid var(--btn-2-border); color: var(--text); }
  .ts-action-bar > .ts-action-share { flex: 1.3; background: var(--mint); border: 0; color: var(--mint-ink); font-weight: 600; }
  .ts-action-bar > .ts-action-save:hover, .ts-action-bar > .ts-action-rescan:hover { background: var(--btn-2-hover-bg); border-color: var(--btn-2-hover-border); }
  .ts-action-bar > .ts-action-share:hover { background: var(--mint-hover); box-shadow: 0 0 0 6px var(--mint-ring); }
  .ts-action-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .ts-action-bar .ts-action-rescan svg { width: 17px; height: 17px; }
  .ts-action-bar .ts-action-share svg { stroke-width: 2; }
}

@media (min-width: 900px) {
  .ts-header[data-nav-ready] .ts-menu-toggle { display: none; }
  .ts-sheet { display: none; }
}

@media (max-width: 639px) {
  .ts-footer { padding: 88px 24px calc(112px + env(safe-area-inset-bottom)); }
  .ts-footer-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; padding-bottom: 36px; }
  .ts-footer-brand { grid-column: 1 / -1; padding-bottom: 8px; }
  .ts-footer-col { gap: 0; }
  .ts-footer-head { margin-bottom: 4px; }
  .ts-flink { padding: 11px 0; }
  .ts-footer-base { flex-direction: column; flex-wrap: nowrap; gap: 8px; line-height: 1.5; }
}

@media (forced-colors: active) {
  .ts-nav-link[aria-current="page"], .ts-more[data-section-current] > summary, .ts-tab[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -2px; }
}
