/* =========================================================
   Camerselling — Home Page Styles
   Theme: bright "studio lightbox" surface with shutter-orange
   accent and focus-confirm green, autofocus-bracket signature
   on cards.

   Responsive strategy (see also the "Responsive breakpoints"
   section near the bottom):
    - Fluid type/spacing via clamp() on the biggest visual
      elements (brand, hero, section heads) so they scale
      smoothly between breakpoints instead of jumping.
    - Product grid steps 5 → 4 → 3 → 2 columns as the viewport
      narrows, all the way down to small phones (~320px).
    - Topbar action labels ("Ronit Bisht", "Logout", "Cart")
      collapse to icon-only on narrow screens so nothing wraps
      or overflows.
    - Mobile nav (hamburger) drawer is preserved/refined; it
      needs a `.open` class toggle on `.mainnav` and, for
      dropdown items, on `.nav-dropdown` — handled by your JS.
    - `overflow-x: hidden` on the page + `max-width: 100%` on
      media prevents any accidental horizontal scroll on very
      narrow devices.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&display=swap');

:root{
  --bg-page:      #F6F7F5;   /* studio lightbox white, slightly cool */
  --bg-panel:     #FFFFFF;
  --bg-panel-2:   #F0F1EE;
  --border:       #E1E4E0;
  --text-primary: #14171A;
  --text-muted:   #6B7176;
  --accent:       #FF6B35;   /* shutter / record-tally orange */
  --accent-dim:   #FFDCC7;
  --focus-green:  #0E9F6E;   /* focus-confirm green, darkened for contrast on white */
  --danger:       #D93A3E;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(20,23,26,0.04), 0 6px 16px rgba(20,23,26,0.05);
  --topbar-h: 60px; /* used to keep sticky bars from overlapping content */
}

.brand-logo{
  height: 48px;   /* was 34px */
  width: auto;
  display: block;
  flex-shrink: 0;
}

@media (max-width: 420px){
  .brand-logo{ height: 34px; }  /* was 26px */
}

*{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* guards against any narrow-device horizontal scroll */
}

a{ color: inherit; text-decoration: none; }
img{ max-width: 100%; height: auto; display: block; }



/* ---------- Skip link (accessibility) ---------- */
.skip-link{
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #14171A;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus{ left: 10px; top: 10px; }

/* ---------- Top bar ---------- */
.topbar{
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(20,23,26,0.03);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner{
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px clamp(12px, 4vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 3vw, 20px);
  flex-wrap: nowrap;
}
.brand{
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 3.5vw, 1.35rem);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand .aperture{
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.brand .aperture .ring-outer{ stroke: var(--accent); }
.brand .aperture .ring-inner{ stroke: var(--focus-green); }
.brand span.dot{ color: var(--accent); }

.search-form{
  flex: 1;
  max-width: 480px;
  display: flex;
  min-width: 0;
}
.search-form input{
  flex: 1;
  min-width: 0;
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px 0 0 8px;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.search-form input:focus{ outline: 2px solid var(--accent); outline-offset: -2px; }
.search-form button{
  background: var(--accent);
  border: none;
  color: #FFFFFF;
  padding: 0 16px;
  border-radius: 0 8px 8px 0;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-actions{
  display: flex;
  align-items: center;
  gap: clamp(10px, 2.5vw, 18px);
  flex-shrink: 0;
}
.icon-btn{
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  white-space: nowrap;
  touch-action: manipulation;
}
.icon-btn:hover{ color: var(--text-primary); }
.cart-count{
  background: var(--accent);
  color: #14171A;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ---------- Main nav (orange strap, centered, white text) ---------- */
.mainnav{
  background: var(--accent);
}
.mainnav-inner{
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
}
.nav-link{
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 0;
  color: #FFFFFF;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
}
.nav-link:hover{ color: #14171A; }
.nav-link::after{
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: #FFFFFF;
  transition: width 0.15s ease, background 0.15s ease;
}
.nav-link:hover::after{
  width: 100%;
  background: #14171A;
}

.nav-dropdown{ position: relative; }
.nav-dropdown .chevron{ transition: transform 0.15s ease; }
.nav-dropdown:hover .chevron{ transform: rotate(180deg); }

.nav-dropdown-menu{
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 200px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 60;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu:hover{
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.nav-dropdown-menu a{
  display: block;
  padding: 10px 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  text-align: left;
}
.nav-dropdown-menu a:hover{
  background: var(--bg-panel-2);
  color: var(--accent);
}

/* ---------- Hero ---------- */
.hero{
  position: relative;
  max-width: 1400px;
  margin: 28px auto 0;
  padding: 0 clamp(12px, 4vw, 24px);
}
.hero-inner{
  background: linear-gradient(120deg, var(--bg-panel) 0%, var(--bg-panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(24px, 6vw, 48px) clamp(20px, 5vw, 40px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(20px, 5vw, 40px);
  overflow: hidden;
  position: relative;
  flex-wrap: wrap;
}
.hero-eyebrow{
  font-family: var(--font-mono);
  color: var(--focus-green);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.hero h1{
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 2.6rem);
  line-height: 1.18;
  margin: 0 0 14px;
  max-width: 20ch;
  word-break: break-word;
}
.hero p{
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0 0 22px;
  font-size: clamp(0.88rem, 2.5vw, 0.98rem);
}
.hero-cta{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #14171A;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 8px;
  touch-action: manipulation;
}
.hero-rings{
  position: absolute;
  right: -60px;
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  height: 320px;
  opacity: 0.6;
  flex-shrink: 0;
}
.hero-rings circle{ stroke: var(--text-muted); opacity: 0.25; fill: none; }

/* Hero variant used on the home page: text column + product image column.
   Fluid, flex-basis driven so it scales smoothly instead of snapping at
   a single breakpoint, and stacks cleanly on narrow/mobile screens. */
.hero-content{
  flex: 1 1 320px;
  min-width: 0;
  position: relative;
  z-index: 2;
}
.hero-image{
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-image img{
  width: 100%;
  max-width: 480px;
  height: auto;
  object-fit: contain;
}

/* ---------- Section heading ---------- */
.section-wrap{
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(12px, 4vw, 24px);
}
.section-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: clamp(28px, 6vw, 44px) 0 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2{
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-head h2 .tally{
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
}
.section-head p{
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---------- Product grid ---------- */
.product-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  padding-bottom: 60px;
  margin-top: clamp(24px, 5vw, 40px);
}

.product-card{
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  min-width: 0;
}
.product-card:hover{
  transform: translateY(-3px);
  border-color: var(--accent-dim);
  box-shadow: 0 10px 24px rgba(20,23,26,0.09);
}

.pc-link{
  display: block;
}

/* signature: autofocus corner brackets that snap in on hover, like a camera viewfinder */
.pc-media{
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-panel-2);
  overflow: hidden;
}
.pc-media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}
.product-card:hover .pc-media img{ transform: scale(1.04); }

.pc-media::before,
.pc-media::after,
.pc-bracket-l,
.pc-bracket-r{
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--focus-green);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.pc-media::before{ top: 8px; left: 8px; border-right: none; border-bottom: none; transform: translate(-4px,-4px); }
.pc-media::after{ top: 8px; right: 8px; border-left: none; border-bottom: none; transform: translate(4px,-4px); }
.pc-bracket-l{ bottom: 8px; left: 8px; border-right: none; border-top: none; transform: translate(-4px,4px); }
.pc-bracket-r{ bottom: 8px; right: 8px; border-left: none; border-top: none; transform: translate(4px,4px); }
.product-card:hover .pc-media::before,
.product-card:hover .pc-media::after,
.product-card:hover .pc-bracket-l,
.product-card:hover .pc-bracket-r{
  opacity: 1;
  transform: translate(0,0);
}

/* On touch devices there's no hover, so always show a faint bracket hint */
@media (hover: none){
  .pc-media::before,
  .pc-media::after,
  .pc-bracket-l,
  .pc-bracket-r{
    opacity: 0.35;
    transform: translate(0,0);
  }
}

.pc-badge{
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);   /* ← badge background color (currently orange) */
  color: white;              /* ← badge text color (currently near-black) */
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  z-index: 2;
}
.pc-badge.out{ background: var(--danger); color: #fff; }

.pc-body{
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.pc-brand{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pc-title{
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  /* exactly two lines, then ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(0.9rem * 1.3 * 2);
}
.pc-price-row{
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 2px;
}
.pc-price{
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--focus-green);
}
.pc-price-old{
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.pc-actions{
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.btn{
  flex: 1;
  border: none;
  border-radius: 7px;
  padding: 9px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  min-height: 38px;
}
.btn:active{ transform: scale(0.97); }
.btn-cart{
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-cart:hover{ border-color: var(--accent); color: var(--accent); }
.btn-buy{
  background: var(--accent);
  color: white;
}
.btn-buy:hover{ opacity: 0.9; }
.btn[disabled]{
  opacity: 0.4;
  cursor: not-allowed;
}

.empty-state{
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* ---------- Toast (used by js/script.js) ---------- */
/* ---------------- Toast (Add to Cart popup) ----------------
   Centered both horizontally and vertically on screen. */

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 9999;

  background: #111318;
  color: #fff;
  padding: 16px 28px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  max-width: calc(100vw - 32px); /* never overflow narrow screens */

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.toast.toast-error {
  background: #b42318;
}

/* Optional: dim the page behind the popup while it's visible.
   Remove this block if you don't want a backdrop. */
.toast.show::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  z-index: -1;
}

/* ---------- Footer ---------- */
.site-footer{
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 28px clamp(12px, 4vw, 24px);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* =========================================================
   Responsive breakpoints
   Product grid: 5 cols (desktop) → 4 (small desktop/tablet)
   → 3 (tablet/large phone) → 2 (phone) → stays 2 down to
   the smallest common phones (~320px), just tighter.
   ========================================================= */

/* Small desktop / large tablet */
@media (max-width: 1180px){
  .product-grid{ grid-template-columns: repeat(4, 1fr); }
}

/* Tablet */
@media (max-width: 900px){
  .hero-inner{ flex-direction: column; align-items: flex-start; padding: 32px 24px; }
  .hero-rings{ display: none; }
  .hero-content{ order: 1; width: 100%; flex-basis: auto; }
  .hero-image{ order: 2; width: 100%; flex-basis: auto; margin-top: 8px; }
  .hero-image img{ max-width: 360px; }
  .search-form{ display: none; }
}

/* Large phone / small tablet */
@media (max-width: 768px){
  .mainnav-inner{ gap: 16px; overflow-x: auto; justify-content: flex-start; }
  .product-grid{ grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .pc-body{ padding: 8px 8px 10px; gap: 4px; }
  .pc-title{ font-size: 0.78rem; min-height: calc(0.78rem * 1.3 * 2); }
  .pc-brand{ font-size: 0.62rem; }
  .pc-price{ font-size: 0.85rem; }
  .pc-price-old{ font-size: 0.68rem; }
  .pc-actions{ flex-direction: column; gap: 6px; }
  .btn{ padding: 7px 6px; font-size: 0.7rem; }
  .topbar-inner{ padding: 12px 16px; }
  .section-wrap{ padding: 0 16px; }
  .hero{ padding: 0 16px; }
  .hero-image img{ max-width: 280px; }

  /* collapse action labels to icons-only so the topbar never wraps */
  .icon-btn .icon-label{
    display: none;
  }
}

/* Phone */
@media (max-width: 560px){
  .product-grid{ grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pc-actions{ flex-direction: row; } /* cards are wider again at 2-up, buttons fit side by side */
  .pc-title{ font-size: 0.82rem; min-height: calc(0.82rem * 1.3 * 2); }
  .pc-price{ font-size: 0.92rem; }
  .btn{ font-size: 0.72rem; padding: 8px 6px; }
  .topbar-actions{ gap: 10px; }
  .hero p{ max-width: none; }
  .hero-image img{ max-width: 220px; }
}

/* Small phone */
@media (max-width: 420px){
  .product-grid{ gap: 8px; }
  .brand{ font-size: 1.1rem; }
  .brand .aperture{ width: 24px; height: 24px; }
  .pc-body{ padding: 7px 7px 9px; }
  .hero-cta{ width: 100%; justify-content: center; }
}

/* Very small phone (older/entry-level devices, e.g. 320–360px) */
@media (max-width: 360px){
  .product-grid{ grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .pc-title{ font-size: 0.76rem; min-height: calc(0.76rem * 1.3 * 2); }
  .pc-price{ font-size: 0.85rem; }
  .pc-price-old{ font-size: 0.65rem; }
  .btn{ font-size: 0.68rem; padding: 7px 4px; }
  .topbar-inner{ gap: 8px; }
  .icon-btn{ font-size: 0.82rem; }
  .hero-image img{ max-width: 180px; }
}

/* Landscape phones: hero shouldn't eat the whole viewport height */
@media (max-height: 480px) and (orientation: landscape){
  .hero-inner{ padding: 20px 24px; }
  .hero h1{ font-size: clamp(1.3rem, 4vw, 1.8rem); margin-bottom: 8px; }
  .hero p{ margin-bottom: 14px; }
  .hero-image{ display: none; } /* reclaim vertical space in short landscape viewports */
}

/* ---------- Responsive Mobile Navbar ---------- */

.mobile-nav-head {
  display: none;
}

.nav-toggle {
  background: #ffffff;
  color: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 40px;
  min-height: 40px; /* comfortable tap target */
  touch-action: manipulation;
}

@media (max-width: 768px) {
  .mainnav {
    background: var(--accent);
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: #ffffff;
    font-weight: 700;
  }

  .mainnav-inner {
    display: none;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 0 16px 12px;
    overflow: visible;
    max-height: calc(100vh - var(--topbar-h) - 48px);
    overflow-y: auto; /* long menus scroll instead of pushing content off-screen */
  }

  .mainnav.open .mainnav-inner {
    display: flex;
  }

  .mainnav .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 13px 0;
    border-bottom: 1px solid rgba(255,255,255,0.25);
  }

  .mainnav .nav-link::after {
    display: none;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown-menu {
    position: static;
    transform: none;
    min-width: 100%;
    opacity: 1;
    visibility: visible;
    display: none;
    box-shadow: none;
    border-radius: 8px;
    margin: 6px 0 10px;
    padding: 6px;
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    display: none;
    transform: none;
  }

  .nav-dropdown.open .nav-dropdown-menu {
    display: block;
  }

  .nav-dropdown:hover .chevron {
    transform: none;
  }

  .nav-dropdown.open .chevron {
    transform: rotate(180deg);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce){
  *{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}