/*
 * The one style sheet of EZ Apps. No external assets, no web fonts: the system font stack.
 * A neutral company look, light and dark. Each app keeps its own colours through --accent, --on-accent and
 * --icon-bg; scripts/build.mjs appends one rule per app (.app-<id>) to the end of this file.
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --line: #d5d9e1;
  --text: #14181f;
  --dim: #4a5262;
  --link: #1a4fa0;
  --brand: #1f3a5f;
  --focus: #1a4fa0;
  --live: #1d6b34;
  --live-bg: #e3f3e7;
  --test: #7a4b00;
  --test-bg: #fdf0d5;
  --soon: #3c4555;
  --soon-bg: #e6e9ef;
  --shadow: 0 1px 2px rgb(20 24 31 / 0.06), 0 4px 16px rgb(20 24 31 / 0.06);
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r-s: 8px;
  --r-m: 14px;
  --r-l: 20px;
  --accent: var(--brand);
  --on-accent: #ffffff;
  --icon-bg: var(--surface-2);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --surface: #1a1d24;
    --surface-2: #232733;
    --line: #333949;
    --text: #eceef3;
    --dim: #a9b0be;
    --link: #8ab4ff;
    --focus: #8ab4ff;
    --live: #8fdca2;
    --live-bg: #183324;
    --test: #f3c46a;
    --test-bg: #3a2c10;
    --soon: #c3c9d4;
    --soon-bg: #2a2f3b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--sans);
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.8rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap {
  width: min(100% - 2rem, 1200px);
  margin-inline: auto;
}

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

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5em 1em;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  border-radius: var(--r-s);
}

.skip:focus {
  top: 0.5rem;
}

/* ------------------------------------------------------------------------------------------------ top bar */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
}

.brand-by {
  color: var(--dim);
  font-size: 0.85rem;
}

.lang {
  display: inline-block;
  padding: 0.45em 0.9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none;
}

.lang:hover {
  background: var(--surface-2);
}

/* ------------------------------------------------------------------------------------------------ home */

.hero {
  padding: clamp(2rem, 1rem + 4vw, 4rem) 0 1.5rem;
}

.hero h1 {
  margin-bottom: 0.4em;
}

.hero .by {
  display: block;
  margin-top: 0.25em;
  color: var(--dim);
  font-size: 0.5em;
  font-weight: 500;
  letter-spacing: 0;
}

.intro {
  max-width: 62ch;
  color: var(--dim);
  font-size: 1.125rem;
}

.list {
  padding: 1rem 0 3.5rem;
}

.list h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25em 0.75em;
}

.count {
  color: var(--dim);
  font-size: 0.95rem;
  font-weight: 400;
}

.empty {
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: var(--r-m);
  color: var(--dim);
  text-align: center;
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 1.25rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgb(20 24 31 / 0.08), 0 10px 28px rgb(20 24 31 / 0.1);
}

.card-top {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.icon {
  flex: none;
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--icon-bg);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.06);
}

.icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-head h3 {
  margin: 0 0 0.15em;
}

.card-title {
  color: var(--text);
  text-decoration: none;
}

.card-title:hover {
  text-decoration: underline;
}

.card-meta {
  margin: 0;
  color: var(--dim);
  font-size: 0.92rem;
}

.card-state {
  margin: 0 0 0.6rem;
}

.card-pitch {
  flex: 1;
}

.card-more {
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.card-links {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  display: inline-block;
  padding: 0.4em 0.9em;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
}

.pill:hover {
  filter: brightness(1.08);
}

.pill-plain {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.pill-off {
  background: transparent;
  color: var(--dim);
  border: 1px dashed var(--line);
  font-weight: 500;
}

.pill-plain:hover {
  background: var(--surface-2);
  filter: none;
}

/* ------------------------------------------------------------------------------------------------ state badges */

.state {
  display: inline-block;
  padding: 0.15em 0.65em;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
}

.state-live {
  color: var(--live);
  background: var(--live-bg);
}

.state-in-test {
  color: var(--test);
  background: var(--test-bg);
}

.state-coming-soon {
  color: var(--soon);
  background: var(--soon-bg);
}

/* ------------------------------------------------------------------------------------------------ app page */

.app-main {
  padding: 1.5rem 0 3.5rem;
}

.back {
  display: inline-block;
  color: var(--dim);
  font-size: 0.95rem;
}

.back::before {
  content: '← ';
}

.app-head {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin: 1rem 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 4px solid var(--accent);
}

.app-head .icon {
  width: clamp(88px, 18vw, 128px);
  height: clamp(88px, 18vw, 128px);
  border-radius: 24%;
}

.app-head h1 {
  margin-bottom: 0.2em;
}

.app-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3em 0.6em;
  color: var(--dim);
  margin-bottom: 0.5em;
}

.app-pitch {
  font-size: 1.2rem;
  margin: 0;
  max-width: 50ch;
}

.app-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 2rem 3rem;
  align-items: start;
}

.app-text {
  max-width: 65ch;
}

.app-side {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

.app-side h2 {
  font-size: 1.1rem;
}

.badges {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.badge {
  display: flex;
  flex-direction: column;
  padding: 0.55em 1em;
  border-radius: var(--r-s);
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  text-decoration: none;
  line-height: 1.25;
}

.badge:hover {
  filter: brightness(1.08);
}

.badge-line {
  font-size: 0.8rem;
}

.badge-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.badge-off {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.4em;
  background: var(--surface-2);
  color: var(--dim);
  border: 1px dashed var(--line);
}

.badge-off .badge-line {
  font-size: 0.95rem;
}

.no-store {
  color: var(--dim);
}

.btn {
  display: inline-block;
  padding: 0.6em 1.1em;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--dim);
}

.app-site {
  margin-bottom: 1.25rem;
}

.facts-title {
  margin-top: 0.5rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.45rem 1rem;
  margin: 0;
}

.facts dt {
  color: var(--dim);
}

.facts dd {
  margin: 0;
}

.shots-band {
  margin-top: 2.5rem;
}

.shots {
  list-style: none;
  margin: 0;
  padding: 0 0 0.75rem;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(78vw, 320px);
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
}

.shots li {
  scroll-snap-align: start;
}

.shots img {
  width: 100%;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

/* ------------------------------------------------------------------------------------------------ legal and 404 */

.doc-main {
  padding: 1.5rem 0 3.5rem;
}

.doc h1 {
  margin-top: 0.75rem;
}

.doc h2 {
  margin-top: 1.75em;
}

.doc-date {
  color: var(--dim);
  font-size: 0.95rem;
}

.doc-intro {
  font-size: 1.125rem;
}

.doc .facts {
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

.doc ul {
  padding-inline-start: 1.3em;
}

.lost > div + div {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------------------------------------ footer */

.foot {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 2rem 0 1.5rem;
  color: var(--dim);
  font-size: 0.95rem;
}

.foot-name {
  color: var(--text);
  font-weight: 700;
  margin-bottom: 0.2em;
}

.foot-name span {
  color: var(--dim);
  font-weight: 400;
}

.foot-links {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.foot-small {
  font-size: 0.85rem;
  margin: 0;
}

/* ------------------------------------------------------------------------------------------------ small screens */

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

  .app-head {
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .doc .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.1rem;
  }

  .doc .facts dd + dt {
    margin-top: 0.6rem;
  }
}

@media (max-width: 420px) {
  .brand-by {
    font-size: 0.8rem;
  }

  .icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }

  .card {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }

  .card:hover {
    transform: none;
  }
}

/* App colours, written by scripts/build.mjs from apps/<id>/app.json. */
.app-backyard-bloom{--accent:#2f5a24;--on-accent:#ffffff;--icon-bg:#fbf5e3}
.app-lunar-return{--accent:#c74f00;--on-accent:#ffffff;--icon-bg:#05060f}
.app-recreio{--accent:#cb4900;--on-accent:#ffffff;--icon-bg:#e9ddff}
.app-verissimum{--accent:#372a6b;--on-accent:#ffffff;--icon-bg:#171233}
