/* platform-core.css — Unified Version 1.0 Design System & Framework */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  --bg-page: #eaedf1;
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-main: #1c1e21;
  --text-muted: #5c6370;
  --text-light: #868e96;
  --border-color: #d1d5db;
  --accent: #0f4c81;
  --accent-hover: #083358;
  --status-draft: #d97706;
  --header-height: 80px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: var(--font-sans); font-size: 16px; line-height: 1.75; color: var(--text-main); background-color: var(--bg-page); scroll-behavior: smooth; }
body { min-height: 100vh; display: flex; flex-direction: column; position: relative; }

/* Platform Header & Brand Area */
.site-header { min-height: var(--header-height); border-bottom: 1px solid var(--border-color); background: var(--bg-primary); position: sticky; top: 0; z-index: 1000; padding: 0.75rem 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1400px; margin: 0 auto; padding: 0 2rem; gap: 1.5rem; flex-wrap: wrap; }
.brand-group { display: flex; flex-direction: column; gap: 0.15rem; }
.brand-title { font-weight: 700; font-size: 0.9rem; letter-spacing: 0.08em; color: var(--text-main); text-transform: uppercase; text-decoration: none; }

/* Institutional Identity Badge */
.brand-badge, .institutional-tag { display: inline-block; font-size: 0.65rem; font-family: var(--font-mono); color: var(--accent); background: #e0f2fe; border: 1px solid #bae6fd; padding: 2px 6px; border-radius: 2px; text-decoration: none; width: fit-content; font-weight: 600; }

/* Unified Navigation & Navigation Cards */
.main-nav { display: flex; gap: 0.5rem; align-items: stretch; flex-wrap: wrap; }
.nav-card {
  display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0.4rem 0.75rem;
  background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 3px;
  text-decoration: none; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); min-height: 44px; transition: all 0.15s; position: relative; white-space: nowrap; cursor: pointer;
}
.nav-card:hover:not(.disabled) { background: #fff; border-color: var(--accent); color: var(--accent); }
.nav-card.active { background: #fff; border-color: var(--accent); color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }

/* Locked Navigation State & Tooltips */
.nav-card.disabled { background: #f1f5f9; color: #94a3b8; border-color: #e2e8f0; cursor: pointer; }
.nav-card-content { display: flex; align-items: center; gap: 4px; }
.lock-icon { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2; fill: none; }
.nav-card.disabled::after {
  content: "Available after participant activation";
  position: absolute; bottom: -32px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; font-size: 0.68rem; font-family: var(--font-mono); padding: 3px 8px; border-radius: 3px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 100;
}
.nav-card.disabled:hover::after { opacity: 1; }
.btn-nav-join { background: var(--accent) !important; color: #ffffff !important; border-color: var(--accent) !important; }

/* Button System */
.btn-primary, .btn-action, .btn-submit-inline, .btn-modal.primary {
  background: var(--accent); color: #fff; border: none; padding: 0.75rem 1rem; font-size: 0.85rem; font-weight: 600; border-radius: 2px; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; transition: background 0.15s;
}
.btn-primary:hover, .btn-action:hover, .btn-submit-inline:hover, .btn-modal.primary:hover { background: var(--accent-hover); }
.btn-secondary, .btn-modal.secondary {
  background: var(--bg-secondary); color: var(--text-main); border: 1px solid var(--border-color); padding: 0.65rem 1rem; font-size: 0.85rem; font-weight: 600; border-radius: 2px; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; transition: background 0.15s;
}
.btn-secondary:hover { background: #f1f5f9; }

/* Card Components */
.card-block, .info-card-block, .public-info-sidebar, .association-card, .participation-card, .naming-card {
  background: var(--bg-primary); border: 1px solid var(--border-color); border-top: 4px solid var(--accent); padding: 2rem; box-shadow: 0 2px 6px rgba(0,0,0,0.01);
}

/* Dialogs (Modal Windows) */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal-overlay.active { display: flex; }
.modal-box { background: #fff; border: 1px solid var(--border-color); width: 100%; max-width: 440px; padding: 2rem; box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-radius: 3px; }
.modal-title { font-size: 1.2rem; font-weight: 700; color: #0f172a; margin-bottom: 0.5rem; }
.modal-subtitle { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; line-height: 1.5; }
.modal-welcome-line { font-size: 0.82rem; color: var(--accent); background: #f0fdf4; border: 1px solid #bbf7d0; padding: 0.65rem 0.85rem; margin-bottom: 1.25rem; line-height: 1.4; font-weight: 500; }

/* Form Controls */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; margin-bottom: 0.3rem; color: var(--text-main); font-family: var(--font-mono); }
.form-input, textarea.form-input { width: 100%; padding: 0.65rem; font-size: 0.9rem; border: 1px solid var(--border-color); font-family: var(--font-sans); background: #fff; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

/* Side Accent Labels (used on index.html and representation.html) */
.side-label-left, .side-label-right {
  position: fixed; top: 50%; transform: translateY(-50%) rotate(-90deg);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.15em; color: #94a3b8;
  text-transform: uppercase; pointer-events: none; z-index: 10; white-space: nowrap;
}
.side-label-left { left: -45px; }
.side-label-right { right: -45px; transform: translateY(-50%) rotate(90deg); }
@media (max-width: 1200px) {
  .side-label-left, .side-label-right { display: none; }
}

/* Footer & Layout Grid */
.site-footer { margin-top: auto; border-top: 1px solid var(--border-color); background: var(--bg-primary); padding: 1.75rem 0; font-size: 0.85rem; color: var(--text-muted); }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; }
.footer-links { display: flex; gap: 2rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: var(--accent); }
.participant-workspace-nav{display:flex;align-items:center;gap:.35rem;margin-left:.35rem}
.participant-workspace-nav .workspace-primary{font-weight:800}
.participant-workspace-nav .workspace-link{font-size:.72rem;color:var(--text-muted);padding:.35rem .45rem;text-decoration:none;white-space:nowrap}
.participant-workspace-nav .workspace-link:hover{color:var(--accent)}
@media(max-width:900px){.participant-workspace-nav{flex-wrap:wrap}}

/* Mobile navigation */
.mobile-nav-toggle,
.mobile-nav-panel,
.mobile-nav-backdrop { display: none; }

@media (max-width: 768px) {
  :root { --header-height: 64px; }

  .site-header { min-height: var(--header-height); padding: 0; }
  .header-inner {
    min-height: var(--header-height);
    padding: 0 1rem;
    gap: 0.75rem;
    flex-wrap: nowrap;
  }
  .brand-group { min-width: 0; flex: 1 1 auto; }
  .brand-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    letter-spacing: 0.055em;
  }
  .brand-badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .main-nav { display: none; }

  .mobile-nav-toggle {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--accent);
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-nav-toggle:hover { background: #fff; border-color: var(--accent); }
  .mobile-nav-toggle:focus-visible { outline: 3px solid rgba(15,76,129,.22); outline-offset: 2px; }
  .mobile-nav-toggle .mobile-nav-icon { width: 20px; height: 16px; position: relative; display: block; }
  .mobile-nav-toggle .mobile-nav-icon::before,
  .mobile-nav-toggle .mobile-nav-icon::after,
  .mobile-nav-toggle .mobile-nav-icon span {
    content: "";
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .18s ease, opacity .18s ease, top .18s ease;
  }
  .mobile-nav-toggle .mobile-nav-icon::before { top: 0; }
  .mobile-nav-toggle .mobile-nav-icon span { top: 7px; }
  .mobile-nav-toggle .mobile-nav-icon::after { top: 14px; }
  .mobile-nav-toggle[aria-expanded="true"] .mobile-nav-icon::before { top: 7px; transform: rotate(45deg); }
  .mobile-nav-toggle[aria-expanded="true"] .mobile-nav-icon span { opacity: 0; }
  .mobile-nav-toggle[aria-expanded="true"] .mobile-nav-icon::after { top: 7px; transform: rotate(-45deg); }

  .mobile-nav-backdrop {
    position: fixed;
    inset: var(--header-height) 0 0;
    display: block;
    background: rgba(15, 23, 42, .32);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease;
    z-index: 1090;
  }
  .mobile-nav-backdrop.is-open { opacity: 1; visibility: visible; pointer-events: auto; }

  .mobile-nav-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100vh - var(--header-height) - 16px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    padding: .75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    box-shadow: 0 14px 32px rgba(15,23,42,.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    z-index: 1100;
  }
  .mobile-nav-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
  .mobile-nav-panel .mobile-nav-item {
    min-height: 48px;
    display: flex;
    align-items: center;
    width: 100%;
    padding: .7rem .85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-main);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 650;
  }
  .mobile-nav-panel .mobile-nav-item:hover,
  .mobile-nav-panel .mobile-nav-item:focus-visible { background: #fff; border-color: var(--accent); color: var(--accent); outline: none; }
  .mobile-nav-panel .mobile-nav-item.active { border-color: var(--accent); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); background: #fff; }
  .mobile-nav-panel .mobile-nav-item.mobile-nav-primary { background: var(--accent); color: #fff; border-color: var(--accent); margin-top: .25rem; justify-content: center; font-weight: 750; }
  .mobile-nav-panel .mobile-nav-item.mobile-nav-primary:hover,
  .mobile-nav-panel .mobile-nav-item.mobile-nav-primary:focus-visible { background: var(--accent-hover); color: #fff; }
  .mobile-nav-panel .mobile-nav-divider { height: 1px; background: #e2e8f0; margin: .35rem 0; }

  body.mobile-nav-open { overflow: hidden; }

  /* Compact page framing */
  .page-container,
  .workspace-page-wrapper { padding-left: 1rem !important; padding-right: 1rem !important; margin-top: 1.25rem !important; }
  .hero-section { padding: 2rem 1.25rem !important; }
  .hero-headline-l1 { font-size: 1.8rem !important; line-height: 1.2; }
  .hero-headline-l2 { font-size: 1.2rem !important; margin-bottom: 1.5rem; }
  .hero-paragraph { font-size: .96rem; line-height: 1.65; }
  .principle-card { height: auto; min-height: 120px; padding: 1.25rem .9rem; }
  .journey-box { padding: 1rem; flex-direction: column; align-items: flex-start; gap: .5rem; }
  .roadmap-progress-section { padding: 1.25rem 1rem; }

  /* Mobile-safe dialogs */
  .modal-overlay { padding: 1rem; overflow-y: auto; }
  .modal-box { width: min(440px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.25rem; }
  .modal-title { font-size: 1.1rem; }
  .modal-subtitle { font-size: .84rem; }
  .modal-actions { flex-direction: column; gap: .55rem; }
  .modal-actions .btn-modal { width: 100%; min-height: 44px; }

  /* Footer stacks cleanly on narrow screens */
  .footer-inner { padding: 0 1rem; flex-direction: column; align-items: flex-start; gap: 1rem; }
  .footer-links { width: 100%; flex-direction: column; gap: .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-toggle .mobile-nav-icon::before,
  .mobile-nav-toggle .mobile-nav-icon::after,
  .mobile-nav-toggle .mobile-nav-icon span,
  .mobile-nav-panel,
  .mobile-nav-backdrop { transition: none; }
}
