/* ==========================================================
   CaseHouse — Design System
   Palette: obsidian / ivory / titanium-gold / deep-emerald / coral
   Type: Space Grotesk (display) + Inter (body) + IBM Plex Mono (spec/data)
   ========================================================== */

:root {
  /* Casety palette — white / navy / light-gray premium look */
  --obsidian: #ffffff;
  --panel: #f4f6f9;
  --card: #ffffff;
  --hairline: #e5e9f0;
  --ivory: #0f1b33;
  --ivory-dim: #6b7688;
  --gold: #0f2f66;
  --gold-dim: #12386f;
  --emerald: #1f8a5c;
  --emerald-bright: #1f8a5c;
  --coral: #d64545;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -24px rgba(15,27,51,.18);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--obsidian);
  color: var(--ivory);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 64px;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--gold); color: #fff; }
@media (min-width: 821px) { body { padding-bottom: 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 .4em;
  letter-spacing: -.02em;
}
.mono { font-family: var(--font-mono); letter-spacing: .02em; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -.02em;
}
.logo span { color: var(--gold); }
.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--ivory-dim);
  align-items: center;
}
.nav-links a:hover { color: var(--ivory); }
.header-actions { display: flex; align-items: center; gap: 18px; }
.cart-link {
  position: relative;
  font-size: 14px;
  font-family: var(--font-mono);
  border: 1px solid var(--hairline);
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ivory);
}
.cart-badge {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--coral);
  color: #ffffff;
  font-size: 10px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.mobile-toggle { 
  display: none; 
  background: none; 
  border: none; 
  color: var(--ivory); 
  font-size: 24px; 
  padding: 0;
  cursor: pointer;
}

/* Categories dropdown (desktop hover) */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-trigger { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: 100%; left: 0;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 10px 0;
  min-width: 220px;
  z-index: 1001;
}
@media (min-width: 821px) {
  .nav-dropdown:hover .nav-dropdown-panel { display: block; }
}
.nav-dropdown-panel a { display: block; padding: 8px 18px; font-size: 14px; color: var(--ivory); white-space: nowrap; }
.nav-dropdown-panel a:hover { background: var(--panel); }
.nav-dropdown-parent { font-weight: 600; }
.nav-dropdown-sub a { color: var(--ivory-dim); font-size: 13px; }

/* ---------------- Mobile Navigation (Categories Only) ---------------- */
/* ---------------- Mobile Navigation (Categories & Subcategories Only) ---------------- */
@media (max-width: 820px) {
  .mobile-toggle { 
    display: block; 
  }

  /* Hide all top-level direct links on mobile (Shop, Preorders, Wallpapers, Track Order) */
  .nav-links > a {
    display: none !important;
  }

  /* Mobile menu container */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    margin: 0;
    border-bottom: 2px solid var(--hairline);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    z-index: 9999;
  }

  /* Show drawer when mobile menu is toggled open */
  .nav-links.nav-open {
    display: flex !important;
  }

  /* Force display of the Category dropdown wrapper */
  .nav-links > .nav-dropdown { 
    display: block !important; 
    width: 100%; 
  }

  /* Main Category Header / Parent Toggle */
  .nav-dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ivory) !important;
    border-bottom: 1px solid var(--hairline);
    text-decoration: none;
  }

  /* Always display the dropdown content panel inside mobile drawer */
  .nav-dropdown-panel {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    border-bottom: 1px solid var(--hairline) !important;
    border-radius: 0 !important;
    background: var(--panel) !important;
    padding: 8px 0 !important;
    min-width: 100% !important;
  }

  /* Parent items inside Categories */
  .nav-dropdown-panel a {
    display: block !important;
    padding: 10px 24px !important;
    font-size: 14px !important;
    color: var(--ivory) !important;
  }

  .nav-dropdown-parent {
    font-weight: 600;
    padding-top: 12px !important;
  }

  /* Child / Subcategory items inside Categories */
  .nav-dropdown-sub {
    display: block !important;
  }

  .nav-dropdown-sub a {
    padding-left: 40px !important; /* Indent subcategories for visual structure */
    color: var(--ivory-dim) !important;
    font-size: 13px !important;
  }
}
/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--gold); color: #ffffff; }
.btn-primary:hover { opacity: .9; }
.btn-outline { border-color: var(--hairline); color: var(--ivory); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- Hero ---------------- */
.hero {
  padding: 90px 0 60px;
  position: relative;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 48px;
  align-items: center;
}
.hero h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.05; }
.hero p.lead { color: var(--ivory-dim); font-size: 17px; max-width: 480px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; }
.hero-visual {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: 24px;
  background: linear-gradient(155deg, #1e1e23, #0b0b0d 70%);
  border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.hero-visual .phone-mock {
  width: 62%;
  aspect-ratio: 9/19.5;
  border-radius: 34px;
  background: linear-gradient(160deg, var(--gold), var(--gold-dim));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.15), 0 30px 60px -20px rgba(0,0,0,.7);
}
.spec-strip {
  margin-top: 30px;
  display: flex;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ivory-dim);
  border-top: 1px solid var(--hairline);
  padding-top: 16px;
}
.spec-strip b { color: var(--ivory); display: block; font-size: 15px; }

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 320px; margin: 0 auto; }
}

/* ---------------- Section header ---------------- */
.section { padding: 64px 0; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 20px;
}
.section-head h2 { font-size: 30px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  color: var(--ivory-dim);
}
.pill.active { background: var(--gold); color: #ffffff; border-color: var(--gold); }
.pill:hover { border-color: var(--gold); }

/* ---------------- Product grid ---------------- */
/* ---------------- Product grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.product-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease;
}

.product-card .thumb {
  aspect-ratio: 1/1;
  background: var(--panel);
  overflow: hidden;
  position: relative;
  width: 100%;
}

.product-card .thumb img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover;
  display: block;
}

.product-card .info { 
  padding: 16px; 
}

/* Mobile: 2 columns for product grid only */
@media (max-width: 820px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .product-card .thumb {
    aspect-ratio: 1/1;
  }
  
  .product-card .info { 
    padding: 10px; 
  }
  
  .product-card .name { 
    font-size: 13px;
    margin-bottom: 2px;
  }
  
  .price { 
    font-size: 14px; 
  }
  
  .compare-price {
    font-size: 11px;
  }
  
  .spec-line {
    font-size: 10px;
    margin-top: 6px;
    padding-top: 6px;
  }
  
  .badge {
    font-size: 9px;
    padding: 3px 8px;
    top: 6px;
    left: 6px;
  }
}

/* Small phones: ensure images don't distort */
@media (max-width: 480px) {
  .grid {
    gap: 8px;
  }
  
  .product-card .info { 
    padding: 8px; 
  }
  
  .product-card .name { 
    font-size: 12px; 
  }
  
  .price { 
    font-size: 13px; 
  }
}



/* ---------------- Product detail ---------------- */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.product-gallery img {
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  aspect-ratio: 1/1;
  object-fit: cover;
  width: 100%;
}
.product-info h1 { font-size: 32px; }
.product-info .price { font-size: 26px; }
.product-info .desc { color: var(--ivory-dim); margin: 18px 0; }
.spec-sheet {
  font-family: var(--font-mono);
  font-size: 13px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 20px 0;
}
.spec-sheet div {
  display: flex; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ivory-dim);
}
.spec-sheet div:last-child { border-bottom: none; }
.spec-sheet div b { color: var(--ivory); font-weight: 500; }
.qty-row { display: flex; align-items: center; gap: 14px; margin: 20px 0; }
.qty-control {
  display: flex; align-items: center; border: 1px solid var(--hairline); border-radius: 999px;
}
.qty-control button { background: none; border: none; color: var(--ivory); width: 36px; height: 36px; font-size: 16px; }
.qty-control input {
  width: 40px; text-align: center; background: none; border: none; color: var(--ivory); font-family: var(--font-mono);
}

@media (max-width: 820px) { .product-detail { grid-template-columns: 1fr; gap: 28px; } }

/* ---------------- Wallpaper gallery ---------------- */
.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.wall-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 9/16;
  background: var(--panel);
  border: 1px solid var(--hairline);
}
.wall-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.wall-card:hover img { transform: scale(1.05); }
.wall-overlay {
  position: absolute; inset: auto 0 0 0;
  padding: 14px;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  display: flex; justify-content: space-between; align-items: center;
  color: #ffffff;
}
.wall-overlay .title { font-size: 13px; font-weight: 600; }
.wall-overlay .dl-count { font-family: var(--font-mono); font-size: 11px; opacity: 0.8; }
.download-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--gold); color: #ffffff;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  opacity: 0; transition: opacity .2s ease;
}
.wall-card:hover .download-btn { opacity: 1; }

/* ---------------- Cart / Checkout ---------------- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th { text-align: left; font-family: var(--font-mono); font-size: 11px; color: var(--ivory-dim); text-transform: uppercase; padding-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.cart-table td { padding: 16px 0; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.cart-item-row { display: flex; gap: 14px; align-items: center; }
.cart-item-row img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); }
.summary-box {
  background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 24px;
}
.summary-row { display: flex; justify-content: space-between; margin-bottom: 12px; color: var(--ivory-dim); font-size: 14px; }
.summary-row.total { color: var(--ivory); font-weight: 700; font-size: 18px; border-top: 1px solid var(--hairline); padding-top: 14px; margin-top: 14px; }

.checkout-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 40px; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; color: var(--ivory-dim); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 12px 14px; background: var(--panel); border: 1px solid var(--hairline);
  border-radius: var(--radius-sm); color: var(--ivory); font-family: var(--font-body); font-size: 14px;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--gold);
}
.payment-option {
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 10px; cursor: pointer;
}
.payment-option.selected { border-color: var(--gold); background: rgba(15,47,102,.05); }
.payment-note { font-size: 12px; color: var(--ivory-dim); margin-top: 8px; font-family: var(--font-mono); }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 48px 0 28px;
  color: var(--ivory-dim);
  font-size: 13px;
  margin-top: 60px;
}
.footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; margin-bottom: 24px; }
.footer-grid h4 { color: var(--ivory); font-size: 14px; }
.footer-grid a { display: block; margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid var(--hairline); padding-top: 20px; text-align: center; }

/* ---------------- Alerts ---------------- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 20px; }
.alert-success { background: rgba(76,175,133,.12); border: 1px solid var(--emerald); color: var(--emerald-bright); }
.alert-error { background: rgba(232,92,74,.12); border: 1px solid var(--coral); color: var(--coral); }

/* ---------------- Empty states ---------------- */
.empty-state { text-align: center; padding: 80px 20px; color: var(--ivory-dim); }