/* ================================================================
   CRISIS Support Center — Common Styles
   Shared design tokens, layout primitives, header, footer
   ================================================================ */

/* ─── Design Tokens ─── */
/* Palette aligned with the main web app (frontend.crisis):
   warm stone neutrals + slate primary, in oklch. */
:root {
  /* Neutral ramp — Tailwind stone */
  --stone-50: oklch(0.985 0.001 106.423);
  --stone-100: oklch(0.97 0.001 106.424);
  --stone-200: oklch(0.923 0.003 48.717);
  --stone-300: oklch(0.869 0.005 56.366);
  --stone-400: oklch(0.709 0.01 56.259);
  --stone-500: oklch(0.553 0.013 58.071);
  --stone-700: oklch(0.374 0.01 67.558);
  --stone-900: oklch(0.216 0.006 56.043);
  --stone-950: oklch(0.147 0.004 49.25);

  /* Slate — app primary ramp (buttons, dark badges) */
  --slate-100: oklch(0.968 0.007 247.896);
  --slate-200: oklch(0.929 0.013 255.508);
  --slate-700: oklch(0.372 0.044 257.287);
  --slate-800: oklch(0.279 0.041 260.031);
  --slate-900: oklch(0.208 0.042 265.755);

  --bg: var(--stone-50);
  --surface: #ffffff;
  --surface-soft: var(--stone-100);
  --text: var(--stone-950);
  --text-secondary: var(--stone-700);
  --muted: var(--stone-500);
  --border: var(--stone-200);
  --border-strong: var(--stone-300);
  --brand: var(--slate-800); /* app --primary */
  --brand-strong: var(--stone-900); /* dark surfaces (dev banner) */
  --brand-fg: var(--slate-100); /* text on primary */
  --brand-link: oklch(50% 0.134 242.749); /* cyan-700 (aqua) */
  --success: oklch(0.627 0.194 149.214); /* green-600 */
  --success-soft: oklch(0.982 0.018 155.826); /* green-50 */
  --muted-on-dark: var(--stone-400); /* subtle text on dark surfaces */

  /* Flat shadows matching the app's near-flat elevation */
  --shadow-xs: 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow-sm:
    0 0 0 oklch(0 0 0 / 0.1), 0 2px 2px oklch(0 0 0 / 0.04);
  --shadow-md: 0 2px 4px oklch(0 0 0 / 0.06), 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow-lg: 0 4px 12px oklch(0 0 0 / 0.08);

  /* Inset highlight/shadow — the app's tactile button/badge detail */
  --inset-shadow-xs:
    inset 0 1px 2px oklch(1 0 0 / 0.2), inset 0 -1px 2px oklch(0 0 0 / 0.025);
  --inset-shadow-md: inset 0 0 3px oklch(0 0 0 / 0.1);
  --btn-shadow: 0 1px 2px oklch(0 0 0 / 0.05), var(--inset-shadow-xs);

  /* Tight radii matching the app scale */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 999px;

  --container: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-display:
    "DM Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    sans-serif;
  --font-body:
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "DM Sans", "Noto Sans JP",
    sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Squircle corners to match the app (progressive enhancement).
   Pills and circles keep true-round corners. */
* {
  corner-shape: superellipse(1.2);
}

.badge,
.plan-badge,
.search-tag,
.article-category,
.update-badge,
.status-dot,
.category-arrow,
.dev-banner-arrow,
.onboarding-banner-arrow,
.contact-card-arrow,
[style*="border-radius: 50%"],
[class*="-arrow"] {
  corner-shape: round;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

/* ─── Container ─── */
.container {
  width: min(calc(100% - 48px), var(--container));
  margin: 0 auto;
}

/* ─── Site Header ─── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: block;
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-nav a {
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease);
}

.header-nav a:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
}

/* ─── Site Footer ─── */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
}

.site-footer-inner {
  padding: 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}

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

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  transition: color 0.15s;
}

/* ─── Section Primitives ─── */
.section {
  background: #fff;
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-inner {
  padding: 56px 0;
}

.section-header {
  margin-bottom: 32px;
}

.section-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 650;
}

/* ─── Breadcrumb ─── */
.breadcrumb-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.breadcrumb {
  display: flex;
  align-items: center;
  padding: 14px 0;
  font-size: 13px;
  color: var(--muted);
  overflow-x: auto;
  white-space: nowrap;
}

.breadcrumb *:not(:first-child)::before {
  display: inline;
  margin-inline: 6px;
  font-size: 11px;
  color: var(--border-strong);
  content: "›";
  speak: never;
}

.breadcrumb a {
  color: var(--muted);
  transition: color 0.15s;
}

.breadcrumb a:hover {
  color: var(--text);
}

.breadcrumb-current {
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─── Category Colours ─── */
.cat-onboarding {
  background: #e8f1e1;
  color: #385a1e;
}
.cat-weather-data {
  background: #dbe9ef;
  color: #0c4b69;
}
.cat-incident {
  background: #f8ebdf;
  color: #b8670c;
}
.cat-billing {
  background: #f4ddef;
  color: #74255f;
}
.cat-faq {
  background: #f3f1f0;
  color: #554a44;
}
.cat-operation-book {
  background: #e1e9f6;
  color: #274bed;
}
.cat-account {
  background: #eeecfd;
  color: #5719b1;
}
.cat-admin {
  background: #e8f4f9;
  color: #286b87;
}
.cat-workflow {
  background: #fae5e5;
  color: #830012;
}
.cat-asset {
  background: #fcf5db;
  color: #d57b00;
}
.cat-mobile {
  background: #fdecef;
  color: #a3123a;
}

/* ─── Contact section tones ─── */
.contact-support {
  background: #e8f4f9;
  color: #286b87;
}
.contact-invoicing {
  background: #f4ddef;
  color: #74255f;
}
.contact-sales {
  background: #e8f1e1;
  color: #385a1e;
}

/* ─── Badges (aligned with app: border + subtle top-gradient + inset) ─── */
.badge,
.plan-badge,
.update-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--inset-shadow-xs);
  background-image: linear-gradient(to bottom, oklch(1 0 0 / 0.6), transparent);
}

.badge-default {
  background-color: var(--surface-soft);
  color: var(--text-secondary);
}

.badge-error {
  border-color: oklch(0.885 0.062 18.334); /* red-200 */
  background-color: oklch(0.936 0.032 17.717); /* red-100 */
  color: oklch(0.444 0.177 26.899); /* red-800 */
}

.badge-warn,
.plan-badge {
  border-color: oklch(0.924 0.12 95.746); /* amber-200 */
  background-color: oklch(0.962 0.059 95.617); /* amber-100 */
  color: oklch(0.473 0.137 46.201); /* amber-800 */
}

.badge-info {
  border-color: oklch(0.882 0.059 254.128); /* blue-200 */
  background-color: oklch(0.932 0.032 255.585); /* blue-100 */
  color: oklch(0.424 0.199 265.638); /* blue-800 */
}

.badge-success {
  border-color: oklch(0.925 0.084 155.995); /* green-200 */
  background-color: oklch(0.962 0.044 156.743); /* green-100 */
  color: oklch(0.448 0.119 151.328); /* green-800 */
}

.plan-badge-sm {
  padding: 0 7px;
  font-size: 11px;
  vertical-align: 2px;
  margin-left: 8px;
}

/* ─── Buttons (aligned with app: gradient fill, border, inset highlight) ─── */
.search-button,
.error-button,
.form-submit,
.contact-channel-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-lg);
  background: linear-gradient(to bottom, var(--slate-700), var(--slate-900));
  color: var(--brand-fg);
  font-weight: 600;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
  transition:
    background 0.05s var(--ease),
    box-shadow 0.05s var(--ease),
    transform 0.05s var(--ease);
}

.search-button:hover,
.error-button:hover,
.form-submit:hover,
.contact-channel-button:hover {
  background: linear-gradient(to bottom, var(--slate-800), #000);
  box-shadow: var(--inset-shadow-md);
  opacity: 1;
}

.search-button:active,
.error-button:active,
.form-submit:active,
.contact-channel-button:active {
  transform: scale(0.99);
}

/* Secondary (light) buttons — app default variant */
.error-button-secondary,
.contact-channel-button-secondary {
  border: 1px solid var(--border);
  background: linear-gradient(to bottom, #fff, var(--bg));
  color: var(--text);
  box-shadow: var(--btn-shadow);
}

.error-button-secondary:hover,
.contact-channel-button-secondary:hover {
  background: linear-gradient(to bottom, var(--surface-soft), var(--surface-soft));
  border-color: var(--border-strong);
  box-shadow: var(--inset-shadow-md);
  color: var(--text);
  opacity: 1;
}

/* ─── Caret icon (replaces ascii arrows) ─── */
.icon-caret {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  flex: 0 0 auto;
}

/* ─── Responsive — Base ─── */
@media (max-width: 900px) {
  .header-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    width: min(calc(100% - 32px), var(--container));
  }

  .site-footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
