/* ============================================================================
   Christian Ego — Corporate Identity tokens & components
   Cloud, DevOps & AI Consulting
   ----------------------------------------------------------------------------
   Single source of truth for the CI. Drop this file into any internal site,
   set <html class="dark"> (or leave light), and use the .ce-* component classes
   together with Tailwind utilities. All colours are exposed as CSS variables
   so you can re-skin without touching markup.
   ========================================================================== */

/* ---- Fonts ---------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ============================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Brand constants (do not change per theme) */
  --ce-brand-blue:        #0094FF;
  --ce-brand-blue-bright: #4DB8FF;
  --ce-navy:              #0B1019;

  /* Type */
  --ce-font-display: 'Space Grotesk', system-ui, sans-serif;
  --ce-font-sans:    'IBM Plex Sans', system-ui, sans-serif;
  --ce-font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  /* Radii */
  --ce-r-sm: 6px;
  --ce-r:    10px;
  --ce-r-lg: 16px;
  --ce-r-xl: 22px;

  /* Spacing rhythm */
  --ce-gap:  20px;

  /* Status hues — shared chroma/lightness, hue varies (oklch) */
  --ce-success: oklch(0.62 0.15 152);
  --ce-warning: oklch(0.74 0.14 75);
  --ce-danger:  oklch(0.62 0.18 25);
  --ce-info:    oklch(0.62 0.16 245);

  /* Easing / motion */
  --ce-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- LIGHT theme (default) ----------------------------------------------- */
:root,
:root.light {
  --ce-bg:          #EEF2F7;
  --ce-bg-grad-1:   #FBFCFE;
  --ce-bg-grad-2:   #EEF2F7;
  --ce-bg-grad-3:   #DFE6EF;

  --ce-surface:     #FFFFFF;
  --ce-surface-2:   #F4F7FB;
  --ce-surface-3:   #E9EEF5;

  --ce-border:      #DDE4EE;
  --ce-border-2:    #C7D1DE;

  --ce-text:        #131A24;
  --ce-text-2:      #54606F;
  --ce-text-3:      #8A95A3;

  --ce-primary:        #0086EA;
  --ce-primary-hover:  #0072CC;
  --ce-primary-soft:   #E1F0FD;
  --ce-primary-ink:    #0A6CC0;     /* readable blue for text/links on light */
  --ce-on-primary:     #FFFFFF;

  --ce-mark:           var(--ce-primary);
  --ce-shadow:         0 1px 2px rgba(16,32,52,.06), 0 8px 24px -12px rgba(16,32,52,.18);
  --ce-shadow-lg:      0 24px 60px -24px rgba(16,32,52,.28);
  --ce-ring:           rgba(0,134,234,.32);

  /* status surfaces (light) */
  --ce-success-soft: oklch(0.95 0.04 152);
  --ce-warning-soft: oklch(0.95 0.05 80);
  --ce-danger-soft:  oklch(0.95 0.04 25);
  --ce-success-ink:  oklch(0.46 0.13 152);
  --ce-warning-ink:  oklch(0.50 0.12 70);
  --ce-danger-ink:   oklch(0.50 0.17 25);

  --ce-plexus-node:  #5E7B98;
  --ce-plexus-line:  #2E6FA8;
  --ce-plexus-glow:  #0094FF;
  --ce-plexus-op:    0.78;
}

/* ---- DARK theme ----------------------------------------------------------- */
:root.dark {
  --ce-bg:          #0B1019;
  --ce-bg-grad-1:   #0E1622;
  --ce-bg-grad-2:   #0B1019;
  --ce-bg-grad-3:   #070A10;

  --ce-surface:     #121A26;
  --ce-surface-2:   #16202E;
  --ce-surface-3:   #1E2A3A;

  --ce-border:      #243245;
  --ce-border-2:    #33475F;

  --ce-text:        #EAF0F7;
  --ce-text-2:      #A4B1C2;
  --ce-text-3:      #6C7C90;

  --ce-primary:        #0094FF;
  --ce-primary-hover:  #38A9FF;
  --ce-primary-soft:   #102A41;
  --ce-primary-ink:    #4DB8FF;
  --ce-on-primary:     #04121F;

  --ce-mark:           var(--ce-brand-blue-bright);
  --ce-shadow:         0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.65);
  --ce-shadow-lg:      0 30px 70px -28px rgba(0,0,0,.8);
  --ce-ring:           rgba(77,184,255,.38);

  --ce-success-soft: oklch(0.30 0.07 152);
  --ce-warning-soft: oklch(0.32 0.07 75);
  --ce-danger-soft:  oklch(0.30 0.08 25);
  --ce-success-ink:  oklch(0.80 0.13 152);
  --ce-warning-ink:  oklch(0.83 0.12 80);
  --ce-danger-ink:   oklch(0.78 0.13 28);

  --ce-plexus-node:  #4C73A0;
  --ce-plexus-line:  #4DB8FF;
  --ce-plexus-glow:  #0094FF;
  --ce-plexus-op:    0.92;
}

/* ============================================================================
   2. BASE
   ========================================================================== */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--ce-font-sans);
  color: var(--ce-text);
  background: var(--ce-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .35s var(--ce-ease), color .35s var(--ce-ease);
}

/* Full-bleed background gradient + plexus mount */
.ce-bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(130% 120% at 50% 36%,
              var(--ce-bg-grad-1) 0%, var(--ce-bg-grad-2) 52%, var(--ce-bg-grad-3) 100%);
}
.ce-bg svg, .ce-bg canvas, [data-ce-plexus] > svg, [data-ce-plexus] > canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

h1, h2, h3, h4, h5 { font-family: var(--ce-font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.ce-mono { font-family: var(--ce-font-mono); }

/* Icon sizing: the span is the sizer, the svg fills it */
[data-ce-icon] { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; }
[data-ce-icon] svg { width: 100%; height: 100%; display: block; }

a { color: var(--ce-primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--ce-primary); color: var(--ce-on-primary); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--ce-border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--ce-border-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }

/* Wordmark */
.ce-wordmark { font-family: var(--ce-font-display); font-weight: 700; letter-spacing: 0.01em; color: var(--ce-text); line-height: 1; white-space: nowrap; }
.ce-wordmark .ego { color: var(--ce-primary-ink); }
.ce-tagline { font-family: var(--ce-font-display); font-weight: 400; color: var(--ce-text-3); letter-spacing: 0.06em; }

/* ============================================================================
   3. COMPONENTS
   ========================================================================== */

/* ---- Surfaces / cards ---------------------------------------------------- */
.ce-card {
  background: var(--ce-surface);
  border: 1px solid var(--ce-border);
  border-radius: var(--ce-r-lg);
  box-shadow: var(--ce-shadow);
}
.ce-card-flush { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-r-lg); }
.ce-panel { background: var(--ce-surface-2); border: 1px solid var(--ce-border); border-radius: var(--ce-r); }
/* nested sub-panel: sits inside a .ce-card, reads as a child surface */
.ce-card-nested {
  background: color-mix(in srgb, var(--ce-surface) 98.5%, var(--ce-text) 1.5%);
  border: 1px solid var(--ce-border);
  border-left: 3px solid color-mix(in srgb, var(--ce-primary) 70%, var(--ce-border));
  border-radius: var(--ce-r);
  transition: border-color .18s var(--ce-ease), box-shadow .22s var(--ce-ease), transform .22s var(--ce-ease);
}
.ce-card-nested:hover,
.ce-card-nested.is-focus,
.ce-card-nested.is-feature {
  border-color: var(--ce-primary);
  border-left-color: var(--ce-primary);
  box-shadow: 0 0 0 1px var(--ce-primary), 0 10px 28px -10px color-mix(in srgb, var(--ce-primary) 45%, transparent);
  transform: translateY(-2px);
}

/* ---- Buttons ------------------------------------------------------------- */
.ce-btn {
  --_bg: var(--ce-surface); --_fg: var(--ce-text); --_bd: var(--ce-border-2);
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ce-font-sans); font-weight: 600; font-size: 14px; line-height: 1;
  padding: 10px 16px; border-radius: var(--ce-r-sm);
  background: var(--_bg); color: var(--_fg); border: 1px solid var(--_bd);
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background-color .18s var(--ce-ease), border-color .18s var(--ce-ease), transform .12s var(--ce-ease), box-shadow .18s var(--ce-ease);
}
.ce-btn:hover { transform: translateY(-1px); }
.ce-btn:active { transform: translateY(0); }
.ce-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ce-ring); }
.ce-btn [data-ce-icon] { width: 16px; height: 16px; }

.ce-btn-primary { --_bg: var(--ce-primary); --_fg: var(--ce-on-primary); --_bd: var(--ce-primary); }
.ce-btn-primary:hover { --_bg: var(--ce-primary-hover); --_bd: var(--ce-primary-hover); }

.ce-btn-ghost { --_bg: transparent; --_fg: var(--ce-text-2); --_bd: transparent; }
.ce-btn-ghost:hover { --_bg: var(--ce-surface-3); --_fg: var(--ce-text); }

.ce-btn-soft { --_bg: var(--ce-primary-soft); --_fg: var(--ce-primary-ink); --_bd: transparent; }

.ce-btn-icon { padding: 9px; }
.ce-btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---- Badges / chips ------------------------------------------------------ */
.ce-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ce-font-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--ce-surface-3); color: var(--ce-text-2); border: 1px solid var(--ce-border);
}
.ce-badge .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.ce-badge-primary { background: var(--ce-primary-soft); color: var(--ce-primary-ink); border-color: transparent; }
.ce-badge-success { background: var(--ce-success-soft); color: var(--ce-success-ink); border-color: transparent; }
.ce-badge-warning { background: var(--ce-warning-soft); color: var(--ce-warning-ink); border-color: transparent; }
.ce-badge-danger  { background: var(--ce-danger-soft);  color: var(--ce-danger-ink);  border-color: transparent; }

/* ---- Inputs -------------------------------------------------------------- */
.ce-label { display: block; font-size: 13px; font-weight: 600; color: var(--ce-text-2); margin-bottom: 7px; }
.ce-input, .ce-select, .ce-textarea {
  width: 100%; font-family: var(--ce-font-sans); font-size: 14px; color: var(--ce-text);
  background: var(--ce-surface-2); border: 1px solid var(--ce-border-2); border-radius: var(--ce-r-sm);
  padding: 10px 12px; transition: border-color .18s var(--ce-ease), box-shadow .18s var(--ce-ease), background-color .18s var(--ce-ease);
}
.ce-input::placeholder, .ce-textarea::placeholder { color: var(--ce-text-3); }
.ce-input:focus, .ce-select:focus, .ce-textarea:focus {
  outline: none; border-color: var(--ce-primary); box-shadow: 0 0 0 4px var(--ce-ring); background: var(--ce-surface);
}
.ce-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A95A3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.ce-textarea { resize: vertical; min-height: 96px; }

/* Toggle / switch */
.ce-switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex: none; cursor: pointer; }
.ce-switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ce-switch .track { position: absolute; inset: 0; border-radius: 99px; background: var(--ce-border-2); transition: background-color .2s var(--ce-ease); }
.ce-switch .thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 99px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .22s var(--ce-ease); }
.ce-switch input:checked ~ .track { background: var(--ce-primary); }
.ce-switch input:checked ~ .thumb { transform: translateX(18px); }

/* ---- Tables -------------------------------------------------------------- */
.ce-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ce-table thead th {
  text-align: left; font-family: var(--ce-font-mono); font-weight: 500; font-size: 11.5px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ce-text-3);
  padding: 12px 16px; border-bottom: 1px solid var(--ce-border);
}
.ce-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--ce-border); color: var(--ce-text); vertical-align: middle; }
.ce-table tbody tr { transition: background-color .14s var(--ce-ease); }
.ce-table tbody tr:hover { background: var(--ce-surface-2); }
.ce-table tbody tr:last-child td { border-bottom: none; }

/* ---- Alerts -------------------------------------------------------------- */
.ce-alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--ce-r); border: 1px solid var(--ce-border); background: var(--ce-surface-2); }
.ce-alert .ic { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.ce-alert-info    { background: var(--ce-primary-soft);  border-color: transparent; color: var(--ce-primary-ink); }
.ce-alert-success { background: var(--ce-success-soft);  border-color: transparent; color: var(--ce-success-ink); }
.ce-alert-warning { background: var(--ce-warning-soft);  border-color: transparent; color: var(--ce-warning-ink); }
.ce-alert-danger  { background: var(--ce-danger-soft);   border-color: transparent; color: var(--ce-danger-ink); }
.ce-alert strong { font-weight: 600; }
.ce-alert p { margin: 2px 0 0; color: var(--ce-text-2); font-size: 13.5px; }

/* ---- Tabs (Reiter / register tabs) -------------------------------------- */
.ce-tabs { display: flex; align-items: flex-end; gap: 6px; padding: 0 10px 0 16px; }
.ce-tab {
  position: relative;
  font-family: var(--ce-font-sans); font-weight: 600; font-size: 14px; color: var(--ce-text-3);
  background: var(--ce-surface-2);
  border: 1px solid var(--ce-border); border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 5px 20px; cursor: pointer;
  transition: color .16s var(--ce-ease), background-color .16s var(--ce-ease);
}
.ce-tab:hover { color: var(--ce-text-2); background: var(--ce-surface-3); }
/* active tab: pure surface, raised, seamlessly merging into the panel below */
.ce-tab[aria-selected="true"] {
  color: var(--ce-primary-ink); background: var(--ce-surface);
  z-index: 2; margin-bottom: -1px; padding-bottom: 7px;
}

/* ---- Stat tiles ---------------------------------------------------------- */
.ce-stat { padding: 20px; }
.ce-stat .k { font-family: var(--ce-font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ce-text-3); }
.ce-stat .v { font-family: var(--ce-font-display); font-weight: 600; font-size: 34px; line-height: 1.05; margin-top: 8px; letter-spacing: -0.02em; }
.ce-stat .d { font-size: 13px; margin-top: 8px; color: var(--ce-text-2); display: flex; align-items: center; gap: 6px; }

/* ---- Nav ----------------------------------------------------------------- */
.ce-nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  font-family: var(--ce-font-sans); font-weight: 500; font-size: 14.5px; color: var(--ce-text-2);
  padding: 10px 12px; border-radius: var(--ce-r-sm); cursor: pointer; border: none; background: none; text-align: left;
  transition: background-color .16s var(--ce-ease), color .16s var(--ce-ease);
}
.ce-nav-item [data-ce-icon] { width: 19px; height: 19px; opacity: .85; }
.ce-nav-item:hover { background: var(--ce-surface-3); color: var(--ce-text); }
.ce-nav-item.active { background: var(--ce-primary-soft); color: var(--ce-primary-ink); font-weight: 600; }
.ce-nav-item.active [data-ce-icon] { opacity: 1; }
.ce-nav-group { font-family: var(--ce-font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ce-text-3); padding: 0 12px; margin: 22px 0 8px; }

/* Avatar */
.ce-avatar { width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; font-family: var(--ce-font-display); font-weight: 600; font-size: 14px; background: var(--ce-primary-soft); color: var(--ce-primary-ink); flex: none; }

/* Divider */
.ce-hr { height: 1px; background: var(--ce-border); border: none; margin: 0; }

/* Modal */
.ce-modal-scrim { position: fixed; inset: 0; background: rgba(8,12,20,.55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 24px; z-index: 80; opacity: 0; pointer-events: none; transition: opacity .25s var(--ce-ease); }
.ce-modal-scrim.open { opacity: 1; pointer-events: auto; }
.ce-modal { width: 100%; max-width: 520px; background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-r-lg); box-shadow: var(--ce-shadow-lg); transform: translateY(12px) scale(.985); transition: transform .25s var(--ce-ease); }
.ce-modal-scrim.open .ce-modal { transform: none; }

/* Progress / meter */
.ce-meter { height: 7px; border-radius: 99px; background: var(--ce-surface-3); overflow: hidden; }
.ce-meter > span { display: block; height: 100%; border-radius: 99px; background: var(--ce-primary); }

/* Focus-visible polish on interactive */
.ce-nav-item:focus-visible, .ce-tab:focus-visible, .ce-switch:focus-within .track { outline: none; box-shadow: 0 0 0 4px var(--ce-ring); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
