/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:      #0a0a0a;
  --surface: #141414;
  --border:  #222;
  --text:    #e8e8e8;
  --muted:   #888;
  --accent:  #00c896;
  --accent-glow: rgba(0, 200, 150, .15);
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* ── Subtle background grid ───────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ── Landing page ─────────────────────────────────────────── */
nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  min-height: 96px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(10,10,10,.7);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
}

.logo-image {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 4px;
}

.logo span { color: var(--accent); }

.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.auth-btn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 20px var(--accent-glow);
}
.auth-btn svg { width: 16px; height: 16px; }

.user-greeting {
  display: none;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  font-size: .9rem;
}
.user-greeting .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}
.user-greeting .username { color: var(--text); font-weight: 600; }

.signout-link {
  color: var(--muted);
  font-size: .8rem;
  text-decoration: none;
  padding: .3rem .6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: color .2s, border-color .2s;
}
.signout-link:hover {
  color: var(--text);
  border-color: var(--muted);
}

.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 680px;
  margin: 8vh auto 0;
  padding: 0 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero h1 .accent { color: var(--accent); }

.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 2rem;
  background: var(--accent);
  color: #000;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 8px;
  text-decoration: none;
  transition: box-shadow .25s, transform .15s;
}
.hero-cta:hover {
  box-shadow: 0 0 30px var(--accent-glow), 0 4px 16px rgba(0,0,0,.4);
  transform: translateY(-1px);
}
.hero-cta svg { width: 18px; height: 18px; }

body.authenticated .hero-cta { display: none; }
body.authenticated .hero p::after {
  content: 'You are signed in. Explore the services below.';
  display: block;
  margin-top: .75rem;
  color: var(--accent);
  font-weight: 600;
}

.divider {
  width: 60px;
  height: 2px;
  background: var(--accent);
  margin: 5rem auto 3rem;
  border-radius: 2px;
  opacity: .5;
}

.services-section {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  padding: 0 1.5rem 6rem;
}

.services-section h2 {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: .5rem;
  letter-spacing: -.02em;
}
.services-section .subtitle {
  text-align: center;
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 2.5rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}

.service-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  background: rgba(255,255,255,.05);
}

.service-card .name {
  font-weight: 600;
  font-size: .95rem;
}

.service-card .desc {
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.service-card.active {
  cursor: pointer;
}
.service-card.active:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}

.service-card.locked {
  pointer-events: none;
  opacity: .35;
  filter: grayscale(.8);
}
.service-card.locked::after {
  content: '';
  position: absolute;
  top: .75rem;
  right: .75rem;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%23888'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.sources {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  padding: 0 1.5rem 2rem;
  color: var(--muted);
  font-size: .85rem;
}

.sources h3 {
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: .75rem;
}

.sources ul {
  list-style: none;
  display: grid;
  gap: .4rem;
  margin: 0;
  padding: 0;
}

.sources a {
  color: var(--accent);
  text-decoration: none;
}

.sources a:hover {
  text-decoration: underline;
}

footer {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .8rem;
  margin-top: auto;
}

.loading .service-card { opacity: .15; }

/* ── Dashboard page ───────────────────────────────────────── */
body.dashboard {
  justify-content: center;
}

.dashboard .container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  padding: 0 1.5rem;
  text-align: center;
}

.dashboard h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 1rem;
}

.accent {
  color: var(--accent);
}

.dashboard .subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 3rem;
  line-height: 1.6;
}

.dashboard .subtitle a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.dashboard .subtitle a:hover {
  text-decoration: underline;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}

.app-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-2px);
}

.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.05);
  color: var(--accent);
}

.app-name {
  font-weight: 600;
  font-size: .95rem;
}

.app-desc {
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 500px) {
  nav {
    padding: 1rem;
    min-height: 84px;
  }
  .hero { margin-top: 5vh; }
  .services-grid { grid-template-columns: 1fr 1fr; }
  .app-grid { grid-template-columns: 1fr 1fr; }
}
