/* ============================================
   POBMEK JUNLAKARIN — Portfolio
   Cargo.site-inspired modern typography
   ============================================ */

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

:root {
  --text: #111;
  --text-light: #555;
  --text-muted: #999;
  --bg: #fff;
  --bg-off: #f5f5f5;
  --border: #e0e0e0;
  --accent: #111;
  --font-heading: 'Instrument Sans', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --max-width: 1200px;
  --nav-height: 56px;
  --transition: 0.25s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

ul, ol {
  list-style: none;
}

/* --- Typography (Cargo-style: bold headings, tight, mixed case) --- */
h1, h2, h3 {
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
  text-transform: none;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.0;
}

h2 {
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  line-height: 1.2;
}

h3 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 1rem;
}

p {
  max-width: 600px;
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  font-weight: 400;
}

small {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-weight: 400;
}

/* --- Navigation --- */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  transition: background var(--transition);
}

nav .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .logo {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

nav .nav-links {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

nav .nav-links a {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}

nav .nav-links a:hover,
nav .nav-links a.active {
  color: var(--text);
}

nav .nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--text);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px);
}

/* --- Hero Section (Home) --- */
.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity 1.6s ease;
  will-change: opacity, transform;
}

.hero-bg--a,
.hero-bg--b {
  animation: kenburns 7s ease forwards;
}

.hero-bg--b {
  opacity: 0;
}

@keyframes kenburns {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); }
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero h1 {
  margin-bottom: 1.5rem;
  color: #fff;
}

.hero .subtitle {
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.hero .scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: float 2s ease-in-out infinite;
}

.hero .scroll-hint::after {
  content: '';
  width: 1px;
  height: 40px;
  background: rgba(255, 255, 255, 0.4);
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* --- Page Layout --- */
.page {
  padding-top: var(--nav-height);
  min-height: 100vh;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 4rem 2rem;
}

.page-header {
  padding: 5rem 0 3rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page-header h1 {
  margin-bottom: 0.75rem;
}

.page-header .page-desc {
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.page-header .page-desc a {
  color: var(--text-muted);
  transition: color var(--transition);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.page-header .page-desc a:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* --- Section divider --- */
.section-divider {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 3rem auto;
}

/* --- Work Grid (3 cards) --- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.work-card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  cursor: pointer;
}

.work-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease, filter 0.6s ease;
  filter: grayscale(20%);
}

.work-card:hover img {
  transform: scale(1.03);
  filter: grayscale(0%);
}

.work-card .card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  transition: opacity var(--transition);
}

.work-card .card-title {
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.work-card .card-sub {
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-top: 0.35rem;
}

/* --- Home Role Cards (text-only, bold) --- */
.home-roles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.home-role {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 2.5rem 2rem;
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.home-role:hover {
  background: var(--bg-off);
  border-color: var(--text-muted);
}

.home-role-title {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}

.home-role-sub {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* --- Work Detail Sections --- */
.work-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.work-section:first-of-type {
  border-top: none;
}

.work-section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.work-section-header h2 {
  margin-bottom: 0;
}

.work-section-header .count {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Video grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.video-item {
  background: var(--bg-off);
}

.video-item .video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.video-item .video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-item .video-info {
  padding: 1rem 1.25rem;
}

.video-item .video-title {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
}

.video-item .video-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  font-weight: 400;
}

/* Credits list */
.credits-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0;
}

.credit-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.credit-item .credit-name {
  font-size: 0.85rem;
  font-weight: 400;
}

.credit-item .credit-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

/* --- Thumbnail Grid (visual-rich, tight) --- */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.tc {
  cursor: pointer;
  overflow: hidden;
}

.tc-img {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #1a1a1a;
}

.tc-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.3s ease;
}

/* Vimeo placeholder (no thumbnail API) */
.tc-img--vm {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #1a1a1a 100%);
}

/* Hover: darken + play button */
.tc-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
}

.tc:hover .tc-img::after {
  background: rgba(0, 0, 0, 0.35);
}

.tc:hover .tc-img img {
  transform: scale(1.03);
}

.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.play-btn svg {
  width: 16px;
  height: 16px;
  margin-left: 2px;
  color: #111;
}

.tc:hover .play-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Card text below thumbnail */
.tc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0 14px;
}

.tc-name {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-meta {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Featured card (standalone, full-width) */
.tc--featured {
  margin-bottom: 4px;
}

.tc--featured .tc-img {
  aspect-ratio: 21 / 9;
}

.tc--featured .tc-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.tc--featured .tc-meta {
  font-size: 0.65rem;
}

.tc-awards {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
  margin-top: 2px;
}

/* Image-only cards (no video) */
.tc[data-vtype="image"] {
  cursor: default;
}

.tc[data-vtype="image"] .play-btn {
  display: none;
}

.tc[data-vtype="image"]:hover .tc-img::after {
  background: rgba(0, 0, 0, 0);
}

/* Awards callout */
.awards-callout {
  margin: 2rem 0 1rem;
  padding: 1.25rem 1.5rem;
  border-left: 2px solid var(--text);
  background: var(--bg-off);
}

.awards-callout p {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-light);
}

/* --- Video Modal --- */
.vmodal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.vmodal.active {
  display: flex;
  opacity: 1;
}

.vmodal-wrap {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
}

.vmodal-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.vmodal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 1001;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  transition: all var(--transition);
}

.vmodal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* --- Year Filter Tabs --- */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.filter-tabs button {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-tabs button:hover,
.filter-tabs button.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* --- Photo Gallery --- */
.photo-section {
  margin-bottom: 5rem;
}

.photo-section-header {
  margin-bottom: 2rem;
}

.photo-section-header h2 {
  margin-bottom: 0.25rem;
}

.photo-section-header .genre {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  font-style: italic;
  font-weight: 400;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  transition: opacity var(--transition);
}

.photo-grid img:hover {
  opacity: 0.85;
}

/* Variable aspect ratios for visual interest */
.photo-grid.masonry {
  columns: 3;
  column-gap: 4px;
}

.photo-grid.masonry img {
  aspect-ratio: auto;
  margin-bottom: 4px;
  break-inside: avoid;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.97);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 2rem;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  cursor: default;
}

.lightbox .lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
}

.lightbox .lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 1rem;
  transition: color var(--transition);
}

.lightbox .lightbox-nav:hover {
  color: var(--text);
}

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

/* --- About Page --- */
.about-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 4rem;
  align-items: start;
}

.about-photo img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
}

.about-content h1 {
  margin-bottom: 2rem;
}

.about-content p {
  margin-bottom: 1.5rem;
}

.about-section {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}

.about-section h3 {
  margin-bottom: 1.5rem;
}

.experience-item {
  margin-bottom: 2rem;
}

.experience-item .role {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.experience-item .org {
  font-size: 0.8rem;
  color: var(--text-light);
}

.experience-item .period {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.experience-item .details {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  line-height: 1.6;
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  color: var(--text-light);
}

/* --- Contact Page --- */
.contact-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-height));
  text-align: center;
  padding: 4rem 2rem;
}

.contact-layout h1 {
  margin-bottom: 2rem;
}

.contact-email {
  font-family: var(--font-heading);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 0.3rem;
  transition: border-color var(--transition);
}

.contact-email:hover {
  border-color: var(--text);
}

.contact-sub {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.contact-socials {
  display: flex;
  gap: 2rem;
  margin-top: 2.5rem;
}

.contact-socials a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  transition: color var(--transition);
}

.contact-socials a:hover {
  color: var(--text);
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
}

footer small {
  display: block;
}

/* --- Animations / Entrance --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger.visible > *:nth-child(3) { transition-delay: 0.15s; }
.stagger.visible > *:nth-child(4) { transition-delay: 0.2s; }
.stagger.visible > *:nth-child(5) { transition-delay: 0.25s; }
.stagger.visible > *:nth-child(6) { transition-delay: 0.3s; }

.stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .home-roles {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .thumb-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-photo img {
    aspect-ratio: 16 / 9;
    max-height: 400px;
  }

  .photo-grid.masonry {
    columns: 2;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --nav-height: 56px;
  }

  nav .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    gap: 1.25rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  }

  nav .nav-links.open {
    display: flex;
  }

  nav .nav-links a {
    font-size: 0.85rem;
  }

  .hamburger {
    display: flex;
  }

  .container {
    padding: 3rem 1.25rem;
  }

  .page-header {
    padding: 4rem 0 2rem;
  }

  .photo-grid.masonry {
    columns: 1;
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .thumb-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  h1 {
    letter-spacing: -0.02em;
  }

  .hero .subtitle {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
  }

  .work-card .card-overlay {
    padding: 1.25rem;
  }
}

/* --- Back to Top Button --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 90;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background 0.2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--text);
  border-color: var(--text);
}

.back-to-top svg {
  width: 16px;
  height: 16px;
  color: var(--text);
  transition: color 0.2s ease;
}

.back-to-top:hover svg {
  color: var(--bg);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --text: #e8e8e8;
  --text-light: #aaa;
  --text-muted: #666;
  --bg: #0a0a0a;
  --bg-off: #141414;
  --border: #222;
  --accent: #e8e8e8;
}

[data-theme="dark"] body {
  background: #0a0a0a;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(60, 60, 80, 0.15) 0%, transparent 60%);
  background-attachment: fixed;
}

[data-theme="dark"] nav {
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: #1a1a1a;
}

[data-theme="dark"] .hero::after {
  background: rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .home-role {
  border-color: #222;
}

[data-theme="dark"] .home-role:hover {
  background: #141414;
  border-color: #444;
}

[data-theme="dark"] .work-card img {
  filter: grayscale(10%) brightness(0.9);
}

[data-theme="dark"] .tc-img {
  background: #111;
}

[data-theme="dark"] .lightbox {
  background: rgba(0, 0, 0, 0.97);
}

[data-theme="dark"] .photo-grid img:hover {
  opacity: 0.8;
}

[data-theme="dark"] footer {
  border-top-color: #1a1a1a;
}

[data-theme="dark"] .back-to-top {
  background: #1a1a1a;
  border-color: #333;
}

[data-theme="dark"] .back-to-top svg {
  color: #e8e8e8;
}

[data-theme="dark"] .back-to-top:hover {
  background: #e8e8e8;
  border-color: #e8e8e8;
}

[data-theme="dark"] .back-to-top:hover svg {
  color: #0a0a0a;
}

[data-theme="dark"] .filter-tabs button {
  border-color: #333;
  color: #666;
}

[data-theme="dark"] .filter-tabs button:hover,
[data-theme="dark"] .filter-tabs button.active {
  background: #e8e8e8;
  color: #0a0a0a;
  border-color: #e8e8e8;
}

[data-theme="dark"] .skill-tag {
  border-color: #333;
  color: #aaa;
}

[data-theme="dark"] .contact-email {
  border-bottom-color: #333;
}

[data-theme="dark"] .contact-email:hover {
  border-bottom-color: #e8e8e8;
}

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition);
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* Hide sun/moon depending on mode */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* Dark mode mobile nav */
[data-theme="dark"] nav .nav-links {
  background: #0a0a0a;
  border-bottom-color: #1a1a1a;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Dark mode photo gate */
[data-theme="dark"] #photo-gate input {
  background: #141414;
  color: #e8e8e8;
  border-color: #333;
}

[data-theme="dark"] #photo-gate button {
  background: #e8e8e8;
  color: #0a0a0a;
  border-color: #e8e8e8;
}

/* Print styles */
@media print {
  nav, .scroll-hint, .lightbox, .back-to-top, .theme-toggle { display: none; }
  .page { padding-top: 0; }
  body { color: #000; }
}
