/* ============================================================================
 * GOG DESIGN SYSTEM · v1 · AI-age visual language
 * ----------------------------------------------------------------------------
 * What this is:
 *   The canonical visual language for GOG: typography, color, spacing,
 *   buttons, cards, form elements, status, notices, and motion.
 *   Framework-light: pure CSS, no libraries, no fragile dependencies.
 *
 * How a future page adopts it (see docs/engineering/GOG_DESIGN_SYSTEM.md):
 *   1. This file is already loaded globally (base.html, after components.css).
 *   2. Compose pages from the `gog-*` classes below. They are OPT-IN:
 *      nothing here restyles existing `.button`/`.card` classes, so pages
 *      that have not adopted the system render exactly as before.
 *   3. Governance rule: approval-gated and destructive actions must use
 *      `.gog-btn-approval` / `.gog-btn-danger` inside the matching gate
 *      panels — never a plain primary button.
 *
 * Brand notes: the dark forest-green + gold AMLAK identity is kept and
 * refined (evolve, don't alienate). The "AI-age" lift comes from larger,
 * calmer type, generous spacing, layered surfaces, and crisp state feedback.
 * ========================================================================== */

:root {
  /* ---- GOG type ---- */
  --gog-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --gog-font-display: Georgia, "Times New Roman", serif;
  --gog-text-hero: clamp(28px, 3.4vw, 40px);
  --gog-text-title: 22px;
  --gog-text-h3: 17px;
  --gog-text-body: 14.5px;
  --gog-text-small: 13px;
  --gog-text-caption: 12px;
  --gog-text-micro: 11px;
  --gog-leading-body: 1.65;
  --gog-leading-tight: 1.35;

  /* ---- GOG surfaces (layered on the existing brand palette) ---- */
  --gog-surface-1: #0d1d17;   /* cards */
  --gog-surface-2: #10241c;   /* raised panels */
  --gog-surface-3: #163027;   /* inset / hover */
  --gog-surface-inset: rgba(4, 14, 10, .55);
  --gog-line: rgba(151, 181, 168, .18);
  --gog-line-strong: rgba(216, 185, 105, .32);

  /* ---- GOG semantic colors ---- */
  --gog-gold: #d8b969;
  --gog-gold-deep: #b8934a;
  --gog-ink-on-gold: #14231b;
  --gog-ok: #61c992;
  --gog-ok-soft: rgba(97, 201, 146, .12);
  --gog-warn: #e8b85f;
  --gog-warn-soft: rgba(232, 184, 95, .12);
  --gog-danger: #ef7c79;
  --gog-danger-soft: rgba(239, 124, 121, .10);
  --gog-info: #7fb6c9;
  --gog-info-soft: rgba(127, 182, 201, .10);

  /* ---- GOG shape & depth ---- */
  --gog-radius-sm: 10px;
  --gog-radius-md: 14px;
  --gog-radius-lg: 20px;
  --gog-radius-xl: 28px;
  --gog-shadow-card: 0 1px 0 rgba(255, 255, 255, .03),
    0 18px 44px rgba(0, 0, 0, .28);
  --gog-shadow-lift: 0 2px 0 rgba(255, 255, 255, .04),
    0 28px 64px rgba(0, 0, 0, .38);
  --gog-shadow-button: 0 10px 26px rgba(0, 0, 0, .30),
    inset 0 1px 0 rgba(255, 255, 255, .35);
  --gog-focus-ring: 0 0 0 3px rgba(216, 185, 105, .45);

  /* ---- GOG motion ---- */
  --gog-ease: cubic-bezier(.2, .8, .2, 1);
  --gog-duration: 180ms;
}

/* ==========================================================================
 * Typography helpers
 * ========================================================================== */
.gog-eyebrow {
  color: var(--gog-gold);
  font-family: var(--gog-font-ui);
  font-size: var(--gog-text-micro);
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.gog-card-title {
  margin: 6px 0 0;
  color: var(--text);
  font-family: var(--gog-font-display);
  font-size: var(--gog-text-title);
  font-weight: 500;
  line-height: var(--gog-leading-tight);
  letter-spacing: -.2px;
}
.gog-card-lede {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: var(--gog-font-ui);
  font-size: var(--gog-text-body);
  line-height: var(--gog-leading-body);
}
.gog-hint {
  color: var(--faint);
  font-family: var(--gog-font-ui);
  font-size: var(--gog-text-small);
  line-height: 1.6;
}

/* ==========================================================================
 * Cards — layered, calm, with a clear header zone
 * ========================================================================== */
.gog-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 26px;
  border: 1px solid var(--gog-line);
  border-radius: var(--gog-radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, 0) 34%),
    linear-gradient(150deg, var(--gog-surface-2), var(--gog-surface-1));
  box-shadow: var(--gog-shadow-card);
  font-family: var(--gog-font-ui);
  transition: transform var(--gog-duration) var(--gog-ease),
    box-shadow var(--gog-duration) var(--gog-ease),
    border-color var(--gog-duration) var(--gog-ease);
}
.gog-card:hover {
  transform: translateY(-2px);
  border-color: rgba(216, 185, 105, .22);
  box-shadow: var(--gog-shadow-lift);
}
.gog-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--gog-line);
}
.gog-card-head-copy { min-width: 0; }
.gog-card-body { display: grid; gap: 16px; padding-top: 18px; }
.gog-card-actions {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}

/* ==========================================================================
 * Buttons — one hierarchy, five roles.
 * GOVERNANCE: approval-gated and destructive actions must use
 * .gog-btn-approval / .gog-btn-danger inside their gate panels.
 * ========================================================================== */
.gog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: var(--gog-radius-md);
  font-family: var(--gog-font-ui);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .01em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform var(--gog-duration) var(--gog-ease),
    box-shadow var(--gog-duration) var(--gog-ease),
    background var(--gog-duration) var(--gog-ease),
    border-color var(--gog-duration) var(--gog-ease),
    color var(--gog-duration) var(--gog-ease);
}
.gog-btn:hover { transform: translateY(-1px); }
.gog-btn:active { transform: translateY(0); }
.gog-btn:focus-visible {
  outline: none;
  box-shadow: var(--gog-focus-ring);
}
.gog-btn[disabled],
.gog-btn.is-disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.gog-btn .gog-btn-icon { font-size: 15px; line-height: 1; }

/* Primary — the one safe action on screen. Gold, unmissable, calm. */
.gog-btn-primary {
  background: linear-gradient(135deg, #f0d67f, var(--gog-gold-deep));
  color: var(--gog-ink-on-gold);
  box-shadow: var(--gog-shadow-button);
}
.gog-btn-primary:hover {
  box-shadow: 0 16px 36px rgba(0, 0, 0, .36),
    0 0 0 1px rgba(216, 185, 105, .35),
    inset 0 1px 0 rgba(255, 255, 255, .4);
}

/* Secondary — ordinary navigation / non-destructive secondary actions. */
.gog-btn-secondary {
  background: linear-gradient(145deg, rgba(32, 62, 50, .9), rgba(16, 36, 28, .9));
  border-color: var(--gog-line);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22);
}
.gog-btn-secondary:hover { border-color: rgba(216, 185, 105, .35); }

/* Ghost — quiet tertiary actions. */
.gog-btn-ghost {
  background: transparent;
  color: var(--gog-gold);
  min-height: 44px;
  padding: 11px 16px;
}
.gog-btn-ghost:hover { background: rgba(216, 185, 105, .10); }

/* Approval — gated actions that extend authority (enable sending,
 * enable publishing...). Visually unmistakable: dark, double-framed in
 * gold, lock icon, always inside a .gog-approval-gate panel. */
.gog-btn-approval {
  background: linear-gradient(145deg, #1c130a, #14100a);
  border: 2px solid var(--gog-gold);
  color: var(--gog-gold);
  box-shadow: 0 0 0 1px rgba(216, 185, 105, .18),
    0 12px 30px rgba(0, 0, 0, .35);
}
.gog-btn-approval:hover {
  background: linear-gradient(145deg, #2a1d0e, #1a140b);
  box-shadow: 0 0 0 3px rgba(216, 185, 105, .22),
    0 14px 34px rgba(0, 0, 0, .4);
}

/* Danger — destructive actions (revoke...). Red-framed, never gold. */
.gog-btn-danger {
  background: var(--gog-danger-soft);
  border: 1px solid rgba(239, 124, 121, .55);
  color: #f2a5a3;
}
.gog-btn-danger:hover {
  background: rgba(239, 124, 121, .18);
  border-color: var(--gog-danger);
  color: #f7c4c3;
}

.gog-btn-lg { min-height: 54px; padding: 15px 30px; font-size: 15px; }
.gog-btn-sm { min-height: 40px; padding: 9px 16px; font-size: 13px; }
.gog-btn-block { width: 100%; }

/* Consequence text under an action — always visible, never hidden. */
.gog-action-consequence {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: var(--gog-text-small);
  line-height: 1.6;
}

/* ==========================================================================
 * Status badges — state at a glance, with a readable dot
 * ========================================================================== */
.gog-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--gog-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-family: var(--gog-font-ui);
  font-size: var(--gog-text-caption);
  font-weight: 750;
  letter-spacing: .8px;
  text-transform: uppercase;
  white-space: nowrap;
}
.gog-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.gog-status.is-connected {
  border-color: rgba(97, 201, 146, .45);
  background: var(--gog-ok-soft);
  color: var(--gog-ok);
}
.gog-status.is-connected::before {
  background: var(--gog-ok);
  box-shadow: 0 0 8px rgba(97, 201, 146, .9);
}
.gog-status.is-prepared {
  border-color: rgba(216, 185, 105, .45);
  background: rgba(216, 185, 105, .10);
  color: var(--gog-gold);
}
.gog-status.is-prepared::before {
  background: var(--gog-gold);
  box-shadow: 0 0 8px rgba(216, 185, 105, .9);
}
.gog-status.is-pending {
  border-style: dashed;
  color: var(--muted);
}
.gog-status.is-warning {
  border-color: rgba(232, 184, 95, .45);
  background: var(--gog-warn-soft);
  color: var(--gog-warn);
}
.gog-status.is-warning::before { background: var(--gog-warn); }
.gog-status.is-danger {
  border-color: rgba(239, 124, 121, .5);
  background: var(--gog-danger-soft);
  color: var(--gog-danger);
}
.gog-status.is-danger::before { background: var(--gog-danger); }

/* ==========================================================================
 * Notices — information with intent (info / governance / warning)
 * ========================================================================== */
.gog-notice {
  padding: 16px 18px;
  border: 1px solid var(--gog-line);
  border-radius: var(--gog-radius-md);
  background: rgba(255, 255, 255, .022);
  color: var(--muted);
  font-size: var(--gog-text-small);
  line-height: 1.65;
}
.gog-notice strong { color: var(--text); }
.gog-notice-governance {
  border-color: rgba(216, 185, 105, .30);
  background: rgba(216, 185, 105, .07);
  color: #d9cda4;
}
.gog-notice-governance strong { color: var(--gog-gold); }
.gog-notice-warning {
  border-color: rgba(232, 184, 95, .35);
  background: var(--gog-warn-soft);
  color: #e6cf9e;
}
.gog-notice-warning strong { color: var(--gog-warn); }

/* ==========================================================================
 * Disclosures — progressive detail, always keyboard-operable
 * ========================================================================== */
.gog-disclosure {
  border-top: 1px solid var(--gog-line);
  padding-top: 4px;
}
.gog-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
  color: var(--text);
  font-size: var(--gog-text-body);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.gog-disclosure > summary::-webkit-details-marker { display: none; }
.gog-disclosure > summary::after {
  content: "›";
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--gog-line);
  border-radius: 50%;
  color: var(--gog-gold);
  font-size: 16px;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform var(--gog-duration) var(--gog-ease);
}
.gog-disclosure[open] > summary::after { transform: rotate(-90deg); }
.gog-disclosure > summary:focus-visible {
  outline: none;
  box-shadow: var(--gog-focus-ring);
  border-radius: var(--gog-radius-sm);
}
.gog-disclosure-body {
  display: grid;
  gap: 10px;
  padding: 2px 2px 16px;
  color: var(--muted);
  font-size: var(--gog-text-small);
  line-height: 1.65;
}

/* ==========================================================================
 * Forms — 48px touch targets, visible labels, calm focus
 * ========================================================================== */
.gog-form { display: grid; gap: 16px; }
.gog-field { display: grid; gap: 8px; }
.gog-field > span {
  color: var(--muted);
  font-size: var(--gog-text-small);
  font-weight: 700;
  letter-spacing: .02em;
}
.gog-input,
.gog-select,
.gog-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--gog-line);
  border-radius: var(--gog-radius-sm);
  background: var(--gog-surface-inset);
  color: var(--text);
  font-family: var(--gog-font-ui);
  font-size: var(--gog-text-body);
  transition: border-color var(--gog-duration) var(--gog-ease),
    box-shadow var(--gog-duration) var(--gog-ease);
}
.gog-textarea { min-height: 96px; resize: vertical; }
.gog-input::placeholder { color: var(--faint); }
.gog-input:focus,
.gog-select:focus,
.gog-textarea:focus {
  outline: none;
  border-color: var(--gog-gold);
  box-shadow: var(--gog-focus-ring);
}

/* ==========================================================================
 * Action zones — where a governed action lives on the page
 * ========================================================================== */
.gog-action {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--gog-line);
  border-radius: var(--gog-radius-md);
  background: var(--gog-surface-inset);
}
.gog-action-title {
  color: var(--text);
  font-size: var(--gog-text-small);
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Approval gate — the visual contract for "this extends authority".
 * Dashed gold frame + explicit label + lock-styled button. Unmissable. */
.gog-approval-gate {
  padding: 20px;
  border: 2px dashed rgba(216, 185, 105, .5);
  border-radius: var(--gog-radius-md);
  background: rgba(216, 185, 105, .05);
}
.gog-approval-gate-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--gog-gold);
  font-size: var(--gog-text-caption);
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* Danger zone — destructive actions live here, red-framed. */
.gog-danger-zone {
  padding: 20px;
  border: 1px solid rgba(239, 124, 121, .4);
  border-radius: var(--gog-radius-md);
  background: var(--gog-danger-soft);
}
.gog-danger-zone-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--gog-danger);
  font-size: var(--gog-text-caption);
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

/* ==========================================================================
 * Health line — connection/token status with a state-colored pulse
 * ========================================================================== */
.gog-health {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--gog-line);
  border-radius: var(--gog-radius-md);
  background: rgba(255, 255, 255, .02);
  font-size: var(--gog-text-small);
  line-height: 1.6;
}
.gog-health strong { color: var(--text); }
.gog-health small { display: block; margin-top: 4px; color: var(--muted); }
.gog-health-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--faint);
}
.gog-health.is-ok .gog-health-dot {
  background: var(--gog-ok);
  box-shadow: 0 0 10px rgba(97, 201, 146, .9);
}
.gog-health.is-warn .gog-health-dot {
  background: var(--gog-warn);
  box-shadow: 0 0 10px rgba(232, 184, 95, .9);
}
.gog-health.is-bad .gog-health-dot {
  background: var(--gog-danger);
  box-shadow: 0 0 10px rgba(239, 124, 121, .9);
}

/* Selected-account row — who this card is about */
.gog-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--gog-line);
  border-radius: var(--gog-radius-md);
  background: rgba(97, 201, 146, .05);
}
.gog-account-row-label {
  color: var(--muted);
  font-size: var(--gog-text-caption);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.gog-account-row-value {
  color: var(--text);
  font-size: var(--gog-text-body);
  font-weight: 700;
  overflow-wrap: anywhere;
  text-align: right;
}

/* ==========================================================================
 * Connections grid polish (this class exists only on the Connections page)
 * ========================================================================== */
.connector-grid {
  gap: 22px;
  align-items: start;
}
.connector-card { min-height: 0; }

/* ==========================================================================
 * Layout utilities
 * ========================================================================== */
.gog-stack { display: grid; gap: 16px; }
.gog-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
 * Motion — subtle everywhere, absent when the user asks for stillness
 * ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .gog-card, .gog-btn, .gog-disclosure > summary::after,
  .gog-input, .gog-select, .gog-textarea {
    transition: none;
  }
  .gog-card:hover, .gog-btn:hover { transform: none; }
}

/* ==========================================================================
 * Responsive
 * ========================================================================== */
@media (max-width: 720px) {
  .gog-card { padding: 20px; }
  .gog-card-head { flex-direction: column; align-items: flex-start; }
  .gog-btn-block-mobile { width: 100%; }
}
