/* ═══════════════════════════════════════════
   lashman Apps – Hub Page Styles
   ═══════════════════════════════════════════ */

:root {
  /* Colors */
  --bg-deep: #060d13;
  --bg-surface: #0a1218;
  --bg-card: rgba(255, 255, 255, 0.035);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --text-primary: #ededed;
  --text-secondary: #9aacbf;
  --text-tertiary: #8a9bae;
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.08);
  --accent-glow: rgba(34, 211, 238, 0.2);

  /* Fonts */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Radius */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* ─── Reset ─── */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ─── Ambient Orbs ─── */

.ambient-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 10% 15%, rgba(88, 28, 135, 0.16) 0%, transparent 65%),
    radial-gradient(ellipse 60% 70% at 85% 75%, rgba(8, 145, 178, 0.13) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 55% 40%, rgba(30, 58, 138, 0.08) 0%, transparent 55%);
}

.ambient-orbs::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  background-repeat: repeat;
}

/* ─── Accessibility Utilities ─── */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: var(--bg-deep);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
}

.skip-link:focus {
  top: 1rem;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ─── Main Layout ─── */

main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.25rem, 4vw, 3rem);
  gap: clamp(3rem, 6vw, 5rem);
}

/* ─── Header ─── */

.hub-header {
  text-align: center;
  max-width: 600px;
}

.hub-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(34, 211, 238, 0.15);
  padding: 0.35em 1em;
  border-radius: 100px;
  margin-bottom: 1.5rem;
}

.hub-title {
  font-family: var(--font-body);
  font-size: clamp(2.5rem, 7vw, 4.5rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.hub-title em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 28px rgba(34, 211, 238, 0.25));
  letter-spacing: -0.02em;
}

.hub-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ─── App Grid ─── */

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1020px;
  width: 100%;
}

/* ─── App Card ─── */

.app-card {
  position: relative;
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease,
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  overflow: hidden;
  transform-style: preserve-3d;
  perspective: 800px;
}

.app-card:not(.app-card--coming-soon):hover {
  border-color: rgba(34, 211, 238, 0.25);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(34, 211, 238, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Per-card accent overrides */
.app-card[data-accent="#a78bfa"]:hover {
  border-color: rgba(167, 139, 250, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(167, 139, 250, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-card[data-accent="#d4a056"]:hover {
  border-color: rgba(212, 160, 86, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(212, 160, 86, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-card[data-accent="#a78bfa"] .app-card-glow {
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(167, 139, 250, 0.08), transparent 60%);
}

.app-card[data-accent="#d4a056"] .app-card-glow {
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(212, 160, 86, 0.08), transparent 60%);
}

.app-card[data-accent="#34d399"]:hover {
  border-color: rgba(52, 211, 153, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(52, 211, 153, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-card[data-accent="#34d399"] .app-card-glow {
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(52, 211, 153, 0.08), transparent 60%);
}

.app-card[data-accent="#0d9488"]:hover {
  border-color: rgba(13, 148, 136, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(13, 148, 136, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-card[data-accent="#0d9488"] .app-card-glow {
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(13, 148, 136, 0.08), transparent 60%);
}

.app-card[data-accent="#6B8AFF"]:hover {
  border-color: rgba(107, 138, 255, 0.25);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 80px rgba(107, 138, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-card[data-accent="#6B8AFF"] .app-card-glow {
  background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(107, 138, 255, 0.08), transparent 60%);
}

.app-card:not(.app-card--coming-soon):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Card mouse-tracking glow */
.app-card-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  background: radial-gradient(
    400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(34, 211, 238, 0.08),
    transparent 60%
  );
}

.app-card:hover .app-card-glow {
  opacity: 1;
}

/* Shimmer sweep on hover */
.app-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 55%,
    transparent 60%
  );
  background-size: 250% 100%;
  background-position: 200% 0;
  pointer-events: none;
  z-index: 2;
}

.app-card:not(.app-card--coming-soon):hover::after {
  animation: shimmer 0.8s ease-out forwards;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.app-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.app-card-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease;
}

.app-card:not(.app-card--coming-soon):hover .app-card-icon {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.07);
}

.app-card-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.app-card[data-accent="#FBBF24"] .app-card-icon img {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.45)) drop-shadow(0 0 1px rgba(251, 191, 36, 0.2));
}

.app-card-icon--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border: 1px dashed var(--border-subtle);
  color: var(--text-tertiary);
}

.app-card-info {
  flex: 1;
  min-width: 0;
}

.app-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.app-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── CC0 Badge ─── */

.hub-cc0 {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ab4a8;
  background: rgba(52, 211, 153, 0.04);
  border: 1px solid rgba(52, 211, 153, 0.12);
  padding: 0.4em 1.1em;
  border-radius: 100px;
  margin-top: calc(-1 * clamp(1.5rem, 3vw, 3rem));
  transition: border-color 0.3s ease, background 0.3s ease;
}

.hub-cc0:hover {
  border-color: rgba(52, 211, 153, 0.22);
  background: rgba(52, 211, 153, 0.07);
}

/* Coming soon card */
.app-card--coming-soon {
  cursor: default;
  opacity: 0.5;
  border-style: dashed;
}

.app-card--coming-soon .app-card-name {
  color: var(--text-secondary);
}

.app-card--coming-soon .app-card-desc {
  color: var(--text-tertiary);
}

/* ─── Footer ─── */

.hub-footer {
  text-align: center;
  padding-top: 1rem;
}

.hub-footer::before {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
  margin: 0 auto 1.5rem;
}

.hub-footer p {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  letter-spacing: 0.01em;
}

.hub-support-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.hub-support-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  min-height: 44px;
  min-width: 44px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-tertiary);
  border-radius: 100px;
  transition: color 0.25s, background 0.25s, border-color 0.25s;
  text-decoration: none;
}

.hub-support-btn svg {
  transition: opacity 0.25s;
}

.hub-support-btn:hover svg {
  opacity: 1;
}

.hub-coffee {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.12);
}
.hub-coffee:hover {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
}
.hub-coffee svg {
  color: #fbbf24;
  opacity: 0.7;
}

.hub-liberapay {
  background: rgba(246, 201, 21, 0.05);
  border: 1px solid rgba(246, 201, 21, 0.10);
}
.hub-liberapay:hover {
  color: #f6c915;
  background: rgba(246, 201, 21, 0.1);
  border-color: rgba(246, 201, 21, 0.25);
}
.hub-liberapay svg {
  color: #f6c915;
  opacity: 0.7;
}

/* ─── Reveal Animation ─── */

.reveal {
  opacity: 0;
  transform: translateY(24px);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Stagger children */
.reveal:nth-child(1) { transition-delay: 0s; }
.reveal:nth-child(2) { transition-delay: 0.12s; }
.reveal:nth-child(3) { transition-delay: 0.24s; }
.reveal:nth-child(4) { transition-delay: 0.36s; }

/* ─── Page Transition ─── */

.page-transition {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.page-transition.is-active {
  opacity: 1;
  pointer-events: all;
}

.page-transition-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  transition: opacity 0.3s ease;
}

.page-transition.is-loaded .page-transition-spinner {
  opacity: 0;
}

.page-transition-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.page-transition.is-loaded .page-transition-frame {
  opacity: 1;
}

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

/* ─── Reduced Motion ─── */

@media (prefers-reduced-motion: reduce) {
  .page-transition,
  .page-transition-frame,
  .page-transition-spinner {
    transition: none !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none !important;
  }

  .app-card {
    transition: none !important;
  }

  .app-card-glow {
    display: none;
  }

  .app-card::after {
    display: none;
  }

  .app-card-icon {
    transition: none !important;
  }
}

/* ─── Tablet ─── */

@media (max-width: 768px) {
  .app-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── Mobile ─── */

@media (max-width: 480px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .app-card {
    padding: 1.25rem;
  }

  .app-card-icon--placeholder svg {
    width: 28px;
    height: 28px;
  }
}
