/* ========================================================================== */
/* TrailPlanner Design System — base.css                                      */
/* Tokens, theme wrappers, layout primitives and shared header                */
/* ========================================================================== */

:root {
  /* Brand */
  --tp-brand-900:#10263d;
  --tp-brand-700:#1f55b6;
  --tp-brand-600:#2563eb;
  --tp-brand-500:#4b8dff;
  --tp-accent-green:#2ac27a;
  --tp-accent-cyan:#22d3ee;
  /* Brand wordmark tokens. */
  --brand-pace:#f8fafc;
  --brand-your:var(--tp-brand-600);
  --brand-trail:var(--brand-pace);
  --brand-your-trail:#5a9e6f;
  --brand-trail-trail:#f58b32;

  /* Public dark theme */
  --tp-public-bg:#07131d;
  --tp-public-bg-soft:#0d1c2b;
  --tp-public-surface:#0f1f31;
  --tp-public-surface-muted:#15283b;
  --tp-public-border:rgba(157, 184, 208, 0.18);
  --tp-public-text:#f5f9ff;
  --tp-public-text-muted:#9eb1c5;

  /* App shell palette */
  --tp-app-bg:#f2f6fb;
  --tp-app-bg-soft:#f8fbff;
  --tp-app-surface:#ffffff;
  --tp-app-surface-muted:#f5f8fc;
  --tp-app-border:#d7e1ec;
  --tp-app-text:#102338;
  --tp-app-text-muted:#5e7288;

  /* Shared semantic colors */
  --tp-primary:var(--tp-brand-600);
  --tp-primary-hover:var(--tp-brand-700);
  --tp-success:#059669;
  --tp-warning:#d97706;
  --tp-danger:#dc2626;
  --tp-info:#2563eb;

  /* Typography */
  --tp-font-sans:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --tp-font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --tp-text-xs:clamp(.75rem, .72rem + .12vw, .8125rem);
  --tp-text-sm:clamp(.8125rem, .78rem + .15vw, .875rem);
  --tp-text-base:clamp(.95rem, .92rem + .16vw, 1rem);
  --tp-text-lg:clamp(1.08rem, 1rem + .28vw, 1.2rem);
  --tp-text-xl:clamp(1.28rem, 1.12rem + .7vw, 1.55rem);
  --tp-text-2xl:clamp(1.6rem, 1.3rem + 1vw, 2.1rem);
  --tp-text-3xl:clamp(1.9rem, 1.45rem + 1.8vw, 2.9rem);
  --tp-text-hero:clamp(2.85rem, 2rem + 3vw, 4.9rem);

  /* Spacing */
  --tp-space-1:.25rem;
  --tp-space-2:.5rem;
  --tp-space-3:.75rem;
  --tp-space-4:1rem;
  --tp-space-5:1.25rem;
  --tp-space-6:1.5rem;
  --tp-space-8:2rem;
  --tp-space-10:2.5rem;
  --tp-space-12:3rem;

  /* Radius */
  --tp-radius-sm:.5rem;
  --tp-radius-md:.875rem;
  --tp-radius-lg:1.125rem;
  --tp-radius-xl:1.5rem;
  --tp-radius-pill:999px;

  /* Shadows */
  --tp-shadow-sm:0 10px 24px rgb(16 35 56 / .08);
  --tp-shadow-card:0 18px 42px rgb(16 35 56 / .10);
  --tp-shadow-elevated:0 30px 70px rgb(4 17 32 / .24);

  /* Dark-only semantic defaults */
  --tp-theme-bg:#06111d;
  --tp-theme-bg-soft:#0a1625;
  --tp-theme-surface:#0f1f31;
  --tp-theme-surface-muted:#14283d;
  --tp-theme-border:rgba(157, 184, 208, .20);
  --tp-theme-text:#f5f9ff;
  --tp-theme-text-muted:#9eb1c5;
  --tp-theme-header-bg:rgba(7, 19, 29, .76);
  --tp-theme-header-border:rgba(157, 184, 208, .20);
  --tp-theme-shadow:0 24px 58px rgba(0, 0, 0, .28);
  --tp-field-bg:#0a1726;
  --tp-table-head-bg:#112338;
  --tp-table-row-hover:rgba(96, 165, 250, .10);
  --tp-page-gutter:24px;
  --tp-container-max-public:1240px;
  --tp-container-max-app:1760px;
  --tp-container-max:var(--tp-container-max-app);
  --tp-header-height:72px;
  --tp-focus-ring:0 0 0 3px rgb(37 99 235 / .16), 0 0 0 1px rgb(37 99 235 / .48);

  /* Legacy aliases used by page CSS */
  --font-sans:var(--tp-font-sans);
  --font-mono:var(--tp-font-mono);
  --fs-xs:var(--tp-text-xs);
  --fs-sm:var(--tp-text-sm);
  --fs-md:var(--tp-text-base);
  --fs-lg:var(--tp-text-lg);
  --fs-xl:var(--tp-text-xl);
  --fs-2xl:var(--tp-text-2xl);
  --fs-3xl:var(--tp-text-3xl);
  --fw-regular:400;
  --fw-medium:500;
  --fw-semibold:600;
  --fw-bold:700;
  --fw-extrabold:850;
  --lh-tight:1.08;
  --lh-snug:1.22;
  --lh-normal:1.5;
  --lh-relaxed:1.68;
  --letter-tight:-.035em;
  --letter-wide:.02em;
  --letter-wider:.08em;
  --text-xs:var(--tp-text-xs);
  --text-sm:var(--tp-text-sm);
  --text-base:var(--tp-text-base);
  --text-lg:var(--tp-text-lg);
  --text-xl:var(--tp-text-xl);
  --text-2xl:var(--tp-text-2xl);
  --text-hero:var(--tp-text-hero);
  --space-0:0;
  --space-1:var(--tp-space-1);
  --space-2:var(--tp-space-2);
  --space-3:var(--tp-space-3);
  --space-4:var(--tp-space-4);
  --space-5:var(--tp-space-5);
  --space-6:var(--tp-space-6);
  --space-7:1.75rem;
  --space-8:var(--tp-space-8);
  --space-10:var(--tp-space-10);
  --space-12:var(--tp-space-12);
  --space-xs:var(--tp-space-2);
  --space-sm:var(--tp-space-3);
  --space-md:var(--tp-space-4);
  --space-lg:var(--tp-space-6);
  --space-xl:var(--tp-space-8);
  --page-x:clamp(1rem, 2vw, 1.75rem);
  --page-y:clamp(1rem, 2vw, 1.625rem);
  --section-gap:clamp(1rem, 2vw, 1.5rem);
  --radius-xs:.25rem;
  --radius-sm:var(--tp-radius-sm);
  --radius-md:var(--tp-radius-md);
  --radius-lg:var(--tp-radius-lg);
  --radius-xl:var(--tp-radius-xl);
  --radius-2xl:1.8rem;
  --radius-pill:var(--tp-radius-pill);
  --shadow-xs:0 1px 2px rgb(16 35 56 / .06);
  --shadow-sm:var(--tp-shadow-sm);
  --shadow-md:var(--tp-shadow-card);
  --shadow-lg:var(--tp-shadow-elevated);
  --shadow-inner:inset 0 1px 0 rgb(255 255 255 / .75);
  --shadow-card:var(--tp-shadow-card);
  --shadow-elevated:var(--tp-shadow-elevated);
  --transition-fast:120ms ease;
  --transition-base:180ms ease;
  --transition-slow:260ms ease;
  --z-base:1;
  --z-sticky:20;
  --z-dropdown:50;
  --z-modal:100;
  --z-toast:200;
  --container-max:var(--tp-container-max-app);
  --header-height:var(--tp-header-height);
  --layout-gutter:var(--tp-page-gutter);
  --table-cell-y:.82rem;
  --table-cell-x:.78rem;
  --table-header-bg:var(--tp-table-head-bg);
  --table-row-hover:var(--tp-table-row-hover);
  --focus-ring:var(--tp-focus-ring);

  /* Legacy palette aliases retained for compatibility. */
  --tp-trail-bg:           #0a110d;
  --tp-trail-bg-soft:      #111a14;
  --tp-trail-surface:      #162019;
  --tp-trail-surface-muted:#1d2b21;
  --tp-trail-border:       rgba(255, 255, 255, 0.07);
  --tp-trail-border-strong:rgba(255, 255, 255, 0.14);
  --tp-trail-text:         #e8ede9;
  --tp-trail-text-muted:   #a4b7a8;
  --tp-trail-header-bg:    rgba(10, 17, 13, 0.88);
  --tp-trail-header-border:rgba(90, 158, 111, 0.20);
  --tp-trail-field-bg:     rgba(255, 255, 255, 0.04);
  --tp-trail-table-head:   #112318;
  --tp-trail-table-hover:  rgba(90, 158, 111, 0.06);
  --tp-trail-primary:      #f58b32;
  --tp-trail-primary-hover:#c96d1a;
  --tp-trail-focus-ring:   0 0 0 3px rgb(245 139 50 / .18), 0 0 0 1px rgb(245 139 50 / .50);
}

* { box-sizing:border-box; }

html {
  scroll-behavior:smooth;
  text-size-adjust:100%;
}

body {
  margin:0;
  font-family:var(--tp-font-sans);
  font-size:var(--tp-text-base);
  line-height:var(--lh-normal);
  color:var(--tp-theme-text);
  background:var(--tp-theme-bg);
}

body.tp-app-shell,
body.tp-app-page {
  --tp-theme-bg:#06111d;
  --tp-theme-bg-soft:#0a1625;
  --tp-theme-surface:#0f1f31;
  --tp-theme-surface-muted:#14283d;
  --tp-theme-border:rgba(157, 184, 208, .20);
  --tp-theme-text:#f5f9ff;
  --tp-theme-text-muted:#9eb1c5;
  --tp-theme-header-bg:rgba(7, 19, 29, .76);
  --tp-theme-header-border:rgba(157, 184, 208, .20);
  --tp-theme-shadow:0 24px 58px rgba(0, 0, 0, .28);
  --tp-field-bg:#0a1726;
  --tp-table-head-bg:#112338;
  --tp-table-row-hover:rgba(96, 165, 250, .10);
  --tp-container-max:var(--tp-container-max-app);
  color-scheme:dark;
  background:
    radial-gradient(circle at top left, rgb(37 99 235 / .18), transparent 24rem),
    radial-gradient(circle at right top, rgb(93 182 255 / .10), transparent 24rem),
    linear-gradient(180deg, #07131d 0%, #0a1623 38%, #050d15 100%);
}

body.tp-public-shell,
body.tp-public-page {
  --tp-theme-bg:var(--tp-public-bg);
  --tp-theme-bg-soft:var(--tp-public-bg-soft);
  --tp-theme-surface:var(--tp-public-surface);
  --tp-theme-surface-muted:var(--tp-public-surface-muted);
  --tp-theme-border:var(--tp-public-border);
  --tp-theme-text:var(--tp-public-text);
  --tp-theme-text-muted:var(--tp-public-text-muted);
  --tp-theme-header-bg:rgba(7, 19, 29, .72);
  --tp-theme-header-border:rgba(157, 184, 208, .18);
  --tp-theme-shadow:var(--tp-shadow-elevated);
  --tp-field-bg:rgba(255, 255, 255, .04);
  --tp-table-head-bg:#112338;
  --tp-table-row-hover:rgba(255, 255, 255, .045);
  --tp-container-max:var(--tp-container-max-public);
  --tp-accent-green:#1f7bff;
  --tp-accent-cyan:#5db6ff;
  background:
    radial-gradient(circle at top left, rgb(37 99 235 / .18), transparent 24rem),
    radial-gradient(circle at right top, rgb(93 182 255 / .10), transparent 24rem),
    linear-gradient(180deg, #07131d 0%, #0a1623 38%, #050d15 100%);
}


body.tp-page {
  min-height:100vh;
}

body,
a {
  color:inherit;
}

img,
svg {
  display:block;
  max-width:100%;
}

button,
input,
select,
textarea {
  font:inherit;
}

button:disabled,
[aria-disabled="true"] {
  cursor:not-allowed;
}

:focus-visible {
  outline:none;
  box-shadow:var(--tp-focus-ring);
}

.tp-page,
.tp-shell {
  min-height:100vh;
}

.page,
.tp-container,
.public-container{
  width:min(var(--tp-container-max), calc(100vw - (var(--tp-page-gutter) * 2)));
  margin-inline:auto;
}

.page {
  max-width:var(--tp-container-max-app);
  padding:0 0 var(--tp-space-10);
}

.tp-main {
  padding-bottom:var(--tp-space-10);
}


.tp-stack,
.stack {
  display:grid;
  gap:var(--tp-space-4);
}

.tp-cluster{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:var(--tp-space-3);
}

.split {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--tp-space-4);
}


.muted{
  color:var(--tp-theme-text-muted);
}

.tp-section {
  margin:0 0 var(--tp-space-10);
}

.tp-section-header {
  display:grid;
  gap:var(--tp-space-2);
  max-width:48rem;
}

.tp-kicker,
.eyebrow {
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  margin:0;
  color:var(--tp-primary);
  font-size:var(--tp-text-xs);
  font-weight:var(--fw-extrabold);
  letter-spacing:var(--letter-wider);
  text-transform:uppercase;
}

.tp-title {
  margin:0;
  color:var(--tp-theme-text);
  font-size:clamp(1.75rem, 1.3rem + 2vw, 2.9rem);
  font-weight:var(--fw-extrabold);
  line-height:var(--lh-tight);
  letter-spacing:var(--letter-tight);
}

.tp-subtitle {
  margin:0;
  color:var(--tp-theme-text-muted);
  font-size:var(--tp-text-base);
  line-height:var(--lh-relaxed);
}


.tp-header {
  position:relative;
  z-index:var(--z-base);
}

.tp-app-page .tp-header{
  margin-top:var(--tp-space-4);
}

.tp-public-shell .tp-header,
.tp-public-page .tp-header {
  position:sticky;
  top:0;
  z-index:30;
  padding-top:var(--tp-space-4);
}

.tp-header-inner {
  display:flex;
  align-items:center;
  gap:var(--tp-space-4);
  padding:var(--tp-space-4) var(--tp-space-5);
  border:1px solid var(--tp-theme-header-border);
  border-radius:var(--tp-radius-xl);
  background:var(--tp-theme-header-bg);
  box-shadow:var(--tp-theme-shadow);
  backdrop-filter:blur(18px);
}

:where(.tp-logo, .tp-brand) {
  display:inline-flex;
  align-items:center;
  gap:var(--tp-space-3);
  flex-shrink:0;
  color:var(--tp-theme-text);
  text-decoration:none;
}

:where(.tp-logo-mark, .tp-brand-mark) {
  display:inline-grid;
  place-items:center;
  width:2.75rem;
  height:2.75rem;
  border-radius:14px;
  overflow:hidden;
  flex:0 0 2.75rem;
  box-shadow:0 18px 34px rgb(15 23 42 / .16);
}

:where(.tp-logo-mark, .tp-brand-mark) img {
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}

body.tp-public-shell :where(.tp-logo-mark, .tp-brand-mark) {
  box-shadow:0 18px 42px rgb(15 23 42 / .18);
}

:where(.brand-wordmark) {
  display:inline-flex;
  align-items:baseline;
  gap:0;
  white-space:nowrap;
}

.brand-pace { color:var(--brand-pace, currentColor); }
.brand-your,
.tp-brand-part-accent,
.tp-v2-brand-part-accent { color:var(--brand-your); }
.brand-trail,
.tp-brand-part-trail,
.tp-v2-brand-part-trail { color:var(--brand-trail); }

:where(.tp-logo-text, .tp-brand-wordmark) {
  display:inline-flex;
  align-items:baseline;
  gap:0;
  font-size:clamp(1.2rem, 1rem + .95vw, 1.72rem);
  font-weight:900;
  letter-spacing:-.05em;
  color:var(--tp-theme-text);
}

:where(.tp-logo-text, .tp-brand-wordmark) .tp-brand-part-light {
  color:var(--tp-theme-text);
}

:where(.tp-logo-text, .tp-brand-wordmark) .tp-brand-part-accent {
  color:var(--brand-your);
}

body.tp-public-shell {
  --brand-pace:#f5f9ff;
  --brand-trail:var(--brand-pace);
}


.tp-brand-inline {
  display:inline-flex;
  align-items:baseline;
  gap:0;
  white-space:nowrap;
  font-weight:inherit;
}
.tp-brand-inline-light { color:inherit; }
.tp-brand-inline-accent { color:var(--brand-your); }

.tp-nav,
.public-nav{
  display:flex;
  align-items:center;
  gap:var(--tp-space-2);
  flex-wrap:wrap;
}


.tp-nav-link,
.public-nav a{
  display:inline-flex;
  align-items:center;
  min-height:2.55rem;
  padding:.68rem .92rem;
  border:1px solid transparent;
  border-radius:var(--tp-radius-pill);
  color:var(--tp-theme-text-muted);
  font-size:var(--tp-text-sm);
  font-weight:var(--fw-bold);
  text-decoration:none;
  transition:background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.tp-nav-link:hover,
.public-nav a:hover{
  color:var(--tp-theme-text);
  background:color-mix(in srgb, var(--tp-theme-surface-muted) 88%, var(--tp-primary) 12%);
  border-color:color-mix(in srgb, var(--tp-theme-border) 82%, var(--tp-primary) 18%);
}

.tp-nav-link.is-active,
.tp-nav-link[aria-current="page"]{
  color:var(--tp-primary);
  background:color-mix(in srgb, var(--tp-primary) 11%, transparent);
  border-color:color-mix(in srgb, var(--tp-primary) 28%, var(--tp-theme-border) 72%);
  box-shadow:var(--shadow-xs);
}

body.tp-public-shell .tp-nav-link.is-active,
body.tp-public-shell .tp-nav-link[aria-current="page"] {
  color:var(--tp-public-text);
  background:rgba(255, 255, 255, .08);
  border-color:rgba(255, 255, 255, .12);
}

.tp-header-actions {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:var(--tp-space-3);
}


.subtitle{
  display:none;
}

.disabled {
  opacity:.56;
}

@media (max-width:1100px) {
.tp-header-inner {
    flex-wrap:wrap;
  }
}

@media (max-width:820px) {
:root {
    --tp-page-gutter:14px;
  }

  .tp-header-inner {
    padding:var(--tp-space-4);
  }

  :where(.tp-logo-text, .tp-brand-wordmark) {
    font-size:1.45rem;
    line-height:1;
  }

  

  .tp-nav-link,
.public-nav a{
    min-height:2.35rem;
    padding:.55rem .82rem;
  }
}

@media print {
:root {
    --tp-theme-bg:#ffffff;
    --tp-theme-surface:#ffffff;
    --tp-theme-surface-muted:#ffffff;
    --tp-theme-border:#d1d5db;
    --tp-theme-text:#000000;
    --tp-theme-text-muted:#374151;
    --tp-theme-header-bg:#ffffff;
    --tp-theme-header-border:#d1d5db;
    --tp-theme-shadow:none;
    --shadow-xs:none;
    --shadow-sm:none;
    --shadow-md:none;
    --shadow-lg:none;
    --shadow-card:none;
    --shadow-elevated:none;
  }

  body {
    background:#ffffff;
    color:#000000;
  }

  .no-print,
nav,
aside,
.tp-header,
.button,
.btn,
.tp-button,
.public-mobile-menu{
    display:none;
  }

  .page,
.tp-container,
.public-container{
    width:100%;
    max-width:none;
    padding:0;
  }
}

/* Brand wordmark hardening: the logo colors must not inherit theme/link accents. */
.brand-wordmark > .brand-pace {
  color:var(--brand-pace, currentColor);
}
.brand-wordmark > .brand-your,
.brand-wordmark > .tp-brand-part-accent,
.brand-wordmark > .tp-v2-brand-part-accent {
  color:var(--brand-your, #2563eb);
}
.brand-wordmark > .brand-trail,
.brand-wordmark > .tp-brand-part-trail,
.brand-wordmark > .tp-v2-brand-part-trail {
  color:var(--brand-trail, #f8fafc);
}


.brand-wordmark > .brand-your,
.brand-wordmark > .tp-brand-part-accent,
.brand-wordmark > .tp-v2-brand-part-accent {
  color:var(--brand-your, #2563eb);
}

.brand-wordmark > .brand-trail,
.brand-wordmark > .tp-brand-part-trail,
.brand-wordmark > .tp-v2-brand-part-trail {
  color:var(--brand-trail, #f8fafc);
}
