:root {
  --bg: #ffffff;
  --surface: #F5F5F4;
  --surface-hover: #E9E9E7;
  --border: #E9E9E7;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #005B8C;
  --accent-hover: #004a73;
  --cta: #E25303;
  --cta-hover: #c44703;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-lifted: 0 6px 18px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */

header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.header-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 96px;
}

.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-img {
  height: 72px;
  width: auto;
  display: block;
}

.header-divider {
  width: 1px;
  height: 48px;
  background: var(--border);
  flex-shrink: 0;
}

.header-title h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.2;
}

.tagline {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

main {
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  flex: 1;
}

/* Footer */

footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-company {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.footer-brand {
  font-weight: 600;
  color: var(--text);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-bottom {
  max-width: 880px;
  margin: 0 auto;
  padding: 0.6rem 1.25rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Device selector */

#device-selector { margin-bottom: 2rem; }

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.search-wrap { position: relative; }

input[type="text"] {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg);
  color: var(--text);
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 91, 140, 0.15);
}

/* Device grid */

#device-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.device-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
}

.device-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lifted);
  transform: translateY(-2px);
}

.device-card-image {
  aspect-ratio: 2/3;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.device-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.75rem;
}

.device-card-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #0080c0);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-card-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.device-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.3;
}

.device-card-orders {
  font-size: 0.77rem;
  color: var(--text-muted);
}

/* Variant labels (device detail page) */

.variant-label {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.06rem 0.45rem;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
  margin-right: 0.2rem;
}

/* Device page header */

.device-header { margin-bottom: 1.75rem; }

.device-header-info {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
  margin-top: 0.5rem;
}

.device-header-image {
  width: 92px;
  height: 136px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.35rem;
  flex-shrink: 0;
}

.device-header h2 { margin: 0 0 0.15rem; font-size: 1.5rem; letter-spacing: -0.015em; }

.btn-change-device {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  display: inline-block;
  text-decoration: none;
}

.btn-change-device:hover { text-decoration: underline; }

.text-muted { color: var(--text-muted); margin: 0; font-size: 0.9rem; }

/* Card sections */

.card-section { margin-bottom: 2rem; }

.card-section h3 {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
}

/* Hero card */

#hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.hero-label {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.hero-version {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 0.3rem;
}

.hero-date {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 1.5rem;
}

.btn-download {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 0.6rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s, box-shadow 0.15s;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 91, 140, 0.3);
}

.btn-download:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(0, 91, 140, 0.4);
}

.hero-files {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.hero-files li {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.hero-files a { color: var(--accent); text-decoration: none; }
.hero-files a:hover { text-decoration: underline; }

.secondary-channels {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.channel-badge-name {
  font-weight: 600;
  color: var(--text);
}

/* Supplemental */

.supplemental-channel-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1rem 0 0.4rem;
}

/* Releases accordion */

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.release-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  background: var(--surface);
  user-select: none;
  transition: background 0.12s;
}

.release-header:hover { background: var(--surface-hover); }

.release-version { font-weight: 600; font-size: 0.95rem; }
.release-date { color: var(--text-muted); font-size: 0.87rem; margin-left: 0.6rem; }

.release-toggle { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }
details summary .release-toggle::before { content: "\25BC\00A0"; }
details[open] summary .release-toggle::before { content: "\25B2\00A0"; }

.release-body {
  padding: 1rem 1rem 0.75rem;
  border-top: 1px solid var(--border);
}

.release-notes {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.6;
}

.files-heading {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 0.4rem;
}

.files-list { list-style: none; padding: 0; margin: 0; }

.files-list li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.35rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.files-list li:last-child { border-bottom: none; }

.files-list a { color: var(--accent); text-decoration: none; word-break: break-all; }
.files-list a:hover { text-decoration: underline; }

.file-kind {
  background: var(--border);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  font-size: 0.71rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.file-checksum {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  word-break: break-all;
  width: 100%;
}

/* Responsive */

@media (max-width: 600px) {
  header { padding: 0 1rem; }
  .header-inner { min-height: 64px; }
  .logo-img { height: 44px; }
  .header-divider, .tagline { display: none; }
  main { padding: 1.25rem 1rem 2rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .device-header h2 { font-size: 1.25rem; }
  .hero-version { font-size: 2.2rem; }

  #device-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .device-card {
    flex-direction: row;
  }

  .device-card-image {
    aspect-ratio: unset;
    width: 72px;
    flex-shrink: 0;
    border-bottom: none;
    border-right: 1px solid var(--border);
  }

  .device-card-body {
    justify-content: center;
  }
}
