/* ════════════════════════════════════════════════════════════
   Yutie Brand Foundation Stylesheet
   ─────────────────────────────────────────────────────────────
   Locked tokens, glass system, typography, three states only.
   Loaded on every Perfex page by yutie_brand module.
   
   Do not modify tokens. They are the constitutional values.
═══════════════════════════════════════════════════════════ */

/* ─── TOKENS · LOCKED ─── */
:root {
  /* Gold palette */
  --gold: #C9A84C;
  --gold-lt: #E2C47A;
  --gold-dp: #A07E28;
  --gold-pale: rgba(201,168,76,0.12);
  --gold-line: rgba(201,168,76,0.35);
  --gold-glow: rgba(201,168,76,0.30);
  --gold-btn: rgba(201,168,76,0.22);

  /* Three states · only three */
  --tending: #6EE7B7;
  --tending-bg: rgba(110,231,183,0.10);
  --tending-line: rgba(110,231,183,0.28);
  --tending-glow: rgba(110,231,183,0.35);
  --waiting: #C9A84C;
  --waiting-bg: rgba(201,168,76,0.12);
  --quiet: #9A9890;
  --quiet-bg: rgba(154,152,144,0.08);
  --quiet-line: rgba(154,152,144,0.22);

  /* Easing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Radii */
  --r: 18px;
  --r-sm: 12px;
  --r-xs: 8px;

  /* Glass */
  --blur: blur(22px) saturate(1.7);

  /* Fonts */
  --spartan: 'League Spartan', sans-serif;
  --outfit: 'Outfit', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --serif: 'Fraunces', Georgia, serif;
}

/* ─── DARK THEME (default) ─── */
[data-theme="dark"] {
  --bg: #080809;
  --text: #edeae4;
  --text2: rgba(237,234,228,0.62);
  --text3: rgba(237,234,228,0.34);
  --text4: rgba(237,234,228,0.16);
  --glass: rgba(255,255,255,0.055);
  --glass-b: rgba(255,255,255,0.11);
  --glass-hi: rgba(255,255,255,0.10);
  --glass-2: rgba(255,255,255,0.085);
  --rule: rgba(255,255,255,0.06);
  --rule-2: rgba(255,255,255,0.10);
  --noise: 0.03;
  --shadow: rgba(0,0,0,0.55);
}

/* ─── LIGHT THEME ─── */
[data-theme="light"] {
  --bg: #f4f1eb;
  --text: #111110;
  --text2: rgba(17,17,16,0.60);
  --text3: rgba(17,17,16,0.34);
  --text4: rgba(17,17,16,0.18);
  --glass: rgba(255,255,255,0.48);
  --glass-b: rgba(255,255,255,0.82);
  --glass-hi: rgba(255,255,255,0.95);
  --glass-2: rgba(255,255,255,0.65);
  --rule: rgba(0,0,0,0.07);
  --rule-2: rgba(0,0,0,0.12);
  --noise: 0.018;
  --shadow: rgba(0,0,0,0.12);
}

/* ─── BASE ─── */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--outfit);
  background: var(--bg);
  color: var(--text);
  font-weight: 300;
  line-height: 1.6;
  transition: background 0.6s var(--ease), color 0.6s var(--ease);
  font-feature-settings: "ss01", "cv01", "cv11";
  cursor: auto;
}

/* Native cursor on interactive elements */
a, button, [role="button"], .nav-item, .icon-btn, .theme-pill,
.tier-chip, .wm-chip, label, summary {
  cursor: pointer;
}
input, textarea, [contenteditable] {
  cursor: text;
}

/* ─── FRACTAL NOISE OVERLAY ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--noise);
  pointer-events: none;
  z-index: 9000;
}

/* ─── CANVAS BACKGROUND ─── */
#bgCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
[data-theme="light"] #bgCanvas {
  opacity: 0.40;
}

/* ─── CALM MODE ─── */
body.calm #bgCanvas {
  opacity: 0.25;
}
body.calm .live-mark,
body.calm .breath,
body.calm .pulse-halo,
body.calm .sweep,
body.calm .spine-pulse,
body.calm .yutie-anim {
  animation-play-state: paused !important;
}

/* ─── SCROLLBARS · invisible ─── */
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }
*::-webkit-scrollbar-corner { display: none; }

/* ─── GLASS SYSTEM ─── */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  position: relative;
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 1px 2px rgba(0,0,0,0.10),
    0 18px 48px var(--shadow);
}

.glass-hover {
  transition:
    border-color 0.5s var(--ease),
    box-shadow 0.5s var(--ease),
    transform 0.5s var(--ease-spring),
    background 0.35s var(--ease);
}
.glass-hover:hover {
  background: var(--glass-2);
  border-color: var(--gold-line);
  box-shadow:
    inset 0 1px 0 var(--glass-hi),
    0 0 0 1px var(--gold-btn),
    0 0 32px var(--gold-pale),
    0 20px 56px var(--shadow);
  transform: translateY(-4px);
}

.glass-sm {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-sm);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

/* ─── TYPOGRAPHY ─── */
.yutie-spartan { font-family: var(--spartan); }
.yutie-outfit { font-family: var(--outfit); }
.yutie-mono { font-family: var(--mono); }
.yutie-serif { font-family: var(--serif); }

.eyebrow {
  font-family: var(--spartan);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

h1, h2, h3, h4, h5, h6,
.yutie-h1, .yutie-h2, .yutie-h3 {
  font-family: var(--spartan);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ─── THREE-STATE LIVE MARKS ─── */
.live-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.live-mark.tending { background: var(--tending); animation: breath-tending 1.8s var(--ease) infinite; }
.live-mark.waiting { background: var(--gold); animation: breath-waiting 2.6s var(--ease) infinite; }
.live-mark.quiet { background: var(--quiet); animation: breath-quiet 4s var(--ease) infinite; }
.live-mark.sm { width: 5px; height: 5px; }

@keyframes breath-tending {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px var(--tending-glow); }
  50% { opacity: 0.55; transform: scale(0.88); box-shadow: 0 0 4px var(--tending-glow); }
}
@keyframes breath-waiting {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px var(--gold-glow); }
  50% { opacity: 0.5; transform: scale(0.88); box-shadow: 0 0 3px var(--gold-glow); }
}
@keyframes breath-quiet {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.4; }
}
@keyframes yutie-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ─── BUTTONS ─── */
.yutie-btn,
.btn-primary,
.btn-yutie-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r-sm);
  font-family: var(--spartan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold-lt), var(--gold));
  color: #08080a;
  border: 1px solid var(--gold);
  box-shadow: 0 4px 16px var(--gold-glow);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease);
}
.yutie-btn:hover,
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gold-glow);
}

.yutie-btn-secondary,
.btn-default {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-family: var(--spartan);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--rule-2);
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.yutie-btn-secondary:hover,
.btn-default:hover {
  color: var(--text);
  border-color: var(--text3);
}

/* ─── FORMS ─── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="search"],
textarea,
select {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r-xs);
  color: var(--text);
  font-family: var(--outfit);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

/* ─── TABLES ─── */
.table,
table.dataTable {
  background: var(--glass);
  border-radius: var(--r-sm);
  overflow: hidden;
  width: 100%;
}
.table thead th,
table.dataTable thead th {
  background: var(--glass-2);
  color: var(--gold);
  font-family: var(--spartan);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  padding: 12px 16px;
}
.table tbody td,
table.dataTable tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 300;
}
.table tbody tr:hover,
table.dataTable tbody tr:hover {
  background: var(--gold-pale);
}

/* ─── PANELS & CARDS ─── */
.panel, .box, .card,
.well, .panel-default {
  background: var(--glass);
  border: 1px solid var(--glass-b);
  border-radius: var(--r);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  padding: 24px;
}

/* ─── MODALS ─── */
.modal-content {
  background: var(--bg);
  border: 1px solid var(--gold-line);
  border-radius: var(--r);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.modal-backdrop {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ─── ALERTS · re-mapped to three states ─── */
.alert {
  border-radius: var(--r-sm);
  padding: 14px 18px;
  border-left: 3px solid;
  font-family: var(--outfit);
}
.alert-success { background: var(--tending-bg); border-color: var(--tending); color: var(--text); }
.alert-warning { background: var(--waiting-bg); border-color: var(--waiting); color: var(--text); }
.alert-info { background: var(--quiet-bg); border-color: var(--quiet); color: var(--text); }
.alert-danger { background: var(--waiting-bg); border-color: var(--waiting); color: var(--text); }

/* ─── ORNAMENTS ─── */
.orn {
  display: inline-block;
  color: var(--gold);
  opacity: 0.55;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  margin: 0 0.35em;
  line-height: 1;
  font-size: 1.05em;
}
.orn-div {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 36px 0 22px;
  opacity: 0.5;
}
.orn-div::before,
.orn-div::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
  max-width: 160px;
}

/* ─── REVEAL ANIMATIONS ─── */
.rv {
  opacity: 0;
  transform: translateY(28px);
  animation: yutie-reveal 0.9s var(--ease-out) forwards;
}
@keyframes yutie-reveal {
  to { opacity: 1; transform: none; }
}
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.12s; }
.d3 { animation-delay: 0.19s; }
.d4 { animation-delay: 0.26s; }
.d5 { animation-delay: 0.33s; }
.d6 { animation-delay: 0.40s; }
.d7 { animation-delay: 0.47s; }
.d8 { animation-delay: 0.54s; }
.d9 { animation-delay: 0.61s; }

/* ─── ACCESSIBILITY ─── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  body.calm-auto #bgCanvas { opacity: 0.20; }
}

/* ─── RESPONSIVE FOUNDATIONS ─── */
@media (max-width: 1023px) {
  body { font-size: 15px; }
}
@media (max-width: 767px) {
  body { font-size: 14px; }
  .panel, .box, .card { padding: 18px; }
}

/* ─── PRINT ─── */
@media print {
  #bgCanvas, body::before { display: none; }
  body { background: white; color: black; }
}

/* ════════════════════════════════════════════════════════════
   End yutie-brand.css
═══════════════════════════════════════════════════════════ */
