/* cooper.ross - one sheet for the whole site.
   Dark is the default; light mode just swaps the tokens below. */

:root {
  --bg: #0a0b0d;
  --bg-elev: #111317;
  --bg-elev-2: #161920;
  --border: #23262e;
  --border-soft: #272b34;
  --text: #e9eaec;
  --text-dim: #9aa0aa;
  --text-faint: #646a74;
  --accent: #ef4146;
  --accent-soft: rgba(239, 65, 71, 0.075);
  --accent-2: #ff6b6b;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --palette-hover: color-mix(in srgb, var(--text) 4%, transparent);
  --palette-backdrop: rgba(0, 0, 0, 0.62);
  --palette-panel-shadow: 0 24px 80px -16px rgba(0, 0, 0, 0.75);
  --palette-scrollbar: var(--border);
  --radius: 16px;
  --maxw: 1080px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f7f7f5;
  --bg-elev: #ffffff;
  --bg-elev-2: #f0f0ee;
  --border: #e2e2dd;
  --border-soft: #dfdfda;
  --text: #15171a;
  --text-dim: #555b63;
  --text-faint: #8b9098;
  --accent: #e0353a;
  --accent-soft: rgba(224, 53, 59, 0.071);
  --accent-2: #e0353a;
  --shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.25);
  --palette-hover: color-mix(in srgb, var(--text) 6%, transparent);
  --palette-backdrop: rgba(21, 23, 26, 0.42);
  --palette-panel-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.22);
  --palette-scrollbar: var(--border-soft);
}

/* Base */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-faint);
}

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

.accent {
  color: var(--accent);
}

.muted {
  color: var(--text-dim);
}

/* ionicons render at 1em by default, which is almost never right */
ion-icon {
  flex-shrink: 0;
}

.cmdk-hint ion-icon,
.section__more ion-icon,
.pcard__links a ion-icon {
  width: 14px;
  height: 14px;
}

.section__more ion-icon {
  vertical-align: -2px;
}

.footer__links a ion-icon,
.ticks li ion-icon {
  width: 16px;
  height: 16px;
}

.ticks li ion-icon {
  margin-top: 3px;
  color: var(--accent);
}

.theme-toggle ion-icon {
  width: 17px;
  height: 17px;
}

/* Background FX */

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}

.spotlight {
  position: fixed;
  left: 0;
  top: 0;
  width: 1200px;
  height: 1200px;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
  transform: translate3d(-100vw, -100vh, 0) translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 55%);
  transition: opacity 0.3s;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 100;
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
  background: linear-gradient(90deg, var(--accent), #ff3d3d);
}

/* Nav */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 50;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 40px);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-weight: 700;
}

.nav__links {
  display: flex;
  gap: 26px;
  font-size: 0.9rem;
}

.nav__links a {
  color: var(--text-dim);
  position: relative;
  transition: color 0.2s;
}

.nav__links a:hover {
  color: var(--text);
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s;
}

.nav__links a:hover::after {
  width: 100%;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* the two nav buttons share their chrome */
.cmdk-hint,
.theme-toggle {
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}

.cmdk-hint:hover,
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.cmdk-hint {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.cmdk-hint ion-icon {
  color: var(--text-faint);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
}

.theme-toggle .icon-moon {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 1px 5px;
  border-radius: 5px;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
}

/* Layout */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

.section {
  padding: clamp(34px, 4.5vw, 58px) 0;
}

.section__head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section__index {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

.section__title {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section__more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-dim);
}

.section__more:hover {
  color: var(--accent);
}

/* Hero */

.hero {
  position: relative;
  /* full-bleed; --sbw (scrollbar width) is set from main.js */
  width: calc(100vw - var(--sbw, 0px));
  margin-left: calc(50% - 50vw + var(--sbw, 0px) / 2);
  border-bottom: 1px solid var(--border);
  background: radial-gradient(1100px 380px at 20% -20%, var(--accent-soft), transparent 60%);
}

.hero__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(82px, 11vh, 108px) clamp(16px, 4vw, 40px) clamp(28px, 4vh, 46px);
}

.hero__title {
  margin: 12px 0;
  line-height: 1;
  font-size: clamp(2.4rem, 6.5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.hero__role {
  margin-bottom: 16px;
  min-height: 1.6em;
  font-family: var(--mono);
  font-size: clamp(0.95rem, 2.5vw, 1.2rem);
  color: var(--text-dim);
}

.hero__role .prompt {
  margin-right: 8px;
  color: var(--accent-2);
}

.caret {
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}

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

.hero__bio {
  max-width: 70ch;
  margin-bottom: 22px;
  font-size: 1rem;
  color: var(--text-dim);
}

/* About */

.about {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 32px;
}

.about__text p {
  max-width: 68ch;
  margin-bottom: 14px;
  color: var(--text-dim);
}

.about__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.chip {
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.about__card {
  padding: 20px;
  height: fit-content;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
}

.about__card h3 {
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ticks {
  list-style: none;
}

.ticks li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.92rem;
  color: var(--text-dim);
}

.ticks a {
  color: var(--text);
  border-bottom: 1px solid var(--accent);
}

/* Projects */

.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 18px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

/* glow that tracks the pointer; --mx/--my are set from main.js */
.pcard::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 60%);
}

.pcard:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.pcard:hover::before {
  opacity: 1;
}

.pcard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pcard__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.pcard__tagline {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.pcard__desc {
  flex: 1;
  font-size: 0.86rem;
  color: var(--text-dim);
}

.pcard__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-faint);
  border: 1px solid var(--border-soft);
}

.pcard__links {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.pcard__links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  transition: color 0.2s;
}

.pcard__links a:hover {
  color: var(--accent);
}

/* Terminal */

.terminal {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
}

.tdot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.tdot--r {
  background: #ff5f56;
}

.terminal__title {
  margin-left: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.terminal__body {
  padding: 16px;
  height: min(480px, 64vh);
  overflow-y: auto;
  line-height: 1.6;
  font-family: var(--mono);
  font-size: 0.86rem;
}

.terminal__body:focus {
  outline: none;
}

.term-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.term-cmd {
  color: var(--text);
}

.term-cmd .prompt {
  color: var(--accent-2);
}

.prompt .cwd {
  color: var(--accent);
}

.term-out {
  color: var(--text-dim);
}

.term-out b {
  color: var(--accent-2);
  font-weight: 500;
}

.term-out a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

.term-err {
  color: var(--accent);
}

.terminal__input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.88rem;
}

.terminal__input .prompt {
  color: var(--accent-2);
  white-space: nowrap;
}

#term-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
}

/* Vim overlay (covers the terminal body while the editor is open) */

.vim-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.6;
  background: var(--bg-elev);
}

.vim-screen {
  flex: 1;
  overflow: hidden;
  padding: 6px 10px;
}

.vim-line {
  min-height: 1.6em;
  white-space: pre;
  color: var(--text);
}

.vim-tilde {
  color: var(--text-faint);
}

.vim-cursor {
  color: var(--bg);
  background: var(--accent);
}

.vim-caret {
  display: inline-block;
  width: 0;
  height: 1.05em;
  margin: 0 -1px;
  vertical-align: text-bottom;
  border-left: 2px solid var(--accent);
  animation: blink 1s steps(1) infinite;
}

.vim-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  border-top: 1px solid var(--border);
}

.vim-status__left {
  font-weight: 600;
  color: var(--text);
  white-space: pre;
}

.vim-status__right {
  color: var(--text-faint);
}

/* Footer */

.footer {
  padding: 20px 0 30px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer__cta {
  margin-bottom: 22px;
  font-size: clamp(1.7rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 26px;
  margin-bottom: 22px;
  font-family: var(--mono);
}

.footer__links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
}

.footer__links a:hover {
  color: var(--accent);
}

.footer__fine {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* Command palette */

.palette {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.palette[hidden] {
  display: none;
}

.palette__backdrop {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(6px);
  background: var(--palette-backdrop);
}

.palette__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, 94vw);
  max-height: min(480px, 68vh);
  overflow: hidden;
  border-radius: 16px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--palette-panel-shadow);
  animation: pop 0.18s ease;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

.palette__search {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.palette__search-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-faint);
}

.palette__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--sans);
}

.palette__input::placeholder {
  color: var(--text-dim);
}

/* it's a <kbd>, so most of its look comes from the global kbd rule */
.palette__esc-hint {
  flex-shrink: 0;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  pointer-events: none;
}

.palette__list {
  flex: 1;
  min-height: 0;
  list-style: none;
  overflow: auto hidden;
  padding: 6px 8px 10px;
  scroll-padding-block: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--palette-scrollbar) transparent;
}

.palette__list::-webkit-scrollbar {
  width: 5px;
}

.palette__list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--palette-scrollbar);
}

.palette__section {
  padding: 14px 12px 6px;
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  user-select: none;
  pointer-events: none;
}

.palette__section:first-child {
  padding-top: 8px;
}

.palette__item {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.palette__ico-wrap {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  transition: border-color 0.12s ease;
}

.palette__item .pi-ico {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
}

.palette__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette__label {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.palette__desc {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette__chevron {
  width: 14px;
  height: 14px;
  margin-left: 4px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.palette__item.active {
  background: var(--accent-soft);
}

.palette__item.active .palette__chevron {
  opacity: 0.85;
}

.palette__item:hover:not(.active) {
  background: var(--palette-hover);
}

.palette__item.active .pi-ico {
  color: var(--accent);
}

.palette__item.active .palette__ico-wrap {
  background: color-mix(in srgb, var(--accent-soft) 50%, var(--bg-elev-2));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.palette__item--empty {
  padding: 20px 12px;
  font-size: 0.88rem;
  color: var(--text-dim);
  cursor: default;
}

.palette__foot {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 11px 20px;
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

.palette__foot-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.palette__foot kbd {
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.66rem;
  line-height: 1.2;
}

/* Responsive */

@media (max-width: 960px) {
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 820px) {
  .nav__links {
    display: none;
  }

  .about {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .projects {
    grid-template-columns: 1fr;
  }

  .terminal {
    border-radius: 12px;
    margin-inline: calc(clamp(16px, 4vw, 40px) * -0.5);
  }

  .terminal__bar {
    padding: 10px 12px;
  }

  .tdot {
    width: 10px;
    height: 10px;
  }

  .terminal__title {
    font-size: 0.72rem;
  }

  .terminal__body {
    padding: 12px;
    height: min(360px, 52dvh);
    font-size: 0.8rem;
    line-height: 1.55;
  }

  .terminal__input {
    align-items: flex-start;
    gap: 6px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    font-size: 0.78rem;
  }

  .terminal__input .prompt {
    max-width: 42vw;
    padding-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 16px stops iOS Safari from zooming the page on focus */
  #term-input {
    font-size: 16px;
    line-height: 1.4;
  }
}

@media (max-width: 480px) {
  .terminal__body {
    height: min(320px, 48dvh);
  }

  .terminal__input .prompt {
    max-width: 36vw;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}
