/* brain.food — Native Apps Download Page
 *
 * Brand colors (from corporate design):
 *   Navy:   #0C283D
 *   Blue:   #226DF2
 *   Orange: #FF6F36
 *   Purple: #8958FE
 *   White:  #FFFFFF
 */

/* ------------------------------------------------------------------ */
/*  Fonts                                                              */
/* ------------------------------------------------------------------ */

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/Poppins-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/Poppins-SemiBold.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/Poppins-Bold.woff2") format("woff2");
}

/* ------------------------------------------------------------------ */
/*  Design tokens                                                      */
/* ------------------------------------------------------------------ */

:root {
  --bf-navy: #0C283D;
  --bf-navy-deep: #081C2C;
  --bf-blue: #226DF2;
  --bf-orange: #FF6F36;
  --bf-purple: #8958FE;
  --bf-white: #FFFFFF;
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ------------------------------------------------------------------ */
/*  Reset & base                                                       */
/* ------------------------------------------------------------------ */

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bf-navy-deep);
  color: var(--bf-white);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.page {
  position: relative;
  min-height: 100dvh;
  padding-bottom: 80px;
}

/* ------------------------------------------------------------------ */
/*  Animated background                                                */
/* ------------------------------------------------------------------ */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 30% 90%, rgba(34, 109, 242, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 75% 10%, rgba(137, 88, 254, 0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 30% at 60% 60%, rgba(255, 111, 54, 0.06) 0%, transparent 60%);
  pointer-events: none;
  animation: bg-drift 12s ease-in-out infinite alternate;
}

@keyframes bg-drift {
  0% { opacity: 0.8; transform: scale(1) translate(0, 0); }
  100% { opacity: 1; transform: scale(1.05) translate(-2%, 3%); }
}

/* ------------------------------------------------------------------ */
/*  Card                                                               */
/* ------------------------------------------------------------------ */

.card {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  min-height: calc(100dvh - 80px);
  justify-content: center;
  padding: 2rem;
}

.card--multi {
  max-width: 640px;
}

/* ------------------------------------------------------------------ */
/*  Apps grid (side-by-side tiles)                                     */
/* ------------------------------------------------------------------ */

.apps-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 2.5rem;
  width: 100%;
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}

.app-tile .emblem {
  margin: 40px 0 28px;
}

.app-tile-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/*  App icon download link                                             */
/* ------------------------------------------------------------------ */

.app-icon-link {
  display: block;
  text-decoration: none;
  position: relative;
  cursor: pointer;
}

.emblem {
  width: 128px;
  height: 128px;
  background: #122f48;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.6s ease, box-shadow 0.6s ease;
  margin: 80px 0;
}

.app-icon-link:hover .emblem,
.app-tile:hover .emblem {
  transform: translateY(-6px);
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.2), 0 0 80px rgba(255, 255, 255, 0.08);
}

.app-icon-link:hover .emblem::after,
.app-tile:hover .emblem::after {
  opacity: 0.4;
  width: 120%;
}

.app-icon-link:active .emblem,
.app-tile:active .emblem {
  transform: translateY(0) scale(0.97);
}

/* Drop glow beneath the icon */
.emblem::after {
  content: "";
  position: absolute;
  bottom: -52px;
  left: 50%;
  transform: translateX(-50%);
  width: 165%;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  filter: blur(20px);
  opacity: 0.8;
  transition: opacity 0.6s ease, width 0.6s ease;
}

.emblem .emblem-logo {
  width: 68px;
  height: auto;
}

/* Tile states (downloads.js): loading until the API and the CDN answered,
   disabled when the released build has no APK or nothing is offered. */
.app-tile[aria-disabled="true"] {
  cursor: default;
  pointer-events: none;
}

.app-tile.is-loading .emblem {
  opacity: 0.55;
  animation: tile-pulse 1.4s ease-in-out infinite;
}

.app-tile.is-disabled {
  opacity: 0.35;
  filter: grayscale(1);
}

@keyframes tile-pulse {
  50% {
    opacity: 0.3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-tile.is-loading .emblem {
    animation: none;
  }
}

.app-tile-version {
  min-height: 1.2em;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.45);
  margin-top: -0.4rem;
}

.downloads-status[hidden] {
  display: none;
}

.downloads-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.retry-button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bf-white);
  background: var(--bf-blue);
  border: 0;
  border-radius: 100px;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
}

.retry-button:hover {
  filter: brightness(1.1);
}

/* ------------------------------------------------------------------ */
/*  Typography                                                         */
/* ------------------------------------------------------------------ */

.headline {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.headline .accent,
.app-tile-name .accent {
  background: linear-gradient(135deg, var(--bf-orange), #FF9A6C);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtext {
  font-size: 1rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.7;
  margin-top: -0.75rem;
}

/* ------------------------------------------------------------------ */
/*  Preview badge                                                      */
/* ------------------------------------------------------------------ */

.preview-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bf-orange);
  background: rgba(255, 111, 54, 0.1);
  border: 1px solid rgba(255, 111, 54, 0.25);
  border-radius: 100px;
  padding: 0.25rem 0.85rem;
  margin-top: -1rem;
}

/* ------------------------------------------------------------------ */
/*  Android badge                                                      */
/* ------------------------------------------------------------------ */

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.3);
  margin-top: -0.75rem;
  padding: 0.35rem 0.9rem;
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.platform-badge:hover {
  color: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.12);
}

.platform-badge svg {
  width: 14px;
  height: 14px;
  fill: rgba(255, 255, 255, 0.35);
}

.platform-badge .badge-download {
  width: 13px;
  height: 13px;
  fill: var(--bf-orange);
  opacity: 0.7;
}

/* ------------------------------------------------------------------ */
/*  Installation guide                                                 */
/* ------------------------------------------------------------------ */

.install-guide {
  width: 100%;
  max-width: 400px;
  margin-top: 0.5rem;
  margin-bottom: 80px;
}

.install-guide summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0.5rem 0;
  list-style: none;
  transition: color 0.15s ease;
}

.install-guide summary::-webkit-details-marker {
  display: none;
}

.install-guide summary::before {
  content: "?";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.install-guide summary:hover {
  color: rgba(255, 255, 255, 0.6);
}

.install-guide[open] summary {
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 1rem;
}

.install-steps {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 1.5rem;
}

.install-intro {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}

.install-steps ol {
  list-style: none;
  counter-reset: steps;
  padding: 0;
  margin: 0;
}

.install-steps li {
  counter-increment: steps;
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.55;
}

.install-steps li:last-child {
  margin-bottom: 0;
}

.install-steps li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(34, 109, 242, 0.15);
  color: var(--bf-blue);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-steps li strong {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.install-steps li em {
  color: rgba(255, 255, 255, 0.5);
  font-style: normal;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.install-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
}

/* ------------------------------------------------------------------ */
/*  Footer                                                             */
/* ------------------------------------------------------------------ */

.footer {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.2);
}

.footer a {
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer a:hover {
  color: rgba(255, 255, 255, 0.5);
}

/* ------------------------------------------------------------------ */
/*  Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 480px) {
  .headline {
    font-size: 1.4rem;
  }

  .subtext {
    font-size: 0.9rem;
  }

  .emblem {
    width: 100px;
    height: 100px;
    border-radius: 24px;
  }

  .emblem .emblem-logo {
    width: 54px;
  }

}
