/* ============================================================
   CJ 5 AUTO REPAIR — Design Tokens & Component Styles
   Phone-app style: narrow device frame, bottom tab nav,
   card-based sections. Red/black/chrome brand palette.
   ============================================================ */

:root {
  /* Type scale — fluid clamp() */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);
  --text-2xl: clamp(1.75rem, 1.4rem + 1.5vw, 2.25rem);

  /* 4px spacing system */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.375rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);

  /* App frame */
  --app-max-width: 430px;

  /* Fonts */
  --font-display: 'Cabinet Grotesk', 'General Sans', system-ui, sans-serif;
  --font-body: 'Satoshi', 'Inter', system-ui, sans-serif;
}

/* LIGHT MODE (default) */
:root,
[data-theme='light'] {
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfd;
  --color-surface-offset: #edf0f4;
  --color-surface-offset-2: #e3e7ec;
  --color-divider: #dfe4e9;
  --color-border: #ccd3da;

  --color-text: #10151c;
  --color-text-muted: #57626d;
  --color-text-faint: #98a2ab;
  --color-text-inverse: #f5f7fa;

  --color-primary: #c81e1e;
  --color-primary-hover: #a81616;
  --color-primary-active: #7f0f0f;
  --color-primary-highlight: #fbe2e0;

  --color-success: #2f7d4f;

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 20 / 0.07);
  --shadow-md: 0 6px 16px oklch(0.2 0.02 20 / 0.1);
  --shadow-lg: 0 24px 60px oklch(0.2 0.02 20 / 0.22);

  --backdrop-bg: radial-gradient(circle at 50% -10%, oklch(0.55 0.19 25 / 0.12), transparent 55%), #e7eaee;
}

/* DARK MODE */
[data-theme='dark'] {
  --color-bg: #0a0d12;
  --color-surface: #10141a;
  --color-surface-2: #131820;
  --color-surface-offset: #161c24;
  --color-surface-offset-2: #1b222b;
  --color-divider: #202832;
  --color-border: #303a46;

  --color-text: #e7ebf0;
  --color-text-muted: #9aa5b1;
  --color-text-faint: #626d79;
  --color-text-inverse: #10151c;

  --color-primary: #ff6b5e;
  --color-primary-hover: #ff8b7f;
  --color-primary-active: #ffaa9f;
  --color-primary-highlight: #3a1310;

  --color-success: #63b783;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 6px 16px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 24px 60px oklch(0 0 0 / 0.55);

  --backdrop-bg: radial-gradient(circle at 50% -10%, oklch(0.4 0.15 25 / 0.18), transparent 55%), #05070a;
}

/* ============================================================
   BODY / BACKDROP
   ============================================================ */

body {
  background: var(--backdrop-bg);
}

/* ============================================================
   APP FRAME (phone-frame everywhere)
   ============================================================ */

.app-frame {
  width: min(var(--app-max-width), 100vw);
  height: 100dvh;
  height: 100vh;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
  position: relative;
}

@media (min-width: 640px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
  }
  .app-frame {
    width: var(--app-max-width);
    height: min(880px, 92vh);
    border-radius: 34px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--color-border);
  }
}

/* ============================================================
   TOP BAR
   ============================================================ */

.app-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  z-index: 5;
}

.topbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.brand-mark-sm {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-faint);
  flex-shrink: 0;
}
.status-chip.is-open .status-dot {
  background: var(--color-success);
  box-shadow: 0 0 0 3px oklch(from var(--color-success) l c h / 0.2);
}
.status-text {
  display: none;
}
.status-chip.is-open .status-text--open {
  display: inline;
  color: var(--color-success);
}
.status-chip:not(.is-open) .status-text--closed {
  display: inline;
  color: var(--color-text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.icon-btn--pill {
  width: auto;
  padding: 0 9px;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.icon-btn--accent {
  background: var(--color-primary);
  color: #ffffff;
}
.icon-btn--accent:hover {
  background: var(--color-primary-hover);
  color: #ffffff;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  min-height: 46px;
  flex: 1 1 auto;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--color-primary-hover);
}
.btn-primary:active {
  background: var(--color-primary-active);
}

.btn-secondary {
  background: var(--color-surface-offset);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-surface-offset-2);
  border-color: var(--color-text-faint);
}

/* ============================================================
   SCROLLABLE CONTENT
   ============================================================ */

.app-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.app-scroll > section {
  padding: var(--space-6) var(--space-5);
}
.app-scroll > section + section {
  border-top: 1px solid var(--color-divider);
}

.section-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.section-intro {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* ============================================================
   HERO CARD
   ============================================================ */

.hero-card {
  padding-top: var(--space-5);
}

.hero-media-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-5);
}
.hero-media-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.hero-eyebrow svg {
  width: 13px;
  height: 13px;
}

.hero-card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}
.hero-card h1 em {
  font-style: normal;
  color: var(--color-primary);
}

.hero-card p {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.hero-actions {
  display: flex;
  gap: var(--space-3);
}

/* ============================================================
   TRUST GRID
   ============================================================ */

.trust-section {
  padding-top: var(--space-2) !important;
}

.trust-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}
.trust-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
}
.trust-card svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
  flex-shrink: 0;
}
.trust-card span {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
}

/* ============================================================
   SERVICES
   ============================================================ */

.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  text-decoration: none;
  color: inherit;
}
.service-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.service-card:active {
  transform: scale(0.97);
}

.service-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}
.service-card-icon svg {
  width: 19px;
  height: 19px;
}

.service-card h3 {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}
.service-card p {
  font-size: 12px;
  color: var(--color-text-muted);
}
.service-card .service-tag {
  margin-top: var(--space-2);
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

/* ============================================================
   REQUEST A SERVICE
   ============================================================ */

.request-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input,
.field select,
.field textarea {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  min-height: 46px;
}
.field textarea {
  resize: vertical;
  min-height: 76px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-primary);
}

.request-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-1);
}
.request-fallback {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.request-fallback a {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
}

/* ============================================================
   HOURS & LOCATION
   ============================================================ */

.location-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  margin-top: var(--space-5);
}

.location-block {
  display: flex;
  gap: var(--space-3);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.location-block:first-child {
  padding-top: 0;
}
.location-block:last-of-type {
  border-bottom: none;
}
.location-block svg {
  width: 19px;
  height: 19px;
  color: var(--color-primary);
  flex-shrink: 0;
  margin-top: 2px;
}
.location-block h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-1);
  font-weight: 700;
}
.location-block a,
.location-block p {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
}
.location-block a {
  text-decoration: none;
}
.location-block a:hover {
  color: var(--color-primary);
}

.hours-table {
  width: 100%;
  margin-top: var(--space-1);
}
.hours-table tr {
  border-bottom: 1px dashed var(--color-divider);
}
.hours-table tr:last-child {
  border-bottom: none;
}
.hours-table td {
  padding-block: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.hours-table td:first-child {
  color: var(--color-text-muted);
  width: 1%;
  white-space: nowrap;
  padding-right: var(--space-4);
}
.hours-table td:last-child {
  width: auto;
  text-align: right;
  font-weight: 700;
}

.location-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.map-frame {
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  min-height: 220px;
  margin-top: var(--space-4);
}
.map-frame iframe {
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: 0;
  filter: grayscale(0.15) contrast(1.02);
}

/* ============================================================
   FOOTER
   ============================================================ */

.app-footer {
  padding: var(--space-6) var(--space-5) var(--space-8) !important;
  text-align: center;
}
.app-footer .brand {
  display: inline-flex;
  margin-bottom: var(--space-3);
}
.app-footer .brand-mark {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.app-footer p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 34ch;
  margin-inline: auto;
  margin-bottom: var(--space-4);
}
.app-footer .copyright {
  font-size: 11px;
  color: var(--color-text-faint);
}

/* ============================================================
   BOTTOM TAB BAR
   ============================================================ */

.bottom-nav {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-2) var(--space-2) max(var(--space-2), env(safe-area-inset-bottom));
  z-index: 5;
}

/* Persistent fade above the nav signals there's more content to
   scroll — keeps the boundary from looking like an abrupt cut-off. */
.bottom-nav::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 26px;
  background: linear-gradient(to bottom, transparent, var(--color-bg) 88%);
  pointer-events: none;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--space-1) 0;
  color: var(--color-text-faint);
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.bottom-nav-item svg {
  width: 21px;
  height: 21px;
}
.bottom-nav-item.is-active {
  color: var(--color-primary);
}
.bottom-nav-item:hover {
  color: var(--color-text);
}

.bottom-nav-item--primary {
  position: relative;
}
.bottom-nav-item--primary .nav-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-12px);
  box-shadow: var(--shadow-md);
}
.bottom-nav-item--primary .nav-icon-wrap svg {
  width: 20px;
  height: 20px;
}
.bottom-nav-item--primary span:not(.nav-icon-wrap) {
  margin-top: -8px;
}
.bottom-nav-item--primary.is-active .nav-icon-wrap {
  background: var(--color-primary-hover);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 360px) {
  .app-scroll > section {
    padding: var(--space-5) var(--space-4);
  }
  .trust-card span {
    font-size: 11px;
  }
}
