/* ==========================================================================
   style.css — design tokens, reset, base typography, page chrome & layout
   Type system: Bricolage Grotesque (display) · Hanken Grotesk (body) · JetBrains Mono (data)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* Color — light */
  --bg: #ffffff;
  --bg-secondary: #f7f8fa;
  --bg-elevated: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-faint: #9ca3af;
  --accent: #0f172a;
  --accent-hover: #1e3a8a;
  --accent-contrast: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ring: rgba(30, 58, 138, 0.35);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --net-node: 71, 85, 105; /* rgb triplet consumed by the hero canvas */
  --grid-line: rgba(15, 23, 42, 0.045);
  --terminal-green: #0d7a4f;

  /* Type */
  --font-display: "Bricolage Grotesque", "Hanken Grotesk", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6rem;

  /* Radii — one soft system across the page */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 999px;

  /* Motion — custom curves; built-in easings are too weak */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 140ms;
  --dur-base: 200ms;
  --dur-slow: 500ms;

  --container: 72rem;
  --header-height: 4rem;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #09090b;
  --bg-secondary: #0e0e12;
  --bg-elevated: #121216;
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-faint: #6b6b74;
  --accent: #e4e4e7;
  --accent-hover: #8fb0f2;
  --accent-contrast: #09090b;
  --border: #212127;
  --border-strong: #33333b;
  --ring: rgba(143, 176, 242, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --net-node: 148, 163, 184;
  --grid-line: rgba(228, 228, 231, 0.05);
  --terminal-green: #3ddc97;

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

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

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

input,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

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

/* Focus — visible, consistent, never removed */
:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: rgba(30, 58, 138, 0.16);
}

:root[data-theme="dark"] ::selection {
  background: rgba(143, 176, 242, 0.28);
}

/* --------------------------------------------------------------------------
   3. Utilities
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

.visually-hidden {
  position: absolute;
  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;
  top: -100%;
  left: var(--space-4);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-size: 0.875rem;
  transition: top var(--dur-base) var(--ease-out);
}

.skip-link:focus {
  top: 0;
}

.dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: var(--radius-full);
  background: var(--text-faint);
  vertical-align: middle;
  margin-inline: var(--space-2);
}

/* Scroll reveal — CSS owns the transition, JS toggles the class.
   Blur-to-sharp makes the entrance read as focus arriving, not a fade. */
[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  filter: blur(6px);
  transition:
    opacity 600ms var(--ease-out),
    transform 600ms var(--ease-out),
    filter 600ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* --------------------------------------------------------------------------
   4. Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-contrast);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand__sub {
  font-size: 0.71875rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.site-nav__link {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}

.site-nav__link.is-active {
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .site-nav__link:hover {
    color: var(--text);
    background: var(--bg-secondary);
  }
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition:
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

.theme-toggle:active {
  transform: scale(0.94);
}

@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }
}

/* One icon per theme */
:root[data-theme="light"] .theme-toggle__sun,
:root[data-theme="dark"] .theme-toggle__moon {
  display: none;
}

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

/* Blueprint grid — sits under the neural canvas */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 90% at 50% 40%, black 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 90% at 50% 40%, black 30%, transparent 78%);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Soft radial fade so canvas nodes never fight the text */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 55% 65% at 50% 45%,
    var(--bg-secondary) 0%,
    transparent 78%
  );
}

.hero__inner {
  position: relative;
  z-index: 1;
  padding-block: var(--space-9) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Terminal line — the department's voice, in its own vernacular */
.hero__terminal {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5ch;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  box-shadow: var(--shadow-sm);
}

.hero__prompt {
  color: var(--terminal-green);
  font-weight: 500;
}

.hero__cmd {
  color: var(--text-secondary);
}

.hero__typing-target {
  color: var(--accent-hover);
  font-weight: 600;
  white-space: nowrap;
}

.hero__caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--accent-hover);
  animation: caret-blink 1.1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.hero__title {
  margin-top: var(--space-5);
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.hero__lede {
  margin-top: var(--space-4);
  max-width: 36rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Search */
.hero__search {
  position: relative;
  margin-top: var(--space-6);
  width: min(100%, 34rem);
  display: flex;
  align-items: center;
}

.hero__search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-faint);
  pointer-events: none;
}

.hero__search-input {
  width: 100%;
  height: 3.25rem;
  padding: 0 3.25rem 0 2.875rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-size: 0.9375rem;
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
}

.hero__search-input::placeholder {
  color: var(--text-faint);
}

.hero__search-input:focus {
  outline: none;
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--ring);
}

.hero__search-kbd {
  position: absolute;
  right: 1rem;
  padding: 0.125rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

/* Stats — hairline-separated row, mono numerals */
.hero__stats {
  margin-top: var(--space-7);
  display: flex;
  align-items: stretch;
}

.hero__stat {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: var(--space-1);
  padding-inline: var(--space-6);
}

.hero__stat + .hero__stat {
  border-left: 1px solid var(--border-strong);
}

.hero__stat dd {
  font-family: var(--font-mono);
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.hero__stat dt {
  font-size: 0.78125rem;
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   6. Directory section
   -------------------------------------------------------------------------- */

.directory {
  padding-block: var(--space-7) var(--space-9);
}

.directory__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}

.directory__title {
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}

.directory__count {
  margin-top: var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.78125rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.faculty-grid {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: var(--space-4);
}

/* --------------------------------------------------------------------------
   7. Profile page layout
   -------------------------------------------------------------------------- */

/* The profile page is no longer a solid sheet: a fixed ambient layer
   (grid + neural canvas + themed line art) sits behind the content. */
.profile-page {
  background: transparent;
}

.profile-page > .container {
  position: relative;
  z-index: 1;
  padding-block: var(--space-5) var(--space-9);
}

.profile-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg-secondary);
}

/* Blueprint grid, fading toward the edges */
.profile-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 85% 85% at 50% 40%, black 25%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 85% 85% at 50% 40%, black 25%, transparent 80%);
}

.profile-bg__canvas {
  position: absolute;
  inset: 0;
  opacity: 0.7;
}

/* Themed line art — faint, slow vertical drift */
.profile-bg__shape {
  position: absolute;
  color: var(--text);
  opacity: 0.07;
  animation: shape-float var(--float-dur, 15s) ease-in-out var(--float-delay, 0s)
    infinite alternate;
}

@keyframes shape-float {
  from {
    transform: translateY(-10px);
  }
  to {
    transform: translateY(12px);
  }
}

.profile-bg__shape--atom    { width: 170px; top: 9%;  right: 4%; }
.profile-bg__shape--circuit { width: 200px; top: 36%; left: 2%; }
.profile-bg__shape--graph   { width: 130px; bottom: 8%; left: 4%; }
.profile-bg__shape--net     { width: 140px; bottom: 12%; right: 5%; }
.profile-bg__shape--hex     { width: 100px; top: 12%; left: 7%; }
.profile-bg__shape--wave    { width: 180px; top: 58%; right: 2%; }

.breadcrumb {
  margin-bottom: var(--space-5);
}

.breadcrumb__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .breadcrumb__link:hover {
    color: var(--text);
  }
}

.profile-layout {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

/* --------------------------------------------------------------------------
   8. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.site-footer__inner {
  padding-block: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.site-footer__note {
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   9. Reduced motion — gentler, not zero
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  [data-reveal] {
    transform: none;
    filter: none;
    transition: opacity var(--dur-base) ease;
  }

  .hero__caret {
    animation: none;
  }

  .profile-bg__shape {
    animation: none;
  }
}
