:root {
  --accent: #ff2e6d;
  --gap: 6px;
}

[data-theme="dark"] {
  --bg: #0d0d0f;
  --header-bg: rgba(13, 13, 15, 0.75);
  --text: #f2f2f3;
  --border: #232327;
  --shadow: rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  --bg: #f7f6f4;
  --header-bg: rgba(247, 246, 244, 0.75);
  --text: #16161a;
  --border: #e4e2df;
  --shadow: rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
  min-height: 100vh;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pfp {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  display: block;
}

.brand-name {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

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

.theme-toggle:active {
  transform: scale(0.92);
}

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

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

/* ---------- Gallery ---------- */

main {
  padding: var(--gap) 24px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: var(--gap);
  padding-top: 28px;
}

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

.grid-narrow {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.grid img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, outline-color 0.18s ease;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.grid-wide img {
  aspect-ratio: 16 / 9;
}

.grid-narrow img {
  aspect-ratio: 9 / 16;
}

.grid img:hover {
  transform: scale(1.025);
  outline-color: var(--accent);
  box-shadow: 0 6px 22px var(--shadow);
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 32px;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.2s ease;
}

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

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .site-header {
    padding: 12px 16px;
  }
  main {
    padding: var(--gap) 12px 40px;
  }
  .grid-wide {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
  .grid-narrow {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}

/* ---------- Accessibility ---------- */

a:focus-visible,
button:focus-visible,
img:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
