:root {
  color-scheme: light;
  --page: #f7f9fc;
  --surface: #fff;
  --surface-muted: #f0f3f8;
  --text: #1c2a3b;
  --muted: #566477;
  --subtle: #66758a;
  --line: #dce3ec;
  --blue: #245fbd;
  --blue-hover: #1d4f9e;
  --button-bg: #245fbd;
  --button-hover: #1d4f9e;
  --focus: #16877f;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #111821;
    --surface: #19232f;
    --surface-muted: #202c3a;
    --text: #edf2f8;
    --muted: #bac5d3;
    --subtle: #a8b4c3;
    --line: #334152;
    --blue: #8eb7ff;
    --blue-hover: #b3ceff;
    --button-bg: #2f67ae;
    --button-hover: #3a77c4;
    --focus: #62d2c5;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111821;
  --surface: #19232f;
  --surface-muted: #202c3a;
  --text: #edf2f8;
  --muted: #bac5d3;
  --subtle: #a8b4c3;
  --line: #334152;
  --blue: #8eb7ff;
  --blue-hover: #b3ceff;
  --button-bg: #2f67ae;
  --button-hover: #3a77c4;
  --focus: #62d2c5;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--page); }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; background: var(--page); color: var(--text); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-hover); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button { font: inherit; }
.container { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; padding: 9px 13px; transform: translateY(-150%); border-radius: 5px; background: var(--text); color: var(--page); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-size: 18px; font-weight: 650; letter-spacing: -.04em; text-decoration: none; white-space: nowrap; }
.brand img { flex: none; }
.brand-accent { color: var(--blue); }
.primary-nav { display: flex; align-items: center; gap: 24px; }
.primary-nav > a { color: var(--muted); font-size: 14px; text-decoration: none; }
.primary-nav > a:hover, .primary-nav > a[aria-current="page"] { color: var(--text); }
.theme-toggle { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; }
.theme-toggle:hover { background: var(--surface-muted); }
.theme-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.menu-toggle { display: none; }

.home-main { width: min(1160px, calc(100% - 40px)); flex: 1; display: flex; flex-direction: column; justify-content: center; margin-inline: auto; }
.intro { padding: 30px 0 22px; text-align: center; }
.intro h1 { margin: 0; font-size: clamp(30px, 4vw, 38px); font-weight: 600; line-height: 1.2; letter-spacing: -.035em; }
.intro-lead { margin: 6px 0 0; color: var(--muted); font-size: 18px; }
.intro-detail { margin: 2px 0 0; color: var(--subtle); font-size: 14px; }
.applications { padding: 0 0 28px; }
.section-heading { margin-bottom: 12px; text-align: center; }
.section-heading h2 { margin: 0; font-size: 22px; font-weight: 550; letter-spacing: -.02em; }
.app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.app-card { min-height: 210px; display: flex; flex-direction: column; align-items: flex-start; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.app-card:only-child { grid-column: 1 / -1; width: min(100%, 720px); margin-inline: auto; }
.app-card-heading { display: flex; align-items: center; gap: 12px; }
.app-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--button-bg); color: #fff; }
.app-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.app-card h3 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.3; }
.app-category { margin: 1px 0 0; color: var(--muted); font-size: 13px; }
.app-description { max-width: 65ch; margin: 14px 0 17px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 1px solid transparent; border-radius: 7px; text-decoration: none; font-size: 14px; font-weight: 600; }
.app-card .button { margin-top: auto; }
.button-primary { background: var(--button-bg); color: #fff; }
.button-primary:hover { background: var(--button-hover); color: #fff; }

.site-footer { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--subtle); font-size: 12px; }
.footer-inner nav { display: flex; align-items: center; gap: 20px; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--blue); text-decoration: underline; }

.text-page { width: 100%; flex: 1; padding: 34px 0 52px; }
.narrow { max-width: 780px; }
.text-page h1 { margin: 0 0 15px; font-size: clamp(30px, 4vw, 36px); font-weight: 600; line-height: 1.2; letter-spacing: -.035em; }
.text-page h2 { margin: 28px 0 8px; font-size: 20px; font-weight: 600; line-height: 1.35; }
.text-page h3 { margin: 20px 0 6px; font-size: 16px; font-weight: 600; }
.text-page p, .text-page li { color: var(--muted); font-size: 15px; }
.text-page p { margin: 0 0 14px; }
.text-page ul { padding-left: 22px; }
.text-page li + li { margin-top: 6px; }
.eyebrow { margin: 0 0 7px !important; color: var(--blue) !important; font-size: 12px !important; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.contact-email { font-size: 17px !important; font-weight: 600; }
.contact-list { margin: 23px 0; }
.muted-note, .policy-date { color: var(--subtle) !important; font-size: 13px !important; }
.policy-page article section + section { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.policy-page section h2 { margin-top: 0; }
.policy-page section p:last-child { margin-bottom: 0; }
.policy-page code { padding: 1px 5px; border-radius: 4px; background: var(--surface-muted); color: var(--text); font-size: .9em; }

@media (max-width: 640px) {
  .container, .home-main { width: calc(100% - 32px); }
  .header-inner { min-height: 60px; }
  .brand { font-size: 17px; }
  .brand img { width: 30px; height: 30px; }
  .menu-toggle { width: 40px; height: 38px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; }
  .menu-toggle span { width: 17px; height: 2px; border-radius: 2px; background: currentColor; }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }
  .primary-nav { position: absolute; z-index: 5; top: 60px; left: 0; right: 0; display: none; align-items: stretch; gap: 0; padding: 8px 16px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
  .primary-nav.is-open { display: flex; flex-direction: column; }
  .primary-nav > a { padding: 9px 2px; }
  .theme-toggle { align-self: flex-start; margin-top: 7px; }
  .app-grid { grid-template-columns: 1fr; }
  .app-card, .app-card:only-child { width: 100%; min-height: 0; grid-column: auto; }
  .intro { padding: 25px 0 18px; }
  .intro-detail { max-width: 36ch; margin: 3px auto 0; }
  .footer-inner { min-height: 66px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; padding-block: 10px; }
  .footer-inner nav { gap: 17px; }
  .text-page { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
