/**
 * CONSTELLATE • Libraries Against Loneliness
 * Main Design System & Core Styles
 * Aligned with "Colour palette.md" and "styleguide.pdf"
 * RMIT Swanston Library Level 6 Wellbeing Installation
 */

@import url('https://fonts.googleapis.com/css2?family=Afacad:ital,wght@0,400..700;1,400..700&family=Archivo+Black&family=Figtree:ital,wght@0,300..900;1,300..900&display=swap');

:root {
  /* =========================================================================
     COLOUR PALETTE (from Colour palette.md & styleguide.pdf)
     Constellate's palette starts in deep teal, the colour of a quiet booth
     after dark. Three core colours carry the brand, and three light accents
     work like stars against them.
     ========================================================================= */

  /* Variant 1 (Primary Duo) */
  --core-1: #102D37;           /* R: 0.063, G: 0.177, B: 0.216 (Deep Teal) */
  --accent-1: #ECF8C0;         /* R: 0.925, G: 0.973, B: 0.753 (Pale Starlight Lime) */

  /* Variant 2 (Secondary Duo) */
  --core-2: #528B90;           /* R: 0.322, G: 0.545, B: 0.565 (Muted Slate Teal) */
  --accent-2: #D2F7F9;         /* R: 0.824, G: 0.969, B: 0.977 (Ice Starlight Cyan) */

  /* Variant 3 (Tertiary Duo) */
  --core-3: #255953;           /* R: 0.145, G: 0.349, B: 0.325 (Eucalyptus Deep Teal) */
  --accent-3: #8C9E50;         /* R: 0.549, G: 0.620, B: 0.314 (Warm Olive Chartreuse) */

  /* Surface & Background System */
  --bg-deep: #08171D;          /* Deepest quiet booth canvas */
  --bg-surface: #0E242C;       /* Slightly lifted container */
  --bg-card: rgba(16, 45, 55, 0.78);
  --bg-card-hover: rgba(22, 60, 73, 0.88);
  --border-subtle: rgba(236, 248, 192, 0.12);
  --border-focus: rgba(236, 248, 192, 0.65);

  /* Typography Colors */
  --text-primary: #F4FAF5;     /* Crisp soft white */
  --text-secondary: #C3D5CE;   /* Muted sea mist */
  --text-muted: #7E9E99;       /* Quiet sage slate */
  --text-dim: #4B6864;         /* Dim teal slate */

  /* Semantic Theme Accents (aliases) */
  --accent-lime: var(--accent-1);
  --accent-cyan: var(--accent-2);
  --accent-olive: var(--accent-3);
  --core-teal: var(--core-1);
  --core-sage: var(--core-2);
  --core-eucalyptus: var(--core-3);

  /* Typography (from styleguide.pdf Stream 1: Archivo Black, Afacad, Figtree) */
  --font-brand: 'Archivo Black', 'Figtree', sans-serif;
  --font-heading: 'Afacad', 'Figtree', -apple-system, sans-serif;
  --font-body: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Radius & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.55), 0 0 1px 1px rgba(236, 248, 192, 0.1);
  --shadow-glow: 0 0 25px rgba(236, 248, 192, 0.3);
  --shadow-cyan-glow: 0 0 25px rgba(210, 247, 249, 0.25);

  /* Touch kiosk dimensions */
  --kiosk-max-width: 880px;
  --touch-min-target: 48px;
}

/* Base Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Background Constellation Canvas */
#constellation-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}

/* Ambient Radial Vignette tuned to Deep Teal & Pale Lime Glow */
.ambient-glow-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle at 50% 15%, rgba(236, 248, 192, 0.07) 0%, transparent 60%),
              radial-gradient(circle at 80% 80%, rgba(82, 139, 144, 0.12) 0%, transparent 50%),
              radial-gradient(circle at 10% 75%, rgba(37, 89, 83, 0.14) 0%, transparent 50%);
}

/* App Container Layout */
#app-viewport {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: var(--kiosk-max-width);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 2.5rem 1.5rem;
}

/* Top App Header / Kiosk Navigation Bar */
.kiosk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 1.25rem 0;
  border-bottom: 1px solid rgba(236, 248, 192, 0.1);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 0 10px rgba(236, 248, 192, 0.5));
  transition: transform 0.3s ease;
}

.brand-icon:hover {
  transform: scale(1.06) rotate(6deg);
}

.brand-text h1.brand-wordmark {
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--accent-lime);
  text-shadow: 0 0 12px rgba(236, 248, 192, 0.3);
  line-height: 1.1;
}

.brand-tagline {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.kiosk-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min-target);
  height: var(--touch-min-target);
  background: rgba(236, 248, 192, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover, .icon-button:focus-visible {
  background: rgba(236, 248, 192, 0.14);
  color: var(--accent-lime);
  border-color: rgba(236, 248, 192, 0.3);
  transform: translateY(-1px);
}

/* Screen Transitions */
.kiosk-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem 0;
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: screenFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes screenFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Glassmorphism Cards */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

/* Typography styles */
.screen-title {
  font-family: var(--font-heading);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
  color: #FFFFFF;
}

.screen-subtitle {
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

/* Buttons (Designed according to styleguide.pdf: core for backgrounds, accent for buttons/spark!) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: var(--touch-min-target);
  padding: 0.85rem 1.75rem;
  font-family: var(--font-body);
  font-size: 1.02rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ECF8C0 0%, #D2F7F9 100%);
  color: var(--core-1); /* Deep Teal text on bright lime accent */
  box-shadow: 0 4px 20px rgba(236, 248, 192, 0.32);
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: #FFFFFF;
  color: #08171D;
  box-shadow: 0 6px 26px rgba(236, 248, 192, 0.5);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(236, 248, 192, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover, .btn-secondary:focus-visible {
  background: rgba(236, 248, 192, 0.12);
  color: var(--accent-lime);
  border-color: rgba(236, 248, 192, 0.28);
  transform: translateY(-1px);
}

.btn-large {
  min-height: 58px;
  padding: 1.1rem 2.4rem;
  font-size: 1.15rem;
}

.btn-pulse {
  animation: pulseGlow 2.8s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 15px rgba(236, 248, 192, 0.3), 0 0 35px rgba(210, 247, 249, 0.2);
  }
  50% {
    box-shadow: 0 0 28px rgba(236, 248, 192, 0.55), 0 0 50px rgba(210, 247, 249, 0.35);
  }
}

/* Modals & Dialogs (Idle & Dev Drawer) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: rgba(8, 23, 29, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-dialog {
  width: 100%;
  max-width: 580px;
  background: #0E242C;
  border: 1px solid rgba(236, 248, 192, 0.18);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-lime);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--accent-lime);
}

/* Footer / Privacy note */
.kiosk-footer {
  text-align: center;
  padding-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(236, 248, 192, 0.04);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(236, 248, 192, 0.08);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  #app-viewport {
    padding: 1rem 1rem 1.5rem 1rem;
  }
  .glass-panel {
    padding: 1.35rem;
  }
  .screen-title {
    font-size: 1.7rem;
  }
  .screen-subtitle {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
  }
  .btn-large {
    min-height: 52px;
    padding: 0.95rem 1.8rem;
    font-size: 1.05rem;
  }
}
