/* ================================================================
   SEMCODAR BRAND BOOK — DESIGN TOKENS & BASE STYLES
   ================================================================ */


/* Backward-compat aliases for section CSS files */
:root {
  --radius-xs: var(--r-xs);
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --sidebar-width: var(--sidebar-w);
  --section-max-width: var(--content-max);
  --transition: var(--t-fast);
}

/* ── Dark Theme (default) ── */
html {
  --bg:         #1C1C1C;
  --bg-2:       #171717;
  --surface:    #252525;
  --surface-2:  #2E2E2E;
  --border:     #363636;
  --border-sub: #2C2C2C;

  --text:       #FBF9F4;
  --text-2:     #B2B2B2;
  --text-3:     #8A8A8A;

  --accent:       var(--c-blue);
  --accent-rgb:   0, 88, 212;
  --accent-dim:   rgba(0, 88, 212, 0.14);
  --accent-2:     var(--c-purple);
  --accent-2-dim: rgba(175, 109, 255, 0.14);

  --section-a-bg: #1C1C1C;
  --section-b-bg: #171717;
  --section-fg:   #FBF9F4;

  --mark-fill: #FBF9F4;
  --mark-bg:   #1C1C1C;

  --rule-ok-bg:     rgba(132, 204, 22, 0.07);
  --rule-ok-border: rgba(132, 204, 22, 0.22);
  --rule-ok-text:   #AEDD8A;
  --rule-no-bg:     rgba(248, 79, 46, 0.07);
  --rule-no-border: rgba(248, 79, 46, 0.22);
  --rule-no-text:   #F4876E;

  /* Legacy compat */
  --color-black:      #1C1C1C;
  --color-purple:     #AF6DFF;
  --color-purple-light: #C49AFF;
  --color-green:      #84CC16;
  --color-yellow:     #FACC15;
  --color-cream:      #F5F0E8;
  --color-white:      #FBF9F4;
  --color-gray:       #9E9E9E;
  --color-gray-dark:  #27272A;
  --color-gray-border: #363636;
  --font-sans: var(--f-body);
  --font-mono: var(--f-mono);
}

/* ── Light Theme ── */
html[data-theme="light"] {
  --bg:         #FBF9F4;
  --bg-2:       #F3EFE8;
  --surface:    #FFFFFF;
  --surface-2:  #ECE9E3;
  --border:     #DDD9D1;
  --border-sub: #E8E4DC;

  --text:       #1C1C1C;
  --text-2:     #6A6461;
  --text-3:     #A09C98;

  --accent:       var(--c-blue);
  --accent-rgb:   0, 88, 212;
  --accent-dim:   rgba(0, 88, 212, 0.08);
  --accent-2:     var(--c-purple);
  --accent-2-dim: rgba(175, 109, 255, 0.10);

  --section-a-bg: #FBF9F4;
  --section-b-bg: #F3EFE8;
  --section-fg:   #1C1C1C;

  --mark-fill: #1C1C1C;
  --mark-bg:   #FBF9F4;

  --rule-ok-bg:     rgba(132, 204, 22, 0.08);
  --rule-ok-border: rgba(132, 204, 22, 0.28);
  --rule-ok-text:   #3A7018;
  --rule-no-bg:     rgba(248, 79, 46, 0.07);
  --rule-no-border: rgba(248, 79, 46, 0.22);
  --rule-no-text:   #C02E12;

  /* Legacy compat */
  --color-black:      #1C1C1C;
  --color-purple:     #AF6DFF;
  --color-purple-light: #8E4FD6;
  --color-green:      #84CC16;
  --color-yellow:     #FACC15;
  --color-cream:      #F5F0E8;
  --color-white:      #FBF9F4;
  --color-gray:       #6A6461;
  --color-gray-dark:  #27272A;
  --color-gray-border: #DDD9D1;
  --font-sans: var(--f-body);
  --font-mono: var(--f-mono);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-body);
  background: var(--bg-body);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--t-slow), color var(--t-slow);
}

/* ── Noise texture overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}
html[data-theme="light"] body::before { opacity: 0.018; }

/* ── Scroll progress bar ── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--c-blue), var(--c-purple), #C49AFF, var(--c-green));
  background-size: 200% 100%;
  animation: progress-shimmer 3s linear infinite;
  z-index: 9999;
  pointer-events: none;
  transition: width 80ms linear;
  will-change: width;
  box-shadow: 0 0 12px rgba(175, 109, 255, 0.55), 0 0 4px rgba(0, 88, 212, 0.4);
}
.scroll-progress::after {
  content: '';
  position: absolute;
  right: -3px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, var(--c-purple) 60%);
  box-shadow: 0 0 12px 4px rgba(175, 109, 255, 0.85), 0 0 24px 8px rgba(175, 109, 255, 0.35);
}
@keyframes progress-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Particle canvas ── */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ── Ambient light orbs ── */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.ambient__orb {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  animation: orb-float 22s ease-in-out infinite;
}
.ambient__orb--1 {
  width: 800px; height: 800px;
  background: radial-gradient(circle, #0058D4 0%, rgba(0, 88, 212, 0.3) 50%, transparent 70%);
  filter: blur(90px);
  top: -240px; left: -160px;
  opacity: var(--orb-1-op);
  animation-delay: 0s;
  animation-duration: 24s;
  transition: opacity var(--t-slow);
}
.ambient__orb--2 {
  width: 640px; height: 640px;
  background: radial-gradient(circle, #AF6DFF 0%, rgba(175, 109, 255, 0.25) 50%, transparent 70%);
  filter: blur(80px);
  top: 30%; right: -180px;
  opacity: var(--orb-2-op);
  animation-delay: -9s;
  animation-duration: 20s;
  transition: opacity var(--t-slow);
}
.ambient__orb--3 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #63D059 0%, rgba(99, 208, 89, 0.2) 50%, transparent 70%);
  filter: blur(100px);
  bottom: -100px; left: 28%;
  opacity: var(--orb-3-op);
  animation-delay: -16s;
  animation-duration: 26s;
  transition: opacity var(--t-slow);
}
.ambient__orb--4 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #FFB801 0%, rgba(255, 184, 1, 0.15) 50%, transparent 70%);
  filter: blur(90px);
  top: 50%; right: 18%;
  opacity: calc(var(--orb-3-op) * 0.75);
  animation-delay: -6s;
  animation-duration: 30s;
  transition: opacity var(--t-slow);
}

/* ── Layout ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

/* ── Sections ── */
.section {
  padding: 80px 64px;
  max-width: var(--section-max-width);
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: background var(--t-slow), color var(--t-slow);
}
.section--dark  { background: var(--section-a-bg); color: var(--section-fg); }
.section--cream { background: var(--section-b-bg); color: var(--section-fg); }

.section__label {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section__label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 2px rgba(var(--accent-rgb), 0.6);
  flex-shrink: 0;
  animation: pulse-dot 2.8s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.4); opacity: 0.7; }
}

.section__title {
  font-family: var(--f-display);
  font-size: clamp(34px, 4.4vw, 62px);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.028em;
  background: linear-gradient(145deg,
    var(--text) 0%,
    color-mix(in srgb, var(--text) 82%, var(--text-2)) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--text);
  margin-bottom: 28px;
}

.section__desc {
  font-size: 17px;
  line-height: 1.78;
  color: var(--text-2);
  max-width: 580px;
  margin-bottom: 52px;
}

/* ── Glass utility classes (Liquid Glass system) ── */
.glass {
  background: var(--g-1);
  backdrop-filter: var(--g-blur);
  -webkit-backdrop-filter: var(--g-blur);
  border-radius: var(--r-lg);
  border: 1px solid var(--g-border);
  border-bottom-color: var(--g-border-dim);
  border-right-color: var(--g-border-dim);
  box-shadow: var(--g-shadow);
  transition: background var(--t-slow), box-shadow var(--t-slow), border-color var(--t-slow);
  position: relative;
}

/* Prismatic top-edge specular highlight (Apple Liquid Glass) */
.glass::after {
  content: '';
  position: absolute;
  top: 0; left: 5%; right: 5%;
  height: 1px;
  background: var(--g-specular);
  border-radius: 1px;
  pointer-events: none;
  z-index: 3;
}

.glass--card {
  background: var(--g-2);
  backdrop-filter: var(--g-blur);
  -webkit-backdrop-filter: var(--g-blur);
  border-radius: var(--r-md);
  border: 1px solid var(--g-border);
  border-bottom-color: var(--g-border-dim);
  box-shadow: var(--g-shadow-card);
  transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), border-color var(--t-slow);
  position: relative;
  overflow: hidden;
}
.glass--card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.07) 40%,
    rgba(255, 255, 255, 0.13) 50%,
    rgba(255, 255, 255, 0.07) 60%,
    transparent 80%
  );
  transform: translateX(-120%) skewX(-15deg);
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}
.glass--card:hover::before {
  animation: glass-shimmer 0.7s ease-out forwards;
}
.glass--card:hover {
  background: var(--g-3);
  box-shadow: var(--g-shadow-hover);
  transform: translateY(-3px) scale(1.005);
}
/* Prismatic top-edge specular on cards (same as .glass::after) */
.glass--card::after {
  content: '';
  position: absolute;
  top: 0; left: 4%; right: 4%;
  height: 1px;
  background: var(--g-specular);
  border-radius: 1px;
  pointer-events: none;
  z-index: 3;
}
/* Card children sit above shimmer + specular */
.glass--card > * { position: relative; z-index: 2; }

.glass--nav {
  background: var(--sidebar-bg);
  backdrop-filter: var(--g-blur-heavy);
  -webkit-backdrop-filter: var(--g-blur-heavy);
  border-right: 1px solid var(--sidebar-border);
}

.glass--pill {
  background: var(--g-1);
  backdrop-filter: var(--g-blur);
  -webkit-backdrop-filter: var(--g-blur);
  border-radius: 100px;
  border: 1px solid var(--g-border);
  border-bottom-color: var(--g-border-dim);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  position: relative;
}

.glass--elevated {
  background: var(--g-3);
  backdrop-filter: var(--g-blur-heavy);
  -webkit-backdrop-filter: var(--g-blur-heavy);
  box-shadow: var(--g-shadow-hover);
}

/* ── Keyframes ── */
@keyframes glass-shimmer {
  0%   { transform: translateX(-120%) skewX(-15deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(260%) skewX(-15deg); opacity: 0; }
}

@keyframes orb-float {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  25%  { transform: translate(60px, 50px) scale(1.08) rotate(3deg); }
  50%  { transform: translate(20px, 80px) scale(1.03) rotate(-2deg); }
  75%  { transform: translate(-40px, 30px) scale(0.95) rotate(1deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

/* ── Section reveal animation ── */
.reveal {
  opacity: 0;
  transform: translateY(24px) scale(0.99);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.reveal--delay-1 { transition-delay: 0.08s; }
.reveal--delay-2 { transition-delay: 0.16s; }
.reveal--delay-3 { transition-delay: 0.24s; }
.reveal--delay-4 { transition-delay: 0.32s; }
.reveal--delay-5 { transition-delay: 0.40s; }

/* ── Stagger grid items ── */
.stagger-item {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition:
    opacity  560ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 560ms cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--stagger-i, 0) * 70ms);
}
.stagger-item.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── gl-divider entrance (triggered by .section.in-view) ── */
.gl-divider {
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 700ms 150ms cubic-bezier(0.16, 1, 0.3, 1);
}
.section.in-view .gl-divider {
  transform: scaleX(1);
}

/* ── Section heading entrance ── */
.section__label {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 500ms cubic-bezier(0.16, 1, 0.3, 1), transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
}
.section.in-view .section__label {
  opacity: 1;
  transform: translateX(0);
}
.section__title {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms 80ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms 80ms cubic-bezier(0.16, 1, 0.3, 1);
}
.section.in-view .section__title {
  opacity: 1;
  transform: translateY(0);
}
.section__desc {
  opacity: 0;
  transition: opacity 500ms 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.section.in-view .section__desc {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .stagger-item { opacity: 1; transform: none; transition: none; }
  .gl-divider { transform: scaleX(1); transition: none; }
  .section__label, .section__title, .section__desc { opacity: 1; transform: none; transition: none; }
  @keyframes glass-shimmer { 0%, 100% { opacity: 0; } }
  @keyframes orb-float { 0%, 100% { transform: none; } }
}

/* ── gl-* utility classes ── */
.gl-divider {
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), color-mix(in srgb, var(--c-purple) 30%, transparent));
  border-radius: 2px;
  margin-bottom: 52px;
  box-shadow: 0 0 6px color-mix(in srgb, var(--c-purple) 20%, transparent);
  position: relative;
}
.gl-divider::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: inherit;
  filter: blur(4px);
  opacity: 0.25;
  border-radius: inherit;
}

.gl-callout {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-purple);
  color: #fff;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  line-height: 1;
  pointer-events: none;
}

/* ── Divider ── */
.divider {
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  margin-bottom: 52px;
  box-shadow: 0 0 10px rgba(175, 109, 255, 0.35);
}

/* ── Copy feedback ── */
.swatch--copying { opacity: 0.72; }

/* ── Footer ── */
.brand-footer {
  margin-left: var(--sidebar-w);
  background: #0D0D0D;
  border-top: 1px solid #222;
  padding: 56px 64px 40px;
}

.brand-footer__inner {
  max-width: var(--content-max);
}

/* Top row: brand + nav + meta */
.brand-footer__top {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 64px;
  align-items: start;
  padding-bottom: 44px;
  border-bottom: 1px solid #1E1E1E;
}

/* Brand block */
.brand-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand-footer__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-display);
  font-size: 18px;
  font-weight: 800;
  color: #FBF9F4;
  letter-spacing: -0.02em;
}

.brand-footer__tagline {
  font-size: 13px;
  line-height: 1.65;
  color: #999;
  max-width: 240px;
}

/* Nav groups */
.brand-footer__nav {
  display: flex;
  gap: 48px;
}

.brand-footer__nav-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-footer__nav-title {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 4px;
}

.brand-footer__nav-link {
  font-size: 12px;
  color: #999;
  text-decoration: none;
  transition: color var(--t-fast);
}

.brand-footer__nav-link:hover {
  color: #FBF9F4;
}

/* Meta block */
.brand-footer__meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-footer__meta-title {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 4px;
}

.brand-footer__meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-footer__meta-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.brand-footer__meta-value {
  font-family: var(--f-mono);
  font-size: 12px;
  color: #ccc;
}

/* Bottom row */
.brand-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 24px;
}

.brand-footer__copy {
  font-family: var(--f-mono);
  font-size: 11px;
  color: #888;
}

.brand-footer__legal {
  font-size: 11px;
  color: #888;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .main-content { margin-left: 0; margin-top: 56px; }
  .section { padding: 56px 24px 48px; }
  .brand-footer { margin-left: 0; padding: 40px 24px 32px; }
  .brand-footer__top { grid-template-columns: 1fr; gap: 40px; }
  .brand-footer__nav { flex-wrap: wrap; gap: 32px; }
  .brand-footer__bottom { flex-direction: column; align-items: flex-start; gap: 6px; }
}
