/* Guides section. Loaded after /styles.css, copied to website/guides.css by build.mjs.
   Colours, radii and shadows are the app's tokens defined in /styles.css
   (from lib/app/theme/app_theme.dart). The "night" panels (index hero, app box)
   use the background and sand of the App Store screenshots. The screenshots are
   phone-only cut-outs with a transparent background (website/assets/guides/,
   260x570 and 520x1140, phone bottom-anchored), so the panel shows around them. */

/* System fonts only: no font requests to third parties, and CJK / Arabic get the
   platform's own typefaces. */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "Noto Sans Arabic", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Apple SD Gothic Neo", "Malgun Gothic", "PingFang SC", "PingFang TC", "Microsoft YaHei",
    "Microsoft JhengHei", sans-serif;
  --read: 700px;
}
:lang(ja) body, :lang(ko) body, :lang(zh) body { line-height: 1.85; }
:lang(ar) body { line-height: 1.85; }
:lang(ja) h1, :lang(ko) h1, :lang(zh) h1,
:lang(ja) h2, :lang(ko) h2, :lang(zh) h2,
:lang(ja) h3, :lang(ko) h3, :lang(zh) h3,
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.4; }
:lang(ja) .eyebrow, :lang(ko) .eyebrow, :lang(zh) .eyebrow, :lang(ar) .eyebrow { letter-spacing: 0.04em; text-transform: none; }
/* CJK: break long runs anywhere, never overflow the column. */
:lang(ja), :lang(zh) { line-break: strict; }
:lang(ko) { word-break: keep-all; }
.doc, .guide-card, .guides-hero, .app-box { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Nav --- */
/* One header on every page: brand, Guides, About, then the language switcher
   (localized pages only). Below 640px the links move to a second row, so they
   are never hidden and long translations still fit at 375px. */
.brand .app-icon { width: 36px; height: 36px; }
.app-icon img { width: 100%; height: 100%; display: block; }
.nav .nav-inner { gap: 12px 20px; }
.nav .nav-links { display: flex; align-items: center; gap: 24px; margin-inline-start: auto; }
.nav .nav-links a { font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.nav .nav-links a:hover { color: var(--primary-dark); }
.nav .nav-links a[aria-current="page"] { color: var(--primary-dark); }
@media (max-width: 640px) {
  .nav .nav-inner { height: auto; min-height: 0; flex-wrap: wrap; padding-top: 10px; padding-bottom: 8px; row-gap: 4px; }
  .nav .brand { order: 1; min-width: 0; }
  .nav .lang-switch { order: 2; margin-inline-start: auto; }
  .nav .nav-links { order: 3; flex: 1 0 100%; margin-inline-start: 0; gap: 22px; min-height: 36px; }
  .nav .nav-links a { font-size: 0.92rem; }
}

/* Language switcher: a native <details> dropdown, works without JS. */
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary svg { width: 16px; height: 16px; flex: none; }
.lang-switch summary:hover, .lang-switch[open] summary { border-color: var(--line-strong); background: var(--active-tint); }
.lang-list {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 60;
  margin: 0;
  padding: 8px;
  list-style: none;
  width: max-content;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 44px -16px rgba(107, 78, 55, 0.28);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.lang-list a {
  display: block;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.lang-list a:hover, .lang-list a:focus-visible { background: var(--active-tint); color: var(--ink); }
.lang-list a[aria-current="true"] { color: #fff; background: var(--primary); font-weight: 700; }

/* --------------------------------------------------------- Breadcrumb --- */
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: "/"; margin-inline-end: 6px; color: var(--line-strong); }
.breadcrumb a { color: var(--ink-muted); text-decoration: none !important; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb li[aria-current] { color: var(--ink-muted); }
.doc .breadcrumb ol { padding: 0 !important; }
.doc .breadcrumb li { margin: 0; font-size: 0.9rem; color: var(--ink-muted); }
/* One line: the current page (last item) truncates with an ellipsis. */
.breadcrumb ol { flex-wrap: nowrap; min-width: 0; }
.breadcrumb li { flex: none; white-space: nowrap; }
.breadcrumb li:last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ Article --- */
.guide { padding-top: 40px; }
article.guide { max-width: var(--read); }
.guide h1 { font-size: clamp(1.9rem, 4.6vw, 2.75rem); line-height: 1.15; letter-spacing: -0.025em; margin-bottom: 12px; }
.doc .updated { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--active-tint); color: var(--primary-dark); font-size: 0.85rem; font-weight: 600; margin: 4px 0 32px; }
.guide .intro { font-size: 1.16rem; color: var(--ink); line-height: 1.7; }
.doc.guide p, .doc.guide li { color: var(--ink-soft); font-size: 1.04rem; }
.doc.guide h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); margin: 48px 0 14px; letter-spacing: -0.015em; scroll-margin-top: 84px; }
.doc.guide h3 { font-size: 1.1rem; color: var(--primary-dark); }
.doc.guide ol, .doc.guide ul { padding-left: 0; padding-inline-start: 24px; }
.doc.guide ul li::marker { color: var(--primary-bright); }
.doc.guide ol li { margin-bottom: 10px; }
/* Numbered steps: clay number badges, like the app's step chips. */
article.guide > ol { list-style: none; padding-inline-start: 0 !important; counter-reset: step; }
article.guide > ol > li { position: relative; padding-inline-start: 44px; counter-increment: step; min-height: 30px; }
article.guide > ol > li::before {
  content: counter(step);
  position: absolute; inset-inline-start: 0; top: 0.1em;
  width: 30px; height: 30px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--active-tint); color: var(--primary-dark);
  font-weight: 800; font-size: 0.88rem; line-height: 1;
}
.doc .callout {
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--primary-bright);
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 22px;
}
.doc .callout p { color: var(--ink) !important; }

.table-wrap { overflow-x: auto; margin: 24px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-card); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.94rem; min-width: 560px; }
.table-wrap th, .table-wrap td { padding: 12px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-wrap thead th { background: var(--active-tint); color: var(--ink); font-weight: 700; }
.table-wrap tbody th { color: var(--ink); font-weight: 600; background: var(--surface-alt); }
.table-wrap td { color: var(--ink-soft); }
.table-wrap tr:last-child th, .table-wrap tr:last-child td { border-bottom: none; }

.doc .faq { margin-top: 12px; }
.doc .faq details { border-radius: 16px; }
.doc .faq details p { color: var(--ink-soft); }
.doc .faq summary { gap: 16px; }

/* ------------------------------------------- Night panels (hero, box) --- */
.night, .app-box {
  background: var(--night);
  color: #e9e4dc;
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 60px -36px rgba(24, 32, 36, 0.65);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.night .eyebrow, .app-box .eyebrow { color: var(--sand); }
.night h1, .night h2, .doc .app-box h2 { color: #fff; }
.night p, .doc .app-box p { color: #d6d0c7 !important; }
.shot { display: block; height: auto; border-radius: 0; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, 0.42)); }

/* Sand wave behind the phones, as in the App Store screenshots. A stretchable
   inline SVG on a ::before of the phone's own box, wider than the phone and
   running out through the panel's edges (the panel clips it), so it passes
   behind the phone in one piece and never ends mid-panel. --wave-corner rises
   from the panel's bottom edge to its end edge (phone beside the text);
   --wave-across runs from edge to edge (stacked layouts, the homepage strip).
   Absolutely positioned and z-index -1 inside the panel's isolation: no layout
   shift, never above text. Mirrored in RTL, where the phone column is on the left. */
:root {
  --wave-corner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 500' preserveAspectRatio='none'%3E%3Cpath fill='%23e7c799' d='M100 500C150 400 210 340 300 310C400 275 470 170 600 40V230C520 300 450 390 360 430C320 450 300 470 290 500Z'/%3E%3C/svg%3E");
  --wave-across: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 300' preserveAspectRatio='none'%3E%3Cpath fill='%23e7c799' d='M0 150C200 90 300 230 500 180C700 130 800 40 1000 60V180C820 170 720 260 520 285C320 310 200 230 0 260Z'/%3E%3C/svg%3E");
}
.guides-hero-shot, .app-box-shot { position: relative; }
.guides-hero-shot::before, .app-box-shot::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  background: var(--wave-corner) center / 100% 100% no-repeat;
  opacity: 0.92;
}
.guides-hero-shot::before { top: 18%; bottom: 0; inset-inline: -260px -130px; }
.app-box-shot::before { top: 16%; bottom: 0; inset-inline: -190px -110px; }
[dir="rtl"] .guides-hero-shot::before, [dir="rtl"] .app-box-shot::before { transform: scaleX(-1); }

/* Store badges (.stores/.store in /styles.css): sand on the night panels. */
.night .store, .app-box .store { background: var(--sand); color: var(--night) !important; box-shadow: 0 10px 22px -12px rgba(231, 199, 153, 0.45); }
.night .store:hover, .app-box .store:hover { background: #f0d6ae; }

/* ------------------------------------------------------- Guides hero --- */
.guides-top { padding-top: 32px; }
.guides-top .breadcrumb { margin-bottom: 18px; }
.guides-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: center;
  padding: 48px 56px 0;
}
.guides-hero-text { padding-bottom: 48px; }
.hero-brand { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; }
.hero-brand img { width: 56px; height: 56px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
.hero-brand span { font-weight: 800; font-size: 1.1rem; color: #fff; letter-spacing: -0.01em; }
.guides-hero h1 { font-size: clamp(2rem, 4.8vw, 3rem); line-height: 1.12; margin: 0 0 16px; color: var(--sand); letter-spacing: -0.03em; }
.guides-hero .intro { font-size: 1.1rem; line-height: 1.7; margin: 0 0 28px; max-width: 54ch; }
.guides-hero-shot { align-self: end; width: 210px; padding-bottom: 44px; }
.guides-hero-shot img { width: 210px; }

/* --------------------------------------------------------- Guide list --- */
.guides-body { padding-top: 48px; }
.guides-body .doc { padding-top: 0; max-width: none; }
.guide-list { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.guide-list li { margin: 0; display: flex; }
.guide-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 24px 22px;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.doc .guide-card { text-decoration: none; }
.guide-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 14px 30px -10px rgba(107, 78, 55, 0.18); }
.guide-card::before {
  content: "";
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 16px;
  background: var(--active-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f6a4c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h4'/%3E%3C/svg%3E") center / 22px no-repeat;
}
.guide-card h2, .guide-card h3 { margin: 0 0 8px !important; font-size: 1.14rem !important; line-height: 1.3; color: var(--ink) !important; letter-spacing: -0.01em; }
.guide-card p { margin: 0 0 16px; color: var(--ink-soft) !important; font-size: 0.97rem !important; flex: 1; }
.guide-card .more { color: var(--primary); font-weight: 700; font-size: 0.92rem; }
.guide-card:hover .more { color: var(--primary-dark); }

/* Related guides at the end of an article */
.related { margin-top: 56px; padding-top: 8px; }
.related .guide-list { margin-top: 16px; grid-template-columns: 1fr; }
.related .guide-card::before { display: none; }

/* ------------------------------------------------------------ App box --- */
.app-box {
  margin: 48px 0;
  padding: 32px 36px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 32px;
  align-items: end;
}
.app-box-main { padding-bottom: 32px; }
.app-box-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.app-box-head img { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35)); }
.app-box .eyebrow { margin: 0; font-size: 0.72rem; }
.doc .app-box h2 { margin: 2px 0 0; font-size: 1.35rem; }
.doc .app-box p { margin: 0 0 22px; font-size: 1rem; }
.app-box-shot { width: 150px; padding-bottom: 30px; }
.app-box-shot img { width: 150px; }
.guides-body .app-box { margin-top: 56px; }

/* ----------------------------------------- Language chooser (/guides/) --- */
.lang-grid { list-style: none; padding: 0 !important; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.lang-grid a { display: block; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none !important; color: var(--ink) !important; font-weight: 600; }
.lang-grid a:hover { background: var(--active-tint); border-color: var(--line-strong); }

/* ------------------------------------------------------------- Footer --- */
.footer { padding: 36px 0 32px; }
.footer .footer-bottom { border-top: none; padding-top: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.footer-links-row { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; }
.footer-links-row span { color: var(--line-strong); }
.footer-bottom a { color: var(--ink-muted); }
.footer-bottom a:hover { color: var(--primary-dark); }
.footer-legal { color: var(--muted-2); }
[dir="rtl"] .footer-legal { text-align: end; }

/* ------------------------------------------------------ About section --- */
.about-legal { margin-top: 48px; }
.about-legal h2 { margin-top: 0 !important; }
.legal-card::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f6a4c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6z'/%3E%3C/svg%3E") !important; }
.lang-note { font-weight: 500; font-size: 0.85em; color: var(--ink-muted); }
.more-about .about-links { list-style: none; padding: 0 !important; margin: 16px 0 0; display: grid; gap: 8px; }
.more-about .about-links li { margin: 0; }
.more-about .about-links a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; }
.more-about .about-links a:hover { border-color: var(--line-strong); background: var(--active-tint); }

/* ------------------------------------------- Legal pages (English only) --- */
/* The legal text is kept byte for byte; only its frame changes here. */
.legal .doc { max-width: var(--read); padding-top: 40px; }
.legal .doc h1 { font-size: clamp(1.9rem, 4.6vw, 2.6rem); line-height: 1.15; letter-spacing: -0.025em; }
.legal .doc p, .legal .doc li { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.7; }
.legal .doc h2 { font-size: clamp(1.2rem, 2.4vw, 1.45rem); margin: 40px 0 12px; }
.legal .doc .updated { display: block; padding: 0; background: none; color: var(--ink-muted); font-weight: 500; margin: 4px 0 28px; }
.legal .doc .breadcrumb { font-size: 0.9rem; color: var(--ink-muted); margin-bottom: 14px; }
.legal .doc table { display: block; max-width: 100%; overflow-x: auto; }

/* -------------------------------------------------------- Responsive --- */
@media (max-width: 860px) {
  .nav-inner { height: 60px; }
  .doc { padding: 32px 0 64px; }
  .guides-hero { grid-template-columns: 1fr; padding: 36px 28px 0; gap: 8px; text-align: center; }
  .guides-hero-text { padding-bottom: 8px; }
  .hero-brand { justify-content: center; }
  .guides-hero .intro { margin-inline: auto; }
  .guides-hero .stores { margin-inline: auto; }
  .guides-hero-shot { justify-self: center; width: 180px; padding-bottom: 32px; }
  .guides-hero-shot img { width: 180px; }
  .guides-hero-shot::before { background-image: var(--wave-across); top: 26%; bottom: 14%; inset-inline: -480px; }
}
@media (max-width: 600px) {
  .app-box { grid-template-columns: 1fr; padding: 26px 22px 0; text-align: center; }
  .app-box-head { justify-content: center; text-align: start; }
  .app-box .stores { margin-inline: auto; }
  .app-box-main { padding-bottom: 4px; }
  .app-box-shot { justify-self: center; width: 140px; padding-bottom: 26px; }
  .app-box-shot img { width: 140px; }
  .app-box-shot::before { background-image: var(--wave-across); top: 24%; bottom: 14%; inset-inline: -320px; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .brand-name { font-size: 0.98rem; }
  .guides-hero { padding: 28px 20px 4px; border-radius: 22px; }
  .guides-hero-shot { display: none; }
  .lang-switch summary { padding: 8px 12px; }
}
