/*
 * track.css — Pack3D Tracking Portal
 *
 * Self-contained stylesheet. No external dependencies.
 *
 * This file is the forward design foundation for pack3d subdomain projects.
 * Token values in :root are to be populated during the pack3d.com visual
 * extraction pass. Placeholders are marked with [EXTRACT].
 *
 * Structure:
 *   1. Design tokens (CSS custom properties)
 *   2. Reset & base
 *   3. Layout
 *   4. Header
 *   5. Status section
 *   6. Progress section
 *   7. Timeline section
 *   8. Notification
 *   9. Modal
 *  10. Skeleton loading animation
 *  11. Utility
 */


/* ─── 1. Design tokens ────────────────────────────────────────────────────── */

:root {
  /* Colour — [EXTRACT] from pack3d.com */
  --p3d-color-brand-primary:    #000000;   /* [EXTRACT] */
  --p3d-color-brand-accent:     #000000;   /* [EXTRACT] */
  --p3d-color-surface-page:     #ffffff;   /* [EXTRACT] */
  --p3d-color-surface-card:     #f5f5f5;   /* [EXTRACT] */
  --p3d-color-surface-header:   #ffffff;   /* [EXTRACT] */
  --p3d-color-border:           #e0e0e0;   /* [EXTRACT] */
  --p3d-color-text-primary:     #111111;   /* [EXTRACT] */
  --p3d-color-text-secondary:   #555555;   /* [EXTRACT] */
  --p3d-color-text-inverse:     #ffffff;   /* [EXTRACT] */

  /* Status colours */
  --p3d-color-status-dispatched: #2e7d32;  /* [EXTRACT or confirm] */
  --p3d-color-status-delivered:  #1565c0;  /* [EXTRACT or confirm] */
  --p3d-color-status-pending:    #f57c00;  /* [EXTRACT or confirm] */
  --p3d-color-status-cancelled:  #c62828;  /* [EXTRACT or confirm] */

  /* Skeleton */
  --p3d-skeleton-base:  #e8e8e8;
  --p3d-skeleton-shine: #f5f5f5;

  /* Typography — [EXTRACT] from pack3d.com */
  --p3d-font-family-base:    system-ui, -apple-system, sans-serif;  /* [EXTRACT] */
  --p3d-font-family-heading: system-ui, -apple-system, sans-serif;  /* [EXTRACT] */
  --p3d-font-size-xs:   0.75rem;
  --p3d-font-size-sm:   0.875rem;
  --p3d-font-size-base: 1rem;
  --p3d-font-size-lg:   1.125rem;
  --p3d-font-size-xl:   1.375rem;
  --p3d-font-size-2xl:  1.75rem;
  --p3d-font-weight-regular: 400;
  --p3d-font-weight-medium:  500;
  --p3d-font-weight-bold:    700;
  --p3d-line-height-base:    1.5;
  --p3d-line-height-heading: 1.2;

  /* Spacing scale */
  --p3d-space-1:  0.25rem;
  --p3d-space-2:  0.5rem;
  --p3d-space-3:  0.75rem;
  --p3d-space-4:  1rem;
  --p3d-space-5:  1.25rem;
  --p3d-space-6:  1.5rem;
  --p3d-space-8:  2rem;
  --p3d-space-10: 2.5rem;
  --p3d-space-12: 3rem;

  /* Border radius */
  --p3d-radius-sm:   4px;
  --p3d-radius-md:   8px;
  --p3d-radius-lg:   12px;
  --p3d-radius-full: 9999px;

  /* Elevation */
  --p3d-shadow-card:   0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --p3d-shadow-modal:  0 8px 32px rgba(0,0,0,0.18);
  --p3d-shadow-header: 0 1px 0 var(--p3d-color-border);

  /* Transitions */
  --p3d-transition-base: 150ms ease;

  /* Layout */
  --p3d-content-max-width: 680px;
  --p3d-header-height: 60px;
}


/* ─── 2. Reset & base ─────────────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--p3d-font-family-base);
  font-size: var(--p3d-font-size-base);
  font-weight: var(--p3d-font-weight-regular);
  line-height: var(--p3d-line-height-base);
  color: var(--p3d-color-text-primary);
  background-color: var(--p3d-color-surface-page);
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--p3d-font-family-heading);
  font-weight: var(--p3d-font-weight-bold);
  line-height: var(--p3d-line-height-heading);
}

a {
  color: var(--p3d-color-brand-primary);
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}


/* ─── 3. Layout ───────────────────────────────────────────────────────────── */

#p3d-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.p3d-main {
  flex: 1;
  width: 100%;
  max-width: var(--p3d-content-max-width);
  margin: 0 auto;
  padding: var(--p3d-space-8) var(--p3d-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--p3d-space-6);
}


/* ─── 4. Header ───────────────────────────────────────────────────────────── */

.p3d-header {
  height: var(--p3d-header-height);
  background-color: var(--p3d-color-surface-header);
  box-shadow: var(--p3d-shadow-header);
  position: sticky;
  top: 0;
  z-index: 100;
}

.p3d-header__inner {
  max-width: var(--p3d-content-max-width);
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--p3d-space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.p3d-brand-mark {
  font-family: var(--p3d-font-family-heading);
  font-weight: var(--p3d-font-weight-bold);
  font-size: var(--p3d-font-size-lg);
  color: var(--p3d-color-brand-primary);
  letter-spacing: -0.02em;
}

.p3d-header__identity {
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-secondary);
}


/* ─── 5. Status section ───────────────────────────────────────────────────── */

.p3d-status {
  display: flex;
  flex-direction: column;
  gap: var(--p3d-space-2);
}

.p3d-status__headline {
  font-size: var(--p3d-font-size-2xl);
  font-weight: var(--p3d-font-weight-bold);
  color: var(--p3d-color-text-primary);
}

.p3d-status__label {
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-secondary);
}


/* ─── 6. Progress section ─────────────────────────────────────────────────── */

.p3d-progress {
  display: flex;
  flex-direction: column;
  gap: var(--p3d-space-3);
}

.p3d-progress__bar-track {
  height: 6px;
  background-color: var(--p3d-color-border);
  border-radius: var(--p3d-radius-full);
  overflow: hidden;
}

.p3d-progress__bar-fill {
  height: 100%;
  background-color: var(--p3d-color-brand-primary);
  border-radius: var(--p3d-radius-full);
  transition: width 0.4s ease;
}

.p3d-progress__meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-secondary);
}

.p3d-progress__activity {
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-primary);
  font-weight: var(--p3d-font-weight-medium);
}


/* ─── 7. Timeline section ─────────────────────────────────────────────────── */

.p3d-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.p3d-timeline__event {
  display: grid;
  grid-template-columns: var(--p3d-space-8) 1fr;
  gap: 0 var(--p3d-space-4);
  position: relative;
}

.p3d-timeline__event::before {
  content: '';
  position: absolute;
  left: calc(var(--p3d-space-4) - 1px);
  top: var(--p3d-space-6);
  bottom: 0;
  width: 2px;
  background-color: var(--p3d-color-border);
}

.p3d-timeline__event:last-child::before {
  display: none;
}

.p3d-timeline__dot {
  width: var(--p3d-space-4);
  height: var(--p3d-space-4);
  border-radius: var(--p3d-radius-full);
  background-color: var(--p3d-color-brand-primary);
  margin-top: var(--p3d-space-1);
  justify-self: center;
  flex-shrink: 0;
}

.p3d-timeline__dot--inactive {
  background-color: var(--p3d-color-border);
}

.p3d-timeline__content {
  padding-bottom: var(--p3d-space-6);
}

.p3d-timeline__description {
  font-size: var(--p3d-font-size-base);
  font-weight: var(--p3d-font-weight-medium);
  color: var(--p3d-color-text-primary);
}

.p3d-timeline__meta {
  font-size: var(--p3d-font-size-xs);
  color: var(--p3d-color-text-secondary);
  margin-top: var(--p3d-space-1);
}

/* Line item list (internal type) */
.p3d-line-items {
  display: flex;
  flex-direction: column;
  gap: var(--p3d-space-3);
}

.p3d-line-item {
  background-color: var(--p3d-color-surface-card);
  border: 1px solid var(--p3d-color-border);
  border-radius: var(--p3d-radius-md);
  padding: var(--p3d-space-4);
  box-shadow: var(--p3d-shadow-card);
}

.p3d-line-item__name {
  font-weight: var(--p3d-font-weight-medium);
  font-size: var(--p3d-font-size-base);
}

.p3d-line-item__brand {
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-secondary);
  margin-bottom: var(--p3d-space-2);
}

.p3d-line-item__status {
  font-size: var(--p3d-font-size-sm);
  margin-top: var(--p3d-space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--p3d-space-2);
}


/* ─── 8. Notification ─────────────────────────────────────────────────────── */

.p3d-notification {
  padding: var(--p3d-space-4);
  border-radius: var(--p3d-radius-md);
  border: 1px solid var(--p3d-color-border);
  background-color: var(--p3d-color-surface-card);
}

.p3d-notification__title {
  font-weight: var(--p3d-font-weight-bold);
  margin-bottom: var(--p3d-space-2);
}

.p3d-notification__body {
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-secondary);
}


/* ─── 9. Modal ────────────────────────────────────────────────────────────── */

.p3d-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.p3d-modal[hidden] {
  display: none !important;
}

.p3d-modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.p3d-modal__panel {
  position: relative;
  background-color: var(--p3d-color-surface-card);
  border-radius: var(--p3d-radius-lg);
  box-shadow: var(--p3d-shadow-modal);
  padding: var(--p3d-space-8);
  max-width: 420px;
  width: calc(100% - var(--p3d-space-8));
}

.p3d-modal__title {
  font-size: var(--p3d-font-size-xl);
  margin-bottom: var(--p3d-space-3);
}

.p3d-modal__body {
  font-size: var(--p3d-font-size-sm);
  color: var(--p3d-color-text-secondary);
  line-height: var(--p3d-line-height-base);
}


/* ─── 10. Skeleton loading animation ──────────────────────────────────────── */

@keyframes p3d-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.p3d-skeleton {
  background: linear-gradient(
    90deg,
    var(--p3d-skeleton-base)  25%,
    var(--p3d-skeleton-shine) 50%,
    var(--p3d-skeleton-base)  75%
  );
  background-size: 200% 100%;
  animation: p3d-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--p3d-radius-sm);
}

.p3d-skeleton--headline {
  height: 2rem;
  width: 60%;
}

.p3d-skeleton--subline {
  height: 1rem;
  width: 40%;
  margin-top: var(--p3d-space-2);
}

.p3d-skeleton--progress-bar {
  height: 6px;
  width: 100%;
  border-radius: var(--p3d-radius-full);
}

.p3d-skeleton--timeline-item {
  height: 56px;
  width: 100%;
  border-radius: var(--p3d-radius-md);
  margin-bottom: var(--p3d-space-3);
}


/* ─── 11. Utility ─────────────────────────────────────────────────────────── */

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

.p3d-text-secondary {
  color: var(--p3d-color-text-secondary);
  font-size: var(--p3d-font-size-sm);
}

.p3d-link-external::after {
  content: ' ↗';
  font-size: 0.8em;
}
