/* Tilelily website (docs/epics/E18).
   Hand-written CSS, no build step, no framework, no external resources.
   Colors mirror the app's design tokens (App/Sources/DesignSystem/Theme.swift):
   accent #8042F0 in light, #A76CF8 in dark. Note that button ink flips with the
   scheme — white on the lighter dark-mode accent would fall below 4.5:1. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f5f3fa;
  --surface-2: #ece8f6;
  --text: #16121f;
  --muted: #5c5670;
  --accent: #8042f0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(128, 66, 240, 0.09);
  --border: rgba(22, 18, 31, 0.12);
  --shadow: 0 18px 48px rgba(30, 12, 70, 0.14);

  --wrap: 68rem;
  --radius: 18px;
  --step: clamp(1rem, 0.6rem + 1.6vw, 1.75rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0b14;
    --surface: #17131f;
    --surface-2: #201a2c;
    --text: #f4f2f8;
    --muted: #a8a2ba;
    --accent: #a76cf8;
    --accent-ink: #160f22;
    --accent-soft: rgba(167, 108, 248, 0.14);
    --border: rgba(244, 242, 248, 0.14);
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration: none;
}

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

h1,
h2,
h3 {
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem);
}

h2 {
  font-size: clamp(1.6rem, 1.25rem + 1.6vw, 2.3rem);
}

h3 {
  font-size: 1.125rem;
}

p {
  margin: 0 0 1rem;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 10px 0;
  z-index: 20;
}

.skip:focus {
  left: 0;
}

/* --- Language hint (the only piece of JavaScript on the page) ------------- */

.langbar {
  display: none;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.langbar[data-visible="true"] {
  display: block;
}

.langbar .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0;
}

.langbar p {
  margin: 0;
}

/* The accent violet on this slightly darker strip lands at 4.4:1 — just under
   the bar. Plain text colour with an underline reads as a link either way. */
.langbar a {
  color: var(--text);
}

.langbar button {
  margin-inline-start: auto;
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}

/* --- Header --------------------------------------------------------------- */

.masthead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
}

.masthead nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.9375rem;
}

.masthead nav a {
  color: var(--muted);
  text-decoration: none;
}

.masthead nav a:hover {
  color: var(--text);
}

@media (max-width: 40rem) {
  .masthead nav {
    display: none;
  }
}

/* --- Sections ------------------------------------------------------------- */

section {
  padding: clamp(3rem, 2rem + 5vw, 5.5rem) 0;
}

.section-lead {
  color: var(--muted);
  max-width: 46ch;
  margin-bottom: 2.5rem;
}

.hero {
  padding-top: clamp(1.5rem, 1rem + 2vw, 3rem);
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  align-items: center;
}

@media (min-width: 56rem) {
  .hero .wrap {
    grid-template-columns: 1.05fr 0.95fr;
  }
}

.hero p.lead {
  font-size: clamp(1.0625rem, 1rem + 0.5vw, 1.3rem);
  color: var(--muted);
  max-width: 40ch;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.badge-link {
  display: inline-block;
  line-height: 0;
  border-radius: 9px;
}

.badge-link img {
  width: 180px;
}

.badge-note {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.9rem;
}

.hero figure {
  margin: 0;
  justify-self: center;
}

.hero figure img {
  width: min(100%, 22rem);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

/* --- Steps ---------------------------------------------------------------- */

.steps {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 0.9rem;
}

.steps h3 {
  margin-bottom: 0.35rem;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* --- Feature lists -------------------------------------------------------- */

.features {
  display: grid;
  gap: 0.75rem 2.5rem;
  /* min() guards the track floor: inside the Plus card the container is
     narrower than 19rem on a phone, and a bare minmax(19rem, …) would push the
     text straight out through the card's right edge. */
  grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
}

/* The check mark is positioned rather than a flex sibling: as a flex item the
   bold lead-in became its own box and broke onto a line of its own instead of
   running on into the explanation. */
.features li {
  position: relative;
  padding: 0.35rem 0 0.35rem 1.6rem;
}

.features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.35rem;
  color: var(--accent);
  font-weight: 700;
}

.features strong {
  font-weight: 600;
}

.features span {
  color: var(--muted);
}

/* --- Plus ----------------------------------------------------------------- */

.plus-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: clamp(1.75rem, 1rem + 3vw, 3rem);
}

.price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}

.price strong {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem);
  letter-spacing: -0.03em;
}

.price span {
  color: var(--muted);
}

.plus-note {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 1.75rem 0 0;
}

/* --- Privacy -------------------------------------------------------------- */

.privacy {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.privacy .wrap {
  display: grid;
  gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  align-items: start;
}

.privacy h2 {
  grid-column: 1 / -1;
}

.privacy .note {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.privacy .note h3 {
  margin-bottom: 0.5rem;
}

.privacy .note p:last-child {
  margin-bottom: 0;
}

/* --- Screenshot gallery --------------------------------------------------- */

.gallery {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.5rem 0 1.75rem;
  margin: 0;
  list-style: none;
  scrollbar-width: thin;
  /* Deliberately not bled to the viewport edges: a `100vw` full-bleed is wider
     than the content box whenever a scrollbar takes space, and that shows up as
     the page scrolling sideways. */
}

.gallery li {
  flex: none;
  scroll-snap-align: center;
  width: min(62vw, 15rem);
}

.gallery img {
  width: 100%;
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: block;
}

.gallery figcaption {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.6rem;
}

.gallery figure {
  margin: 0;
}

/* --- FAQ ------------------------------------------------------------------ */

.faq {
  max-width: 46rem;
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.9rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

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

.faq summary::after {
  content: "+";
  color: var(--accent);
  font-weight: 700;
  flex: none;
}

.faq details[open] summary::after {
  content: "–";
}

.faq details p {
  color: var(--muted);
  margin: 0 0 1rem;
  max-width: 60ch;
}

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

footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}

footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

footer p {
  margin: 0;
}

.tagline {
  color: var(--text);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
