/* ============================================================
 * Measuring Tools Pro — content pages theme
 *
 * Stand-alone CSS for the static legal pages (privacy policy and
 * refund policy). Mirrors the Android app's look: warm paper-white
 * surfaces, generous rounding, and the tape-measure icon's palette —
 * navy (#0F1B3D) as the primary, yellow (#FFC21A) as the accent and
 * coral (#FF5B3A) for warnings. In dark the roles swap the way the
 * app does it: yellow (#FFC93A) becomes the primary on deep navy.
 * Light by default; a dark variant kicks in via prefers-color-scheme
 * so it tracks the OS just like the app's system theme.
 *
 * Contrast (WCAG 2.1): every text colour below is AA (>= 4.5:1) on
 * the surfaces it sits on (--ab-surface, --ab-surface-2, --ab-bg).
 * Yellow and coral are only used as text in dark mode; in light they
 * are decoration (borders, markers), and --ab-warn-text carries the
 * coral meaning for text.
 * ============================================================ */

:root {
  /* Brand */
  --ab-brand: #0F1B3D;          /* navy — primary (links, markers) */
  --ab-brand-deep: #0A1330;     /* pressed / gradient end */
  --ab-brand-bright: #2A3A6E;   /* hover / highlight */
  --ab-brand-tint: rgba(15, 27, 61, 0.08);
  --ab-on-brand: #FFFFFF;       /* text / icon on a --ab-brand fill */
  --ab-accent: #FFC21A;         /* yellow — secondary accent */
  --ab-accent-ink: #8A6200;     /* yellow meaning as text on light */
  --ab-select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%230F1B3D' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");

  /* Warnings (coral) */
  --ab-warn: #FF5B3A;           /* borders / markers */
  --ab-warn-text: #B23A1E;      /* text on light surfaces (5.3:1+) */
  --ab-warn-bg: #FFF0E8;

  /* Light surfaces */
  --ab-bg: #F6F5F1;             /* page background (warm paper) */
  --ab-bg-grad-1: #FFF1C4;      /* soft yellow glow at the top */
  --ab-bg-grad-2: #F6F5F1;
  --ab-surface: #FFFFFF;        /* cards */
  --ab-surface-2: #F3F1EC;      /* nested / faq closed */
  --ab-border: #E8E5DE;
  --ab-border-strong: #DAD7CF;

  /* Text */
  --ab-text: #0F1B3D;           /* headings / body strong */
  --ab-text-soft: #4A5168;      /* paragraph */
  --ab-text-muted: #666C80;     /* meta */

  /* Shape */
  --ab-radius-lg: 22px;
  --ab-radius-md: 16px;
  --ab-radius-sm: 12px;
  --ab-radius-pill: 999px;

  /* Elevation */
  --ab-shadow-card: 0 1px 2px rgba(15, 27, 61, 0.04),
                    0 12px 32px -16px rgba(15, 27, 61, 0.22);
  --ab-shadow-glow: 0 8px 22px -8px rgba(15, 27, 61, 0.40);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ab-bg: #0A1020;
    --ab-bg-grad-1: #17213F;
    --ab-bg-grad-2: #0A1020;
    --ab-surface: #131B2E;
    --ab-surface-2: #1A2439;
    --ab-border: rgba(255, 255, 255, 0.09);
    --ab-border-strong: rgba(255, 255, 255, 0.16);

    --ab-text: #F3F4F7;
    --ab-text-soft: #B5BBCB;
    --ab-text-muted: #8E95A8;

    --ab-brand: #FFC93A;
    --ab-brand-deep: #E5A000;
    --ab-brand-bright: #FFD866;
    --ab-brand-tint: rgba(255, 201, 58, 0.16);
    --ab-on-brand: #0F1B3D;
    --ab-accent: #FFE7A3;
    --ab-accent-ink: #FFC93A;
    --ab-select-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23FFC93A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");

    --ab-warn: #FF6A4D;
    --ab-warn-text: #FF8A6E;
    --ab-warn-bg: #3A2016;

    --ab-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30),
                      0 16px 40px -20px rgba(0, 0, 0, 0.70);
    --ab-shadow-glow: 0 8px 22px -8px rgba(255, 201, 58, 0.35);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, var(--ab-bg-grad-1), transparent 70%),
    var(--ab-bg-grad-2);
  background-attachment: fixed;
  color: var(--ab-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.7;
  overflow-x: hidden;
}

/* Long English words / URLs must not blow out narrow phone widths. */
.ab-card p,
.ab-card li,
.ab-faq-answer,
.ab-faq-item summary {
  overflow-wrap: anywhere;
  word-break: break-word;
}

a {
  color: var(--ab-brand);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--ab-brand-bright); }

::selection {
  background: var(--ab-brand-tint);
  color: var(--ab-text);
}

/* ============================================================
 * Page scaffold
 * ============================================================ */
.ab-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Top bar ----- */
.ab-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--ab-surface) 86%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--ab-border);
}

.ab-topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.ab-back {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ab-brand-tint);
  border: 1px solid var(--ab-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ab-brand);
  font-size: 1.2rem;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.ab-back:hover {
  background: var(--ab-brand);
  border-color: var(--ab-brand);
  color: var(--ab-on-brand);
}

.ab-topbar h1 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ab-text);
}

.ab-brandmark {
  flex: none;
  display: inline-flex;
  align-items: center;
}
.ab-brandmark img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}

/* ----- Language switcher ----- */
.ab-lang-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.ab-lang-switch select {
  background-color: var(--ab-surface);
  border: 1px solid var(--ab-border-strong);
  color: var(--ab-text);
  padding: 8px 30px 8px 12px;
  border-radius: var(--ab-radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: var(--ab-select-arrow);
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.ab-lang-switch select:focus {
  outline: none;
  border-color: var(--ab-brand);
  box-shadow: 0 0 0 3px var(--ab-brand-tint);
}

/* ----- Content ----- */
.ab-content {
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 24px 24px;
}

.ab-card {
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-lg);
  box-shadow: var(--ab-shadow-card);
  padding: 32px 36px;
  margin-bottom: 22px;
}

.ab-card > :first-child { margin-top: 0; }
.ab-card > :last-child { margin-bottom: 0; }

.ab-card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 32px 0 14px;
  color: var(--ab-text);
  padding-left: 14px;
  border-left: 4px solid var(--ab-brand);
  border-image: linear-gradient(180deg, var(--ab-brand), var(--ab-accent)) 1;
  line-height: 1.4;
}
.ab-card h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--ab-text);
}

.ab-card p,
.ab-card li {
  color: var(--ab-text-soft);
  font-size: 0.97rem;
  line-height: 1.8;
}
.ab-card strong { color: var(--ab-text); }

/* Links in the body: navy is also the text colour in light mode, so mark
 * links with a yellow underline (the tape-measure accent) as well. */
.ab-card a {
  text-decoration: underline;
  text-decoration-color: var(--ab-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.ab-card a:hover { text-decoration-color: var(--ab-brand-bright); }

.ab-card ol,
.ab-card ul {
  padding-left: 1.4rem;
  margin: 12px 0;
}
.ab-card li { margin-bottom: 6px; }

.ab-card ul li::marker { color: var(--ab-brand); }

.ab-effective {
  color: var(--ab-text-muted);
  font-size: 0.85rem;
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid var(--ab-border);
}

/* Warning callout (coral). <p class="ab-warn"> or <div class="ab-warn"> */
.ab-card .ab-warn,
.ab-warn {
  background: var(--ab-warn-bg);
  border-left: 4px solid var(--ab-warn);
  border-radius: var(--ab-radius-sm);
  padding: 12px 16px;
  color: var(--ab-text);
}
.ab-warn strong { color: var(--ab-warn-text); }

/* Lead paragraph in the FAQ intro card */
.ab-intro {
  margin: 0;
  color: var(--ab-text-soft);
}

/* ============================================================
 * FAQ accordion
 * ============================================================ */
.ab-faq-item {
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--ab-shadow-card);
  transition: border-color 0.2s ease;
}
.ab-faq-item[open] {
  border-color: var(--ab-brand);
}
.ab-faq-item summary {
  cursor: pointer;
  padding: 18px 22px;
  font-weight: 600;
  color: var(--ab-text);
  font-size: 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ab-faq-item summary::-webkit-details-marker { display: none; }
.ab-faq-item summary::after {
  content: "";
  flex: none;
  margin-left: auto;
  width: 22px;
  height: 22px;
  background: var(--ab-brand);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 5v14M5 12h14' stroke='black' stroke-width='2.4' stroke-linecap='round'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 5v14M5 12h14' stroke='black' stroke-width='2.4' stroke-linecap='round'/></svg>") center / contain no-repeat;
  transition: transform 0.25s ease;
}
.ab-faq-item[open] summary::after {
  transform: rotate(135deg);
}
.ab-faq-item summary:hover { color: var(--ab-brand); }

.ab-faq-answer {
  padding: 0 22px 20px;
  color: var(--ab-text-soft);
  font-size: 0.95rem;
  line-height: 1.8;
}
.ab-faq-answer > :first-child { margin-top: 0; }
.ab-faq-answer ol,
.ab-faq-answer ul { padding-left: 1.3rem; }
.ab-faq-answer li { margin-bottom: 6px; }
.ab-faq-answer strong { color: var(--ab-text); }

/* ============================================================
 * Footer nav (also embeddable on the top page)
 * ============================================================ */
.ab-footer-nav {
  background: var(--ab-surface);
  border-top: 1px solid var(--ab-border);
  padding: 32px 24px;
  margin-top: 8px;
}
.ab-footer-nav-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
}
.ab-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
}
.ab-footer-links a {
  color: var(--ab-text-soft);
  font-size: 0.92rem;
  font-weight: 500;
}
.ab-footer-links a:hover { color: var(--ab-brand); }
.ab-footer-copy {
  color: var(--ab-text-muted);
  font-size: 0.82rem;
  margin: 0;
}
.ab-footer-copy a { color: var(--ab-text-muted); }
.ab-footer-copy a:hover { color: var(--ab-brand); }

/* ============================================================
 * Responsive
 * ============================================================ */
@media (max-width: 600px) {
  .ab-content { padding: 22px 14px 16px; }
  .ab-card { padding: 22px 18px; border-radius: var(--ab-radius-md); }
  .ab-topbar-inner { padding: 10px 14px; gap: 10px; }
  .ab-topbar h1 { font-size: 1.05rem; }
  .ab-card h2 { font-size: 1.18rem; }
  .ab-card h3 { font-size: 1rem; }
  .ab-lang-switch select { font-size: 0.8rem; padding: 7px 26px 7px 10px; }
  .ab-faq-item summary { padding: 15px 16px; font-size: 0.96rem; }
  .ab-faq-answer { padding: 0 16px 16px; font-size: 0.92rem; }
}
