/* ═══════════════════════════════════════════════
   BASE — SANTET V3
   Reset, typography, layout, a11y utilities
   ═══════════════════════════════════════════════ */
@import url('./tokens.css');

/* ── RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 13px; line-height: 1.6;
  color: var(--tx); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Anti-copy deterrent (bypassable): disable selection except for fields/code. */
body { -webkit-user-select:none; user-select:none; }
input, textarea, select, option, code, pre { -webkit-user-select:text; user-select:text; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,184,0,.4); border-radius: 2px; }

/* ── TYPOGRAPHY ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--tx);
  line-height: 1.2;
}
code {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--tx2);
}
pre {
  padding: 16px; margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.75;
  color: var(--tx);
  overflow-x: auto; white-space: pre;
}

/* ── A11Y UTILITIES ────────────────────────────────── */
.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 100000;
  padding: 10px 16px;
  background: var(--r2);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-120%);
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.cluster { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Focus visible ring */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--r3);
  outline-offset: 2px;
}

/* ── LAYOUT ────────────────────────────────────────── */
main.page {
  display: block;
}
.main-wrap {
  margin-left: var(--sw);
  min-height: 100vh;
  padding: 28px 32px 56px;
  transition: margin-left var(--transition-slow);
}
.main-wrap.sb-collapsed { margin-left: var(--sw-icon); }

.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

/* ── Page enter animation ────────────────────────── */
.page,
main.page {
  animation: fade-up .42s cubic-bezier(.22,.68,0,1.2) backwards;
}

/* ── Container ─────────────────────────────────────── */
.container {
  width: 100%; max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(16px,4vw,32px);
}

/* ── Portal edit grid ──────────────────────────────── */
.portal-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .portal-edit-grid {
    grid-template-columns: 1fr;
  }
}

/* ── DS Utility classes (layout helpers) ───────────── */
.ds-flex { display:flex; }
.ds-inline-flex { display:inline-flex; }
.ds-grid { display:grid; }
.ds-gap-xs { gap:4px; }
.ds-gap-sm { gap:8px; }
.ds-gap-md { gap:16px; }
.ds-gap-lg { gap:24px; }
.ds-p-xs { padding:4px; }
.ds-p-sm { padding:8px; }
.ds-p-md { padding:16px; }
.ds-p-lg { padding:24px; }
.ds-mb-xs { margin-bottom:4px; }
.ds-mb-sm { margin-bottom:8px; }
.ds-mb-md { margin-bottom:16px; }
.ds-mb-lg { margin-bottom:24px; }
.ds-mt-xs { margin-top:4px; }
.ds-mt-sm { margin-top:8px; }
.ds-mt-md { margin-top:12px; }
.ds-mt-lg { margin-top:16px; }
.ds-mt-xl { margin-top:20px; }
.ds-ml-xs { margin-left:4px; }
.ds-ml-sm { margin-left:8px; }
.ds-pt-md { padding-top:12px; }
.ds-block { display:block; }
.ds-none  { display:none; }
.ds-w-full { width:100%; }
.ds-max-w-container { max-width:1100px; margin:0 auto; }
.ds-truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ds-no-margin { margin:0; }
.ds-no-padding { padding:0; }
.ds-border-0 { border:0; }
.ds-bg-transparent { background:transparent; }
.ds-cursor-pointer { cursor:pointer; }
.ds-user-select-none { user-select:none; }
.ds-items-center { align-items:center; }
.ds-justify-center { justify-content:center; }
.ds-justify-between { justify-content:space-between; }
.ds-flex-col { flex-direction:column; }
.ds-flex-wrap { flex-wrap:wrap; }
.ds-leading-normal { line-height:1.5; }
.ds-text-xs { font-size:11px; }
.ds-text-sm { font-size:12px; }
.ds-text-base { font-size:13px; }
.ds-text-lg { font-size:15px; }
.ds-text-xl { font-size:18px; }
.ds-font-medium { font-weight:500; }
.ds-font-semibold { font-weight:600; }
.ds-font-bold { font-weight:700; }
.ds-text-center { text-align:center; }
.ds-text-right { text-align:right; }
.ds-nowrap { white-space:nowrap; }

/* ── Text color utilities ──────────────────────────── */
.txt-green { color:var(--green); }
.txt-r4    { color:var(--r4); }
.txt-yellow { color:var(--yellow); }
.txt-blue   { color:var(--blue); }
.txt-purple { color:var(--purple); }
.txt-red    { color:var(--red); }
.txt-xs { font-size:9px; }
.txt-sm { font-size:11px; }
.txt-body-sm { font-size:12px; font-weight:500; }

/* ── Border utilities ──────────────────────────────── */
.border-top { border-top:1px solid var(--border); }
.border-subtle { border:1px solid rgba(255,255,255,.06); }
.border-dashed { border-style:dashed; }
.text-capitalize { text-transform:capitalize; }

/* ── Muted / mono helpers ──────────────────────────── */
.muted { color: var(--tx3); }
.mono-sm { font-family: var(--font-mono); font-size: 12px; }


/* ── Page titles — consistent across all pages ── */
.page-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-top--center {
  align-items: center;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--tx);
  position: relative;
  padding-bottom: 10px;
}

.page-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 28px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--r3), var(--orange, #f97316));
  box-shadow: 0 0 8px rgba(255, 184, 0, .4);
}

.page-title--solo {
  padding-bottom: 7px;
}

.page-sub {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--tx3);
  margin-top: 5px;
  max-width: 54ch;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Stat pills (page header badges) ──────────── */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  background: rgba(255, 184, 0, .1);
  border: 1px solid rgba(255, 184, 0, .25);
  color: var(--r3);
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  line-height: 1;
}
.stat-pill--neutral {
  background: rgba(148, 148, 168, .08);
  border-color: var(--border);
  color: var(--tx2);
}

/* ── Device reset dropdown ───────────────────── */
.device-reset-dropdown { position: relative; }
.device-reset-dropdown .chevron { font-size: 10px; opacity: .6; }

/* ── Page top layout fix ─────────────────────── */
.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-top > div:first-child { flex: 1; min-width: 200px; }

/* Card base */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--r3);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color var(--transition), box-shadow var(--transition), transform .2s;
  animation: card-entrance .4s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes card-entrance {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card:hover {
  border-color: var(--border-r);
  box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 12px 28px rgba(0,0,0,.25);
  transform: translateY(-2px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.card-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Card title */
.card-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
}

.card-desc {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--tx3);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* card--nm: sidebar/dashboard content cards */
.card--nm {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.card--nm::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--r3), var(--r1));
  opacity: 0.7;
  border-radius: 3px 0 0 3px;
}
.card--nm:hover {
  border-color: var(--border-r);
  box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 12px 28px rgba(0,0,0,.25);
  transform: translateY(-2px);
}
.card--nm:hover::before {
  opacity: 1;
  box-shadow: 0 0 12px var(--shadow-r);
}


/* ── Public Navbar (from landing.css) ─────────────── */
.landing-navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(20px,4vw,40px);
  background: transparent; border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
.landing-navbar.scrolled {
  background: rgba(8,9,13,0.78);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255,184,0,0.12);
  box-shadow: 0 4px 24px rgba(0,0,0,.4), 0 1px 0 rgba(255,184,0,.06) inset;
}
.landing-navbar__brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-heading); font-weight: 800; font-size: 14px;
  letter-spacing: 0.16em; color: var(--tx); text-decoration: none;
}
.landing-navbar__brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--r3), var(--purple));
  color: var(--bg); font-weight: 900;
  box-shadow: 0 0 20px rgba(255,184,0,0.35);
}
.landing-navbar__brand-text strong { color: var(--r3); }
.landing-navbar__links { display: flex; align-items: center; gap: 28px; }
.landing-navbar__link {
  color: var(--tx2); text-decoration: none; font-size: 13px;
  font-weight: 500; position: relative; transition: color .2s;
}
.landing-navbar__link:hover { color: var(--tx); }
.landing-navbar__link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px; background: linear-gradient(90deg, var(--r3), var(--purple));
  border-radius: 2px; transform: scaleX(0); transform-origin: left;
  transition: transform .25s;
}
.landing-navbar__link:hover::after { transform: scaleX(1); }
.landing-navbar__cta {
  padding: 9px 18px; border-radius: 8px;
  background: linear-gradient(135deg, var(--r3), var(--r4));
  color: var(--bg); font-size: 13px; font-weight: 700;
  text-decoration: none; letter-spacing: 0.04em;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 18px rgba(255,184,0,0.4);
}
.landing-navbar__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(255,184,0,0.6);
}
.landing-navbar__menu-btn {
  display: none; background: none;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--tx); padding: 8px 12px; cursor: pointer;
}

/* ── Hero ─────────────────────────────────────── */

/* ── Mobile Navbar ─────────────────────────────── */
@media (max-width: 768px) {
  .landing-navbar {
    padding: 12px 16px;
    background: rgba(8,9,13,0.85) !important;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255,184,0,0.12) !important;
  }
  .landing-navbar__menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .landing-navbar__links {
    position: fixed;
    top: 0; right: -100%;
    width: 280px; height: 100vh;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 70px 24px 24px;
    background: rgba(8,9,13,0.96);
    backdrop-filter: blur(24px);
    border-left: 1px solid var(--border);
    transition: right 0.3s ease;
    z-index: 199;
  }
  .landing-navbar__links.open {
    right: 0;
  }
  .landing-navbar__link {
    width: 100%;
    padding: 14px 0;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .landing-navbar__link::after {
    bottom: 0;
  }
  .landing-navbar__cta {
    width: 100%;
    text-align: center;
    margin-top: 12px;
    padding: 14px 20px;
    font-size: 14px;
  }
}


/* ── Background layers (aurora, grid, stars) ────── */
.bg-aurora,
.bg-grid,
.bg-stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}

.bg-aurora {
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, rgba(168,85,247,0.22), transparent 60%),
    radial-gradient(ellipse 50% 45% at 85% 20%, rgba(255,184,0,0.10), transparent 60%),
    radial-gradient(ellipse 45% 40% at 50% 80%, rgba(59,130,246,0.10), transparent 60%);
  filter: blur(40px);
  animation: aurora 22s ease-in-out infinite alternate;
  z-index: 0;
}
@keyframes aurora {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(2%,-2%,0) scale(1.05); }
  100% { transform: translate3d(-2%,1%,0) scale(1.02); }
}

.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at center, #000 35%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 35%, transparent 75%);
  z-index: 0; opacity: 0.55;
}

.bg-stars {
  background:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 60% 70%, #fff, transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(255,184,0,0.9), transparent),
    radial-gradient(1px 1px at 30% 80%, rgba(59,130,246,0.8), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(168,85,247,0.8), transparent);
  background-size: 600px 600px;
  animation: stars 120s linear infinite;
  opacity: 0.55; z-index: 0;
}
@keyframes stars { from { transform: translateY(0); } to { transform: translateY(-600px); } }
.cursor-glow {
  position: fixed; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,184,0,0.10) 0%, rgba(168,85,247,0.06) 35%, transparent 70%);
  transform: translate(-50%,-50%); pointer-events: none; z-index: 9999;
  mix-blend-mode: screen; transition: opacity .3s; opacity: 0;
}
