/* ==========================================================================
   碳界 CARBONEDGE — Base / Typography / Textures / Utilities
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

::selection {
  background: var(--accent);
  color: var(--bg-0);
}

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

.skip-link {
  position: fixed;
  top: -48px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: top var(--t-fast) var(--ease-out);
}
.skip-link:focus {
  top: 12px;
}

/* ---------- Typography ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
}

.h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-h2);
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-h3);
  line-height: 1.35;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.section-label::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.section-lead {
  color: var(--text-2);
  font-size: 1.05rem;
  line-height: var(--lh-body);
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  letter-spacing: 0.04em;
}

.num {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout helpers ---------- */

.container {
  width: min(var(--container), 100% - 48px);
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section-head {
  display: grid;
  gap: var(--sp-4);
  margin-bottom: var(--sp-7);
  max-width: 720px;
}

.section-head--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-6);
  max-width: none;
}

.section-head--split .section-head__text {
  max-width: 640px;
}

.section-head__text {
  display: grid;
  gap: var(--sp-4);
}

.band-alt {
  background: var(--bg-1);
}

.hairline {
  height: 1px;
  background: var(--line);
  border: 0;
}

/* ---------- Carbon weave textures ---------- */

.weave {
  background-color: var(--bg-1);
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.045) 0 2px,
      transparent 2px 8px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.045) 0 2px,
      transparent 2px 8px
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.028), transparent 38%),
    linear-gradient(315deg, rgba(0, 0, 0, 0.42), transparent 46%);
}

.weave--fine {
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.06) 0 1px,
      transparent 1px 5px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.06) 0 1px,
      transparent 1px 5px
    ),
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent 40%),
    linear-gradient(315deg, rgba(0, 0, 0, 0.5), transparent 50%);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 26px;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition:
    background var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out);
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform var(--t-med) var(--ease-out);
}

.btn--primary {
  background: var(--accent);
  color: #1d1404;
}
.btn--primary:hover {
  background: var(--accent-2);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(232, 163, 61, 0.24);
}
.btn--primary:hover svg {
  transform: translateX(3px);
}

.btn--ghost {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}
.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.btn--lg {
  min-height: 54px;
  padding: 0 32px;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

/* ---------- Icon tiles ---------- */

.icon-tile {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  background: var(--accent-dim);
  border: 1px solid rgba(232, 163, 61, 0.28);
  color: var(--accent);
}

.icon-tile svg {
  width: 22px;
  height: 22px;
}

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

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity var(--t-slow) var(--ease-out),
    transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Reduced motion ---------- */

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