/* Galena Labs: tokens, type, components, and page layout. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:        #0D0E10;  /* graphite black */
  --surface:   #15171A;  /* raised panels */
  --line:      #272A2F;  /* hairlines, cleavage lines */
  --text:      #E4E6E9;  /* primary text */
  --muted:     #8A9098;  /* secondary text (6.0:1 on --bg) */
  --galena:    #A9AFB7;  /* lead-gray metallic, headings and mark */
  --sheen-1:   #6C727A;
  --sheen-2:   #D2D6DB;
  --sheen-3:   #7B8189;
  --tarnish:   #7A92BA;  /* single accent, from the logo slate #506890 lightened for dark: links, focus ring (6.1:1 on --bg) */

  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --max: 1100px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --header-h: 4.5rem;
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
}

@media (min-width: 48em) {
  body { font-size: 1.125rem; }
}

/* Grain: tiled feTurbulence, far below perception at a glance */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

h1, h2, h3, p, dl, dd { margin: 0; }

a {
  color: var(--tarnish);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--tarnish);
  outline-offset: 4px;
  border-radius: 1px;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  z-index: 60;
  padding: 0.5rem 0.875rem;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8125rem;
  border: 1px solid var(--line);
}
.skip-link:focus { top: 0.75rem; }

/* ---------- Type roles ---------- */

.display {
  font-family: var(--sans);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  line-height: 1.15;
  color: var(--galena);
  text-wrap: balance;
}

/* Metallic sheen: light moving slowly across a crystal face */
.sheen {
  color: var(--galena);
  /* stays at or above --sheen-3 (4.9:1) everywhere; --sheen-1 is too dark for text */
  background-image: linear-gradient(
    100deg,
    var(--sheen-3) 0%,
    var(--galena) 34%,
    var(--sheen-2) 50%,
    var(--galena) 66%,
    var(--sheen-3) 100%
  );
  background-size: 200% 100%;
  background-position: 70% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sheen 10s ease-in-out infinite alternate;
}

@keyframes sheen {
  from { background-position: 78% 50%; }
  to   { background-position: 22% 50%; }
}

.mono {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.index {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

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

.scroll-sentinel {
  position: absolute;
  top: 40px;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.site-header.is-solid {
  background-color: var(--bg);
  border-bottom-color: var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: auto;
  height: 32px;
}

@media (min-width: 48em) {
  .brand img { height: 36px; }
}

.nav-link {
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--text);
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.nav-link:hover { color: var(--tarnish); border-bottom-color: currentColor; }

/* ---------- Crystal ---------- */

.crystal {
  width: 100%;
  height: auto;
  overflow: visible;
}

.crystal line {
  stroke: var(--galena);
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- Cleavage divider: a 1px plane fractured once ---------- */

.cleave {
  position: relative;
  height: 9px;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.cleave::before,
.cleave::after {
  content: "";
  position: absolute;
  top: 0;
  border-color: var(--line);
  border-style: solid;
  border-width: 0;
}
.cleave::before {
  left: var(--gutter);
  width: calc((100% - 2 * var(--gutter)) * var(--break, 0.62));
  border-top-width: 1px;
}
.cleave::after {
  left: calc(var(--gutter) + (100% - 2 * var(--gutter)) * var(--break, 0.62));
  right: var(--gutter);
  height: 9px;
  border-left-width: 1px;
  border-bottom-width: 1px;
}
.cleave--late { --break: 0.28; }

/* ---------- Capability icons ---------- */

.icon {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--galena);
  stroke-width: 1;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.icon path,
.icon line,
.icon polyline { vector-effect: non-scaling-stroke; }
.icon .faint { stroke-opacity: 0.4; }

/* ---------- Email ---------- */

.email {
  display: inline-block;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.2;
  overflow-wrap: anywhere;
  padding-bottom: 0.15em;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.3s;
}
a.email:hover { border-bottom-color: var(--tarnish); }

/* ---------- Scroll cue ---------- */

.scroll-cue {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 64px;
  background: linear-gradient(to bottom, transparent, var(--galena));
  transform-origin: top;
  animation: cue 3.2s var(--ease) infinite;
  opacity: 0.5;
}
@keyframes cue {
  0%   { transform: scaleY(0); opacity: 0; }
  40%  { transform: scaleY(1); opacity: 0.5; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ---------- Reveal (JS adds .is-pending only to off-screen elements) ---------- */

.is-pending {
  opacity: 0;
  transform: translateY(10px);
}
[data-reveal] {
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

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

.site-footer {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 2rem var(--gutter) 2.5rem;
}

/* ---------- 404 ---------- */

.notfound {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2.5rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 2rem) var(--gutter) 3rem;
  text-align: center;
}
.notfound__art {
  width: min(260px, 60vw);
  fill: none;
  stroke: var(--galena);
  stroke-width: 1;
  stroke-linejoin: round;
}
.notfound__art .faint { stroke-opacity: 0.35; }
.notfound h1 { font-size: clamp(1.25rem, 3.4vw, 1.75rem); }
.notfound .nav-link { color: var(--tarnish); }

/* ---------- Reduced motion: everything holds still ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .sheen { background-position: 50% 50%; }
  .scroll-cue { display: none; }
  .is-pending { opacity: 1; transform: none; }
}

/* ========== Page layout ========== */


.hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 1.5rem) var(--gutter) 7rem;
  text-align: center;
  overflow: hidden;
}

.hero__crystal {
  align-self: center;
  width: min(580px, 80vw, 56svh);
  margin-bottom: 2rem;
}

.hero__copy {
  position: relative;
  max-width: var(--max);
}

.hero__title {
  font-size: clamp(1.5rem, 4vw, 3.25rem);
  letter-spacing: 0.14em;
  padding-left: 0.14em; /* balance trailing tracking so the line sits on axis */
}

.hero__sub {
  max-width: 46ch;
  margin: 1.25rem auto 0;
  color: var(--muted);
  text-wrap: pretty;
}

.hero__place {
  position: absolute;
  left: max(var(--gutter), (100% - var(--max)) / 2); /* align with the header's left edge */
  bottom: 2rem;
}

.hero .scroll-cue { left: 50%; }

@media (min-width: 64em) {
  .hero__title { white-space: nowrap; }
}

/* Small screens: the crystal steps back behind the headline */
@media (max-width: 39.99em) {
  .hero {
    grid-template-rows: 1fr;
    align-items: center;
  }
  .hero__crystal {
    position: absolute;
    top: 42%;
    left: 50%;
    width: 118vw;
    margin: 0;
    transform: translate(-50%, -50%);
    opacity: 0.55;
  }
}

/* Statement */

.statement {
  display: grid;
  place-items: center;
  min-height: 80vh;
  min-height: 80svh;
  padding: 7rem var(--gutter);
  text-align: center;
}

.statement__text {
  max-width: 38ch;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  line-height: 1.5;
  text-wrap: pretty;
}

/* Capabilities */

.caps {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 8rem var(--gutter);
}

.caps .index {
  margin-bottom: 3.5rem;
  text-align: center;
}

.caps__grid {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.cap {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--line);
}

.cap__title {
  margin: 1.5rem 0 0.625rem;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--galena);
}

.cap__text {
  max-width: 44ch;
  font-size: 1rem;
  color: var(--text);
}

@media (min-width: 48em) {
  .caps__grid { grid-template-columns: 1fr 1fr; }
  .cap { padding: 3rem 3rem 3.25rem; }
  .cap:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--line); }
}

/* Contact */

.contact {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2rem;
  min-height: 70vh;
  min-height: 70svh;
  padding: 6rem var(--gutter);
  text-align: center;
}

.contact__email {
  min-height: 1.4em;
  font-size: clamp(1.125rem, 2.2vw, 1.5rem);
}

.site-footer { text-align: center; }
