:root {
  --site-cyan: #55d9ee;
  --site-violet: #9b6cff;
  --site-text: #f8fbff;
  --site-muted: #b8c3d8;
  --site-surface: rgba(8, 12, 28, 0.72);
  --site-surface-strong: rgba(7, 10, 24, 0.9);
  --site-border: rgba(166, 194, 255, 0.2);
  --site-focus: #8cecff;
  --site-radius: 16px;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-color: rgba(139, 111, 255, 0.8) rgba(3, 6, 17, 0.7);
}

body {
  min-width: 0;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: #fff;
  background: rgba(111, 75, 255, 0.78);
}

a,
button,
input {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 3px solid var(--site-focus);
  outline-offset: 3px;
}

.site-nav {
  position: sticky;
  top: max(0.75rem, env(safe-area-inset-top));
  z-index: 100;
  display: flex;
  width: fit-content;
  max-width: calc(100% - 1.5rem);
  margin: 0 auto;
  padding: 0.4rem;
  justify-content: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: rgba(5, 9, 23, 0.7);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

body > .site-nav {
  margin-top: max(0.75rem, env(safe-area-inset-top));
}

.site-nav a {
  display: inline-flex;
  min-height: 2.35rem;
  padding: 0.55rem 0.85rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--site-muted);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.site-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.site-nav a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(120deg, rgba(65, 188, 228, 0.28), rgba(125, 77, 255, 0.36));
  box-shadow: inset 0 0 0 1px rgba(167, 220, 255, 0.2);
}

.footer {
  color: var(--site-muted) !important;
}

.footer p {
  margin: 0;
}

.back-button {
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.94) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24) !important;
  transition: transform 180ms ease, box-shadow 180ms ease !important;
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32) !important;
  text-decoration: none !important;
}

.reveal-ready {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 650ms ease, transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-ready.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Homepage */
html:has(body.home-page),
body.home-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.home-page .layout-container {
  width: 100%;
  min-height: 100svh;
  padding: clamp(1rem, 3vw, 2rem);
  gap: clamp(1.35rem, 4vh, 3rem);
}

.home-page .shift-y {
  transform: none !important;
}

.home-page .hero {
  margin-top: clamp(1rem, 7vh, 5rem);
}

.home-page .title {
  margin: 0 0 0.85rem;
  font-size: clamp(2.45rem, 7vw, 4.25rem);
  line-height: 1.05;
  text-shadow: 0 0 32px rgba(115, 201, 255, 0.2);
}

.home-page .subtitle {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
}

.home-page .solarity-link {
  width: min(100%, 680px);
  padding: clamp(1rem, 3vw, 1.45rem);
  border: 1px solid rgba(125, 206, 255, 0.16);
  border-radius: var(--site-radius);
  background: rgba(5, 10, 25, 0.32);
  backdrop-filter: blur(10px);
}

.home-page .solarity-link p {
  margin: 0 0 0.8rem;
}

.home-page .solarity-link a {
  display: inline-flex;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  font-weight: 700;
}

.home-page .social-links {
  margin-top: auto;
}

.home-page .social-links a {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(4, 8, 20, 0.45);
  transition: transform 180ms ease, background-color 180ms ease;
}

.home-page .social-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-3px);
}

.home-page .footer {
  margin: 0.25rem auto 0;
}

/* Gallery */
html:has(body.gallery-page),
body.gallery-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.gallery-page {
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
}

.gallery-page > .title {
  margin: clamp(1.5rem, 5vh, 3.5rem) 0 1.5rem;
  font-size: clamp(2.35rem, 6vw, 3.4rem);
  background: linear-gradient(110deg, #65e6f6, #9a6dff 58%, #d68dff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(111, 88, 255, 0.22));
}

.gallery-page .controls {
  width: min(100%, 760px);
  margin: 0 auto 2rem;
  padding: 0.75rem;
  border: 1px solid var(--site-border);
  border-radius: 14px;
  background: var(--site-surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
}

.gallery-page .filter-buttons {
  flex-wrap: wrap;
  justify-content: center;
}

.gallery-page .filter-btn,
.gallery-page .pagination button,
.lora-page .filter-menu button,
.lora-page .sort-menu .sort-btn,
.lora-page .pagination button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-page #searchInput {
  min-height: 44px;
  border-color: rgba(173, 203, 255, 0.22);
  background: rgba(4, 7, 18, 0.72);
}

.gallery-page .grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  width: min(100%, 1200px);
  padding: 0;
}

.gallery-page .gallery-item {
  border-color: rgba(173, 203, 255, 0.17);
  background: rgba(15, 19, 36, 0.84);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  cursor: zoom-in;
}

.gallery-page .gallery-item:hover,
.gallery-page .gallery-item:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 18px 42px rgba(92, 53, 230, 0.32);
}

.gallery-page .gallery-item img {
  height: clamp(220px, 24vw, 280px);
}

.gallery-page .tag {
  color: #cfbaff;
  background: rgba(126, 82, 255, 0.2);
}

.gallery-page .fullview-close {
  display: grid;
  width: 48px;
  height: 48px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(5, 8, 18, 0.72);
}

/* LoRA library */
html:has(body.lora-page),
body.lora-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

.lora-page .layout-container {
  position: relative;
  z-index: 1;
  width: min(100%, 1280px);
  max-width: none;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
}

.lora-page header.shift-y,
.lora-page .filter-menu.shift-y,
.lora-page .controls-container.shift-xy,
.lora-page .search-results-info.shift-y,
.lora-page .gallery-container.shift-y,
.lora-page .pagination-wrapper.shift-y,
.lora-page .back-button.shift-y,
.lora-page .footer.shift-y {
  transform: none !important;
}

.lora-page header {
  margin: clamp(2rem, 6vh, 4.5rem) auto 1.5rem;
}

.lora-page .title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
}

.lora-page .subtitle {
  margin: 0.7rem auto 0;
  color: var(--site-muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.lora-page .icon-links {
  margin: 1.5rem auto 0;
  transform: none !important;
}

.lora-page .filter-menu {
  display: flex;
  margin: 0 auto;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.lora-page .filter-menu button,
.lora-page .sort-menu .sort-btn {
  margin: 0.2rem;
}

.lora-page .controls-container {
  width: min(100%, 760px);
  margin: 1.25rem auto 0;
  padding: 0.75rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid var(--site-border);
  border-radius: 14px;
  background: var(--site-surface);
  backdrop-filter: blur(14px);
}

.lora-page .search-container {
  width: min(100%, 360px);
  margin-left: 0;
}

.lora-page .search-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.lora-page .search-results-info {
  margin: 0.8rem 0 1rem;
}

.lora-page .gallery-container {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  width: min(100%, 1120px);
  padding: 0 0 2rem;
  gap: clamp(1rem, 3vw, 2rem);
}

.lora-page .lora-card {
  max-width: 320px;
  border: 1px solid rgba(173, 203, 255, 0.16);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.lora-page .lora-card:hover,
.lora-page .lora-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 20px 48px rgba(91, 52, 227, 0.34);
}

.lora-page .pagination-wrapper,
.lora-page .back-button-wrapper,
.lora-page .footer {
  position: relative;
  z-index: 1;
}

/* Projects */
html:has(body.projects-page),
body.projects-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
}

.projects-page .container-title,
.projects-page .center-xy,
.projects-page .back-button,
.projects-page .footer {
  transform: none !important;
}

.projects-page .projects-hero {
  width: min(100% - 2rem, 760px);
  margin: clamp(2rem, 6vh, 4.5rem) auto 1.5rem;
  text-align: center;
}

.projects-page .container-title {
  margin: 0 0 0.55rem;
  font-size: clamp(2.35rem, 6vw, 3.5rem);
}

.projects-page .page-intro {
  margin: 0;
  color: var(--site-muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.projects-page .center-xy,
.projects-page .container {
  display: block;
}

.projects-page .project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 1120px);
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
  gap: clamp(1rem, 3vw, 2rem);
}

.projects-page .project-card,
.projects-page .placeholder-text {
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  border: 1px solid rgba(173, 203, 255, 0.16);
  border-radius: 22px;
  background: #080812;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
  transition: transform 240ms ease, box-shadow 240ms ease;
}

.projects-page .project-card:hover,
.projects-page .project-card:focus-visible,
.projects-page .placeholder-text:hover {
  transform: translateY(-7px);
  box-shadow: 0 28px 62px rgba(25, 15, 72, 0.5);
}

.projects-page .project-card img,
.projects-page .placeholder-text img {
  transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.projects-page .project-card:hover img,
.projects-page .project-card:focus-visible img,
.projects-page .placeholder-text:hover img {
  transform: scale(1.035);
}

.projects-page .project-overlay,
.projects-page .placeholder-overlay {
  padding: clamp(1.1rem, 3vw, 2rem);
  align-items: flex-end;
  justify-content: flex-start;
  opacity: 1;
  background: linear-gradient(to top, rgba(4, 5, 13, 0.96), rgba(4, 5, 13, 0.58) 42%, transparent 72%);
  text-align: left;
}

.projects-page .project-overlay p,
.projects-page .placeholder-overlay p {
  margin: 0;
  font-size: clamp(0.92rem, 1.5vw, 1.02rem);
}

.projects-page .project-overlay strong,
.projects-page .placeholder-overlay strong {
  display: inline-block;
  margin-bottom: 0.45rem;
  color: var(--site-cyan);
  font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.projects-page .back-button-wrapper {
  margin: 1rem auto 2rem;
}

.projects-page .footer {
  margin: 0 auto max(1.5rem, env(safe-area-inset-bottom));
}

/* Donation */
html:has(body.donate-page),
body.donate-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
}

.donate-page .layout-container {
  width: min(100%, 1280px);
  min-height: auto;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem) 2rem;
  gap: 1.5rem;
}

.donate-page .hero {
  margin: clamp(2rem, 6vh, 4.5rem) auto 0;
}

.donate-page .title {
  margin: 0 0 0.4rem;
  font-size: clamp(2.25rem, 6vw, 3.4rem);
  line-height: 1.12;
}

.donate-page .subtitle {
  margin: 0;
  color: var(--site-muted);
}

.donate-page .donate-layout {
  position: static;
  top: auto;
  width: 100%;
  max-width: 1200px;
  margin: 1rem auto 0;
  padding: clamp(1rem, 3vw, 2rem);
  gap: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--site-border);
  background: rgba(9, 12, 24, 0.78);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
}

.donate-page .donate-left,
.donate-page .donate-right {
  min-width: 0;
  gap: 1rem;
}

.donate-page .intro-paragraph {
  margin: 0;
  color: var(--site-muted);
}

.donate-page .section,
.donate-page .crypto-block {
  margin: 0;
  border: 1px solid rgba(173, 203, 255, 0.12);
  background: rgba(5, 8, 18, 0.82);
}

.donate-page .section {
  padding: clamp(1.1rem, 3vw, 2rem);
}

.donate-page .crypto-grid {
  gap: 1rem;
}

.donate-page .crypto-block {
  min-width: 0;
}

.donate-page .wallet {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #dbe7ff;
  font-size: 0.83rem;
}

.donate-page .qr {
  margin-right: auto;
  margin-left: auto;
  background: #fff;
}

.donate-page .back-button,
.donate-page .footer {
  transform: none !important;
}

.donate-page .back-button-wrapper {
  margin: 0.5rem auto 1.5rem;
}

@media (max-width: 900px) {
  .donate-page .donate-layout,
  .donate-page .crypto-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .projects-page .project-grid {
    grid-template-columns: minmax(0, 340px);
    justify-content: center;
  }

  .projects-page .project-card {
    order: -1;
  }
}

@media (max-width: 640px) {
  .site-nav {
    border-radius: 18px;
  }

  .site-nav a {
    padding: 0.52rem 0.68rem;
    font-size: 0.84rem;
  }

  .home-page .layout-container {
    gap: 1.4rem;
  }

  .home-page .hero {
    margin-top: 1.5rem;
  }

  .home-page .solarity-link {
    font-size: 1rem;
  }

  .gallery-page .controls,
  .gallery-page .filter-buttons {
    width: 100%;
  }

  .gallery-page .controls {
    flex-direction: column;
  }

  .gallery-page .filter-btn {
    flex: 1;
  }

  .lora-page header {
    margin-top: 2rem;
  }

  .lora-page .controls-container,
  .lora-page .sort-menu,
  .lora-page .search-container {
    width: 100%;
  }

  .lora-page .sort-menu {
    display: flex;
  }

  .lora-page .sort-menu .sort-btn {
    flex: 1;
  }

  .lora-page .gallery-container {
    grid-template-columns: minmax(0, 320px);
    justify-content: center;
  }

  .projects-page .project-grid {
    padding: 1rem;
  }

  .donate-page .donate-layout {
    padding: 0.8rem;
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .reveal-ready {
    opacity: 1;
    transform: none;
  }
}
