/* Light theme (default) – white tonalities + liquid glass */
:root,
[data-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.4);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-highlight: rgba(255, 255, 255, 0.85);
  --glass-shadow: rgba(0, 0, 0, 0.06);
  --text: #1a1d24;
  --text-soft: #4b5563;
  --accent: rgba(31, 126, 142, 0.45);
  --bg-gradient: linear-gradient(145deg, #f8fafc 0%, #e2e8f0 35%, #f1f5f9 70%, #e8eef4 100%);
  --orb-1: radial-gradient(circle, #94a3b8 0%, transparent 70%);
  --orb-2: radial-gradient(circle, #cbd5e1 0%, transparent 70%);
  --noise-opacity: 0.04;
}

/* Dark theme */
[data-theme="dark"] {
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-highlight: rgba(255, 255, 255, 0.25);
  --glass-shadow: rgba(0, 0, 0, 0.15);
  --text: rgba(255, 255, 255, 0.95);
  --text-soft: rgba(255, 255, 255, 0.7);
  --accent: rgba(120, 200, 255, 0.5);
  --bg-gradient: linear-gradient(145deg, #133334 0%, #162f2d 35%, #11312f 70%, #15363b 100%);
  --orb-1: radial-gradient(circle, #1b3252 0%, transparent 70%);
  --orb-2: radial-gradient(circle, #010e10 0%, transparent 70%);
  --noise-opacity: 0.03;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
  padding: 0 1.5rem 3rem 1.5rem;
  position: relative;
  overflow-x: hidden;
}

/* Subtle animated gradient orbs for depth */
body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: 60vmin;
  height: 60vmin;
  background: var(--orb-1);
  top: -20%;
  left: -10%;
  animation: float 18s ease-in-out infinite;
}

body::after {
  width: 50vmin;
  height: 50vmin;
  background: var(--orb-2);
  bottom: -15%;
  right: -5%;
  animation: float 22s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 5%) scale(1.05); }
}

.noise {
  position: fixed;
  inset: 0;
  opacity: var(--noise-opacity);
  pointer-events: none;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Loading screen */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: var(--bg-gradient);
}

.loading-screen__spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: loadingSpin 0.9s linear infinite;
}

@keyframes loadingSpin {
  to { transform: rotate(360deg); }
}

.loading-screen__text {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-soft);
}

/* No-access view */
.no-access {
  position: relative;
  z-index: 2;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.no-access__card {
  max-width: 420px;
  width: 100%;
  padding: 2.5rem 2rem;
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 12px 40px var(--glass-shadow);
}

.no-access__message {
  margin: 0 0 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.no-access__hint {
  margin: 0 0 1.75rem 0;
  font-size: 0.9375rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.no-access__google-btn {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

@keyframes headerFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.page-header {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 2.5rem auto;
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  animation: headerFadeIn 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0;
  transition: opacity 0.2s ease;
}

.logo:hover {
  opacity: 0.9;
}

.logo__img {
  display: block;
  height: 2.5rem;
  width: auto;
  object-fit: contain;
}

.container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 5.5rem;
}

.title {
  font-size: 75px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.25rem 0;
  text-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .title {
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.1);
}

/* Title fade-in */
.title {
  opacity: 0;
  animation: titleFadeIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}

@keyframes titleFadeIn {
  to {
    opacity: 1;
  }
}

.title .wave {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: wave 1.3s cubic-bezier(0.42, 0, 0.2, 1) 1 0.5s;
}

@keyframes wave {
  0%   { transform: rotate(0deg); }
  15%  { transform: rotate(16deg); }
  30%  { transform: rotate(-10deg); }
  45%  { transform: rotate(10deg); }
  60%  { transform: rotate(-6deg); }
  75%  { transform: rotate(4deg); }
  100% { transform: rotate(0deg); }
}

.subtitle {
  font-size: 20px;
  font-weight: 300;
  color: var(--text-soft);
  margin: 0;
  opacity: 0;
  animation: subtitleFadeIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.45s forwards;
}

@keyframes subtitleFadeIn {
  to {
    opacity: 1;
  }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Item appear animation */
@keyframes itemAppear {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Liquid glass item */
.glass-item {
  --blur: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  min-height: 8rem;
  padding: 1.75rem 1.75rem;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.2s ease;

  /* Appear animation: staggered, one-shot */
  opacity: 0;
  animation: itemAppear 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;

  /* Liquid glass: frosted, translucent */
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 0 var(--glass-highlight),
    0 8px 32px var(--glass-shadow);
}

.glass-item:nth-child(1) { animation-delay: 0.5s; }
.glass-item:nth-child(2) { animation-delay: 0.6s; }
.glass-item:nth-child(3) { animation-delay: 0.7s; }
.glass-item:nth-child(4) { animation-delay: 0.8s; }
.glass-item:nth-child(5) { animation-delay: 0.9s; }
.glass-item:nth-child(6) { animation-delay: 1s; }
.glass-item:nth-child(7) { animation-delay: 1.1s; }
.glass-item:nth-child(8) { animation-delay: 1.2s; }

/* Inner shine line */
.glass-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--glass-highlight) 20%,
    var(--glass-highlight) 80%,
    transparent 100%
  );
  opacity: 0.8;
  border-radius: 16px 16px 0 0;
}

.glass-item:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: var(--glass-border);
  box-shadow:
    inset 0 1px 0 0 var(--glass-highlight),
    0 12px 40px var(--glass-shadow),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .glass-item:hover {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow:
    inset 0 1px 0 0 var(--glass-highlight),
    0 12px 40px var(--glass-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.glass-item:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.2),
    0 4px 16px var(--glass-shadow);
}

.glass-item__icon {
  width: auto;
  height: 3.75rem;
  object-fit: contain;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.glass-item__label {
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

/* Focus for accessibility */
.glass-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Theme toggle */
.theme-toggle {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px var(--glass-shadow);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px var(--glass-shadow);
}

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

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

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

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

.subtitle-container {
  text-align: center;
  margin-bottom: 2.5rem;
}