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

/* === Custom Properties === */
:root {
  --color-bg: #000;
  --color-text: #fff;
  --color-text-muted: #888;
  --color-accent: #f44d15;
  --color-card-bg: #111;
  --color-card-border: #222;
  --color-separator: #1a1a1a;
  --color-link: #f44d15;
  --max-width: 1200px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* === Base === */
html {
  font-family: var(--font-stack);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  color: var(--color-text);
  background-color: var(--color-bg);
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-text);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent);
}

/* === Typography Scale === */
h1 { font-size: 2.25rem; font-weight: 700; line-height: 1.2; margin-bottom: 0.5rem; }
h2 { font-size: 1.75rem; font-weight: 600; line-height: 1.3; margin-bottom: 0.5rem; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.5rem; }

p {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

/* === Layout === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 2rem 0;
}

/* === Navigation === */
.site-nav {
  padding: 1rem 0;
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav__brand {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-text);
}

.site-nav__brand:hover {
  color: var(--color-text);
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.site-nav__links a {
  font-size: 1.1rem;
  color: var(--color-text);
  transition: color 0.2s;
}

.site-nav__links a:hover {
  color: var(--color-accent);
}

.site-nav__links a.active {
  color: var(--color-accent);
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 6px;
  padding: 0.5rem 0;
  min-width: 200px;
  z-index: 100;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown.open .nav-dropdown__menu {
  display: block;
}

.nav-dropdown__menu a {
  display: block;
  padding: 0.4rem 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.nav-dropdown__menu a:hover {
  background: var(--color-card-border);
}

/* Hamburger (mobile) */
.site-nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.site-nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

/* === Page Header === */
.page-header {
  text-align: center;
  padding: 2rem 0 2.5rem;
}

.page-header h1 {
  text-shadow: 2px 2px 6px rgba(0,0,0,0.8);
}

.page-header .subtitle {
  font-size: 1.25rem;
  color: var(--color-text-muted);
}

/* === Homepage: Hero === */
.hero {
  text-align: center;
  padding: 2rem 0 1rem;
}

.hero h1 {
  font-size: 2.25rem;
}

.hero h2 {
  font-size: 1.25rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.hero__image {
  max-width: 80%;
  margin: 0 auto;
}

/* === Homepage: Project Rows === */
.project-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s;
  color: var(--color-text);
}

.project-row:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.project-row__image {
  flex: 0 0 300px;
}

.project-row__image img {
  border-radius: 8px;
}

.project-row__content h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.project-row__content p {
  color: var(--color-text-muted);
  font-size: 1rem;
  margin-bottom: 1rem;
}

.btn-outline {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--color-text-muted);
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.95rem;
  transition: border-color 0.2s, color 0.2s;
}

.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* === Project Pages: Float Sections === */
.tech-section {
  overflow: hidden;
  margin-bottom: 2rem;
}

.tech-section__image,
.tech-section__image--left,
.tech-section__image--right {
  display: block;
  width: 45%;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.tech-section__image--left img,
.tech-section__image--right img {
  width: 100%;
  border-radius: 8px;
}

.tech-section__image--left {
  float: left;
  margin-right: 1.5rem;
}

.tech-section__image--right {
  float: right;
  margin-left: 1.5rem;
}

/* === Parts Table === */
.parts-table {
  width: auto;
  border-collapse: collapse;
}

.parts-table th,
.parts-table td {
  padding: 0.75rem 1.5rem 0.75rem 0;
  text-align: left;
}

.parts-table th:last-child,
.parts-table td:last-child {
  padding-right: 0;
}

.parts-table thead th {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  border-bottom: 1px solid var(--color-card-border);
}

.parts-table tbody tr {
  border-bottom: 1px solid var(--color-separator);
}

.parts-table tbody td {
  font-size: 1rem;
}

.parts-table a {
  color: var(--color-accent);
}

.parts-table a:hover {
  text-decoration: underline;
}

/* === Downloads === */
.downloads a {
  color: var(--color-accent);
  font-size: 1rem;
}

.downloads a:hover {
  text-decoration: underline;
}

.downloads li {
  margin-bottom: 0.5rem;
}

/* === Gallery Grid === */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.gallery-grid__item {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.gallery-grid__item img {
  border-radius: 8px;
  transition: transform 0.2s;
}

.gallery-grid__item:hover img {
  transform: scale(1.05);
}

/* === Assembly Gallery: Numbered Steps === */
.assembly-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.assembly-grid__item {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.assembly-grid__item img {
  border-radius: 8px;
  transition: transform 0.2s;
}

.assembly-grid__item:hover img {
  transform: scale(1.05);
}

.assembly-grid__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* === Shop: Horizontal Product Cards === */
.shop-card {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.shop-card--sold {
  opacity: 0.6;
}

.shop-card__image {
  flex: 0 0 240px;
  position: relative;
  cursor: pointer;
}

.shop-card__image img {
  border-radius: 8px;
}

.shop-card__sold-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: var(--color-accent);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-accent);
  border-radius: 6px;
}

.shop-card__details h3 {
  font-size: 1.25rem;
  margin-bottom: 0.15rem;
}

.shop-card__subtitle {
  color: var(--color-accent);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.shop-card__description {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.shop-card__price {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.shop-card__price--sold {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.shop-card__paypal {
  min-height: 50px;
}

/* === Lightbox === */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 2rem;
  cursor: pointer;
  z-index: 1001;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 2.5rem;
  cursor: pointer;
  padding: 1rem;
  z-index: 1001;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-nav:hover {
  opacity: 1;
}

.lightbox-nav--prev { left: 0.5rem; }
.lightbox-nav--next { right: 0.5rem; }

.lightbox-step {
  color: var(--color-text);
  font-size: 0.9rem;
  margin-top: 0.75rem;
  text-align: center;
}

/* === System & Software === */
.system-software pre {
  display: block;
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.9rem;
  overflow-x: auto;
  color: var(--color-text);
  margin-bottom: 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.system-software code {
  background: var(--color-card-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
}

.system-software pre code {
  padding: 0;
  background: none;
  border-radius: 0;
}

/* === Layout: Keyboard (cyberdeck-keyboard page) === */
.keyboard-layout pre {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.75rem;
  overflow-x: auto;
  color: var(--color-text);
  text-align: center;
  margin-bottom: 1rem;
}

/* === Footer === */
.site-footer {
  text-align: center;
  padding: 3rem 0 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* === Responsive === */
@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.35rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero__image { max-width: 100%; }

  /* Nav */
  .site-nav__toggle { display: block; }
  .site-nav__links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-card-border);
    padding: 1rem 1.5rem;
    gap: 0.75rem;
  }
  .site-nav__links.open { display: flex; }
  .site-nav .container { position: relative; flex-wrap: wrap; }
  .nav-dropdown__menu {
    position: static;
    border: none;
    background: none;
    padding-left: 1rem;
  }

  /* Project rows */
  .project-row {
    flex-direction: column;
    text-align: center;
  }
  .project-row__image { flex: none; width: 100%; }

  /* Float sections */
  .tech-section__image,
  .tech-section__image--left,
  .tech-section__image--right {
    float: none;
    width: 100%;
    margin: 0 0 1rem 0;
  }

  /* Grids */
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .assembly-grid { grid-template-columns: repeat(3, 1fr); }

  /* Shop */
  .shop-card {
    flex-direction: column;
    text-align: center;
  }
  .shop-card__image { flex: none; width: 100%; }
}

@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .assembly-grid { grid-template-columns: repeat(2, 1fr); }
}
