/* ============================================================
   Intelligence Engine — ieorg.xyz
   The desktop: retro windows on black, paper chrome,
   ultramarine + signal red + one yellow folder.
   ============================================================ */

/* ---------- fonts (self-hosted, latin) ---------- */
@font-face {
  font-family: 'Archivo Black';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/archivo-black-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo Variable';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/archivo-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

/* ---------- tokens ---------- */
:root {
  --void: #0F0F0F;
  --paper: #F2F0E9;
  --paper-dim: rgba(242, 240, 233, 0.62);
  --paper-faint: rgba(242, 240, 233, 0.34);
  --hair: rgba(242, 240, 233, 0.14);
  --ink: #141414;
  --ink-soft: rgba(20, 20, 20, 0.68);
  --ink-hair: rgba(20, 20, 20, 0.16);
  --blue: #2B44E0;
  --blue-body: #2F49C4;
  --red: #E03A26;
  --yellow: #F5C518;

  --f-display: 'Archivo Black', 'Arial Black', sans-serif;
  --f-body: 'Archivo Variable', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --wrap: 1100px;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --barH: 44px;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  background: var(--void);
  height: 100%;
}
body {
  margin: 0;
  background: var(--void);
  color: var(--paper);
  font-family: var(--f-body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.6;
  height: 100%;
  overflow: hidden;
}
/* the document never scrolls — this inner pane does. iOS Safari's
   translucent status-bar strip samples the (static) document, so the
   strip stays solid void-black instead of ghosting page content. */
.page {
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
h1, h2, h3, p, dl, dd, figure, pre { margin: 0; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
address { font-style: normal; }
img, canvas { max-width: 100%; display: block; }

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

.skip {
  position: absolute;
  left: -100vw;
  top: 0;
  z-index: 300;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-mono);
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  text-decoration: none;
}
.skip:focus-visible { left: 0.5rem; top: 0.5rem; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ---------- film grain ---------- */
body::after {
  content: '';
  position: fixed;
  inset: -60px;
  z-index: 190;
  pointer-events: none;
  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.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
}

/* ---------- menu bar ---------- */
.menubar {
  position: sticky;
  top: 0;
  z-index: 120;
  height: calc(var(--barH) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: clamp(0.9rem, 2.5vw, 1.6rem);
  background: var(--void);
  border-bottom: 1px solid var(--hair);
}
.menubar::before {
  /* black apron above the viewport top: iOS Safari's translucent
     status-bar strip samples the page pixels up there */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 140px;
  background: var(--void);
}
.mb-left { display: inline-flex; align-items: center; gap: 0.7rem; }
.cursor {
  display: block;
  width: 10px;
  height: 17px;
  background: var(--blue);
  animation: blink 1.3s steps(1) infinite;
}
@keyframes blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0.25; }
}
.mb-name {
  font-family: var(--f-display);
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.mb-right { display: inline-flex; align-items: center; gap: clamp(0.9rem, 2.5vw, 1.6rem); }
.mb-link {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-dim);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.mb-link:hover { color: var(--paper); border-bottom-color: var(--blue); }
.mb-clock {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--paper-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- the desktop ---------- */
.desktop {
  position: relative;
  min-height: calc(100svh - var(--barH));
  overflow: hidden;
  background-image: radial-gradient(rgba(242, 240, 233, 0.055) 1px, transparent 1px);
  background-size: 26px 26px;
}

.desk-caption {
  position: absolute;
  left: clamp(1rem, 3vw, 2.2rem);
  bottom: clamp(1rem, 3.5vh, 2rem);
  z-index: 1;
  display: grid;
  gap: 0.45rem;
  font-weight: 400;
}
.dc-name {
  font-family: var(--f-display);
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-width: 11ch;
  line-height: 1.25;
}
.dc-sub {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-dim);
  max-width: 20ch;
  line-height: 1.6;
}

.scrollcue {
  position: absolute;
  bottom: 1.1rem;
  right: var(--gut);
  z-index: 1;
  margin: 0;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--paper-faint);
  animation: cueFloat 2.6s ease-in-out infinite;
}
@keyframes cueFloat {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* ---------- windows ---------- */
.win {
  position: absolute;
  z-index: 10;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  text-decoration: none;
  opacity: 0.001;
  transform: translateY(12px) scale(0.97);
}
html.loaded .win {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
html.loaded .win-donut { transition-delay: 0.1s; }
html.loaded .win-orbit { transition-delay: 0.22s; }
html.loaded .win-crowd { transition-delay: 0.34s; }
html.loaded .win-hold { transition-delay: 0.46s; }
html.loaded .win-pie { transition-delay: 0.58s; }
html.loaded .win-hands { transition-delay: 0.7s; }
html.loaded .win-readme { transition-delay: 0.92s; }

.win-bar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.42rem 0.65rem;
  border-bottom: 2px solid var(--ink);
  background-image: radial-gradient(rgba(20, 20, 20, 0.14) 1px, transparent 1px);
  background-size: 5px 5px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.win-bar:active { cursor: grabbing; }
.win-dots { display: inline-flex; gap: 0.3rem; }
.win-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
}
.win-dots i:nth-child(1) { background: var(--red); }
.win-dots i:nth-child(2) { background: var(--blue); }
.win-dots i:nth-child(3) { background: var(--yellow); }
.win-title {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  background: var(--paper);
  padding: 0.05em 0.45em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-body { display: block; position: relative; }

/* readme */
.win-readme { width: min(360px, 88vw); z-index: 14; }
.win-readme .win-body {
  padding: 1rem 1.1rem 1.15rem;
  display: grid;
  gap: 0.75rem;
}
.win-readme p {
  font-size: 0.925rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.readme-status {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: rgba(20, 20, 20, 0.45);
}
.readme-link a {
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
}
.readme-link a:hover { color: var(--blue); }

/* hold + orbit */
.win-hold { width: min(300px, 82vw); }
.win-hold .win-body { height: min(300px, 66vw); }
.win-orbit { width: min(250px, 76vw); }
.win-orbit .win-body { height: min(230px, 56vw); }

/* screen windows (black CRT body) */
.win-screen {
  background: var(--void);
  overflow: hidden;
}
.win-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
  opacity: 0.35;
}
.win-screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.win-donut { width: min(460px, 92vw); }
.win-donut .win-body { height: min(340px, 52vw); }

.win-hands { width: min(320px, 86vw); display: block; }
.win-hands .win-body { height: min(330px, 66vw); }
.win-hands .win-bar { cursor: grab; }
.win-hands:hover .win-title { background: var(--blue); color: var(--paper); }

/* crowd (screen-print red body, like the poster) */
.win-crowd { width: min(540px, 94vw); }
.win-crowd .win-body {
  height: min(290px, 52vw);
  background:
    radial-gradient(rgba(20, 20, 20, 0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 7px 7px;
  overflow: hidden;
}
.win-crowd canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* pie (blue body) */
.win-pie { width: min(280px, 80vw); }
.win-pie .win-body {
  height: min(250px, 60vw);
  background:
    radial-gradient(rgba(20, 20, 20, 0.16) 1px, transparent 1px),
    var(--blue-body);
  background-size: 7px 7px;
  overflow: hidden;
}
.win-pie canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* desktop placement (wide screens) */
@media (min-width: 861px) {
  .win-readme { left: 4%; top: 12%; }
  .win-donut { left: 31%; top: 6%; }
  .win-hands { right: 5.5%; top: 12%; }
  .win-orbit { left: 22%; top: 45%; z-index: 12; }
  .win-crowd { left: 17%; top: 58%; }
  .win-hold { left: 53%; top: 47%; }
  .win-pie { right: 5%; top: 57%; }
}

/* ---------- contact ---------- */
.contact {
  position: relative;
  background: var(--void);
  border-top: 1px solid var(--hair);
  padding-top: clamp(4.5rem, 11vh, 8rem);
}
.label {
  display: flex;
  align-items: center;
  gap: 0.8em;
  font-family: var(--f-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: clamp(2rem, 5vh, 3.2rem);
}
.sq { width: 8px; height: 8px; background: var(--blue); flex: none; }

h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.02;
  text-transform: uppercase;
  margin-bottom: clamp(2rem, 5vh, 3rem);
}
.dot { color: var(--red); font-style: normal; }

.contact-rows {
  display: grid;
  gap: 1.5rem;
  max-width: 46rem;
}
.contact-rows > div {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 1em;
  align-items: baseline;
  border-top: 1px solid var(--hair);
  padding-top: 1.3rem;
}
.contact-rows dt {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.contact-rows dd {
  margin: 0;
  font-family: var(--f-mono);
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  line-height: 1.5;
}
.contact-rows dd a {
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
  transition: color 0.2s ease;
}
.contact-rows dd a:hover { color: var(--blue); }
.contact-rows address {
  font-family: var(--f-body);
  font-size: clamp(0.98rem, 2vw, 1.06rem);
  color: var(--paper-dim);
}

/* ---------- footer ---------- */
.site-foot {
  border-top: 1px solid var(--hair);
  margin-top: clamp(4rem, 10vh, 6rem);
  padding-block: 1.5rem calc(1.7rem + env(safe-area-inset-bottom, 0px));
}
.foot-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.foot-legal, .foot-stamp {
  font-family: var(--f-mono);
  font-size: 0.71rem;
  letter-spacing: 0.06em;
  color: var(--paper-dim);
}
.foot-nav { display: flex; gap: 1.4rem; }
.foot-nav a {
  font-family: var(--f-mono);
  font-size: 0.69rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.foot-nav a:hover { border-bottom-color: var(--blue); }

/* ---------- 404 ---------- */
.notfound {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-content: center;
  text-align: center;
  padding: var(--gut);
}
.notfound .kicker {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 1.4rem;
}
.notfound h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(4rem, 18vw, 11rem);
  line-height: 0.95;
  margin-bottom: 1.4rem;
}
.notfound p { color: var(--paper-dim); max-width: 40ch; margin-inline: auto; }
.notfound a.back {
  display: inline-block;
  margin-top: 2.2rem;
  font-family: var(--f-mono);
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration-color: var(--blue);
  text-decoration-thickness: 2px;
}

/* ---------- reveals ---------- */
.rv {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.rv.in { opacity: 1; transform: none; }

/* ---------- small-screen desktop: same metaphor, cascaded ---------- */
@media (max-width: 860px) {
  .desktop { height: 132svh; min-height: 0; }

  .scrollcue { bottom: 0.9rem; }
  .desk-caption { bottom: 1rem; }

  .win-readme .win-body { padding: 0.85rem 0.95rem 1rem; }
  .win-readme p { font-size: 0.86rem; }

  .contact-rows > div { grid-template-columns: 1fr; gap: 0.3em; }
  h2 { font-size: clamp(1.6rem, 7vw, 2.2rem); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .win { opacity: 1; transform: none; transition: none; }
  .scrollcue { animation: none; }
  .cursor { animation: none; }
  .rv { opacity: 1; transform: none; transition: none; }
}
