/* Guide pages (/guides/...) — Flipage brand theme (palette from flipage.css).
   Light and dark themes: the system setting by default, or the header switch, which stores
   "light"/"dark" in localStorage and sets <html data-theme>. */

/* Urbanist is bundled in assets/fonts, as on the landing page. */
@font-face {
  font-family: "Urbanist";
  src: url("../fonts/urbanist_regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Urbanist";
  src: url("../fonts/urbanist_semibold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Urbanist";
  src: url("../fonts/urbanist_bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* Dark theme (default, matches the rest of the site). */
:root {
  color-scheme: dark;
  --purple: #7c3aed;
  --purple-hover: #8b5cf6;
  --lavender: #f3e8ff;
  --ink: #1c1430;
  --bg: #14161c;
  --surface: #ffffff08;
  --line: #ffffff14;
  --strong: #ffffff;
  --text: #ffffffd6;
  --muted: #ffffff8c;
  --accent: #d8b4fe;
  --note-bg: #7c3aed1f;
  --cta-bg: linear-gradient(135deg, #7c3aed33, #7c3aed0d);
  --cta-line: #7c3aed55;
  --secondary-line: #ffffff40;
  --secondary-hover: #ffffff10;
  --shadow: 0 10px 24px #00000040;
  --video-shadow: 0 24px 50px #0000008c, 0 8px 18px #00000059;
}

/* Light theme: the system preference unless the visitor chose dark, or an explicit choice. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #fbf9ff;
    --surface: #ffffff;
    --line: #1c14301a;
    --strong: #1c1430;
    --text: #1c1430d9;
    --muted: #1c143099;
    --accent: #7c3aed;
    --note-bg: #7c3aed12;
    --cta-bg: linear-gradient(135deg, #f3e8ff, #ffffff);
    --cta-line: #7c3aed40;
    --secondary-line: #1c143033;
    --secondary-hover: #1c14300d;
    --shadow: 0 10px 24px #3c147826;
    --video-shadow: 0 24px 50px #3c147859, 0 8px 18px #0000002e;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbf9ff;
  --surface: #ffffff;
  --line: #1c14301a;
  --strong: #1c1430;
  --text: #1c1430d9;
  --muted: #1c143099;
  --accent: #7c3aed;
  --note-bg: #7c3aed12;
  --cta-bg: linear-gradient(135deg, #f3e8ff, #ffffff);
  --cta-line: #7c3aed40;
  --secondary-line: #1c143033;
  --secondary-hover: #1c14300d;
  --shadow: 0 10px 24px #3c147826;
  --video-shadow: 0 24px 50px #3c147859, 0 8px 18px #0000002e;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: "Urbanist", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

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

/* Header: brand, language switch, theme switch. */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 72px;
  padding: 0 max(20px, calc((100% - 760px) / 2));
  border-bottom: 1px solid var(--line);
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--strong);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}

/* The white mark on dark, the purple mark on light. */
.brand .mark-light {
  display: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .brand .mark-dark {
    display: none;
  }

  :root:not([data-theme="dark"]) .brand .mark-light {
    display: inline;
  }
}

:root[data-theme="light"] .brand .mark-dark {
  display: none;
}

:root[data-theme="light"] .brand .mark-light {
  display: inline;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lang-switch {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.lang-switch:hover {
  color: var(--strong);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--strong);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--secondary-line);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Show the icon of the theme you'd switch to: a moon in light, a sun in dark. */
.theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .icon-sun {
    display: none;
  }

  :root:not([data-theme="dark"]) .theme-toggle .icon-moon {
    display: block;
  }
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Article. */
.guide {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 32px 20px 24px;
}

.guide .breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
}

.guide .breadcrumbs li {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: "›";
  margin-right: 6px;
}

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

.guide h1 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--strong);
}

.guide h1 em,
.guide h2 em {
  font-style: normal;
  color: var(--accent);
}

.guide .lede {
  margin: 0 0 28px;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--strong);
}

/* Date line under the title; keep the date in step with dateModified and the sitemap. */
.updated {
  margin: -4px 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.guide section {
  margin: 0 0 48px;
  scroll-margin-top: 24px;
}

.guide h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  line-height: 1.2;
  color: var(--strong);
}

.guide h3 {
  margin: 24px 0 8px;
  font-size: 1.15rem;
  color: var(--strong);
}

.guide p,
.guide li {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
}

.guide ul,
.guide ol {
  padding-left: 22px;
}

.guide li + li {
  margin-top: 6px;
}

.guide strong {
  color: var(--strong);
}

/* Quick answer and table of contents: bordered boxes. */
.summary,
.toc {
  margin: 0 0 40px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.summary {
  border-left: 4px solid var(--purple);
}

.guide .summary h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.toc p {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--strong);
}

.guide .summary ol,
.guide .toc ul {
  margin: 0;
  padding-left: 20px;
}

.toc ul {
  line-height: 1.8;
}

/* Hero: the colour frame and the same frame as a Pencil Sketch page. */
.hero-figure {
  margin: 0 0 32px;
}

.hero-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.hero-pair img {
  display: block;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.hero-pair .arrow {
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 700;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* App steps: text beside a phone screenshot. */
.guide .steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.guide .steps > li {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 24px;
  align-items: center;
  margin: 0 0 20px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  counter-increment: step;
}

.steps h3 {
  margin: 0 0 6px;
}

.steps h3::before {
  content: counter(step) ". ";
  color: var(--accent);
}

.steps p {
  margin: 0;
}

.steps img {
  width: 150px;
  border-radius: 16px;
  border: 1px solid var(--line);
}

@media (max-width: 560px) {
  .guide .steps > li {
    grid-template-columns: 1fr 96px;
    gap: 14px;
    padding: 16px;
  }

  .steps img {
    width: 96px;
    border-radius: 12px;
  }
}

/* Hand-flip video: vertical, so it stays narrow and centred on wide screens. */
.video-figure {
  width: min(100%, 360px);
  margin: 24px auto 8px;
}

.video-figure video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  box-shadow: var(--video-shadow);
  background: #000;
  object-fit: cover;
}

.video-figure figcaption {
  text-align: center;
}

.wide-figure {
  margin: 24px 0 0;
}

.wide-figure img {
  display: block;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.note {
  margin: 20px 0 0;
  padding: 14px 18px;
  border-left: 3px solid var(--purple);
  background: var(--note-bg);
  border-radius: 0 12px 12px 0;
}

.note p {
  margin: 0;
}

/* Buttons: the Play call to action and template downloads. */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  background: var(--purple);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  transition: background 0.15s ease;
}

.button:hover {
  background: var(--purple-hover);
}

.button.secondary {
  background: transparent;
  border: 1px solid var(--secondary-line);
  color: var(--strong);
}

.button.secondary:hover {
  background: var(--secondary-hover);
}

/* Google's official Play badge, unmodified (assets/guides/google-play-badge-{en,es}.png). The
   PNG has its own clear space and border; keep it at least 40 px tall. */
.play-badge {
  display: inline-flex;
  align-items: center;
}

/* Google's PNGs have different built-in margins (visible badge: 67% of the EN image height,
   77% of the ES one), so each is sized to show a 48 px badge, level with .button. */
.play-badge img {
  display: block;
  width: auto;
  height: 62px;
}

.play-badge img[src$="-en.png"] {
  height: 72px;
}

/* Left-aligned rows: offset the EN image's empty margin so the badge lines up with the text. */
section:not(.cta) > .button-row > .play-badge:first-child img[src$="-en.png"] {
  margin-left: -11px;
}

.button-row {
  align-items: center;
}

/* The download card stays lavender in both themes, like the brand's paper. */
.download-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  align-items: center;
  padding: 22px;
  background: var(--lavender);
  border-radius: 22px;
}

.download-card img {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.guide .download-card h2,
.guide .download-card p {
  color: var(--ink);
}

.download-card h2 {
  margin-bottom: 8px;
}

.download-card p {
  margin: 0;
}

.download-card .button.secondary {
  color: var(--ink);
  border-color: #1c143040;
}

.download-card .button.secondary:hover {
  background: #1c14300d;
}

@media (max-width: 560px) {
  .download-card {
    grid-template-columns: 1fr;
  }

  .download-card img {
    max-width: 220px;
  }
}

.cta {
  padding: 28px;
  text-align: center;
  background: var(--cta-bg);
  border: 1px solid var(--cta-line);
  border-radius: 24px;
}

.cta h2 {
  margin-bottom: 8px;
}

.cta p {
  margin: 0 auto;
  max-width: 520px;
}

.cta .button-row {
  justify-content: center;
}

/* FAQ, same pattern as the landing page. */
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--strong);
}

.faq details p {
  margin: 10px 0 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 20px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--strong);
}

.trademark {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}
