/*
  Highsoft Labs – minimal, role-based color system
  Palette: based on Open Color (https://yeun.github.io/open-color/), adjusted for contrast
*/

:root {
  --radius: 12px;
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

  /* Light theme (default) */
  --bg: #ffffff;
  --surface: #f8f9fa; /* oc-gray-1 */
  --muted: #495057; /* oc-gray-7 */
  --text: #212529; /* oc-gray-9 */
  --border: #dee2e6; /* oc-gray-3 */
  --card: #ffffff;

  --primary: #1971c2; /* oc-blue-8 */
  --primary-contrast: #ffffff;
  --accent: #0ca678; /* oc-teal-7 */
  --accent-contrast: #ffffff;

  --warning: #f08c00; /* oc-orange-7 */
  --danger: #e03131; /* oc-red-8 */

  /* Bar backgrounds (light) - subtle warm/cool harmony */
  --bar-odd: #faf8f5; /* warm off-white with hint of cream */
  --bar-even: #f5f9fa; /* cool off-white with hint of blue */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1113; /* near oc-gray-9/10 */
    --surface: #15181b;
    --muted: #c1c2c5; /* oc-gray-5/6 */
    --text: #e9ecef; /* oc-gray-2 */
    --border: #2b3035; /* oc-gray-8 */
    --card: #121417;

    --primary: #4dabf7; /* oc-blue-4 */
    --primary-contrast: #081018;
    --accent: #63e6be; /* oc-teal-3 */
    --accent-contrast: #081410;

    --warning: #ffd43b; /* oc-yellow-4 */
    --danger: #ff6b6b; /* oc-red-4 */

    /* Bar backgrounds (dark) - subtle warm/cool harmony */
    --bar-odd: #17161a; /* warm dark grey with violet hint */
    --bar-even: #161a1a; /* cool dark grey with teal hint */
  }
}

/* Explicit theme override via data-theme */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f8f9fa;
  --muted: #495057;
  --text: #212529;
  --border: #dee2e6;
  --card: #ffffff;
  --primary: #1971c2;
  --primary-contrast: #ffffff;
  --accent: #0ca678;
  --accent-contrast: #ffffff;
  --warning: #f08c00;
  --danger: #e03131;
  --bar-odd: #faf8f5;
  --bar-even: #f5f9fa;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1113;
  --surface: #15181b;
  --muted: #c1c2c5;
  --text: #e9ecef;
  --border: #2b3035;
  --card: #121417;
  --primary: #4dabf7;
  --primary-contrast: #081018;
  --accent: #63e6be;
  --accent-contrast: #081410;
  --warning: #ffd43b;
  --danger: #ff6b6b;
  --bar-odd: #17161a;
  --bar-even: #161a1a;
}

/* Base reset */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  background: #e9ecef; /* oc-gray-2 - noticeably darker than content */
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  min-height: 100vh;
}
:root[data-theme="dark"] body {
  background: #0a0b0d; /* darker than content area */
}

/* Main content wrapper */
main {
  background: var(--bg);
  min-height: 100vh;
}

/* Centered content box for catalog and about sections */
.content-box {
  max-width: 1400px;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.12);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
:root[data-theme="dark"] .content-box {
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.narrow {
  width: min(800px, calc(100% - 2rem));
}

.site-header {
  display: none;
}
.header-inner {
  display: none;
}
.brand .logo {
  display: none;
}

.hero {
  padding: 5rem 0 4rem;
  background-image: url('/hero.png');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.05) 100%);
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  width: 120px;
  height: 120px;
  background-image: url('/alt_logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.7;
  z-index: 1;
}
.hero .container {
  position: relative;
  z-index: 1;
}
@media (max-width: 760px) {
  .hero::after {
    width: 80px;
    height: 80px;
    bottom: 1rem;
    right: 1rem;
  }
}
.title {
  font-size: clamp(3rem, 6vw, 4.5rem);
  line-height: 1.05;
  margin: 0 0 0.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
.subtitle {
  margin: 0 0 1.5rem 0;
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.45rem;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.015em;
  max-width: 46rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.hero-body {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.2rem;
  line-height: 1.65;
  font-weight: 450;
  max-width: 40rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
  font-style: italic;
  letter-spacing: -0.005em;
  border-left: 3px solid rgba(255, 255, 255, 0.4);
  padding-left: 1.25rem;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 2rem 0 1rem;
}
.section-header h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}
.catalog .section-header {
  display: none;
}

/* App list renders as stacked rows */
#appsGrid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app-bar {
  /* Full-width within the centered main container */
  width: 100%;
  background: var(--bar-odd);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s ease;
}
.app-bar:nth-child(even) {
  background: var(--bar-even);
}
.app-bar:hover {
  background: color-mix(in oklab, var(--bar-odd) 94%, var(--primary) 6%);
}
.app-bar:nth-child(even):hover {
  background: color-mix(in oklab, var(--bar-even) 94%, var(--primary) 6%);
}
.bar-inner {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
  padding: 2.5rem 0;
  display: grid;
  grid-template-columns: minmax(280px, 480px) 1fr;
  grid-auto-flow: column;
  gap: 1rem;
}
/* Alternate order on even rows using order property to avoid grid wrap */
.app-bar:nth-child(even) .bar-inner .app-hero { order: 2; }
.app-bar:nth-child(even) .bar-inner .app-content { order: 1; }
@media (max-width: 860px) {
  .bar-inner {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
  }
}

.app-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: clip;
  aspect-ratio: 16/9;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  cursor: zoom-in;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.app-hero:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.app-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.app-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.app-tagline {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.45;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.015em;
}
.app-desc {
  color: color-mix(in oklab, var(--text) 85%, var(--muted) 15%);
  font-size: 1.05rem;
  line-height: 1.65;
  font-weight: 450;
}
.app-desc strong {
  color: var(--text);
  font-weight: 650;
}
.app-desc em {
  color: var(--text);
  font-style: italic;
  font-weight: 500;
}
.app-desc ul, .app-desc ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}
.app-desc li {
  margin: 0.25rem 0;
  color: color-mix(in oklab, var(--text) 85%, var(--muted) 15%);
}
.app-desc p {
  margin: 0.5rem 0;
}
.app-desc p:first-child {
  margin-top: 0;
}
.app-desc p:last-child {
  margin-bottom: 0;
}
.app-desc a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.app-desc a:hover {
  color: color-mix(in oklab, var(--primary), var(--text) 20%);
}
.app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.media-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-top: 0.25rem;
}
.media-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: clip;
  background: var(--surface);
}
.media-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16/9;
}
.media-item iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border: 0;
  background: #000;
}

.card-tags,
.app-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
}
.tag {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--primary) 8%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--primary) 15%, var(--border));
  color: color-mix(in oklab, var(--primary) 85%, var(--text) 15%);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.card-actions,
.app-actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.coming-soon {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1;
  color: var(--warning);
  background: color-mix(in oklab, var(--warning) 10%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--warning) 25%, var(--border));
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--primary);
  color: var(--primary-contrast);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  letter-spacing: -0.01em;
}
.btn:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface);
}

.btn-link {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-link:hover {
  background: color-mix(in oklab, var(--surface), var(--primary) 6%);
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
.btn-accent:hover {
  filter: brightness(1.1);
}

.btn-waitlist {
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in oklab, var(--primary), var(--accent) 40%) 100%);
  color: var(--primary-contrast);
  border-color: transparent;
  position: relative;
  overflow: hidden;
}
.btn-waitlist::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.btn-waitlist:hover::before {
  opacity: 1;
}
.btn-waitlist:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px color-mix(in oklab, var(--primary) 40%, transparent);
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  padding: 1rem 0;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  color: var(--danger);
  background: color-mix(in oklab, var(--danger) 10%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--danger) 25%, var(--border));
  padding: 0.75rem;
  border-radius: 10px;
}
.empty-state {
  color: var(--muted);
  padding: 1rem 0;
}

.about {
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--surface) 70%, var(--bg)),
    var(--bg)
  );
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.about::before {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 200px;
  height: 200px;
  background-image: url('/team.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom left;
  opacity: 0.3;
  pointer-events: none;
}
:root[data-theme="dark"] .about::before {
  filter: invert(1) opacity(0.15);
  opacity: 1;
}
.about h2 {
  margin: 0 0 1rem;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.about .lead {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}
.about .lead strong {
  color: var(--text);
  font-weight: 600;
}
.about .lead em {
  color: color-mix(in oklab, var(--text) 80%, var(--accent) 20%);
}

/* About section illustration (left side) */
.about-img {
  float: left;
  width: min(240px, 40%);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 0 1rem 0.75rem 0;
}
@media (max-width: 760px) {
  .about-img {
    float: none;
    width: 100%;
    display: block;
    margin: 0 0 1rem 0;
  }
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  color: var(--muted);
}
.site-footer p {
  margin: 0;
  text-align: center;
}

/* Modal */
.modal {
  border: none;
  padding: 0;
  border-radius: var(--radius);
  background: transparent;
}
.modal::backdrop {
  backdrop-filter: blur(3px);
  background: color-mix(in oklab, var(--bg) 20%, black 35%);
}
.modal-box {
  width: min(560px, calc(100% - 2rem));
  margin: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}
.modal-box { color: var(--text); }
.modal-box h3 { color: var(--text); }
.modal-body {
  padding: 1rem;
}
.modal-footer {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
/* Image modal overrides: size to content, cap to viewport */
.image-modal .modal-box {
  width: auto;
  max-width: 96vw;
  display: inline-block;
  position: relative;
  padding: 0.5rem;
}
.image-modal #imagePreview {
  display: block;
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 8px;
}
.image-modal .image-close {
  position: fixed;
  top: 12px;
  right: 12px;
  background: #333;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.form-field label {
  font-weight: 600;
  font-size: 0.9rem;
}
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.form-error {
  color: var(--danger);
  font-weight: 600;
}
.form-success {
  color: var(--accent);
  font-weight: 600;
}

/* Inline waitlist form inside app rows */
.inline-waitlist {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 0.75rem;
  margin-top: 0.25rem;
}
.inline-waitlist .actions { display:flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.25rem; }

/* Header theme toggle icon style */
#themeToggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 100;
  transition: all 0.2s ease;
}
#themeToggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
#themeToggle::before {
  content: "☀️";
  font-size: 24px;
  transition: transform 0.3s ease;
}
:root[data-theme="dark"] #themeToggle::before {
  content: "🌙";
}
#themeLabel {
  display: none;
}

/* Multiselect (checkbox group) */
.multiselect-group {
  border: none;
  padding: 0;
  margin: 0;
}
.multiselect-group .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-weight: normal;
}
.multiselect-group .checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Utilities */
[hidden] {
  display: none !important;
}
