/* FlyHomeMN Tech — one stylesheet for every page. Colors and type follow
   docs/company/document-pack.md §7 (Brand Guide). Sky and gold fail contrast
   as body text on white: use them for large text, icons and accents only. */

:root {
  /* Brand colors: fixed in both themes. */
  --navy: #1b3a6b;
  --sky: #4ea8de;
  --gold: #e0a53a;
  --ink: #0f1b2d;
  --white: #ffffff;

  /* Roles: what the rules below use. Dark mode redefines these. */
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f2f6fa;         /* "cloud": alternate sections, backend page */
  --surface: #ffffff;        /* cards, panels, form fields */
  --text: #0f1b2d;
  --muted: #5b6b80;          /* "slate" */
  --heading: #1b3a6b;
  --line: #dde5ee;
  --field-line: #c5d1df;
  --link: #1f6fa8;           /* sky, darkened to pass AA as body-size link text */
  --link-hover: #1b3a6b;
  --accent: #1b3a6b;         /* buttons, pills, ticks */
  --accent-hover: #0f1b2d;
  --on-accent: #ffffff;
  --brand-panel: #1b3a6b;    /* backend sidebar, contact section */
  --on-navy: #d6e2f0;
  --footer: #0f1b2d;
  --gold-soft: #fbeed3;
  --danger: #b42318;
  --good: #1f7a4d;
  --header-bg: rgba(255, 255, 255, .94);
  --shadow: rgba(15, 27, 45, .08);
  --flash-bg: #e7f4ec;
  --flash-line: #a6d8bb;
  --flash-text: #14532d;
  --radius: 12px;
  --max: 1080px;
  --head: "Poppins", Helvetica, Arial, sans-serif;
  --body: "Inter", Helvetica, Arial, sans-serif;
}

/* Dark mode. The head script in base.html sets data-theme from the saved
   choice, else the OS setting; static/js/theme.js flips it. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1422;
  --bg-alt: #0f1a2b;
  --surface: #15233a;
  --text: #e4ebf3;
  --muted: #9aabc0;
  --heading: #dcebf9;
  --line: #24364f;
  --field-line: #3a4f70;
  --link: #7cc3ef;
  --link-hover: #b4dcf6;
  --accent: #4ea8de;
  --accent-hover: #7cc3ef;
  --on-accent: #0f1b2d;
  --brand-panel: #142c52;
  --footer: #070d17;
  --gold-soft: rgba(224, 165, 58, .15);
  --danger: #f4776b;
  --good: #5ccf95;
  --header-bg: rgba(11, 20, 34, .92);
  --shadow: rgba(0, 0, 0, .4);
  --flash-bg: rgba(92, 207, 149, .12);
  --flash-line: rgba(92, 207, 149, .4);
  --flash-text: #a7e8c5;
}
/* The logo's navy lines vanish on a dark page: give it a light tile, like the
   backend sidebar already does. */
[data-theme="dark"] .brand img { background: var(--white); border-radius: 8px; padding: 2px; }
[data-theme="dark"] .hero-logo { background: #f2f6fa; border-radius: 28px; padding: 18px; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font: 16px/1.6 var(--body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1, h2, h3 { font-family: var(--head); color: var(--heading); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 1.75rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface); padding: 8px 12px; }

/* Wordmark: "FlyHomeMN" navy + "Tech" sky, as in the logo. */
.wordmark { font-family: var(--head); font-weight: 700; color: var(--heading); letter-spacing: -.01em; }
.wordmark span { color: var(--sky); font-weight: 600; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.2rem; }
.brand img { width: 40px; height: 40px; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--heading); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; text-decoration: none; border: 2px solid var(--accent);
  transition: background .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { color: var(--accent); background: transparent; }
.btn-ghost:hover { background: var(--accent); color: var(--on-accent); }

/* ---------- hero ---------- */
.hero { background: linear-gradient(180deg, var(--bg-alt), var(--bg)); padding: 72px 0 64px; }
.hero .wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; }
.eyebrow { font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
.eyebrow::before { content: ""; display: inline-block; width: 24px; height: 3px; background: var(--gold); vertical-align: middle; margin-right: 10px; border-radius: 2px; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-logo { justify-self: center; width: min(320px, 80%); }

/* ---------- sections ---------- */
section { padding: 72px 0; }
.alt { background: var(--bg-alt); }
.section-intro { max-width: 40em; color: var(--muted); margin-bottom: 32px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column;
}
.card p { color: var(--muted); }
.card .btn { align-self: flex-start; margin-top: auto; }
.badge {
  align-self: flex-start; font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  color: var(--text); background: var(--gold-soft); border: 1px solid var(--gold);
  padding: 2px 10px; border-radius: 999px; margin-bottom: 12px;
}
.product .tagline { font-family: var(--head); color: var(--text); font-weight: 500; margin-bottom: .5em; }
.service h3::before { content: ""; display: block; width: 28px; height: 3px; background: var(--gold); border-radius: 2px; margin-bottom: 14px; }

.about .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.facts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts li span:first-child { color: var(--muted); }
.facts li span:last-child { font-weight: 500; text-align: right; }

.contact { background: var(--brand-panel); color: var(--white); text-align: center; }
.contact h2 { color: var(--white); }
.contact p { color: var(--on-navy); max-width: 36em; margin-left: auto; margin-right: auto; }
.contact .btn { background: var(--white); color: var(--navy); border-color: var(--white); margin-top: 12px; }
.contact .btn:hover { background: var(--sky); border-color: var(--sky); color: var(--ink); }

/* ---------- footer ---------- */
.site-footer { background: var(--footer); color: #b7c3d3; padding: 32px 0; font-size: .9rem; }
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.site-footer a { color: var(--on-navy); margin-left: 18px; }
.site-footer a:first-child { margin-left: 0; }

/* ---------- legal pages ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 56px 20px 72px; }
.legal h1 { margin-bottom: .2em; }
.legal .updated { color: var(--muted); margin-bottom: 2em; }
.legal h2 { font-size: 1.2rem; margin-top: 2em; }
.legal ul { padding-left: 1.2em; }
.legal li { margin-bottom: .4em; }

/* ---------- small screens ---------- */
/* Hamburger: hidden on wide screens, the nav drops down under the header on
   small ones (static/js/menu.js toggles .open). Shared with the backend. */
.menu-btn { display: none; position: relative; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.menu-btn span { position: absolute; left: 11px; right: 11px; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; background: var(--heading); transition: transform .2s, opacity .2s; }
.menu-btn span:nth-child(1) { transform: translateY(-7px); }
.menu-btn span:nth-child(3) { transform: translateY(7px); }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg); }
.menu-btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

@media (max-width: 760px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px var(--shadow); padding: 6px 0 10px; }
  .nav.open { display: flex; }
  .nav a { padding: 13px 20px; font-size: 1.05rem; }
  .hero { padding: 48px 0; }
  .hero .wrap, .about .wrap { grid-template-columns: 1fr; gap: 32px; }
  .hero-logo { order: -1; width: 180px; }
  section { padding: 56px 0; }
  .site-footer a { margin-left: 0; margin-right: 18px; }
}

/* ---------- contact form (on navy) ---------- */
.contact { text-align: left; }
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; align-items: start; }
.contact p { margin-left: 0; }
.contact-alt a { color: var(--white); }
.contact-form { background: var(--surface); color: var(--text); border-radius: var(--radius); padding: 28px; }
.contact-form .field { margin-bottom: 16px; }
.contact-form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--heading); }
.contact-form input, .contact-form select, .contact-form textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--field-line); border-radius: 8px; padding: 10px 12px;
}
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus {
  outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky);
}
.contact-form .has-error input, .contact-form .has-error textarea { border-color: var(--danger); }
.contact-form .err, .form-error { color: var(--danger); font-size: .85rem; }
.form-error { font-weight: 600; }
.contact .contact-form .btn { background: var(--accent); color: var(--on-accent); border-color: var(--accent); margin-top: 4px; }
.contact .contact-form .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.center { text-align: center; }
.center-logo { margin: 0 auto 24px; }

@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; gap: 24px; }
  .contact-form { padding: 20px; }
}

/* ---------- light/dark switch (static/js/theme.js) ---------- */
.theme-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--heading); cursor: pointer; flex: none; }
.theme-btn:hover { border-color: var(--heading); }
.theme-btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .sun, [data-theme="dark"] .theme-btn .moon { display: none; }
[data-theme="dark"] .theme-btn .sun { display: block; }
.nav { margin-left: auto; }

@media (max-width: 760px) {
  .theme-btn { margin-left: auto; }
  .menu-btn { order: 1; }  /* after the switch, at the far right */
}

/* ---------- error pages (404, 500, 403_csrf, nginx/50x.html) ---------- */
.err { max-width: 640px; margin: 0 auto; padding: 56px 20px 80px; text-align: center; }
.err-art { width: min(320px, 100%); height: auto; margin: 0 auto 8px; display: block; overflow: visible; }
.err-path { fill: none; stroke: var(--sky); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 10; }
.err-plane path { fill: var(--gold); }
.err-dot { fill: var(--heading); }
.err-code { font-family: var(--head); font-weight: 600; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.err h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); margin: 0 0 12px; }
.err-lede { color: var(--muted); font-size: 1.05rem; margin: 0 auto 28px; max-width: 34em; }
.err-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.err-links { display: flex; gap: 6px 18px; justify-content: center; flex-wrap: wrap; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .93rem; }
.err-small { color: var(--muted); font-size: .9rem; margin-top: 24px; }
@media (prefers-reduced-motion: no-preference) {
  .err-plane { animation: err-drift 3s ease-in-out infinite alternate; }
  @keyframes err-drift { to { translate: 0 4px; } }
}
@media (max-width: 760px) { .err-actions .btn { flex: 1 1 100%; text-align: center; } }
