/**
 * base.css
 * Liminality Editorial Design System — Tokens, typography, grid, and layout.
 */

:root {
  /* Liminality Paper & Ink Tokens */
  --paper: #f5f4ef;
  --card: #faf9f5;
  --badge: #eae8e0;
  --ink: #0e0d0a;
  --muted: #595850;
  --tertiary: #66655e;
  --rule: #d7d6cf;
  --grid-line: rgba(14, 13, 10, 0.05);
  --selection: rgba(14, 13, 10, 0.15);

  --font-grotesk: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Space Mono", ui-monospace, SFMono-Regular, monospace;
  --font-serif: Georgia, serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-card: 16px;
  --radius-pill: 100px;
}

html[data-theme="dark"] {
  --paper: #0e0d0a;
  --card: #151410;
  --badge: #22211c;
  --ink: #f5f4ef;
  --muted: #a3a195;
  --tertiary: #87857b;
  --rule: #2a2924;
  --grid-line: rgba(245, 244, 239, 0.06);
  --selection: rgba(245, 244, 239, 0.25);
}

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

html, body {
  min-height: 100%;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-grotesk);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--selection);
  color: var(--ink);
}

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 32px Hairline Grid Motif */
.liminal-grid {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Architectural Corner Marks */
.corner-mark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--tertiary);
  border-width: 1px;
  pointer-events: none;
  z-index: 2;
}
.corner-mark-tl { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.corner-mark-tr { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.corner-mark-bl { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.corner-mark-br { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* Header */
.app-header {
  height: 64px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-symbol {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  object-fit: contain;
  display: block;
}

html[data-theme="dark"] .brand-symbol {
  filter: invert(1);
}

.brand-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--badge);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

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

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.theme-toggle-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Master Grid */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
}

@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
}

.panel {
  overflow-y: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
