  :root {
    --bg: #FAFAFA;
    --surface: #FFFFFF;
    --surface-translucent: rgba(255, 255, 255, 0.92);
    --border: #E5E5E5;
    --text: #171717;
    --text-secondary: #525252;
    --text-muted: #A3A3A3;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-subtle: rgba(37, 99, 235, 0.08);
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
    --transition: 180ms ease;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0A0A0A;
      --surface: #141414;
      --surface-translucent: rgba(20, 20, 20, 0.92);
      --border: #262626;
      --text: #FAFAFA;
      --text-secondary: #A3A3A3;
      --text-muted: #525252;
      --accent: #60A5FA;
      --accent-hover: #93C5FD;
      --accent-subtle: rgba(96, 165, 250, 0.15);
      --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
      --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
      --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
    }
  }

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

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

  body { font-family: var(--font-body); line-height: 1.6; color: var(--text); background: var(--bg); min-height: 100vh; }

  .icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }
  .icon-sm { width: 14px; height: 14px; }
  .icon-lg { width: 20px; height: 20px; }

  /* Responsive site background. Each rule layers the size-appropriate
     variant over the legacy /background.jpg — if the variants haven't been
     generated yet (deploy/migrate-photos.js does that), the original still
     shows underneath, so the background never disappears mid-rollout. */
  .bg-image { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-image: url('/backgrounds/bg-1920.jpg'), url('/background.jpg'); background-size: cover, cover; background-position: center center, center center; background-repeat: no-repeat, no-repeat; z-index: -1; opacity: 0.15; }
  @media (max-width: 480px) { .bg-image { background-image: url('/backgrounds/bg-480.jpg'), url('/background.jpg'); } }
  @media (min-width: 481px) and (max-width: 768px) { .bg-image { background-image: url('/backgrounds/bg-768.jpg'), url('/background.jpg'); } }
  @media (min-width: 769px) and (max-width: 1280px) { .bg-image { background-image: url('/backgrounds/bg-1280.jpg'), url('/background.jpg'); } }
  @media (min-width: 1921px) { .bg-image { background-image: url('/backgrounds/bg-3840.jpg'), url('/background.jpg'); } }
  @media (prefers-color-scheme: dark) { .bg-image { opacity: 0.1; } }

  .nav { position: fixed; top: 0; right: 0; padding: 20px 24px; z-index: 100; }

  .menu-toggle { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--surface-translucent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); color: var(--text); }
  .menu-toggle:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }

  .menu-dropdown { position: absolute; top: 72px; right: 24px; background: var(--surface-translucent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px; min-width: 180px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: var(--transition); }
  .menu-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }

  .menu-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: var(--text); text-decoration: none; font-size: 0.9375rem; font-weight: 500; border-radius: var(--radius-md); transition: var(--transition); }
  .menu-item:hover { background: var(--accent-subtle); color: var(--accent); }
  .menu-item .icon { opacity: 0.7; }

  .menu-divider { height: 1px; background: var(--border); margin: 8px 0; }

  .page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

  .container { width: 100%; max-width: 520px; }
  .container-wide { width: 100%; max-width: 800px; padding-top: 80px; }

  .card { background: var(--surface-translucent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 48px 40px; box-shadow: var(--shadow-md); text-align: center; }

  .avatar { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 28px; overflow: hidden; border: 3px solid var(--surface); box-shadow: var(--shadow-md); }
  .avatar img { width: 100%; height: 100%; object-fit: cover; }

  h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 400; letter-spacing: -0.02em; margin-bottom: 8px; }

  .tagline { color: var(--text-secondary); font-size: 0.9375rem; margin-bottom: 32px; line-height: 1.5; }

  .bio { color: var(--text-secondary); font-size: 0.9375rem; line-height: 1.75; margin-bottom: 36px; text-align: left; }
  .bio p { margin-bottom: 16px; }
  .bio p:last-child { margin-bottom: 0; }

  .links { display: flex; flex-direction: column; gap: 12px; }

  .link { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 20px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text); text-decoration: none; font-size: 0.9375rem; font-weight: 500; transition: var(--transition); }
  .link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-subtle); }
  .link .icon { opacity: 0.7; }
  .link:hover .icon { opacity: 1; }

  .section-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px; margin-top: 32px; }

  .projects-link { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }

  .project-tag { display: inline-flex; align-items: center; padding: 8px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary); text-decoration: none; font-size: 0.8125rem; font-weight: 500; transition: var(--transition); cursor: pointer; }
  .project-tag:hover { border-color: var(--accent); color: var(--accent); }

  .footer { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.8125rem; }

  .page-header { text-align: center; margin-bottom: 48px; }
  .page-header h1 { font-family: var(--font-display); font-size: 2.5rem; margin-bottom: 12px; }
  .page-header p { color: var(--text-secondary); font-size: 1rem; }

  .project-card { background: var(--surface-translucent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; margin-bottom: 20px; box-shadow: var(--shadow-sm); transition: var(--transition); }
  .project-card:hover { box-shadow: var(--shadow-md); }

  .project-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

  .project-card h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 400; }
  .project-card h2 a { color: inherit; text-decoration: none; transition: var(--transition); }
  .project-card h2 a:hover { color: var(--accent); }

  .project-card-link { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--accent-subtle); border-radius: var(--radius-full); color: var(--accent); text-decoration: none; font-size: 0.8125rem; font-weight: 500; transition: var(--transition); }
  .project-card-link:hover { background: var(--accent); color: white; }

  .project-card p { color: var(--text-secondary); font-size: 0.9375rem; line-height: 1.7; margin-bottom: 16px; }
  .project-card p a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-subtle); text-underline-offset: 2px; transition: var(--transition); }
  .project-card p a:hover { color: var(--accent-hover); text-decoration-color: var(--accent); }
  .project-card p:last-of-type { margin-bottom: 0; }

  .project-image { width: 100%; border-radius: var(--radius-md); margin: 20px 0; border: 1px solid var(--border); }

  .project-image-caption { font-size: 0.8125rem; color: var(--text-muted); text-align: center; margin-top: -12px; margin-bottom: 16px; font-style: italic; }

  .project-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

  .project-meta-tag { display: inline-flex; align-items: center; padding: 6px 12px; background: var(--bg); border-radius: var(--radius-full); color: var(--text-muted); font-size: 0.75rem; font-weight: 500; }

  .project-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin: 24px 0; padding: 20px; background: var(--bg); border-radius: var(--radius-md); }
  .project-stat { text-align: center; }
  .project-stat-value { font-family: var(--font-display); font-size: 1.75rem; color: var(--accent); line-height: 1.2; }
  .project-stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

  .project-role { display: inline-block; padding: 4px 10px; background: var(--accent-subtle); color: var(--accent); border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; margin-bottom: 16px; }

  .project-links { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

  .related-posts-list { list-style: none; text-align: left; }
  .related-posts-list li { margin-bottom: 12px; }
  .related-posts-list a { color: var(--accent); text-decoration: none; font-weight: 500; font-size: 0.9375rem; }
  .related-posts-list a:hover { color: var(--accent-hover); }
  .related-posts-list p { font-size: 0.875rem; margin-bottom: 0; }

  .back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; margin-bottom: 24px; color: var(--accent); text-decoration: none; font-weight: 500; font-size: 0.9375rem; transition: var(--transition); }
  .back-link:hover { color: var(--accent-hover); }

  .gallery-container { width: 100%; max-width: 1200px; padding-top: 80px; }

  .gallery-header { text-align: center; margin-bottom: 48px; }
  .gallery-header h1 { font-family: var(--font-display); font-size: 2.5rem; margin-bottom: 12px; }
  .gallery-header p { color: var(--text-secondary); font-size: 1rem; }

  .gallery-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; justify-content: center; }

  .filter-btn { padding: 8px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-full); color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: var(--transition); font-family: var(--font-body); text-decoration: none; }
  .filter-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
  .filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; text-decoration: none; }

  .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

  .gallery-item { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: var(--transition); }
  .gallery-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; pointer-events: none; -webkit-user-drag: none; }
  .gallery-item:hover img { transform: scale(1.05); }

  .gallery-empty { grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: var(--text-muted); }
  .gallery-loading { grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: var(--text-muted); }

  .filter-count { opacity: 0.6; font-size: 0.75rem; margin-left: 2px; }

  .gallery-item-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 14px 12px; background: linear-gradient(transparent, rgba(0,0,0,0.65)); color: #fff; display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: var(--transition); pointer-events: none; }
  .gallery-item:hover .gallery-item-caption { opacity: 1; }
  .gallery-item-title { font-size: 0.875rem; font-weight: 600; line-height: 1.3; }
  .gallery-item-location { font-size: 0.75rem; opacity: 0.85; }

  /* Project page photo gallery */
  .project-gallery .photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .photo-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; cursor: pointer; border: 1px solid var(--border); background: var(--surface); transition: var(--transition); }
  .photo-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
  .photo-item img { width: 100%; height: 100%; object-fit: cover; -webkit-user-select: none; user-select: none; pointer-events: none; -webkit-user-drag: none; }

  .lightbox { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.95); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: var(--transition); }
  .lightbox.open { opacity: 1; visibility: visible; }

  .lightbox-close { position: absolute; top: 20px; right: 20px; width: 44px; height: 44px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.1); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
  .lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

  .lightbox-content { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: 92%; max-height: 94%; gap: 14px; }
  .lightbox img { max-width: 100%; max-height: calc(94vh - 110px); object-fit: contain; border-radius: var(--radius-md); -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-user-drag: none; }

  .lightbox-info { text-align: center; color: rgba(255,255,255,0.9); max-width: 640px; padding: 0 16px; }
  .lightbox-title { font-family: var(--font-display); font-size: 1.25rem; margin-bottom: 4px; }
  .lightbox-desc { font-size: 0.875rem; color: rgba(255,255,255,0.75); margin-bottom: 6px; line-height: 1.5; }
  .lightbox-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 0.8125rem; color: rgba(255,255,255,0.65); }
  .lightbox-meta-sep { opacity: 0.5; }
  .lightbox-project-link { color: #93C5FD; text-decoration: none; font-weight: 500; }
  .lightbox-project-link:hover { text-decoration: underline; }

  .lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.1); border: none; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
  .lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
  .lightbox-prev { left: 20px; }
  .lightbox-next { right: 20px; }

  .cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface-translucent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); padding: 20px 24px; z-index: 300; transform: translateY(100%); transition: transform 0.3s ease; }
  .cookie-banner.visible { transform: translateY(0); }

  .cookie-content { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }

  .cookie-text { flex: 1; min-width: 280px; color: var(--text-secondary); font-size: 0.875rem; line-height: 1.5; }
  .cookie-text a { color: var(--accent); text-decoration: none; }
  .cookie-text a:hover { text-decoration: underline; }

  .cookie-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

  .cookie-btn { padding: 10px 20px; border-radius: var(--radius-md); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: var(--transition); font-family: var(--font-body); }
  .cookie-btn-accept { background: var(--accent); color: white; border: none; }
  .cookie-btn-accept:hover { background: var(--accent-hover); }
  .cookie-btn-reject { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
  .cookie-btn-reject:hover { border-color: var(--text-secondary); color: var(--text); }

  @media (max-width: 640px) {
    .page { padding: 20px 16px; }
    .card { padding: 36px 28px; }
    h1 { font-size: 1.75rem; }
    .gallery-grid { grid-template-columns: 1fr; }
    .gallery-container, .container-wide { padding-top: 70px; }
    .project-card { padding: 24px; }
    .project-card-header { flex-direction: column; gap: 12px; }
    .project-stats { grid-template-columns: repeat(2, 1fr); }
  }
