/* ============================================================
   pris.la — design system entry point
   Single source of truth for the whole site. Link this on
   every page. Page-specific stylesheets layer on top and must
   only consume the tokens defined here (no raw hex/fonts).

   Foundations live in tokens/*.css; this file adds the reset,
   base element styles, and the shared component library
   (nav, eyebrow, sections, buttons, cards, stats, chat).
   Derived from the canonical navy homepage.
   ============================================================ */

@import "tokens/fonts.css";
@import "tokens/colors.css";
@import "tokens/typography.css";
@import "tokens/spacing.css";

/* ─── Back-compat aliases ───────────────────────────────────
   Older markup/scripts referenced these names; keep them
   mapped to the canonical semantic tokens so nothing breaks. */
:root {
  --card: var(--surface-card);
  --onAccent: var(--on-accent);
  --green: var(--ok);
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Shared layout ─── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ─── Eyebrow label ─── */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow-rule {
  width: 20px;
  height: 1px;
  background: var(--accent);
  display: block;
  flex-shrink: 0;
}

/* ─── Section rhythm ─── */
.section {
  border-top: 1px solid var(--line);
  padding: var(--section-pad) 0;
}
.section-header { margin-bottom: clamp(36px, 4vw, 52px); }
.section-header h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-h2);
  line-height: 1.05;
  letter-spacing: var(--tracking-display);
  margin: 16px 0 0;
  color: var(--ink);
}
.section-header p {
  font-family: var(--font-body);
  font-size: var(--text-lede);
  line-height: 1.6;
  color: var(--soft);
  max-width: 58ch;
  margin: 16px 0 0;
}

/* ─── NAV ─── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
.nav-logo-img {
  height: 26px;
  width: auto;
  display: block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-nav);
  text-transform: uppercase;
  color: var(--soft);
  text-decoration: none;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--ink); }

/* ─── HERO ─── */
.hero {
  padding: clamp(56px, 10vw, 124px) var(--gutter) clamp(48px, 7vw, 96px);
  max-width: var(--container-max);
  margin: 0 auto;
}
.hero-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--soft);
  margin-bottom: clamp(28px, 4vw, 48px);
}
.hero-eyebrow .dot-accent {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: block;
  flex-shrink: 0;
}
.hero-eyebrow .slash { opacity: 0.4; }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-hero);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0;
  max-width: 18ch;
  color: var(--ink);
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero-lede {
  font-size: var(--text-lede);
  line-height: 1.6;
  color: var(--soft);
  max-width: 62ch;
  margin: clamp(28px, 4vw, 40px) 0 0;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: clamp(32px, 4vw, 44px);
}

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--text-button);
  letter-spacing: var(--tracking-button);
  text-transform: uppercase;
  color: var(--on-accent);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-button);
  padding: 16px 26px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--text-button);
  letter-spacing: var(--tracking-button);
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius-button);
  padding: 16px 26px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-outline:hover { background: var(--ink); color: var(--bg); }

/* Nav-sized pill button — same invert hover as outline */
.btn-nav {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-button);
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-nav:hover { background: var(--ink); color: var(--bg); }

.btn-text {
  font-family: var(--font-mono);
  font-size: var(--text-button);
  letter-spacing: var(--tracking-button);
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color 0.15s;
}
.btn-text:hover { border-color: var(--accent); }

/* ─── TOOL / PROJECT CARDS ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--gap-card);
}
.projects-grid {
  display: flex;
  overflow-x: auto;
  gap: var(--gap-card);
  padding-bottom: 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.projects-grid::-webkit-scrollbar { height: 4px; }
.projects-grid::-webkit-scrollbar-track { background: transparent; }
.projects-grid::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-card);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(26px, 3vw, 40px);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--ease-lift), border-color var(--ease-lift), box-shadow var(--ease-lift);
}
.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card-hover);
}
.tool-card .card-glyph {
  font-size: clamp(30px, 3.4vw, 42px);
  line-height: 1;
  color: var(--accent);
}
.tool-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-card-title-lg);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.tool-card p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--soft);
  margin: 0;
}
.tool-card .card-cta {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: var(--text-button);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-inner);
  flex-shrink: 0;
  width: clamp(280px, 75vw, 320px);
  scroll-snap-align: start;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: clamp(24px, 2.6vw, 34px);
}
.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.project-card .card-glyph {
  font-size: 30px;
  line-height: 1;
  color: var(--accent);
}
.project-card .card-index {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.1em;
  color: var(--soft);
}
.project-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-card-title);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
.project-card p {
  font-size: var(--text-body-sm);
  line-height: 1.6;
  color: var(--soft);
  margin: 0;
}
.project-card .card-metric {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--text-button);
  line-height: 1.5;
  color: var(--accent);
}

/* ─── STATS BAND ─── */
.section-stats { background: var(--surface-card); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.stat-cell {
  background: var(--surface-card);
  padding: clamp(26px, 3vw, 40px);
}
.stat-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-metric);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat-caption {
  font-size: 14px;
  line-height: 1.5;
  color: var(--soft);
  margin-top: 14px;
}

/* ─── CONTACT ─── */
.section-contact { padding: var(--section-pad-lg) 0; }
.section-contact h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-h2-contact);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 18px 0 0;
  max-width: 14ch;
  color: var(--ink);
}
.section-contact h2 em {
  font-style: italic;
  color: var(--accent);
}
.section-contact .contact-lede {
  font-size: var(--text-lede);
  line-height: 1.6;
  color: var(--soft);
  max-width: 54ch;
  margin: clamp(24px, 3vw, 34px) 0 0;
}
.contact-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: clamp(32px, 4vw, 44px);
}

/* ─── FOOTER ─── */
.site-footer {
  border-top: 1px solid var(--line);
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding-top: 28px;
  padding-bottom: 28px;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-button);
  color: var(--soft);
}
.footer-right .dot { color: var(--accent); }

/* ─── CHAT WIDGET ─── */
.chat-widget {
  position: fixed;
  right: clamp(16px, 3vw, 28px);
  bottom: clamp(16px, 3vw, 28px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}

.chat-panel {
  width: min(370px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 120px));
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-card);
  flex-shrink: 0;
}
.chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-header-info { display: flex; flex-direction: column; line-height: 1.3; }
.chat-header-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}
.chat-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--soft);
}
.chat-header-status .online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  display: block;
}
.chat-close {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-button);
  border: none;
  background: transparent;
  color: var(--soft);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.chat-close:hover { background: var(--line); color: var(--ink); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble {
  max-width: 84%;
  border-radius: var(--radius-bubble);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
}
.bubble-agent {
  align-self: flex-start;
  background: var(--surface-card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.bubble-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid transparent;
}
.bubble-typing {
  align-self: flex-start;
  background: var(--surface-card);
  color: var(--soft);
  border: 1px solid var(--line);
  font-style: italic;
}
.chat-disclaimer {
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--soft);
  text-align: center;
  padding: 4px 8px;
  margin-top: 2px;
  flex-shrink: 0;
}

.chat-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-card);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--soft); }
.chat-send {
  border: none;
  border-radius: var(--radius-input);
  background: var(--accent);
  color: var(--on-accent);
  padding: 0 16px;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.chat-send:hover { opacity: 0.9; }
