:root {
  --design-bg: #d0e8f2;
  --design-border: #7bb8d4;
  --design-accent: #4a9ec5;
  --dev-bg: #1b3a5c;
  --dev-border: #2d5a8a;
  --dev-accent: #3d7ab8;
  --surface: #f4f1ec;
  --text-dark: #1a1a2e;
  --text-light: #f0ede8;
  --overlay-dark: rgba(18, 18, 36, 0.88);
  --overlay-light: rgba(255, 255, 255, 0.88);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Custom glove cursor — pointer (default) - based on Wii menu - source: https://primmr.dev/projects/wii-pointer-cursors/ */
html, body, * {
  cursor: url("/assets/cursor-pointer.png") 3 3, default !important;
}
a:hover {
  cursor: url("/assets/cursor-highlight.png") 3 3, default !important;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Custom glove cursor — pointing hand for interactive elements - based on Wii menu - source: https://primmr.dev/projects/wii-pointer-cursors/ */
.card, .filter-btn, a, button, [role="button"] {
  cursor: url("/assets/cursor-highlight.png") 10 0, pointer;
}

/* Custom cursor — OpenHighlight.cur for scrollable/grab areas */
.grid {
  cursor: url("/assets/cursor-open.png") 3 3, grab !important;
}

/* Custom cursor — Closed.cur for active grab/drag */
.grid.grabbing, .grid.grabbing * {
  cursor: url("/assets/cursor-closed.png") 3 3, grabbing !important;
}

/* --- HEADER --- */
header {
  padding: 4rem 2rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -20%;
  width: 140%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(123,184,212,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(27,58,92,0.08) 0%, transparent 50%);
  z-index: 0;
  pointer-events: none;
}

header h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.05;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.8s ease-out;
}

header p {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-weight: 300;
  color: #5a5a6e;
  margin-top: 1rem;
  letter-spacing: 0.04em;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.8s ease-out 0.15s both;
}

/* --- FILTER BAR --- */
.filters {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  padding: 0 2rem 2rem;
  flex-wrap: wrap;
  animation: fadeUp 0.8s ease-out 0.3s both;
}

.filter-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 1.4rem;
  border: 1.5px solid #c8c4bc;
  border-radius: 100px;
  background: transparent;
  color: #6b6b7b;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: var(--design-accent);
  color: var(--design-accent);
}

.filter-btn.active {
  background: var(--text-dark);
  border-color: var(--text-dark);
  color: var(--text-light);
}

/* --- SCROLL CONTAINER --- */
.grid-wrapper {
  position: relative;
  padding: 0 0 3rem;
}

.grid {
  display: grid;
  grid-template-rows: 255px 255px;
  grid-auto-flow: column;
  grid-auto-columns: 340px;
  gap: 0.6rem;
  padding: 1rem 2.5rem 2rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.grid::-webkit-scrollbar { height: 6px; }
.grid::-webkit-scrollbar-track { background: transparent; }
.grid::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.grid::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

@media (max-width: 680px) {
  .grid {
    padding: 1rem 1.2rem 1.5rem;
    gap: 0.5rem;
    grid-template-rows: 210px;
    grid-auto-columns: 280px;
  }
}

/* --- SCROLL ARROWS --- */
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-60%);
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid #c8c4bc;
  background: rgba(244,241,236,0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #5a5a6e;
  transition: all 0.25s ease;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.scroll-btn:hover {
  background: var(--text-dark);
  border-color: var(--text-dark);
  color: var(--text-light);
}

.scroll-btn.left { left: 8px; }
.scroll-btn.right { right: 8px; }
.scroll-btn.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 680px) {
  .scroll-btn { width: 36px; height: 36px; font-size: 1rem; }
  .scroll-btn.left { left: 4px; }
  .scroll-btn.right { right: 4px; }
}

/* --- SCROLL INDICATOR --- */
.scroll-track {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding-top: 0.5rem;
}
.scroll-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #c8c4bc;
  transition: all 0.3s ease;
}
.scroll-dot.active {
  width: 22px;
  border-radius: 3px;
  background: var(--design-accent);
}

/* --- CARD --- */
.card {
  position: relative;
  overflow: visible;
  cursor: pointer;
  scroll-snap-align: center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.35s ease;
  animation: fadeUp 0.6s ease-out both;
}

/* Fake border — same CRT shape, slightly larger, sits behind */
.card-border {
  position: absolute;
  inset: -3.5px;
  clip-path: url(#crt-clip-bulge);
  z-index: 0;
  /* Default border color */
  background: #7bb8d4;
}

/* Inner container clipped to CRT shape */
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  clip-path: url(#crt-clip-bulge);
  z-index: 1;
  /* Static noise background as fallback */
  background: #2a2a2a;
}

/* Animated static noise canvas */
.card-static {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.5;
}

/* CRT glass bulge — convex highlight overlay + faint scanlines */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  clip-path: url(#crt-clip-bulge);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 2px,
      rgba(0,0,0,0.03) 2px,
      rgba(0,0,0,0.03) 4px
    ),
    radial-gradient(ellipse 130% 90% at 50% 38%,
      rgba(255,255,255,0.12) 0%,
      rgba(255,255,255,0.04) 35%,
      transparent 65%);
  box-shadow:
    inset 0 0 30px 6px rgba(0,0,0,0.15),
    inset 0 2px 8px rgba(255,255,255,0.08);
}

/* CRT bezel shadow — depth around the curved edges */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  clip-path: url(#crt-clip-bulge);
  box-shadow:
    inset 0 0 20px 8px rgba(0,0,0,0.12),
    inset 0 0 50px 4px rgba(0,0,0,0.06);
}

.card img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              filter 0.4s ease,
              opacity 0.4s ease;
}

/* When image fails to load, hide it to show static */
.card img.img-error {
  opacity: 0;
}

.card:hover {
  transform: translateY(-6px) scale(1.015);
  filter: drop-shadow(0 16px 32px rgba(0,0,0,0.18));
}

.card.design .card-border {
  background: var(--design-border);
}
.card.design .card-inner {
  background: var(--design-bg);
}

.card.dev .card-border {
  background: var(--dev-border);
}
.card.dev .card-inner {
  background: var(--dev-bg);
}

.card:hover img:not(.img-error) {
  transform: scale(1.04);
}

/* --- TITLE PILL (top middle) --- */
.card-title {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.45rem 1.2rem;
  border-radius: 0 0 10px 10px;
  z-index: 3;
  white-space: nowrap;
  transition: opacity 0.3s ease;
}

.card.design .card-title {
  background: var(--design-accent);
  color: #fff;
}

.card.dev .card-title {
  background: var(--dev-accent);
  color: #fff;
}

/* --- CATEGORY TAG --- */
.card-tag {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  z-index: 3;
  opacity: 0.85;
}

.card.design .card-tag {
  background: rgba(255,255,255,0.8);
  color: var(--design-accent);
}

.card.dev .card-tag {
  background: rgba(0,0,0,0.45);
  color: #a8cce8;
}

/* --- DESCRIPTION OVERLAY --- */
.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 5;
}

.card.design .card-overlay {
  background: var(--overlay-light);
  color: var(--text-dark);
}

.card.dev .card-overlay {
  background: var(--overlay-dark);
  color: var(--text-light);
}

.card.active .card-overlay {
  opacity: 1;
  pointer-events: auto;
}

.card.active img {
  filter: blur(3px) brightness(0.7);
}

.card.active .card-title {
  opacity: 0;
}

.overlay-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}

.overlay-desc {
  font-size: 0.88rem;
  font-weight: 300;
  line-height: 1.65;
  max-width: 320px;
  opacity: 0.85;
}

.overlay-tech {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}

.overlay-tech span {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
}

.card.design .overlay-tech span {
  background: rgba(74,158,197,0.15);
  color: var(--design-accent);
}

.card.dev .overlay-tech span {
  background: rgba(61,122,184,0.25);
  color: #8bbde0;
}
.card-action-btn {
    background: rgba(134, 173, 212, 0.25);
    color: var(--design-accent);
    border-radius: 3px;
    padding: 2px 6px;
    text-decoration: none;
}
.card-action-btn:hover,
.card-action-btn:active {
    background: rgba(61,122,184,0.25);
    color: var(--design-accent);
}

.close-hint {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.3rem;
  opacity: 0.5;
  line-height: 1;
}

/* --- LINKEDIN CARD --- */
.card.linkedin .card-border {
  background: #004182;
}
.card.linkedin .card-inner {
  background: #0a66c2;
}

.card.linkedin .card-title {
  background: #004182;
  color: #fff;
}

.card.linkedin .card-tag {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.card.linkedin .card-overlay {
  background: rgba(10, 102, 194, 0.92);
  color: #fff;
}

.card.linkedin .overlay-tech span {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.card.linkedin img {
  object-fit: contain;
  padding: 2.5rem;
  background: #0a66c2;
}

/* --- FOOTER --- */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: #9a9aaa;
  letter-spacing: 0.04em;
}

/* --- ANIMATIONS --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media only screen and (min-width:800px) {
    .hide-on-desktop {
        display:none;
    }
}
