/* ════════════════════════════════════════════════════════════
   Lookup pages (Vault Access, Track & Trace) — Swiss system from home.css
   (tokens, grid, header/footer). Here: the lookup form, the numbered guide,
   record views (vault view, shipment), and the Swiss door animation.
   ════════════════════════════════════════════════════════════ */

/* ─── Access section ───────────────────────────────────────── */
.sw-lookup { padding: clamp(48px, 7vw, 112px) 0 clamp(56px, 8vw, 120px); border-bottom: 1px solid var(--sw-rule); }
.sw-lookup .sw-grid { row-gap: clamp(32px, 4vw, 56px); align-items: start; }

.sw-lookup-head { grid-column: 1 / span 8; display: flex; flex-direction: column; gap: 20px; }
.sw-lookup-head .sw-kicker { grid-column: auto; padding-right: 0; background: none; }
.sw-lookup-title {
  font-size: var(--sw-text-hero-title); font-weight: var(--sw-weight-display); font-stretch: var(--sw-width-display);
  line-height: 0.95; letter-spacing: -0.035em; text-wrap: balance;
}
.sw-lookup-lead { font-size: var(--sw-text-lg); color: var(--sw-ink-2); max-width: 44ch; text-wrap: pretty; }

/* ─── Form ─────────────────────────────────────────────────── */
.sw-lookup-form { grid-column: 1 / span 6; display: flex; flex-direction: column; gap: 24px; border-top: 1px solid var(--sw-ink); padding-top: 28px; }
.sw-field { display: flex; flex-direction: column; gap: 10px; }
.sw-field label { font-size: var(--sw-text-sm); font-weight: var(--sw-weight-strong); letter-spacing: 0.02em; }
.sw-field input {
  width: 100%; min-height: 60px; padding: 0 18px;
  font-family: var(--sw-sans); font-size: 1.25rem; font-weight: 500; letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
  color: var(--sw-ink); background: var(--sw-white);
  border: 1px solid var(--sw-ink); border-radius: 0;
  transition: border-color 150ms var(--sw-ease), box-shadow 150ms var(--sw-ease);
}
.sw-field input::placeholder { color: #A5A5AC; letter-spacing: 0.04em; }
.sw-field input:focus { outline: none; border-color: var(--sw-red); box-shadow: inset 0 0 0 1px var(--sw-red); }
.sw-field input[aria-invalid="true"] { border-color: var(--sw-red); }
.sw-field-row { position: relative; display: flex; }
.sw-field-row input { padding-right: 88px; }
.sw-field-toggle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 80px;
  font: var(--sw-weight-strong) 0.875rem var(--sw-sans); color: var(--sw-ink);
  background: none; border: none; border-left: 1px solid var(--sw-rule); cursor: pointer;
}
.sw-field-toggle:hover { color: var(--sw-red); }
body.home .sw-field-toggle:focus-visible { outline-offset: -3px; }

.sw-form-message {
  margin: 0; padding: 14px 16px;
  border-left: 3px solid var(--sw-red); background: #FDF2F4; color: #8A0019;
  font-size: 0.9375rem; line-height: 1.45;
}
.sw-btn-block { width: 100%; min-height: 56px; font-size: 1rem; }
body.home .sw-btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.sw-form-note { font-size: var(--sw-text-sm); color: var(--sw-ink-2); }

/* ─── Guide (numbered, like the homepage register) ─────────── */
.sw-lookup-guide { grid-column: 8 / span 5; border-top: 1px solid var(--sw-ink); padding-top: 28px; }
.sw-guide-title { font-size: var(--sw-text-sm); font-weight: var(--sw-weight-strong); color: var(--sw-ink-2); margin-bottom: 8px; }
.sw-guide { list-style: none; }
.sw-guide li { display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--sw-rule); }
.sw-guide-no {
  font-stretch: var(--sw-width-numeral); font-weight: var(--sw-weight-display);
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem); line-height: 0.85; letter-spacing: -0.03em;
  font-feature-settings: "kern", "tnum", "lnum"; color: var(--sw-red);
}
.sw-guide h3 { font-size: var(--sw-text-lg); font-weight: var(--sw-weight-strong); letter-spacing: -0.01em; margin-bottom: 6px; }
.sw-guide p { color: var(--sw-ink-2); text-wrap: pretty; }
body.home .sw-guide a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
body.home .sw-guide a:hover { color: var(--sw-red); }

/* ─── Vault view (Swiss) ───────────────────────────────────── */
.sw-record-result { padding: clamp(48px, 6vw, 96px) 0 var(--sw-section); border-bottom: 1px solid var(--sw-rule); }
/* Result containers are focused by script (so screen readers announce them), never tabbed to: no outline */
body.home .sw-record:focus, body.home .sw-record:focus-visible { outline: none; }
.sw-record .vv-icon { display: none; }

.sw-record .result-card {
  background: none; border: none; border-top: 1px solid var(--sw-ink);
  border-radius: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible;
}
.sw-record .result-card::before, .sw-record .result-card::after { display: none; }
.sw-record .result-header {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px;
  padding: 28px 0; background: none; border-bottom: 1px solid var(--sw-rule);
}
.sw-record .result-header h3 {
  font-family: var(--sw-sans); color: var(--sw-ink); display: flex; flex-direction: column; gap: 8px;
  font-size: var(--sw-text-sm); font-weight: var(--sw-weight-strong); letter-spacing: 0.02em;
}
.sw-record .vv-vault-number {
  font-size: var(--sw-text-h2); font-weight: var(--sw-weight-display); font-stretch: var(--sw-width-display);
  line-height: 0.95; letter-spacing: -0.03em; font-feature-settings: "kern", "tnum", "lnum";
}
.sw-record .vv-header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sw-record .status-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; min-height: 40px;
  background: none; border: none; border-radius: 0; box-shadow: none;
  font-size: 0.9375rem; font-weight: var(--sw-weight-strong); color: var(--sw-ink); letter-spacing: 0; text-transform: none;
}
.sw-record .status-badge::before { content: ""; width: 10px; height: 10px; background: var(--sw-ink); }
.sw-record .status-badge:not(.status-active) { color: var(--sw-red); }
.sw-record .status-badge:not(.status-active)::before { background: var(--sw-red); }

.sw-record .result-body { padding: 0; counter-reset: vv-section; }
.sw-record .vv-section {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--sw-col-gap);
  padding: clamp(28px, 3.5vw, 44px) 0; margin: 0; border-bottom: 1px solid var(--sw-rule);
}
.sw-record .vv-section-title, .sw-record .vault-contents-title {
  grid-column: 1 / span 3; margin: 0; align-self: start;
  display: flex; flex-direction: column; gap: 10px;
  font-family: var(--sw-sans); font-size: var(--sw-text-lg); font-weight: var(--sw-weight-strong);
  color: var(--sw-ink); text-transform: none; letter-spacing: -0.01em;
}
.sw-record .vv-section-title::before, .sw-record .vault-contents-title::before {
  counter-increment: vv-section; content: counter(vv-section, decimal-leading-zero);
  font-stretch: var(--sw-width-numeral); font-weight: var(--sw-weight-display);
  font-size: clamp(2.25rem, 1.6rem + 2vw, 3.5rem); line-height: 0.85; letter-spacing: -0.03em; color: var(--sw-red);
  font-feature-settings: "kern", "tnum", "lnum";
}
.sw-record .vv-count { margin: 0; opacity: 1; font-size: var(--sw-text-sm); font-weight: 400; color: var(--sw-ink-2); }
.sw-record .vv-count::before { content: none; }

.sw-record .info-grid {
  grid-column: 4 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--sw-col-gap); margin: 0;
}
.sw-record .info-item {
  background: none; border: none; border-radius: 0; padding: 16px 0 18px; border-top: 1px solid var(--sw-rule);
}
.sw-record .info-item label {
  display: block; margin-bottom: 6px;
  font-size: var(--sw-text-sm); font-weight: 400; color: var(--sw-ink-2); text-transform: none; letter-spacing: 0;
}
.sw-record .info-item span { font-size: 1.0625rem; font-weight: 500; color: var(--sw-ink); word-break: break-word; }
.sw-record .vv-status-ok { color: var(--sw-ink); font-weight: var(--sw-weight-strong); }
.sw-record .vv-note { font-size: var(--sw-text-sm); color: var(--sw-ink-2); font-weight: 400; }
.sw-record .vv-code {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--sw-ink); border-radius: 0; background: none;
  font-family: var(--sw-sans); font-size: 1.125rem; font-weight: var(--sw-weight-display); letter-spacing: 0.08em;
  font-feature-settings: "kern", "tnum", "lnum"; color: var(--sw-ink);
}

/* Items */
.sw-record .vv-table-wrap { grid-column: 4 / -1; overflow-x: auto; }
.sw-record .contents-table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--sw-ink); }
.sw-record .contents-table th {
  background: none; color: var(--sw-ink-2); font-size: var(--sw-text-sm); font-weight: 400;
  text-transform: none; letter-spacing: 0; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--sw-rule); text-align: left;
}
.sw-record .contents-table td {
  color: var(--sw-ink); font-size: 0.9375rem; padding: 16px 12px 16px 0; border-bottom: 1px solid var(--sw-rule); vertical-align: top;
}
.sw-record .contents-table td strong { font-weight: var(--sw-weight-strong); }
.sw-record .contents-table tr:hover td { background: var(--sw-paper); }
.sw-record .contents-table .vv-qty { text-align: left; font-feature-settings: "kern", "tnum"; }
.sw-record .category-tag {
  background: none; color: var(--sw-ink); border: 1px solid var(--sw-rule); border-radius: 0;
  padding: 3px 8px; font-size: var(--sw-text-sm); font-weight: 500;
}
.sw-record .contents-table tr.media-row td, .sw-record .contents-table tr.media-row:hover td { background: var(--sw-paper); padding: 14px 12px 18px; }
.sw-record .media-tile { border-radius: 0; border: 1px solid var(--sw-rule); background: var(--sw-ink); }
.sw-record .media-type-badge { border-radius: 0; background: var(--sw-ink); color: var(--sw-white); }

.sw-record .vv-empty { grid-column: 4 / -1; text-align: left; padding: 8px 0; color: var(--sw-ink-2); }
.sw-record .vv-empty h3 { font-family: var(--sw-sans); color: var(--sw-ink); font-size: var(--sw-text-lg); margin-bottom: 6px; }

/* Heading words rising from a mask (js/record-motion.js) */
.rm-word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.rm-word > span { display: inline-block; }

/* ─── Door animation: Swiss variant (steel + ink + red on white) ─ */
body.home .vo-overlay {
  --vo-gold: #111111; --vo-gold-light: #4A4A50; --vo-steel-1: #F4F4F6; --vo-steel-2: #D4D4DA;
  background: radial-gradient(circle at 50% 45%, #FFFFFF 0%, #EDEDF0 75%);
}
body.home .vo-frame {
  background: conic-gradient(from 210deg, #C9C9CF, #F7F7F8, #B9B9C0, #F7F7F8, #C9C9CF);
  box-shadow: 0 30px 80px rgba(17,17,17,0.18), inset 0 0 0 1px #111111;
}
body.home .vo-door {
  background: radial-gradient(circle at 35% 30%, #FFFFFF, transparent 45%), radial-gradient(circle, #F4F4F6 0%, #D4D4DA 80%, #BDBDC4 100%);
  box-shadow: inset 0 0 0 2px #111111, inset 0 0 30px rgba(17,17,17,0.12), 0 12px 40px rgba(17,17,17,0.2);
}
body.home .vo-door::before { box-shadow: inset 0 0 0 1px #111111; }
body.home .vo-bolt { background: linear-gradient(180deg, #3A3A40, #111111); }
body.home .vo-spoke::after { background: radial-gradient(circle at 35% 35%, #6A6A70, #111111 70%); }
body.home .vo-light { background: radial-gradient(circle, #FFFFFF 0%, #FFE6EA 30%, color-mix(in srgb, var(--sw-red, #E4002B) 22%, transparent) 58%, transparent 72%); }
body.home .vo-label { font-family: var(--sw-sans); font-weight: var(--sw-weight-display); color: #111111; letter-spacing: 0.24em; }
body.home .vo-status { font-family: var(--sw-sans); font-weight: var(--sw-weight-strong); font-stretch: var(--sw-width-label); color: var(--sw-red); }
body.home .vo-skip { font-family: var(--sw-sans); color: var(--sw-ink-2); }

/* ─── Track & Trace ────────────────────────────────────────── */
.sw-field-inline { display: flex; }
.sw-field-inline input { flex: 1; min-width: 0; }
.sw-field-inline .sw-btn { min-height: 60px; padding: 0 32px; font-size: 1rem; }

/* Journey rail: stages as numbered segments; done = ink, current = red, ahead = hairline */
.sw-rail {
  list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 6px;
  padding: clamp(24px, 3vw, 36px) 0 0;
}
.sw-rail li { position: relative; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 4px solid var(--sw-rule); color: #A5A5AC; }
/* Stage colour is a separate bar over the grey track so it can fill in (transform only) */
.sw-rail-fill { position: absolute; left: 0; right: 0; top: -4px; height: 4px; background: var(--sw-ink); transform-origin: left center; }
.sw-rail li.is-current .sw-rail-fill { background: var(--sw-red); }
.sw-rail .sw-rail-no {
  font-stretch: var(--sw-width-numeral); font-weight: var(--sw-weight-display);
  font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.75rem); line-height: 0.85; letter-spacing: -0.03em;
  font-feature-settings: "kern", "tnum", "lnum";
}
.sw-rail .sw-rail-label { font-size: 0.9375rem; font-weight: var(--sw-weight-strong); }
.sw-rail li.is-done { color: var(--sw-ink); }
.sw-rail li.is-current { color: var(--sw-red); }
.sw-rail-stopped { font-weight: 400; }
.sw-rail-alert {
  margin: 16px 0 0; padding: 12px 16px; border-left: 3px solid var(--sw-red); background: #FDF2F4; color: #8A0019; font-size: 0.9375rem;
}

/* Summary figures (like the homepage figures row) */
.sw-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(28px, 3vw, 40px); border-top: 1px solid var(--sw-ink); border-bottom: 1px solid var(--sw-rule); }
.sw-summary-item { padding: 20px var(--sw-col-gap) 22px 0; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px; }
.sw-summary-item + .sw-summary-item { border-left: 1px solid var(--sw-rule); padding-left: var(--sw-col-gap); }
.sw-summary-item dt { font-size: var(--sw-text-sm); color: var(--sw-ink-2); }
.sw-summary-item dd { font-size: clamp(1.25rem, 1rem + 0.8vw, 1.75rem); font-weight: var(--sw-weight-display); font-stretch: var(--sw-width-display); letter-spacing: -0.02em; line-height: 1.1; word-break: break-word; }
.sw-summary-item.is-accent dd { color: var(--sw-red); }

.sw-record-text { grid-column: 4 / -1; font-size: var(--sw-text-lg); line-height: 1.55; max-width: 64ch; white-space: pre-line; }

/* Tracking history: numbered register, latest entry in red */
.sw-history { grid-column: 4 / -1; list-style: none; border-top: 1px solid var(--sw-ink); }
.sw-history li { display: grid; grid-template-columns: 72px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--sw-rule); }
.sw-history-no {
  font-stretch: var(--sw-width-numeral); font-weight: var(--sw-weight-display); font-size: 2rem; line-height: 0.85;
  letter-spacing: -0.03em; color: #A5A5AC; font-feature-settings: "kern", "tnum", "lnum";
}
.sw-history li:last-child .sw-history-no { color: var(--sw-red); }
.sw-history-status { font-size: var(--sw-text-lg); font-weight: var(--sw-weight-strong); }
.sw-history-meta { color: var(--sw-ink-2); font-size: 0.9375rem; margin-top: 2px; font-variant-numeric: tabular-nums; }
.sw-history-desc { margin-top: 6px; }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sw-lookup-head { grid-column: 1 / -1; }
  .sw-lookup-form { grid-column: 1 / span 7; }
  .sw-lookup-guide { grid-column: 8 / -1; }
  .sw-record .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .sw-lookup-form, .sw-lookup-guide { grid-column: 1 / -1; }
  .sw-guide li { grid-template-columns: 56px 1fr; }

  .sw-record .vv-section { grid-template-columns: 1fr; row-gap: 20px; }
  .sw-record .vv-section-title, .sw-record .vault-contents-title,
  .sw-record .info-grid, .sw-record .vv-table-wrap, .sw-record .vv-empty { grid-column: 1 / -1; }
  .sw-record .vv-section-title, .sw-record .vault-contents-title { flex-direction: row; align-items: baseline; gap: 14px; }
  .sw-record .info-grid { grid-template-columns: 1fr; }

  .sw-field-inline { flex-direction: column; gap: 12px; }
  .sw-field-inline .sw-btn { width: 100%; }
  .sw-rail { grid-template-columns: 1fr; row-gap: 0; }
  .sw-rail li { flex-direction: row; align-items: baseline; gap: 14px; padding: 10px 0 10px 14px; border-top: none; border-left: 4px solid var(--sw-rule); }
  .sw-rail-fill { top: 0; bottom: 0; left: -4px; right: auto; width: 4px; height: auto; transform-origin: center top; }
  .sw-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sw-summary-item:nth-child(3) { border-left: none; padding-left: 0; }
  .sw-summary-item:nth-child(n + 3) { border-top: 1px solid var(--sw-rule); }
  .sw-record-text, .sw-history { grid-column: 1 / -1; }
  .sw-history li { grid-template-columns: 52px 1fr; }

  /* Items: each row becomes a labelled card */
  .sw-record .contents-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sw-record .contents-table, .sw-record .contents-table tbody, .sw-record .contents-table tr, .sw-record .contents-table td { display: block; width: 100%; }
  .sw-record .contents-table tr:not(.media-row) { padding: 14px 0; border-bottom: 1px solid var(--sw-rule); }
  .sw-record .contents-table td { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 5px 0; border: none; }
  .sw-record .contents-table td::before { content: attr(data-label); color: var(--sw-ink-2); font-size: var(--sw-text-sm); }
  .sw-record .contents-table tr.media-row td { display: block; }
  .sw-record .contents-table tr.media-row td::before { content: none; }
  .sw-record .contents-table tr:hover td { background: none; }
}

/* Next of kin on Vault Access: the server sends no details; placeholder text is shown blurred */
.vv-blurred { display: inline-block; filter: blur(6px); opacity: 0.75; user-select: none; pointer-events: none; }
.vv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sw-record .vv-restricted-note {
  grid-column: 4 / -1; margin-top: 18px; padding: 12px 16px; border-left: 3px solid var(--sw-ink); background: var(--sw-paper);
  font-size: 0.9375rem; color: var(--sw-ink);
}
body.home .vv-restricted-note a { font-weight: var(--sw-weight-strong); text-decoration: underline; text-underline-offset: 3px; }
body.home .vv-restricted-note a:hover { color: var(--sw-red); }
html[dir="rtl"] body.home .vv-restricted-note { border-left: none; border-right: 3px solid var(--sw-ink); }
@media (max-width: 768px) { .sw-record .vv-restricted-note { grid-column: 1 / -1; } }
/* Record sections waiting to be scrolled to (js/record-motion.js, scroll option) */
.rm-wait > * { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .rm-wait > * { opacity: 1; } }

/* Anonymous shipments in public tracking (js/shipment-view.js) */
.sw-private { color: var(--sw-ink-2); font-style: italic; }
.sw-private-note { grid-column: 4 / -1; margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--sw-ink); background: var(--sw-paper); color: var(--sw-ink); }
@media (max-width: 768px) { .sw-private-note { grid-column: 1 / -1; } }

/* Tracking automation (js/track.js): live indicator, e-mail alerts */
.sw-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sw-form-message.is-info { border-left-color: var(--sw-ink); background: var(--sw-paper); color: var(--sw-ink); }
.sw-live { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--sw-rule); font-size: var(--sw-text-sm); font-weight: var(--sw-weight-strong); color: var(--sw-ink); }
.sw-live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #0A7D3E; }
.sw-live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: sw-live-pulse 2s cubic-bezier(0.22, 1, 0.36, 1) infinite; }
@keyframes sw-live-pulse { from { transform: scale(1); opacity: 0.6; } to { transform: scale(3); opacity: 0; } }
.sw-alerts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px 28px; align-items: center; margin-top: 28px; padding: 22px 24px; border: 1px solid var(--sw-ink); background: var(--sw-white); }
.sw-alerts-text { display: flex; flex-direction: column; gap: 4px; }
.sw-alerts-text strong { font-size: 1.125rem; }
.sw-alerts-text span { color: var(--sw-ink-2); font-size: var(--sw-text-sm); }
.sw-alerts-row { display: flex; gap: 8px; }
.sw-alerts-row input { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 1px solid var(--sw-rule); background: var(--sw-white); color: var(--sw-ink); font: inherit; }
.sw-alerts-row input:focus { outline: none; border-color: var(--sw-red); box-shadow: inset 0 0 0 1px var(--sw-red); }
.sw-alerts-row .sw-btn { min-height: 48px; padding: 0 20px; cursor: pointer; white-space: nowrap; }
.sw-alerts-msg { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-left: 3px solid var(--sw-red); background: #FDF2F4; color: #8A0019; font-size: var(--sw-text-sm); }
.sw-alerts-msg.is-ok { border-left-color: #0A7D3E; background: #EEF8F2; color: #0A5C2E; }
.sw-alerts-msg[hidden] { display: none; }
@media (max-width: 700px) { .sw-alerts { grid-template-columns: 1fr; } .sw-alerts-row { flex-direction: column; } }
@media (prefers-reduced-motion: reduce) { .sw-live-dot::after { animation: none; } }
