/* Color tokens: exactly 5 colors */
    :root {
      --color-primary: #0b5fff; /* brand blue */
      --color-bg: #f8fafc; /* light background */
      --color-fg: #0f172a; /* dark text */
      --color-muted: #64748b; /* muted slate */
      --color-bg-dark: #0b1020; /* dark background */
      --radius: 14px;
      --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
      --shadow-strong: 0 10px 32px rgba(0, 0, 0, 0.18);
    }

    html[data-theme="light"] {
      color-scheme: light;
      --bg: var(--color-bg);
      --fg: var(--color-fg);
      --surface: #ffffff;
      --border: color-mix(in oklab, var(--color-muted), white 70%);
      --muted: var(--color-muted);
      --bsr-panel: #ffffff;
      --bsr-border: rgba(15, 23, 42, 0.06);
      --bsr-inactive-text: #374151; /* slate-700 */
      --bsr-active-grad-start: #1e40af; /* indigo-800 */
      --bsr-active-grad-end: #2563eb; /* indigo-600 */
      --bsr-shadow: 0 8px 20px rgba(2,6,23,0.06);
    }

    html[data-theme="dark"] {
      color-scheme: dark;
      --bg: var(--color-bg-dark);
      --fg: #e2e8f0;
      --surface: #0f1428;
      --border: color-mix(in oklab, var(--color-muted), black 60%);
      --muted: color-mix(in oklab, var(--color-muted), white 20%);
      --bsr-panel: #0b1220;
      --bsr-border: rgba(255,255,255,0.06);
      --bsr-inactive-text: #cbd5e1; /* slate-300 */
      --bsr-active-grad-start: #11266b; /* deeper indigo */
      --bsr-active-grad-end: #1e3a8a;
      --bsr-shadow: 0 8px 20px rgba(2,6,23,0.45);
    }

    /* Base */
    * {
      box-sizing: border-box;
    }
    html,
    body {
      height: 100%;
    }
    body {
      margin: 0;
      font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
      background: var(--bg);
      color: var(--fg);
      line-height: 1.55;
    }
    img {
      display: block;
      max-width: 100%;
      height: auto;
    }
    a,
    button {
      color: inherit;
      font: inherit;
    }

    .container {
      max-width: 1120px;
      margin: 0 auto;
      padding: 1rem;
    }

    .sr-only {
      position: absolute !important;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    /* Header */
    .site-header {
      padding: 1rem 0 0.25rem;
      border-bottom: 1px solid var(--border);
      background: var(--bg);
      position: sticky;
      top: 0;
      z-index: 10;
      backdrop-filter: saturate(180%) blur(6px);
    }
    .title {
      margin: 0.25rem 0;
      text-align: center;
      font-size: clamp(1.5rem, 2.5vw, 2rem);
      font-weight: 800;
      letter-spacing: 0.2px;
    }
    .title .accent {
      color: var(--color-primary);
    }
    .controls {
      position: fixed;
      top: 12px;
      right: 12px;
      z-index: 20;
      display: inline-flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0;
    }

    /* Toggle switch (like provided image) */
    .switch-wrap {
      display: inline-flex;
      align-items: center;
      gap: 0.6rem;
    }
    .switch-label {
      font-size: 0.9rem;
      color: var(--muted);
    }
    .switch-input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
    .switch {
      position: relative;
      width: 56px;
      height: 30px;
      border-radius: 999px;
      background: #b4c6ff; /* OFF track (tint of brand) */
      border: 1px solid var(--border);
      box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
      transition: background 200ms ease;
      cursor: pointer;
      display: inline-block;
    }
    .switch-knob {
      position: absolute;
      top: 2px;
      left: 2px;
      width: 26px;
      height: 26px;
      border-radius: 999px;
      background: #fff;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
      transition: transform 200ms ease;
    }
    .switch-input:checked + .switch {
      background: var(--color-primary);
    }
    .switch-input:checked + .switch .switch-knob {
      transform: translateX(26px);
    }

    /* Small screens: reduce toggle size so it looks balanced on mobile */
    @media (max-width: 640px) {
      .controls {
        top: 10px;
        right: 10px;
        z-index: 100;
      }

      .switch {
        width: 44px;        /* smaller pill */
        height: 24px;
        border-radius: 20px;
      }

      .switch-knob {
        width: 18px;        /* smaller knob */
        height: 18px;
        top: 3px;
        left: 3px;
        transition: transform 180ms ease;
      }

      /* distance the knob moves when checked */
      .switch-input:checked + .switch .switch-knob {
        transform: translateX(20px);
      }
    }

    /* Intro (professional description) */
    .intro {
      text-align: center;
      margin: 0.75rem auto 1.5rem;
      max-width: 65ch;
      color: var(--muted);
      font-size: 1rem;
      line-height: 1.6;
      padding: 0 1rem;
      opacity: 0;
      transform: translateY(10px);
      animation: fadeInUp 0.6s ease 0.3s forwards;
    }

    @keyframes fadeInUp {
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Gallery */
    .gallery {
      display: grid;
      gap: 1rem;
      grid-template-columns: repeat(2, 1fr);
      margin-top: 1rem;
    }
    @media (min-width: 900px) {
      .gallery {
        grid-template-columns: repeat(4, 1fr);
      }
    }

    /* hide gallery sections when toggled off */
    .gallery.hidden {
      display: none !important;
      visibility: hidden;
    }

    .card {
      background: var(--surface);
      border: 2px solid color-mix(in oklab, var(--color-primary), var(--surface) 75%);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
      outline: none;
      cursor: pointer;
    }
    .card:hover {
      box-shadow: var(--shadow-strong);
      border-color: color-mix(in oklab, var(--color-primary), var(--surface) 55%);
    }
    .card:focus-visible {
      box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary), white 60%), var(--shadow);
    }

    .card-figure {
      aspect-ratio: 3 / 2; /* Changed to make images even larger - more square/taller */
      overflow: hidden;
      background: color-mix(in oklab, var(--bg), var(--muted) 10%);
    }
    .card-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 300ms ease;
    }
    .card:hover .card-img,
    .card:focus-within .card-img {
    }

    .card-body {
      padding: 0.5rem 0.8rem 0.7rem; /* Further reduced padding to give more space to image */
      text-align: center; /* Center align the text */
    }
    .card-title {
      margin: 0 0 0.15rem;
      font-size: 0.8rem; /* Further reduced from 0.85rem to make text smaller */
      font-weight: 700;
    }
    .card-meta {
      margin: 0;
      font-size: 0.75rem; /* Further reduced from 0.75rem to make text smaller */
      color: var(--muted);
    }

    /* BSR toggle (Certificate / LOR) */
    .bsr-toggle {
      display: flex;
      justify-content: center;
      align-items: center;
      margin: 0.9rem 0 0.6rem;
      width: 100%;
    }

    .bsr-btns {
      display: inline-flex;
      gap: 6px;
      padding: 6px;
      border-radius: 999px;
      background: color-mix(in oklab, var(--surface), var(--muted) 88%);
      box-shadow: 0 8px 20px rgba(2,6,23,0.06);
      border: 1px solid color-mix(in oklab, var(--muted), transparent 85%);
    }

    .bsr-btn {
      appearance: none;
      -webkit-appearance: none;
      border: none;
      background: transparent;
      color: var(--muted);
      font-weight: 800;
      letter-spacing: 0.6px;
      padding: 10px 22px;
      border-radius: 999px;
      cursor: pointer;
      transition: all 180ms ease;
      box-shadow: none;
      font-size: 0.88rem;
      text-align: center;
      line-height: 1;
    }

    .bsr-btn:focus {
      outline: none;
      box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-primary), white 70%);
    }

    /* active style matches provided image: rounded pill with gradient and soft shadow */
    .bsr-btn.active,
    .bsr-btn[aria-selected="true"] {
      color: white;
      background: linear-gradient(180deg, color-mix(in oklab, var(--color-primary), #3a78ff 6%), var(--color-primary));
      box-shadow: 0 8px 22px rgba(11,95,255,0.18), 0 2px 6px rgba(0,0,0,0.06);
      transform: translateY(-2px);
    }

    /* invert order on small screens if needed, keep compact */
    @media (max-width: 520px) {
      .bsr-btns { padding: 4px; gap: 6px; }
      .bsr-btn { padding: 8px 14px; font-size: 0.82rem; }
    }

    /* optional body attribute so you can style gallery per view */
    :root[data-view="lor"] .card { opacity: 0.9; } /* example hook - adapt as needed */

    /* Modal */
    .modal {
      position: fixed;
      inset: 0;
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: opacity 300ms ease, visibility 300ms ease;
    }
    .modal.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }
    .modal-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
      backdrop-filter: blur(4px);
    }
    .modal-dialog {
      position: relative;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      max-height: 100vh;
      overflow: auto;
      width: 100%;
    }

    /* Image Modal - removed padding from sides */
    .image-viewer {
      position: relative;
      max-width: 100vw;
      max-height: 100vh;
      background: var(--surface);
      overflow: hidden;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    #modalImg {
      width: auto;
      height: auto;
      max-width: 100vw;
      max-height: 90vh;
      object-fit: contain;
      display: block;
    }

    /* Modal close button - smaller and top right */
    .modal-close {
      position: absolute;
      top: 15px;
      right: 15px;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      appearance: none;
      border: 2px solid var(--border);
      background: var(--surface);
      color: var(--fg);
      font-size: 1.2rem;
      font-weight: bold;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 200ms ease;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      z-index: 10;
      padding: 0;
    }
    .modal-close:hover {
      background: color-mix(in oklab, var(--surface), var(--color-primary) 10%);
      border-color: var(--color-primary);
    }

    /* Download button - icon only */
    .download-btn {
      position: absolute;
      bottom: 20px;
      right: 20px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      appearance: none;
      border: none;
      background: var(--color-primary);
      color: white;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 200ms ease;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
      z-index: 10;
    }
    .download-btn:hover {
      background: color-mix(in oklab, var(--color-primary), black 15%);
      box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    }
    .download-btn:active {
      transform: translateY(0);
    }
    .download-btn svg {
      width: 20px;
      height: 20px;
    }

    /* Mobile responsiveness for modal */
    @media (max-width: 640px) {
      .image-viewer {
        max-width: 100vw;
        max-height: 100vh;
      }
      
      #modalImg {
        max-height: 85vh;
      }
      
      .modal-close {
        width: 28px;
        height: 28px;
        top: 10px;
        right: 10px;
        font-size: 1rem;
      }
      
      .download-btn {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
      }
      
      .download-btn svg {
        width: 18px;
        height: 18px;
      }
    }

    /* Footer */
    .site-footer {
      margin-top: 2rem;
      padding: 1rem 0;
      text-align: center;
      color: var(--muted);
      font-size: 0.95rem;
      border-top: 1px solid color-mix(in oklab, var(--muted), transparent 85%);
      background: transparent;
    }
    .site-footer-inner {
      max-width: 1100px;
      margin: 0 auto;
      padding: 0 1rem;
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
      align-items: center;
    }
    .site-footer .year {
      font-weight: 700;
      color: var(--color-primary);
    }
    .site-footer .footer-note {
      margin: 0;
      font-size: 0.85rem;
      color: color-mix(in oklab, var(--muted), black 10%);
    }

    /* small screens: slightly smaller footer text */
    @media (max-width: 640px) {
      .site-footer { font-size: 0.85rem; padding: 0.75rem 0; }
      .site-footer-inner { padding: 0 0.75rem; }
    }

    /* Theme-specific vars for the BSR toggle */
    html[data-theme="light"] {
      --bsr-panel: #ffffff;
      --bsr-border: rgba(15, 23, 42, 0.06);
      --bsr-inactive-text: #374151; /* slate-700 */
      --bsr-active-grad-start: #1e40af; /* indigo-800 */
      --bsr-active-grad-end: #2563eb; /* indigo-600 */
      --bsr-shadow: 0 8px 20px rgba(2,6,23,0.06);
    }

    html[data-theme="dark"] {
      --bsr-panel: #0b1220;
      --bsr-border: rgba(255,255,255,0.06);
      --bsr-inactive-text: #cbd5e1; /* slate-300 */
      --bsr-active-grad-start: #11266b; /* deeper indigo */
      --bsr-active-grad-end: #1e3a8a;
      --bsr-shadow: 0 8px 20px rgba(2,6,23,0.45);
    }

    /* BSR toggle container */
    .bsr-toggle {
      display: flex;
      justify-content: center;
      align-items: center;
      margin: 0.9rem 0 0.6rem;
      width: 100%;
    }

    /* pill background that adapts to theme */
    .bsr-btns {
      display: inline-flex;
      gap: 6px;
      padding: 6px;
      border-radius: 999px;
      background: var(--bsr-panel);
      border: 1px solid var(--bsr-border);
      box-shadow: var(--bsr-shadow);
      -webkit-backdrop-filter: blur(6px);
      backdrop-filter: blur(6px);
      transition: background-color 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
    }

    /* buttons inside pill */
    .bsr-btn {
      appearance: none;
      -webkit-appearance: none;
      border: none;
      background: transparent;
      color: var(--bsr-inactive-text);
      font-weight: 800;
      letter-spacing: 0.6px;
      padding: 10px 22px;
      border-radius: 999px;
      cursor: pointer;
      transition: color 160ms ease, transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
      font-size: 0.9rem;
      text-align: center;
      line-height: 1;
      white-space: nowrap;
    }

    /* focus accessible outline */
    .bsr-btn:focus {
      outline: none;
      box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
    }

    /* Active style (visible text on active pill) */
    .bsr-btn.active,
    .bsr-btn[aria-selected="true"] {
      color: #ffffff;
      background: linear-gradient(180deg, var(--bsr-active-grad-start), var(--bsr-active-grad-end));
      box-shadow: 0 10px 30px rgba(37,99,235,0.18);
      transform: translateY(-2px);
    }

    /* Hover for non-active buttons: slightly darker/lighter depending on theme */
    html[data-theme="light"] .bsr-btn:not(.active):hover {
      background: rgba(15,23,42,0.03);
      color: #111827;
    }

    html[data-theme="dark"] .bsr-btn:not(.active):hover {
      background: rgba(255,255,255,0.03);
      color: #f8fafc;
    }

    /* compact adjustments for small screens */
    @media (max-width: 520px) {
      .bsr-btns { padding: 4px; gap: 6px; }
      .bsr-btn { padding: 8px 14px; font-size: 0.82rem; }
    }
