/* Spare Cables - Populist & Accessible Mobile-First Design */

:root {
  --color-bg-main: #090d16;
  --color-bg-card: #0f172a;
  --color-bg-card-hover: #1e293b;
  --color-accent-blue: #38bdf8;
  --color-accent-amber: #f59e0b;
  --color-accent-emerald: #10b981;
  --color-border: #334155;
  --touch-target-min: 48px;
}

/* Base resets & typography */
html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #f1f5f9;
  background-color: var(--color-bg-main);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1e293b 0%, #090d16 70%);
  background-attachment: fixed;
  color: #f8fafc;
}

/* Minimum touch targets for mobile thumbs & older/younger folks */
button,
a,
input,
select,
.touch-target {
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
  touch-action: manipulation;
}

/* Focus visibility for accessibility */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
.table-container:focus-visible,
.overflow-x-auto:focus-visible {
  outline: 3px solid #38bdf8;
  outline-offset: 3px;
}

/* Interactive Device Card Styling */
.device-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #334155;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  cursor: pointer;
  user-select: none;
}

.device-card:hover {
  transform: translateY(-2px);
  border-color: #64748b;
  background-color: rgba(30, 41, 59, 0.95);
}

.device-card.active,
.device-card[aria-pressed="true"] {
  border-color: #38bdf8;
  background-color: rgba(14, 116, 144, 0.25);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
  transform: translateY(-2px);
}

/* Goal / Need Button Styling */
.goal-btn,
.need-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid #334155;
  background-color: rgba(15, 23, 42, 0.85);
  cursor: pointer;
  user-select: none;
}

.goal-btn:hover,
.need-btn:hover {
  border-color: #64748b;
  background-color: rgba(30, 41, 59, 0.95);
}

.goal-btn.active,
.goal-btn[aria-pressed="true"],
.need-btn.active,
.need-btn[aria-pressed="true"] {
  border-color: #f59e0b;
  background-color: rgba(180, 83, 9, 0.25);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
  transform: translateY(-2px);
}

/* "Can't Go Wrong" Highlight Card */
.all-around-card {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.35) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 2px solid #38bdf8;
  box-shadow: 0 8px 32px rgba(56, 189, 248, 0.2);
}

/* Pitfall Warnings */
.pitfall-box {
  background: linear-gradient(135deg, rgba(136, 19, 55, 0.25) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid #f43f5e;
}

/* Prevent flex-column children from overflowing mobile viewports */
body > main {
  width: 100%;
}

body > header,
body > section,
body > main,
body > div,
main > section,
.overflow-x-auto {
  max-width: 100%;
  min-width: 0;
}

/* Table scroll wrapper and styling */
.table-container {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  border-radius: 0.75rem;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.75);
}

.table-container table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9375rem;
}

.table-container thead,
.overflow-x-auto thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

.table-container th {
  background: #1e293b;
  color: #94a3b8;
  font-weight: 600;
  padding: 0.875rem 1rem;
  border-bottom: 2px solid #334155;
  white-space: nowrap;
}

.table-container td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #1e293b;
  color: #f1f5f9;
}

.table-container tr:nth-child(even) td {
  background: rgba(30, 41, 59, 0.3);
}

.table-container tr:hover td {
  background: rgba(56, 189, 248, 0.1);
}

/* Amazon Buy Button */
.amazon-buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  font-weight: 700;
  border-radius: 0.5rem;
  padding: 0.75rem 1.25rem;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.amazon-buy-btn:hover {
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

/* Nerd Mode Accordion */
details.nerd-details summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details.nerd-details summary::-webkit-details-marker {
  display: none;
}

details.nerd-details[open] summary .nerd-chevron {
  transform: rotate(180deg);
}

.nerd-chevron {
  transition: transform 0.2s ease;
}

/* Defer layout/paint of heavy below-the-fold reference sections (defer-rendering-heavy-content) */
#usb-c-standards,
#video-standards,
#device-quick-picks,
#faq-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 640px;
}
