/* ==========================================================================
   JIANBAI · Core Design System
   Minimal · Editorial · High-end
   Supports dark (default) & light themes via [data-theme]
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Raw channels — every translucent tint derives from these two */
  --bg-rgb: 10,10,9;
  --fg-rgb: 240,235,226;

  /* Ground */
  --ink:      #0A0A09;
  --ink-1:    #0D0D0B;
  --ink-2:    #121210;
  --ink-3:    #191917;
  --ink-4:    #212120;

  /* Paper */
  --paper:    #F0EBE2;
  --paper-80: rgba(var(--fg-rgb),.80);
  --paper-60: rgba(var(--fg-rgb),.60);
  --paper-42: rgba(var(--fg-rgb),.42);
  --paper-26: rgba(var(--fg-rgb),.26);
  --paper-14: rgba(var(--fg-rgb),.14);

  /* Lines */
  --line:     rgba(var(--fg-rgb),.09);
  --line-2:   rgba(var(--fg-rgb),.15);
  --line-3:   rgba(var(--fg-rgb),.26);

  /* Accent (brass) — used sparingly */
  --brass:    #C2A176;
  --brass-d:  #8A6F4B;

  /* Fixed-on-image values — never invert, photos stay deep */
  --on-scrim:    #F2EEE6;
  --on-scrim-2:  rgba(242,238,230,.62);
  --on-scrim-3:  rgba(242,238,230,.34);

  /* Surfaces & media */
  --stage:    #070706;
  --av-a:     #3A3630;
  --av-b:     #6B6357;
  --img-dim:  .92;
  --hero-dim: .86;
  --grain:    .028;
  --solid-hover: #FFFFFF;
  --sh-1: 0 18px 44px rgba(0,0,0,.55);
  --sh-2: 0 30px 84px rgba(0,0,0,.5);

  /* States */
  --ok:       #A3BFA0;
  --fail:     #C08C7E;
  --warn:     #C4B07A;

  /* Hero veils */
  --hero-a1: .70; --hero-a2: .26;
  --hero-b1: .70; --hero-b2: .12; --hero-b3: .62;
  --hero-c1: .55;

  /* Type */
  --f-sans: "PingFang SC","HarmonyOS Sans SC","Source Han Sans SC","Microsoft YaHei","Helvetica Neue",Arial,sans-serif;
  --f-serif: "Instrument Serif","Times New Roman","Songti SC","STSong",Georgia,serif;
  --f-mono: "SF Mono","JetBrains Mono",ui-monospace,Consolas,monospace;

  /* Motion */
  --ease: cubic-bezier(.16,1,.3,1);
  --ease-io: cubic-bezier(.65,0,.35,1);

  /* Layout */
  --pad: clamp(20px, 4.2vw, 64px);
  --max: 1560px;
  --nav-h: 74px;
}

/* ---------------- Light theme ---------------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg-rgb: 246,243,236;
  --fg-rgb: 23,21,15;

  --ink:      #F6F3EC;
  --ink-1:    #F1EDE4;
  --ink-2:    #EAE5DB;
  --ink-3:    #DFD9CD;
  --ink-4:    #D6CFC1;

  --paper:    #17150F;
  --paper-80: rgba(var(--fg-rgb),.84);
  --paper-60: rgba(var(--fg-rgb),.62);
  --paper-42: rgba(var(--fg-rgb),.48);
  --paper-26: rgba(var(--fg-rgb),.32);
  --paper-14: rgba(var(--fg-rgb),.16);

  --line:     rgba(var(--fg-rgb),.11);
  --line-2:   rgba(var(--fg-rgb),.18);
  --line-3:   rgba(var(--fg-rgb),.32);

  --brass:    #A07E4E;
  --brass-d:  #7A5C34;

  --stage:    #E9E4DA;
  --av-a:     #DCD5C7;
  --av-b:     #B9B0A0;
  --img-dim:  1;
  --hero-dim: 1;
  --grain:    .020;
  --solid-hover: #2A2721;
  --sh-1: 0 16px 40px rgba(23,21,15,.12);
  --sh-2: 0 24px 64px rgba(23,21,15,.13);

  --ok:       #5D7A54;
  --fail:     #96594A;
  --warn:     #8A7038;

  /* Hero veils — bright, airy cover in daylight */
  --hero-a1: .62; --hero-a2: .16;
  --hero-b1: .58; --hero-b2: .04; --hero-b3: .46;
  --hero-c1: .40;
}

/* ---------- Reset ---------- */
*,*::before,*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--ink); }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-sans);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.75;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; background: none; border: 0; outline: 0; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1,h2,h3,h4,h5,p { margin: 0; font-weight: 300; }
::selection { background: var(--paper); color: var(--ink); }
hr { border: 0; height: 1px; background: var(--line); margin: 0; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--fg-rgb),.16); border-radius: 20px; border: 2px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--fg-rgb),.3); }

/* ---------- Typography ---------- */
.display {
  font-size: clamp(44px, 7.4vw, 118px);
  line-height: .96;
  letter-spacing: -.035em;
  font-weight: 200;
}
.h2 {
  font-size: clamp(30px, 3.6vw, 54px);
  line-height: 1.12;
  letter-spacing: -.025em;
  font-weight: 200;
}
.h3 {
  font-size: clamp(20px, 1.7vw, 25px);
  line-height: 1.35;
  letter-spacing: -.01em;
  font-weight: 300;
}
.h4 { font-size: 16px; line-height: 1.5; font-weight: 400; letter-spacing: .01em; }

.eyebrow {
  font-family: var(--f-serif);
  font-size: 12px;
  font-style: italic;
  letter-spacing: .12em;
  color: var(--paper-42);
  text-transform: uppercase;
}
.label {
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--paper-42);
  font-weight: 400;
}
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dim { color: var(--paper-60); }
.dimmer { color: var(--paper-42); }
.serif { font-family: var(--f-serif); }
.italic { font-style: italic; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.wrap--narrow { max-width: 1080px; }
.section { padding: clamp(72px, 11vh, 148px) 0; position: relative; }
.section--tight { padding: clamp(48px, 6vh, 88px) 0; }

.grid12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(16px, 2vw, 32px);
}

.rule { height: 1px; background: var(--line); width: 100%; }
.rule--v { width: 1px; height: 100%; background: var(--line); }

/* ---------- Grain & vignette ---------- */
.grain::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 9000;
  pointer-events: none;
  opacity: var(--grain, .028);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 8s steps(6) infinite;
}
@keyframes grainShift {
  0%,100% { transform: translate(0,0); }
  16% { transform: translate(-2%,1%); }
  33% { transform: translate(1%,-2%); }
  50% { transform: translate(-1%,-1%); }
  66% { transform: translate(2%,1%); }
  83% { transform: translate(-1%,2%); }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 30px;
  border: 1px solid var(--line-3);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--paper);
  overflow: hidden;
  isolation: isolate;
  transition: color .5s var(--ease), border-color .5s var(--ease);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
  transform: translateY(101%);
  transition: transform .6s var(--ease);
  z-index: -1;
}
.btn:hover { color: var(--ink); border-color: var(--paper); }
.btn:hover::before { transform: translateY(0); }
.btn--solid { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn--solid::before { background: var(--ink); }
.btn--solid:hover { color: var(--paper); border-color: var(--paper); }
.btn--sm { height: 36px; padding: 0 20px; font-size: 12px; }
.btn--ghost { border-color: transparent; padding: 0 4px; height: auto; }
.btn--ghost::before { display: none; }
.btn--ghost:hover { color: var(--ink); }
.btn[disabled], .btn.is-disabled { opacity: .35; pointer-events: none; }

/* Arrow link */
.alink {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--paper-80);
  position: relative;
  padding-bottom: 6px;
}
.alink::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--line-3);
  transform-origin: left;
  transform: scaleX(1);
  transition: transform .5s var(--ease), background .5s;
}
.alink:hover { color: var(--paper); }
.alink:hover::after { background: var(--paper); }
.alink span.ar {
  display: inline-block;
  transition: transform .55s var(--ease);
}
.alink:hover span.ar { transform: translateX(5px); }

/* ---------- Reveal motion ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1.1s var(--ease), transform 1.2s var(--ease), filter 1.2s var(--ease);
  filter: blur(4px);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
[data-reveal].is-in { opacity: 1; transform: none; filter: blur(0); }

.mask { overflow: hidden; display: block; }
.mask > * {
  display: block;
  transform: translateY(104%);
  transition: transform 1.15s var(--ease);
  transition-delay: var(--d, 0ms);
}
.mask.is-in > * { transform: translateY(0); }

/* Image reveal */
.imgbox { position: relative; overflow: hidden; background: var(--ink-3); }
.imgbox > img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 1.6s var(--ease), filter 1.2s var(--ease);
  filter: saturate(.92) contrast(1.02);
}
.imgbox.is-in > img { transform: scale(1); }
.imgbox::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: scaleY(1);
  transform-origin: bottom;
  transition: transform 1.1s var(--ease);
}
.imgbox.is-in::after { transform: scaleY(0); }

/* ---------- Header ---------- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 500;
  display: flex;
  align-items: center;
  transition: height .5s var(--ease), background .5s var(--ease), border-color .5s;
  border-bottom: 1px solid transparent;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.site-head.is-stuck {
  height: 62px;
  background: rgba(var(--bg-rgb),.72);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom-color: var(--line);
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  letter-spacing: .22em;
  font-weight: 300;
  padding: 6px 0;
}
.brand b { font-weight: 400; }
.brand i {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--paper-42);
  text-transform: uppercase;
}
.nav-links { display: flex; gap: clamp(18px, 2.6vw, 42px); }
.nav-links a {
  position: relative;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: var(--paper-60);
  padding: 6px 0;
  transition: color .4s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .5s var(--ease);
}
.nav-links a:hover { color: var(--paper); }
.nav-links a:hover::after, .nav-links a.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav-links a.is-active { color: var(--paper); }
.nav-acts { display: flex; align-items: center; gap: 14px; }

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: clamp(48px, 7vh, 88px) 0 30px;
  position: relative;
}
.foot-top {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 32px;
  padding-bottom: clamp(48px, 7vh, 84px);
}
.foot-col h5 {
  font-size: 10px;
  letter-spacing: .3em;
  color: var(--paper-42);
  text-transform: uppercase;
  margin-bottom: 20px;
}
.foot-col li { margin-bottom: 11px; }
.foot-col a { font-size: 13px; color: var(--paper-60); transition: color .4s; }
.foot-col a:hover { color: var(--paper); }
.foot-mark {
  font-family: var(--f-serif);
  font-size: clamp(64px, 15vw, 240px);
  line-height: .8;
  letter-spacing: -.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(var(--fg-rgb),.14);
  text-align: center;
  user-select: none;
  padding: clamp(8px, 2vh, 30px) 0;
  transition: -webkit-text-stroke-color .8s var(--ease);
}
.foot-mark:hover { -webkit-text-stroke-color: rgba(var(--fg-rgb),.34); }
.foot-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--paper-42);
  flex-wrap: wrap;
}

/* ---------- Cursor ---------- */
.cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--paper);
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50%,-50%,0);
  transition: width .4s var(--ease), height .4s var(--ease), opacity .3s;
  will-change: transform;
}
.cursor-dot.is-hover { width: 44px; height: 44px; opacity: .9; }
.cursor-dot.is-hidden { opacity: 0; }
@media (pointer: fine) {
  .has-js.cursor-on, .has-js.cursor-on * { cursor: none !important; }
}

/* ---------- Utilities ---------- */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.col { flex-direction: column; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; }
.wrap-anywhere { overflow-wrap: anywhere; }
.tabular { font-variant-numeric: tabular-nums; }
.mt-a { margin-top: auto; }
.hide { display: none !important; }

.page-fade {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 9500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s var(--ease);
}
.page-fade.is-out { opacity: 1; }

/* Thin top progress bar for app pages */
.progress-top {
  position: fixed;
  top: 0; left: 0;
  height: 1px;
  width: 0;
  background: var(--paper);
  z-index: 9600;
  transition: width .4s var(--ease), opacity .6s;
}

/* ---------- Theme switch ---------- */
.theme-toggle {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  display: inline-grid;
  place-items: center;
  color: var(--paper-60);
  transition: color .4s var(--ease), border-color .4s var(--ease), background .4s var(--ease);
}
.theme-toggle:hover { color: var(--paper); border-color: var(--line-3); background: rgba(var(--fg-rgb),.05); }
.theme-toggle svg { width: 14px; height: 14px; display: block; }
.theme-toggle .tm-moon { display: none; }
html[data-theme="light"] .theme-toggle .tm-moon { display: block; }
html[data-theme="light"] .theme-toggle .tm-sun { display: none; }
.theme-toggle--lg { width: 36px; height: 36px; }

/* cross-fade every surface while the theme changes */
html.theme-fade,
html.theme-fade *,
html.theme-fade *::before,
html.theme-fade *::after {
  transition-property: background-color, background-image, border-color, color, fill, stroke, box-shadow, opacity !important;
  transition-duration: .5s !important;
  transition-timing-function: var(--ease) !important;
}
html.theme-fade .grain::after { transition-property: opacity !important; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .foot-top { grid-template-columns: 1fr 1fr; }
  .display { letter-spacing: -.02em; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
  .mask > * { transform: none; }
}
