/* Graphite Portal — design tokens + base */
:root {
  --ink: #0E0E10;
  --ink-2: #1A1A1E;
  --ink-3: #2A2A30;
  --paper: #FFFFFF;
  --bone: #F5F3EE;
  --bone-2: #EDEAE2;
  --line: #E4E0D6;
  --line-dark: #2E2E34;
  --muted: #6B6B72;
  --muted-2: #95959C;
  --accent: #FF5A4E;
  --accent-ink: #1A1A1E;
  --ok: oklch(62% 0.13 155);
  --warn: oklch(72% 0.16 75);
  --crit: oklch(58% 0.20 25);

  --r: 14px;
  --r-sm: 8px;
  --chamfer: 18px;

  --density: 1;

  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bone);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* Chamfered corner — top-right + bottom-left diagonal cut */
.chamfer {
  clip-path: polygon(
    0 0,
    calc(100% - var(--chamfer)) 0,
    100% var(--chamfer),
    100% 100%,
    var(--chamfer) 100%,
    0 calc(100% - var(--chamfer))
  );
}
.chamfer-tr {
  clip-path: polygon(
    0 0,
    calc(100% - var(--chamfer)) 0,
    100% var(--chamfer),
    100% 100%,
    0 100%
  );
}
.chamfer-sm {
  --chamfer: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.btn-primary:hover { background: #ff7065; border-color: #ff7065; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--bone); }
.btn-ghost-light {
  background: transparent;
  color: var(--bone);
  border-color: var(--bone);
}
.btn-ghost-light:hover { background: var(--bone); color: var(--ink); }
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-quiet:hover { background: var(--paper); border-color: var(--ink); }
.btn-pill-arrow::after {
  content: "→";
  font-size: 14px;
  margin-left: 2px;
}

/* Cards */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  position: relative;
}
.card-dark {
  background: var(--ink-2);
  color: var(--bone);
  border: 1px solid var(--line-dark);
}

/* Eyebrow / kicker */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-coral { color: var(--accent); }

/* Editorial headline */
.h-display {
  font-size: clamp(40px, 5.4vw, 72px);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin: 0;
}
.h-display .accent {
  color: var(--accent);
  font-style: italic;
  font-family: var(--font-serif);
  font-weight: 400;
}

.h-section {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}

/* Divider */
.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--paper);
}
.pill-ok { color: var(--ok); border-color: color-mix(in oklch, var(--ok) 35%, var(--line)); background: color-mix(in oklch, var(--ok) 8%, var(--paper)); }
.pill-warn { color: var(--warn); border-color: color-mix(in oklch, var(--warn) 35%, var(--line)); background: color-mix(in oklch, var(--warn) 10%, var(--paper)); }
.pill-crit { color: var(--crit); border-color: color-mix(in oklch, var(--crit) 35%, var(--line)); background: color-mix(in oklch, var(--crit) 8%, var(--paper)); }
.pill-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* Sidebar nav item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--muted-2);
  font-size: 14px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.nav-item:hover { color: var(--bone); background: rgba(255,255,255,0.04); }
.nav-item.active {
  background: var(--bone);
  color: var(--ink);
  border-color: var(--bone);
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Inputs */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--ink); }
.input-dark {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--bone);
}
.input-dark:focus { border-color: var(--accent); }
.input-dark::placeholder { color: var(--muted-2); }

/* KBD */
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
}

/* Mono code block */
.code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--ink);
  color: #E8E5DD;
  padding: 16px 18px;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre;
  border: 1px solid var(--line-dark);
}
.code .tok-key { color: #FF8A82; }
.code .tok-str { color: #B8E0A6; }
.code .tok-num { color: #F0C77A; }
.code .tok-com { color: #6B6B72; }
.code .tok-fn  { color: #82BFE0; }

/* Subtle striped placeholder for imagery */
.placeholder-img {
  background:
    repeating-linear-gradient(
      135deg,
      var(--bone-2) 0 8px,
      var(--bone) 8px 16px
    );
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Density */
[data-density="comfy"] .row { padding-block: 18px; }
[data-density="cozy"] .row { padding-block: 12px; }
[data-density="compact"] .row { padding-block: 8px; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
.dark-scroll ::-webkit-scrollbar-thumb { background: var(--ink-3); }

/* Table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  text-align: left;
  padding: 14px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  font-weight: 500;
  color: var(--muted);
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bone);
}
.tbl tbody tr { transition: background 0.12s; }
.tbl tbody tr:hover { background: var(--bone); }

/* Animations */
@keyframes pulse-coral {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--accent) 50%, transparent); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
@keyframes scan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.4s ease both; }

/* Sparkline */
.spark { width: 100%; height: 38px; }

/* Login background */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}
.login-bg::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, color-mix(in oklch, var(--accent) 18%, transparent), transparent 40%),
    radial-gradient(circle at 80% 70%, color-mix(in oklch, var(--accent) 8%, transparent), transparent 50%);
  filter: blur(40px);
}
.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
}

/* Severity bars */
.sev-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bone-2);
  overflow: hidden;
  position: relative;
}
.sev-bar-fill {
  position: absolute; inset: 0; right: auto;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 56px 32px;
  text-align: center;
  background: var(--paper);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.active {
  border-color: var(--accent);
  background: color-mix(in oklch, var(--accent) 4%, var(--paper));
}

/* Annotated overlay marker */
.marker {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--paper);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: transform 0.15s;
}
.marker:hover { transform: scale(1.12); }
.marker.warn { background: var(--warn); }
.marker.crit { background: var(--crit); color: var(--paper); }

/* Logo wordmark */
.wordmark {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.wordmark-mark {
  width: 18px; height: 18px;
  background: var(--accent);
  display: inline-block;
  clip-path: polygon(0 0, 70% 0, 100% 30%, 100% 100%, 30% 100%, 0 70%);
}

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Mobile drawer ─── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  animation: fade-up 0.2s ease;
}
.drawer-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  body { font-size: 14px; }

  /* Wraps tables so they horizontally scroll instead of overflowing the page */
  .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-scroll .tbl { min-width: 640px; }
  .tbl th, .tbl td { padding: 12px 12px; font-size: 13px; }

  .code { padding: 12px 14px; font-size: 11.5px; }

  /* Hide ⌘K hint, it's keyboard-only anyway */
  .kbd-hide-mobile { display: none; }

  /* Drawer toggle visible only on mobile */
  .drawer-toggle { display: inline-flex; }

  /* Tighter card padding everywhere */
  .card { /* unchanged */ }

  /* Pills can wrap on narrow rows */
  .pill { font-size: 10px; padding: 3px 8px; }

  /* Buttons keep tap target */
  .btn { padding: 10px 14px; }

  /* Tab strip horizontal scroll */
  .tab-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap !important; }
  .tab-scroll::-webkit-scrollbar { height: 0; }

  /* Login bg grid less dense */
  .login-bg::after { background-size: 32px 32px; }
}

@media (max-width: 480px) {
  .h-display { font-size: clamp(32px, 9vw, 44px); }
  .h-section { font-size: clamp(24px, 6vw, 32px); }
}
