/**
 * Styles for Brayden Gourlay's Web Landing.
 */

/* ---------- Global properties (theming) ---------- */
:root {
  /* Shared */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --gap: 14px;
  --shadow-glow: 0 0 12px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.18);
  --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Light theme (default) */
  --title-color: rgba(255, 255, 255, 0.95);
  --title-shadow: 0 0 6px rgba(0, 0, 0, 0.5), 0 0 4px rgba(0, 0, 0, 0.1);
  --title-outline: 1px #000000;
  --icon-bg: rgba(245, 245, 245, 0.88);
  --icon-color: #1a1a1a;
  --icon-border: rgba(255, 255, 255, 0.5);
  --icon-shadow: 0 0 10px rgba(0, 0, 0, 0.22);
  --label-color: #1a1a1a;
  --gear-bg: rgba(245, 245, 245, 0.92);
  --gear-color: #333;
  --gear-active-bg: #7c5cff;
  --gear-active-color: #fff;
  --modal-bg: rgba(255, 255, 255, 0.95);
  --modal-text: #1a1a1a;
  --modal-border: rgba(0, 0, 0, 0.08);
  --backdrop: rgba(0, 0, 0, 0.35);
  --option-bg: rgba(200, 200, 200, 0.92);
  --option-active: #7c5cff;
  --option-active-text: #fff;
  --dock-track-bg: rgba(200, 200, 200, 0.7);
}

/* Dark theme */
[data-theme="dark"] {
  --title-color: rgba(255, 255, 255, 0.95);
  --title-shadow: 0 0 6px rgba(0, 0, 0, 0.5), 0 0 4px rgba(0, 0, 0, 0.1);
  --title-outline: 1px #000000;
  --icon-bg: rgba(45, 45, 48, 0.88);
  --icon-color: #f0f0f0;
  --icon-border: rgba(255, 255, 255, 0.08);
  --icon-shadow: 0 0 12px rgba(0, 0, 0, 0.45);
  --label-color: #f0f0f0;
  --gear-bg: rgba(50, 50, 55, 0.9);
  --gear-color: #e8e8e8;
  --gear-active-bg: #8b6fff;
  --gear-active-color: #fff;
  --modal-bg: rgba(32, 32, 36, 0.96);
  --modal-text: #f0f0f0;
  --modal-border: rgba(255, 255, 255, 0.1);
  --backdrop: rgba(0, 0, 0, 0.55);
  --option-bg: rgba(95, 95, 100, 0.9);
  --option-active: #8b6fff;
  --option-active-text: #fff;
  --dock-track-bg: rgba(95, 95, 100, 0.7);
}

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--title-color);
  overflow: hidden; /* portal is full-viewport, no body scroll */
  background: #0a0a0a;
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* ---------- Background ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 1.4s ease-in-out;
  transform: scale(1.02); /* slight overscale to avoid edge gaps */
}

.bg-image.active {
  opacity: 1;
  z-index: 1;
}

/* ---------- Header ---------- */
.header {
  min-width: 280px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.2rem 1.2rem 0 1.2rem;
  pointer-events: none;
}

.header > * {
  pointer-events: auto;
}

.title {
  font-size: clamp(1.45rem, 3.8vw, 2rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--title-color);
  text-shadow: var(--title-shadow);
  -webkit-text-stroke: var(--title-outline);
  paint-order: stroke fill;
  transition: color var(--transition);
}

.subtitle {
  font-weight: 500;
  font-size: 0.82em;
  opacity: 0.95;
  padding-left: 2.4em;
}

/* ---------- Settings gear button ---------- */
.settings-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--gear-bg);
  color: var(--gear-color);
  display: grid;
  place-items: center;
  box-shadow: var(--icon-shadow);
  border: 1px solid var(--icon-border);
  transition: background var(--transition), color var(--transition), transform 0.2s ease, box-shadow var(--transition);
}

.settings-btn:hover {
  transform: scale(1.05);
}

.settings-btn[aria-expanded="true"] {
  background: var(--gear-active-bg);
  color: var(--gear-active-color);
  border-color: transparent;
}

.gear-icon {
  transition: transform 0.4s ease;
}

.settings-btn[aria-expanded="true"] .gear-icon {
  transform: rotate(60deg);
}

/* ---------- App dock ---------- */
.dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 0 0 1.2rem;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: hidden;
}

.dock-backdrop {
  max-width: calc(100vw - 1.2rem);  /* leaves side margin */
  width: max-content;               /* shrinks to content when possible */
  background: var(--dock-track-bg);
  border-radius: var(--radius);
}

.dock-track {
  display: flex;
  gap: var(--gap);
  padding: 0.6rem 1rem;
  overflow-x: auto;                 /* only the icons scroll */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.dock-track::-webkit-scrollbar {
  height: 5px;
}
.dock-track::-webkit-scrollbar-track {
  background: transparent;
}
.dock-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 10px;
}

/* Individual dock item */
.dock-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 76px;
  padding: 0.15rem;
  border-radius: var(--radius);
  transition: transform 0.2s ease;
}

.dock-item:hover {
  transform: translateY(-3px);
}

.dock-item:active {
  transform: translateY(0) scale(0.97);
}

.disabled {
  pointer-events: none;
  opacity: 0.7;
  transition: none;
}

.icon-wrap {
  cursor: pointer;
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--icon-bg);
  color: var(--icon-color);
  display: grid;
  place-items: center;
  box-shadow: var(--icon-shadow);
  border: 1px solid var(--icon-border);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.dock-item:hover .icon-wrap {
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.3);
}

.label {
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--label-color);
  text-align: center;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
  line-height: 1.2;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Theme modal (slides from right) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--backdrop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.theme-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(300px, 86vw);
  background: var(--modal-bg);
  color: var(--modal-text);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
  border-left: 1px solid var(--modal-border);
  display: flex;
  flex-direction: column;
  padding: 1.2rem 1.2rem 1.2rem;
  transform: translateX(105%);
  transition: transform var(--transition), background var(--transition);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.theme-modal.is-open {
  transform: translateX(0);
}

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

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--modal-text);
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
}

.close-btn:hover {
  opacity: 1;
  background: rgba(127, 127, 127, 0.15);
}

.theme-options {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--option-bg);
  color: var(--modal-text);
  text-align: left;
  transition: background var(--transition), color var(--transition), transform 0.15s;
  border: 2px solid transparent;
}

.theme-option:hover {
  transform: scale(1.05);
}

.theme-option[aria-pressed="true"],
.theme-option.is-active {
  background: var(--option-active);
  color: var(--option-active-text);
  border-color: transparent;
}

.theme-preview {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.light-preview {
  background: linear-gradient(135deg, #f8f8f8 50%, #e0e0e0 50%);
}

.dark-preview {
  background: linear-gradient(135deg, #2a2a2e 50%, #1a1a1e 50%);
  border-color: rgba(255, 255, 255, 0.2);
}

.theme-label {
  font-weight: 560;
  font-size: 0.98rem;
}

/* ---------- Responsiveness ---------- */
@media (max-width: 640px) {
  .dock-item {
    width: 70px;
  }

  .icon-wrap {
    width: 58px;
    height: 58px;
  }

  .icon-wrap svg {
    width: 28px;
    height: 28px;
  }

  .label {
    font-size: 0.68rem;
  }

  .settings-btn {
    width: 44px;
    height: 44px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Focus styles for accessibility ---------- */
.settings-btn:focus-visible,
.dock-item:focus-visible,
.theme-option:focus-visible,
.close-btn:focus-visible {
  outline: 2px solid #7c5cff;
  outline-offset: 3px;
}