/* ==========================================================================
   Threadcaster Studios — full stylesheet
   Brand: woven isometric ribbons + pixel dissipation, electric blue / magenta
   on near-black. Contrast of every text colour checked against --bg (AA+).
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:        #05070c;
  --bg-1:      #0a0e17;
  --bg-2:      #101725;
  --line:      #1c2536;
  --line-2:    #2a3549;

  /* Text — ratios vs --bg: 18.4:1 / 11.2:1 / 6.4:1 */
  --txt:       #f2f5fa;
  --txt-2:     #b8c2d6;
  --txt-3:     #8592ab;

  /* Brand */
  --blue:      #0057ff;   /* fills only (white text on it = 5.5:1) */
  --blue-lt:   #4d8bff;   /* text on dark = 6.2:1 */
  --pink:      #fc1884;
  --pink-lt:   #ff4d9e;   /* text on dark = 6.5:1 */

  --grad: linear-gradient(90deg, var(--blue) 0%, var(--pink) 100%);

  --wrap: 1120px;
  --radius: 8px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  /* header height + breathing room for in-page anchors */
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 800;
}

p { margin: 0; }

a { color: var(--blue-lt); }
a:hover { color: var(--pink-lt); }

/* height:auto matters: these images carry width/height attributes, so sizing
   only the width in CSS would leave the attribute height in force and squash
   them. */
img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 2px solid var(--blue-lt);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Shared bits ---------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

/* The brand "weave": two fine diagonal lattices in the two brand hues,
   echoing the interlaced ribbons of the mark. */
.weave {
  background-image:
    repeating-linear-gradient(60deg,  rgba(0, 87, 255, .055) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(-60deg, rgba(252, 24, 132, .05) 0 1px, transparent 1px 15px);
}

/* Small square = the pixel-dissipation motif from the logo */
.px {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--blue);
  flex: none;
}
.px.pink { background: var(--pink); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--txt-3);
  margin: 0 0 18px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--blue);
  color: #fff;
  padding: 12px 20px;
  z-index: 200;
  font-weight: 700;
}
.skip:focus {
  left: 12px;
  top: 12px;
}

/* ---------- Header / navigation --------------------------------------- */

.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(5, 7, 12, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.hdr.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(5, 7, 12, .92);
}
/* Brand hairline across the very top */
.hdr::before {
  content: "";
  display: block;
  height: 2px;
  background: var(--grad);
}

.hdr-in {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--txt);
  flex: none;
}
.brand img { height: 34px; width: auto; }
.brand-txt {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .04em;
  white-space: nowrap;
}
.brand-txt b {
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 30px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  position: relative;
  color: var(--txt-2);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  padding: 6px 0;
  transition: color .2s var(--ease);
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease);
}
.nav-links a:hover,
.nav-links a[aria-current="true"] { color: var(--txt); }
.nav-links a:hover::after,
.nav-links a[aria-current="true"]::after { transform: scaleX(1); }

/* Language switcher */
.lang {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.lang button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--txt-3);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang button:hover { color: var(--txt); }
.lang button[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
}

/* Mobile menu toggle */
.burger {
  display: none;
  appearance: none;
  border: 1px solid var(--line-2);
  background: transparent;
  border-radius: var(--radius);
  width: 42px;
  height: 42px;
  padding: 0;
  cursor: pointer;
  margin-left: auto;
  position: relative;
}
.burger span {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 2px;
  background: var(--txt);
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.burger span:nth-child(1) { top: 14px; }
.burger span:nth-child(2) { top: 20px; }
.burger span:nth-child(3) { top: 26px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 820px) {
  .burger { display: block; }
  .nav {
    position: fixed;
    inset: 72px 0 auto;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line);
    padding: 12px 24px 24px;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s var(--ease), transform .22s var(--ease), visibility .22s;
  }
  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nav-links a {
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
    font-size: 1.05rem;
  }
  .nav-links a::after { display: none; }
  .lang { margin-top: 18px; align-self: flex-start; }
}

/* ---------- Hero ------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(56px, 9vw, 104px) 0 clamp(52px, 7vw, 88px);
  overflow: hidden;
}
/* Brand glows. Plain radial gradients rather than blur() filters: the falloff
   is already soft, and a 90px blur over a 600px box next to the header's
   backdrop-filter is enough compositing work to stall paints. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.hero::before {
  width: 760px; height: 760px;
  top: -300px; right: -180px;
  background: radial-gradient(circle,
    rgba(0, 87, 255, .26) 0%, rgba(0, 87, 255, .10) 36%, transparent 68%);
}
.hero::after {
  width: 640px; height: 640px;
  bottom: -320px; left: -220px;
  background: radial-gradient(circle,
    rgba(252, 24, 132, .17) 0%, rgba(252, 24, 132, .06) 38%, transparent 70%);
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 6.2vw, 4.1rem);
  margin: 0 0 22px;
}
.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  font-size: clamp(1.02rem, 1.6vw, 1.16rem);
  color: var(--txt-2);
  max-width: 48ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  padding: 14px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform .2s var(--ease), background .2s var(--ease),
              border-color .2s var(--ease), color .2s var(--ease);
}
.btn-primary {
  background: var(--blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--pink);
  color: #fff;
  transform: translateY(-2px);
}
.btn-ghost {
  border-color: var(--line-2);
  color: var(--txt);
}
.btn-ghost:hover {
  border-color: var(--blue-lt);
  color: var(--txt);
  transform: translateY(-2px);
}

/* Hero meta strip grounds the composition */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--txt-3);
}
.hero-meta span {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* Hero mark + its pixel dissipation */
.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
}
/* soft halo behind the mark, cheaper than stacking drop-shadows */
.hero-art::before {
  content: "";
  position: absolute;
  width: 128%;
  padding-bottom: 128%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(0, 87, 255, .30) 0%, rgba(252, 24, 132, .10) 42%, transparent 68%);
  pointer-events: none;
}
.hero-art img {
  position: relative;
  width: min(330px, 78%);
  height: auto;
  filter: drop-shadow(0 0 30px rgba(0, 87, 255, .35));
}
.hero-art .spark {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--blue);
  animation: drift 7s var(--ease) infinite;
}
.hero-art .spark.p { background: var(--pink); }
.hero-art .spark.s { width: 6px; height: 6px; }
.hero-art .spark:nth-child(2) { top: 4%;  right: 10%; animation-delay: 0s; }
.hero-art .spark:nth-child(3) { top: 15%; right: 2%;  animation-delay: .9s; }
.hero-art .spark:nth-child(4) { top: 28%; right: 14%; animation-delay: 1.8s; }
.hero-art .spark:nth-child(5) { top: 9%;  right: 22%; animation-delay: 2.7s; }
.hero-art .spark:nth-child(6) { top: 36%; right: 4%;  animation-delay: 3.6s; }

@keyframes drift {
  0%, 100% { transform: translate(0, 0);        opacity: .30; }
  50%      { transform: translate(9px, -11px);  opacity: .95; }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; margin-bottom: 8px; }
  .hero-art img { width: min(230px, 56%); }
}

/* ---------- Sections --------------------------------------------------- */

.sec {
  position: relative;
  padding: clamp(60px, 8vw, 104px) 0;
  border-top: 1px solid var(--line);
}

.sec-head {
  max-width: 60ch;
  margin-bottom: 42px;
}
.sec-head h2 {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  margin-bottom: 16px;
}
.sec-head p { color: var(--txt-2); }

/* Card grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 26px 30px;
  overflow: hidden;
  transition: border-color .25s var(--ease), transform .25s var(--ease),
              background .25s var(--ease);
}
/* gradient top edge, revealed on hover */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.card:hover {
  border-color: var(--line-2);
  background: var(--bg-2);
  transform: translateY(-3px);
}
.card:hover::before { transform: scaleX(1); }

.card h3 {
  font-size: 1.12rem;
  margin: 14px 0 10px;
}
.card p {
  color: var(--txt-2);
  font-size: .95rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pink-lt);
  border: 1px solid rgba(252, 24, 132, .38);
  background: rgba(252, 24, 132, .10);
  border-radius: 999px;
  padding: 5px 13px;
}
.tag.blue {
  color: var(--blue-lt);
  border-color: rgba(0, 87, 255, .45);
  background: rgba(0, 87, 255, .12);
}

/* Feature slot — the in-development project */
.slot {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 36px;
  align-items: center;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(28px, 4vw, 44px);
  overflow: hidden;
}
.slot::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--grad);
}
.slot h3 {
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  margin: 16px 0 14px;
}
.slot p { color: var(--txt-2); max-width: 54ch; }

/* Pixel strip: reads as "progress / dissipation" */
.pxstrip {
  display: flex;
  gap: 6px;
  margin-top: 26px;
}
.pxstrip i {
  width: 14px;
  height: 14px;
  background: var(--line-2);
}
.pxstrip i:nth-child(1) { background: var(--blue); }
.pxstrip i:nth-child(2) { background: var(--blue); }
.pxstrip i:nth-child(3) { background: var(--pink); }
.pxstrip i:nth-child(4) { background: rgba(252, 24, 132, .45); }

.slot-art img {
  width: 132px;
  height: auto;
  opacity: .92;
  filter: drop-shadow(0 0 34px rgba(0, 87, 255, .32));
}
@media (max-width: 760px) {
  .slot { grid-template-columns: 1fr; }
  .slot-art { display: none; }
}

/* ---------- Contact ---------------------------------------------------- */

.contact-band {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-1);
  padding: clamp(32px, 5vw, 56px);
  overflow: hidden;
}
.contact-band > * { position: relative; z-index: 1; }
.contact-band h2 { margin-bottom: 14px; }

.mail {
  display: inline-block;
  font-size: clamp(1.25rem, 3.4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--txt);
  text-decoration: none;
  margin-top: 12px;
  padding-bottom: 6px;
  background-image: var(--grad);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 2px;
  transition: background-size .3s var(--ease), color .2s var(--ease);
  word-break: break-word;
}
.mail:hover {
  color: var(--txt);
  background-size: 100% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.contact-note {
  color: var(--txt-3);
  font-size: .9rem;
  margin-top: 22px;
}
.contact-note a {
  text-decoration: none;
  border-bottom: 1px solid rgba(77, 139, 255, .45);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.contact-note a:hover { border-bottom-color: var(--pink-lt); }

/* ---------- Footer ----------------------------------------------------- */

.ftr {
  border-top: 1px solid var(--line);
  padding: 46px 0 56px;
  font-size: .88rem;
  color: var(--txt-3);
}
.ftr-in {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
  justify-content: space-between;
}
.ftr-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}
.ftr-brand img { height: 28px; width: auto; }
.ftr-brand span {
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--txt-2);
  font-size: .92rem;
}
.ftr-legal { line-height: 1.75; }
.ftr-legal strong { color: var(--txt-2); font-weight: 600; }

.ftr-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ftr-links a {
  color: var(--txt-3);
  text-decoration: none;
  transition: color .2s var(--ease);
}
.ftr-links a:hover { color: var(--blue-lt); }

/* ---------- Legal / privacy pages -------------------------------------- */

.doc {
  padding: clamp(44px, 6vw, 76px) 0 clamp(60px, 8vw, 96px);
  max-width: 74ch;
}
.doc h1 {
  font-size: clamp(2rem, 4.4vw, 2.8rem);
  margin-bottom: 12px;
}
.doc .updated {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--txt-3);
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.doc h2 {
  font-size: 1.2rem;
  margin: 40px 0 14px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.doc p { color: var(--txt-2); margin-bottom: 14px; }
.doc ul {
  color: var(--txt-2);
  padding-left: 0;
  list-style: none;
  margin: 0 0 14px;
}
.doc li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
}
.doc li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 7px;
  height: 7px;
  background: var(--blue);
}
.doc li strong { color: var(--txt); font-weight: 700; }
.doc a { word-break: break-word; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 44px;
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
}

/* ---------- Reveal on scroll ------------------------------------------- */

.rv {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.rv.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .rv { opacity: 1; transform: none; }
}

/* ---------- CJK typography ---------------------------------------------
   Negative tracking, uppercasing and wide letter-spacing are Latin-only
   devices: on Han characters they read as broken spacing. Swap the stack
   and neutralise them when the document is in Chinese. */

html[lang^="zh"] body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Noto Sans CJK SC", "Source Han Sans SC", var(--sans);
  line-height: 1.75;
}
html[lang^="zh"] h1,
html[lang^="zh"] h2,
html[lang^="zh"] h3 { letter-spacing: 0; line-height: 1.3; }
html[lang^="zh"] .eyebrow,
html[lang^="zh"] .tag,
html[lang^="zh"] .hero-meta {
  text-transform: none;
  letter-spacing: .04em;
  font-family: inherit;
}
html[lang^="zh"] .doc .updated {
  text-transform: none;
  letter-spacing: .04em;
  font-family: inherit;
}
/* The wordmark and the language switcher stay Latin */
html[lang^="zh"] .brand-txt { letter-spacing: .04em; }
html[lang^="zh"] .lang button { font-family: var(--mono); }
