/* PORTIS Foundation page styles
 * For the design canvas at portis-foundation.html
 */

/* ── Page chrome ─────────────────────────── */
.page-head {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.page-head-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-7);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  text-decoration: none; color: var(--text-primary);
}
.brand-mark { width: 22px; height: 22px; color: var(--accent); fill: currentColor; }
.brand-mark.big { width: 56px; height: 56px; }
.brand-word {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}
.brand-word.big { font-size: 36px; }
.brand-sub {
  font-family: var(--font-body); font-weight: 500; font-size: var(--fs-xs);
  color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase;
  padding-left: var(--sp-2); border-left: 1px solid var(--border);
  margin-left: var(--sp-1);
}
.brand.stacked { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand.stacked .brand-sub { padding-left: 0; border-left: 0; margin-left: 0; }

.page-head-nav { display: flex; gap: var(--sp-1); }
.page-head-nav a {
  text-decoration: none; color: var(--text-secondary);
  font-size: var(--fs-base); font-weight: 500;
  padding: 8px 14px; border-radius: var(--r-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.page-head-nav a:hover { background: var(--bg-sunken); color: var(--text-primary); }
.page-head-nav a.active { background: var(--accent-soft); color: var(--accent-strong); }

.canvas { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-9) var(--sp-7); }
.page-foot {
  max-width: var(--content-max); margin: 0 auto;
  padding: var(--sp-8) var(--sp-7); color: var(--text-muted); font-size: var(--fs-sm);
  border-top: 1px solid var(--border);
}

/* ── Intro ───────────────────────────────── */
.intro { max-width: 760px; margin-bottom: var(--sp-10); }
.eyebrow {
  font-family: var(--font-body); font-size: var(--fs-xs);
  font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 var(--sp-3) 0;
}
.intro h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: var(--fs-4xl); line-height: 1.05; letter-spacing: -0.025em;
  color: var(--text-primary); margin: 0 0 var(--sp-5) 0;
}
.lede { font-size: var(--fs-lg); line-height: 1.55; color: var(--text-secondary); margin: 0; }

/* ── Block ───────────────────────────────── */
.block { margin-bottom: var(--sp-10); }
.block-head {
  display: flex; align-items: baseline; gap: var(--sp-4);
  border-bottom: 1px solid var(--border); padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.block-num {
  font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-muted); letter-spacing: 0.05em;
}
.block-head h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-2xl); letter-spacing: -0.015em;
  color: var(--text-primary); margin: 0;
}
.block-lede { color: var(--text-secondary); max-width: 780px; margin: 0 0 var(--sp-6) 0; }

/* ── Principles ──────────────────────────── */
.principles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.principle {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-6);
}
.principle h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-lg); margin: 0 0 var(--sp-2) 0; color: var(--text-primary);
}
.principle p { color: var(--text-secondary); margin: 0; }

/* ── Logo ────────────────────────────────── */
.logo-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-4);
  grid-auto-rows: minmax(180px, auto);
}
.logo-tile {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); text-align: center; position: relative;
}
.logo-tile-hero { grid-row: span 2; flex-direction: column; gap: var(--sp-4); }
.logo-tile-hero .brand-mark.big { width: 96px; height: 96px; }
.logo-tile-hero .brand-word.big { font-size: 56px; }
.logo-caption {
  position: absolute; top: var(--sp-3); left: var(--sp-4);
  font-size: var(--fs-xs); color: var(--text-muted);
  font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.logo-sizes { display: flex; align-items: flex-end; gap: var(--sp-4); color: var(--accent); fill: currentColor; }

/* ── Type ────────────────────────────────── */
.type-stack {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.type-row {
  display: grid; grid-template-columns: 260px 1fr; gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.type-row:last-child { border-bottom: none; }
.type-meta { display: flex; flex-direction: column; gap: 2px; }
.type-spec { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-secondary); }
.type-use { font-size: var(--fs-xs); color: var(--text-muted); }
.type-sample { color: var(--text-primary); }

/* ── Tokens ──────────────────────────────── */
.token-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.token-group {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-5);
}
.token-group h4 {
  font-family: var(--font-display); font-size: var(--fs-base); font-weight: 600;
  margin: 0 0 var(--sp-3) 0; color: var(--text-primary);
}
.swatch {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm);
  margin-bottom: var(--sp-2); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: var(--fs-xs);
}
.swatch span { mix-blend-mode: difference; color: #fff; opacity: 0.85; }
.swatch.text-swatch { background: var(--bg-base); }
.swatch.text-swatch span { mix-blend-mode: normal; color: var(--text-muted); }
.swatch.text-swatch b { font-family: var(--font-display); font-size: var(--fs-xl); }

/* ── Components ──────────────────────────── */
.comp-h {
  font-family: var(--font-display); font-size: var(--fs-md); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin: var(--sp-7) 0 var(--sp-3) 0;
}
.comp-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-body); font-weight: 600; font-size: var(--fs-base);
  padding: 8px 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: all var(--dur-fast); text-decoration: none;
}
.btn-primary { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-secondary { background: var(--bg-raised); color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-sunken); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-sunken); color: var(--text-primary); }
/* Phase 268 — persistent, prominent, session-aware Sign in CTA in the public topbar.
   Accent-filled (always visible, including mobile); 44px min touch target on phones. */
.btn-signin { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); font-weight: 600; }
.btn-signin:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
@media (max-width: 760px) { .btn-signin { min-height: 44px; padding-top: 10px; padding-bottom: 10px; } }
.btn-danger { background: var(--status-danger); color: #fff; border-color: var(--status-danger); }
.btn-sm { padding: 5px 11px; font-size: var(--fs-sm); }
.btn-icon { padding: 6px 10px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.04em; padding: 3px 9px; border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.badge-ok      { background: var(--status-ok-soft); color: var(--status-ok); }
.badge-warn    { background: var(--status-warn-soft); color: var(--status-warn); }
.badge-danger  { background: var(--status-danger-soft); color: var(--status-danger); }
.badge-info    { background: var(--status-info-soft); color: var(--status-info); }
.badge-neutral { background: var(--bg-sunken); color: var(--text-muted); border-color: var(--border); }
.badge-pulse::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--status-ok); box-shadow: 0 0 0 0 var(--status-ok);
  animation: pulseDot 2s var(--ease-out) infinite;
}
@keyframes pulseDot {
  0%,100% { box-shadow: 0 0 0 0 var(--status-ok); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600;
  padding: 2px 8px; border-radius: var(--r-xs);
  background: var(--bg-sunken); color: var(--text-secondary); border: 1px solid var(--border);
}
.tag-noaa { background: color-mix(in oklab, var(--noaa) 12%, transparent); color: var(--noaa); border-color: color-mix(in oklab, var(--noaa) 30%, transparent); }
.tag-eccc { background: color-mix(in oklab, var(--eccc) 12%, transparent); color: var(--eccc); border-color: color-mix(in oklab, var(--eccc) 30%, transparent); }

/* Instrument tiles */
.instrument-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.instrument {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5);
  display: flex; flex-direction: column; gap: 4px;
}
.instrument.warn { border-color: var(--status-warn); background: var(--status-warn-soft); }
.instr-label {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
}
.instr-value {
  font-family: var(--font-mono); font-weight: 600; font-size: var(--fs-2xl);
  color: var(--text-primary); font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.instr-value small { font-size: var(--fs-base); color: var(--text-muted); margin-left: 4px; font-weight: 500; }
.instr-foot { font-size: var(--fs-sm); color: var(--text-secondary); }
.status-ok { color: var(--status-ok); }
.status-warn { color: var(--status-warn); }

/* Card */
.sample-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.card-head {
  padding: var(--sp-5) var(--sp-6); display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--sp-4); border-bottom: 1px solid var(--border); background: var(--bg-raised);
}
.card-eyebrow {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted); margin: 0 0 4px 0;
}
.card-title {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg);
  margin: 0; color: var(--text-primary);
}
.card-actions { display: flex; gap: var(--sp-2); align-items: center; }
.card-body { padding: var(--sp-5) var(--sp-6); }
.card-foot {
  padding: var(--sp-3) var(--sp-6); border-top: 1px solid var(--border);
  background: var(--bg-sunken);
}
.card-meta { font-size: var(--fs-xs); color: var(--text-muted); }

.kv-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3) var(--sp-6); margin: 0; }
.kv-list > div { display: flex; flex-direction: column; gap: 2px; }
.kv-list dt {
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-muted);
}
.kv-list dd {
  font-family: var(--font-mono); font-size: var(--fs-base); color: var(--text-primary);
  margin: 0; font-variant-numeric: tabular-nums;
}
.kv-list .muted { color: var(--text-muted); font-weight: 400; }

/* Table */
.table-wrap {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden;
}
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap thead th {
  background: var(--bg-raised); padding: var(--sp-3) var(--sp-4);
  text-align: left; font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.table-wrap thead th.num { text-align: right; }
.table-wrap tbody td {
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
  font-size: var(--fs-base); color: var(--text-primary);
}
.table-wrap tbody td.num {
  text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover { background: var(--row-hover); }
.table-wrap tbody tr.warn-row { background: var(--status-warn-soft); }

/* Alerts */
.alert {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md);
  margin-bottom: var(--sp-3); border: 1px solid var(--border);
  background: var(--bg-surface);
}
.alert-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 7px;
}
.alert-info    { background: var(--status-info-soft); border-color: color-mix(in oklab, var(--status-info) 30%, transparent); }
.alert-info .alert-dot { background: var(--status-info); }
.alert-warn    { background: var(--status-warn-soft); border-color: color-mix(in oklab, var(--status-warn) 30%, transparent); }
.alert-warn .alert-dot { background: var(--status-warn); }
.alert-danger  { background: var(--status-danger-soft); border-color: color-mix(in oklab, var(--status-danger) 30%, transparent); }
.alert-danger .alert-dot { background: var(--status-danger); }
.alert strong { color: var(--text-primary); }

/* Shell preview */
.shell-preview {
  display: grid; grid-template-columns: var(--rail-w-expanded) 1fr;
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; min-height: 480px; background: var(--bg-base);
}
.shell-rail {
  background: var(--bg-surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-3);
}
.rail-brand {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-2) var(--sp-5);
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-lg);
  color: var(--text-primary);
}
.rail-brand .brand-mark { color: var(--accent); fill: currentColor; }
.shell-rail nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.rail-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px var(--sp-3); border-radius: var(--r-sm);
  font-size: var(--fs-base); color: var(--text-secondary);
  text-decoration: none; cursor: pointer;
}
.rail-item:hover { background: var(--bg-sunken); color: var(--text-primary); }
.rail-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.rail-icon { width: 20px; text-align: center; opacity: 0.7; }
.rail-badge {
  margin-left: auto; font-style: normal;
  font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600;
  background: var(--accent); color: var(--text-on-accent);
  padding: 1px 6px; border-radius: var(--r-pill);
}
.rail-foot { border-top: 1px solid var(--border); padding-top: var(--sp-3); margin-top: var(--sp-3); }
.rail-user {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); margin-top: var(--sp-2);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--text-on-accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 600; font-size: var(--fs-xs);
}
.rail-user strong { display: block; font-size: var(--fs-sm); color: var(--text-primary); }
.rail-user small { display: block; font-size: var(--fs-xs); color: var(--text-muted); }

.shell-main { display: flex; flex-direction: column; }
.shell-top {
  height: var(--topbar-h); padding: 0 var(--sp-6);
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-5);
  border-bottom: 1px solid var(--border); background: var(--bg-surface);
}
.shell-context .eyebrow { margin: 0 0 2px 0; font-size: 10px; }
.shell-context h3 {
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md);
  margin: 0; color: var(--text-primary);
}
.shell-pills { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 4px 10px;
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-secondary);
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-dot.ok { background: var(--status-ok); }
.pill-dot.warn { background: var(--status-warn); }
.pill-dot.info { background: var(--status-info); }
.shell-body { padding: var(--sp-6); flex: 1; }
.shell-note { color: var(--text-muted); font-style: italic; }

/* Next list */
.next-list {
  list-style: none; padding: 0; margin: 0;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md);
}
.next-list li {
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
  color: var(--text-secondary); line-height: 1.55;
}
.next-list li:last-child { border-bottom: none; }
.next-list a { color: var(--accent); text-decoration: none; font-weight: 600; }
.next-list a:hover { text-decoration: underline; }
.next-list code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-sunken); padding: 1px 5px; border-radius: 3px; }

/* Responsive */
@media (max-width: 900px) {
  .principles, .token-grid, .instrument-grid, .kv-list { grid-template-columns: 1fr; }
  .logo-grid { grid-template-columns: 1fr; }
  .logo-tile-hero { grid-row: auto; }
  .type-row { grid-template-columns: 1fr; gap: var(--sp-2); }
  .shell-preview { grid-template-columns: 1fr; }
  .shell-rail { display: none; }
}
