/* ============================================
   PORTFOLIO - Main Stylesheet
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Fraunces:wght@600;700;900&display=swap');

:root {
  --bg: #0a0a0b;
  --bg-elevated: #131316;
  --bg-card: #1a1a1f;
  --border: #2a2a30;
  --border-hover: #3a3a44;
  --text: #f5f5f7;
  --text-muted: #8a8a93;
  --text-dim: #5a5a64;
  --accent: #00ff88;
  --accent-2: #ff0080;
  --accent-3: #ffae00;
  --danger: #ff4444;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 40px -10px rgba(0, 255, 136, 0.15);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  color-scheme: dark;

  /* Surfaces, glows and shadows that differ per theme */
  --nav-bg: rgba(10, 10, 11, 0.7);
  --panel-bg: rgba(19, 19, 22, 0.96);
  --panel-border: rgba(255, 255, 255, 0.1);
  --panel-shadow: 0 22px 60px -30px rgba(0, 0, 0, 0.95);
  --avatar-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  --cover-shadow: 0 24px 80px -40px rgba(168, 85, 247, 0.72);
  --cover-fade-rgb: 10, 10, 11;
  --glow-a: rgba(0, 255, 136, 0.08);
  --glow-b: rgba(255, 0, 128, 0.06);
  --on-accent: #0a0a0b;
  --accent-soft: rgba(0, 255, 136, 0.06);
  --accent-shadow: rgba(0, 255, 136, 0.4);
  --apk: #3ddc84;
  --apk-shadow: rgba(61, 220, 132, 0.2);
  --skeleton-a: #1a1a1f;
  --skeleton-b: #2a2a30;
  --tooltip-bg: #1a1a1f;
  --tooltip-text: #fff;
  --tooltip-border: rgba(255, 255, 255, 0.1);
  --float-shadow: rgba(0, 0, 0, 0.45);
  --float-shadow-hover: rgba(0, 0, 0, 0.55);
  --chart-hole: #0a0a0b;
  --chart-total: #fff;
  --chart-sub: rgba(255, 255, 255, 0.4);
  --chart-glow: rgba(0, 255, 136, 0.12);
  --slice-0: #00ff88; --slice-1: #ff0080; --slice-2: #ffae00; --slice-3: #00d4ff;
  --slice-4: #a855f7; --slice-5: #f97316; --slice-6: #06b6d4; --slice-7: #84cc16;
}

/* Light theme: set on <html data-theme="light"> by the head script (system default or saved choice) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e9ebef;
  --bg-elevated: #f4f5f7;
  --bg-card: #f4f5f7;
  --border: #d8dbe1;
  --border-hover: #c1c5ce;
  --text: #1b1d22;
  --text-muted: #525763;
  --text-dim: #646974;
  --accent: #007a45;
  --accent-2: #d1006a;
  --accent-3: #a55d00;
  --shadow: 0 12px 40px -12px rgba(0, 135, 77, 0.28);

  --nav-bg: rgba(233, 235, 239, 0.85);
  --panel-bg: rgba(244, 245, 247, 0.97);
  --panel-border: rgba(15, 18, 25, 0.08);
  --panel-shadow: 0 22px 60px -30px rgba(15, 20, 35, 0.35);
  --avatar-shadow: 0 10px 26px rgba(15, 20, 35, 0.22);
  --cover-shadow: 0 24px 80px -40px rgba(168, 85, 247, 0.45);
  --cover-fade-rgb: 233, 235, 239;
  --glow-a: rgba(0, 160, 90, 0.07);
  --glow-b: rgba(209, 0, 106, 0.05);
  --on-accent: #ffffff;
  --accent-soft: rgba(0, 135, 77, 0.08);
  --accent-shadow: rgba(0, 135, 77, 0.35);
  --apk: #15803d;
  --apk-shadow: rgba(21, 128, 61, 0.2);
  --skeleton-a: #e1e4e9;
  --skeleton-b: #d5d9df;
  --tooltip-bg: #1b1d22;
  --tooltip-text: #fff;
  --tooltip-border: transparent;
  --float-shadow: rgba(15, 20, 35, 0.22);
  --float-shadow-hover: rgba(15, 20, 35, 0.3);
  --chart-hole: #f4f5f7;
  --chart-total: #1b1d22;
  --chart-sub: rgba(17, 18, 22, 0.5);
  --chart-glow: rgba(0, 135, 77, 0.1);
  /* Same hues as dark, less saturated so the chart doesn't glare on a light page */
  --slice-0: #2cb67d; --slice-1: #db4f86; --slice-2: #e2a23f; --slice-3: #3aa9d3;
  --slice-4: #9469d4; --slice-5: #e07b3c; --slice-6: #2a9db3; --slice-7: #7fa83c;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--glow-a), transparent),
    radial-gradient(ellipse 50% 40% at 80% 100%, var(--glow-b), transparent);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============= NAV ============= */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Show the icon of the mode you would switch to */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
/* ============= HERO ============= */
.hero {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
  position: relative;
  scroll-margin-top: 5rem;
}
.hero-cover {
  position: relative;
  aspect-ratio: 3.75 / 1;
  min-height: 280px;
  max-height: 390px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--bg-elevated);
  box-shadow: var(--cover-shadow);
}
.hero-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 44%, rgba(var(--cover-fade-rgb), 0.28) 72%, rgba(var(--cover-fade-rgb), 0.88)),
    linear-gradient(90deg, rgba(var(--cover-fade-rgb), 0.16), transparent 32%, transparent 72%, rgba(var(--cover-fade-rgb), 0.18));
  pointer-events: none;
}
.hero-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-profile {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 2.25rem;
  margin: -64px 1.5rem 0;
  padding: 1.5rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: var(--panel-shadow);
  --hero-dur: 0.45s;
  --hero-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-person {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: start;
  gap: 1.4rem;
}
.hero-avatar {
  width: 112px;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  border: 4px solid var(--bg-elevated);
  background: var(--bg-elevated);
  box-shadow: var(--avatar-shadow), 0 0 0 1px var(--border-hover);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.035em;
  margin-bottom: 0.75rem;
}
.hero h1 .accent {
  font-style: italic;
  color: var(--text);
  background: none;
  -webkit-text-fill-color: currentColor;
}
.hero-tagline {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 0.45rem;
}
.hero-title-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.hero-title-row h1 { margin-bottom: 0; }
.hero-toggle {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.hero-toggle:hover,
.hero-toggle:focus-visible { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.hero-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hero-toggle svg { transition: transform var(--hero-dur) var(--hero-ease); }
.hero-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
/* Height is driven from JS (measured px -> auto); grid-row interpolation stalls on first run */
.hero-more,
.hero-visual {
  height: 0;
  overflow: hidden;
  transition: height var(--hero-dur) var(--hero-ease);
}
/* Content fades/slides on the compositor while the row height eases open */
.hero-more-inner > *,
.hero-visual-body {
  opacity: 0;
  transform: translateY(-8px);
  will-change: opacity, transform;
  transition: opacity 0.2s ease, transform var(--hero-dur) var(--hero-ease);
}
.hero-more.open .hero-more-inner > *,
.hero-profile.is-open .hero-visual-body {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease 0.08s, transform var(--hero-dur) var(--hero-ease);
}
.hero-desc {
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 760px;
  margin: 0.9rem 0 1rem;
}
@media (prefers-reduced-motion: reduce) {
  .hero-more, .hero-visual, .hero-toggle svg,
  .hero-more-inner > *, .hero-visual-body { transition: none !important; }
}
.hero-socials { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.social-btn {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.25s, color 0.25s, transform 0.25s;
  color: var(--text-muted);
}
.social-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.hero-visual { min-width: 0; }
.hero-visual-body {
  padding-left: 2rem;
  border-left: 1px solid var(--border);
  display: grid;
  place-items: center;
}

/* ============= SECTION HEADER ============= */
.section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 900;
  letter-spacing: -0.03em;
}
.section-head .label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* ============= FILTERS ============= */
.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.filter-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-hover); }
.filter-btn.active {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

/* ============= GRID ============= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  position: relative;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.card-image {
  aspect-ratio: 1;
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: transform 0.6s ease, opacity 0.35s ease;
}
.card:hover .card-image img { transform: scale(1.06); }

.card-hint {
  position: absolute;
  top: 100%;
  font-size: 1.4rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
  transform: rotate(-25deg);
}
.card:hover .card-hint,
.card:active .card-hint {
  opacity: 1;
  animation: tap-gesture 0.9s ease-in-out infinite;
}
@keyframes tap-gesture {
  0%, 100% { transform: rotate(-25deg) translate(0, 0);         }
  40%       { transform: rotate(-25deg) translate(-4px, -4px);  }
  60%       { transform: rotate(-25deg) translate(-4px, -4px);  }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.card-image.img-loading {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.card-image.img-loading img {
  opacity: 0;
}
.card-new-badge {
  position: absolute;
  top: 12px;
  right: -72px;
  width: 220px;
  background: linear-gradient(90deg, #c0392b, #e53e3e 50%, #f97316);
  color: #fff;
  text-align: center;
  transform: rotate(45deg);
  font-family: var(--font-mono);
  font-size: 1.24rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 10px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.card-image.img-loading .card-new-badge,
.card-image.img-loading .card-badges {
  opacity: 0;
}
.card-image.img-loading ~ .card-body {
  opacity: 0;
}
.card-new-badge::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: ribbon-shine 3s ease-in-out infinite;
}
@keyframes ribbon-shine {
  0%        { left: -80%; }
  40%, 100% { left: 130%; }
}
.card-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  transition: opacity 0.3s ease;
}
.card-badge {
  padding: 0.3rem 0.7rem;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid #2a2a30;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #00ff88;
}
.card-engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #ffae00;
  border-color: rgba(255, 174, 0, 0.45);
}
.engine-icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  object-fit: contain;
}
.card-image .engine-icon {
  width: 1rem;
  height: 1rem;
  opacity: 1;
  object-fit: contain;
  transition: none;
}
.card:hover .card-image .engine-icon {
  transform: none;
}
.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  transition: opacity 0.3s ease;
}
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  position: relative;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 0.75rem;
}
.card-price {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 700;
}
.card-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: grid;
  place-items: center;
  transition: background 0.2s, transform 0.2s;
}
.card:hover .card-arrow { background: var(--accent); color: var(--on-accent); transform: rotate(-45deg); }

/* ============= EMPTY STATE ============= */
.empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}

/* ============= DETAIL PAGE ============= */
.detail {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 3rem;
  align-items: start;
}
.detail-image-main {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  aspect-ratio: 1;
  border: 1px solid var(--border);
}
.detail-image-main img { width: 100%; height: 100%; object-fit: contain; }
.detail-gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  background: var(--bg-elevated);
}
.thumb.active { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }

.detail-info h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0.5rem 0 1rem;
}
.detail-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.detail-category,
.detail-engine {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.detail-category { color: var(--accent); }
.detail-engine {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent-3);
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-hover);
}
.detail-engine .engine-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-basis: 1.1rem;
}
.detail-price {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1.5rem;
  font-weight: 700;
}
.detail-desc {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  overflow-wrap: anywhere;
}
.detail-desc p { margin: 0 0 1rem; }
.detail-desc p:last-child { margin-bottom: 0; }
.detail-desc strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.tag {
  padding: 0.35rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 100px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--accent);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px var(--accent-shadow); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 0.5rem; }
.btn-apk {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 100px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  transition: border-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn-apk:hover {
  border-color: var(--apk);
  color: var(--apk);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px var(--apk-shadow);
}
/* ============= FOOTER ============= */
.footer {
  max-width: 1400px;
  margin: 4rem auto 0;
  padding: 3rem 2rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* ============= RESPONSIVE ============= */
@media (max-width: 900px) {
  .hero { padding: 1.5rem 1.5rem 2rem; }
  .hero-cover { aspect-ratio: 2.5 / 1; }
  .hero-profile { grid-template-columns: 1fr; margin: -48px 0.75rem 0; gap: 0; }
  .hero-visual-body { margin-top: 1.25rem; padding: 1.25rem 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .detail-grid { grid-template-columns: 1fr; }
  .section { padding: 2rem 1.5rem; }
  .nav-inner { padding: 1rem 1.5rem; }
}
@media (max-width: 500px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .card-body { padding: 0.85rem; }
  .card-title { font-size: 1rem; }
}
@media (max-width: 430px) {
  .hero { padding: 1rem 1rem 1.5rem; }
  .hero-cover { aspect-ratio: auto; min-height: 0; height: 220px; border-radius: 16px; }
  .hero-profile { margin: -34px 0 0; padding: 1rem; border-radius: 18px; }
  .hero-person { grid-template-columns: 72px minmax(0, 1fr); gap: 0.85rem; }
  .hero-avatar { width: 72px; border-width: 3px; }
  .hero h1 { font-size: 1.75rem; }
  .hero-tagline { font-size: 0.68rem; }
  .hero-visual { display: none; }
  .hero-desc { font-size: 0.88rem; line-height: 1.55; margin: 0.75rem 0 0.8rem; }
  .hero-title-row { gap: 0.6rem; }
  .hero-toggle { width: 36px; height: 36px; }
  .social-btn { padding: 0.42rem 0.7rem; font-size: 0.75rem; }

  /* Nav: brand nhỏ lại, link gọn hơn */
  .brand { font-size: 1.1rem; }
  .nav-inner { padding: 0.75rem 1rem; }

  /* Section padding */
  .section { padding: 1.5rem 1rem; }

  /* Contact widget: nhỏ lại và sát góc hơn */
  .contact-float { bottom: 1.25rem; right: 1.25rem; gap: 0.6rem; }
  .contact-btn { width: 44px; height: 44px; }
  .contact-btn svg { width: 22px; height: 22px; }

}

/* Invisible marker under the grid; scrolling near it loads the next batch of cards */
#gridSentinel { height: 1px; }

/* ============================================
   PIZZA CHART
   ============================================ */
#heroPizza {
  width: 100%;
  max-width: 265px;
  margin: 0 auto;
}
.pizza-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 20px var(--chart-glow));
}
.donut-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.9rem;
  margin-top: 0.8rem;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}
.donut-legend-item span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ============================================
   CONTACT FLOAT WIDGET
   ============================================ */
.contact-float {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 998;
}
.contact-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 20px var(--float-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.contact-btn:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 28px var(--float-shadow-hover);
}
.contact-btn svg { display: block; flex-shrink: 0; }
.contact-telegram { background: #229ED9; }
.contact-whatsapp { background: #25D366; }

.contact-btn .contact-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-size: 0.8rem;
  font-family: var(--font-body, sans-serif);
  white-space: nowrap;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--tooltip-border);
  box-shadow: 0 4px 16px var(--float-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.contact-btn .contact-tooltip::after {
  content: '';
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: var(--tooltip-bg);
}
.contact-btn:hover .contact-tooltip { opacity: 1; }

@media (hover: none) {
  .contact-tooltip { display: none; }
}

/* ============= COLLECTION: search, shelves, grid view ============= */
[hidden] { display: none !important; }

.collection-toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2.25rem;
}
.collection-toolbar .filters { margin-bottom: 0; }
.chip-count {
  font-family: var(--font-mono);
  font-size: 0.75em;
  opacity: 0.7;
  margin-left: 0.25rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(100%, 460px);
  padding: 0 0.6rem 0 1rem;
  height: 46px;
  border-radius: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  color: var(--accent);
}
.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}
.search-box input::placeholder { color: var(--text-dim); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
}
.search-clear:hover { color: var(--text); }

.shelves {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}
.shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}
.shelf-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.shelf-count, .grid-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.shelf-note {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.shelf-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.shelf-nav {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
}
.shelf-nav:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.shelf-nav:disabled { opacity: 0.3; cursor: default; }
.shelf-all, .grid-back {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 100px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s, background-color 0.2s;
}
.shelf-all:hover, .grid-back:hover { border-color: var(--accent); background: var(--accent-soft); }

.shelf { position: relative; }
.shelf-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 4 * 1.25rem) / 5);
  gap: 1.25rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 2px;
  /* room for the card hover lift, which overflow would otherwise clip */
  padding: 8px 2px 12px;
  margin: -8px -2px 0;
  scrollbar-width: none;
}
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-track > * { scroll-snap-align: start; }
/* soft fades hint that a shelf continues past the edge */
.shelf::before, .shelf::after {
  content: '';
  position: absolute;
  top: 60px;
  bottom: 12px;
  width: 48px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.25s;
}
.shelf::before { left: -2px; background: linear-gradient(90deg, var(--bg), transparent); }
.shelf::after { right: -2px; background: linear-gradient(270deg, var(--bg), transparent); }
.shelf.can-scroll-left::before, .shelf.can-scroll-right::after { opacity: 1; }

.shelf-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border-hover);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.shelf-more span {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
}
.shelf-more:hover { color: var(--accent); border-color: var(--accent); }

.grid-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.grid-back { display: inline-flex; align-items: center; gap: 0.4rem; border-color: var(--border); }
.grid-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

@media (max-width: 1200px) {
  .shelf-track { grid-auto-columns: calc((100% - 3 * 1.25rem) / 4); }
}
@media (max-width: 900px) {
  .shelf-track { grid-auto-columns: calc((100% - 2 * 1rem) / 3); gap: 1rem; }
}
@media (max-width: 700px) {
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; }
  .shelf-track { grid-auto-columns: 44%; gap: 0.75rem; }
  .shelves { gap: 2rem; }
}
@media (max-width: 500px) {
  .shelf-track { grid-auto-columns: 46%; }
  .shelf-nav { display: none; }
  .shelf-note { display: none; }
  .filters { margin: 0 -1rem; padding: 0 1rem; }
}
@media (hover: none) {
  .shelf-nav { display: none; }
}
