/* ==========================================================================
   site.css — layout and components
   ========================================================================== */

/* --------------------------------------------------------------------------
   CRT treatment
   Scanlines are purely decorative and sit above everything at very low
   opacity. They are opt-in via prefers-reduced-motion: no-preference, and can
   be killed outright with the [data-crt="off"] switch.
   -------------------------------------------------------------------------- */

.crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  display: none;
}

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-crt="off"]) .crt-overlay {
    display: block;
    background: repeating-linear-gradient(
      to bottom,
      rgb(0 0 0 / 16%) 0,
      rgb(0 0 0 / 16%) 1px,
      transparent 1px,
      transparent 3px
    );
    opacity: 0.4;
  }

  [data-theme="light"] .crt-overlay {
    opacity: 0.14;
  }
}

/* --------------------------------------------------------------------------
   Header + nav
   -------------------------------------------------------------------------- */

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

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
  white-space: nowrap;
}

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

.nav {
  margin-inline-start: auto;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--step--1);
  color: var(--fg-dim);
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
}

.nav__link:hover,
.nav__link:focus-visible {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav__link[aria-current="true"] {
  color: var(--accent);
}

.nav__link[aria-current="true"]::before {
  content: "> ";
}

/* The DOOM link is deliberately styled as an executable, so it reads as an
   easter egg rather than another peer nav item. */
.nav__link--doom {
  color: var(--amber);
  border: 1px dashed var(--border-bright);
  margin-inline-start: var(--space-2);
}

.nav__link--doom:hover,
.nav__link--doom:focus-visible {
  color: var(--bg);
  background: var(--amber);
  border-style: solid;
}

.nav__link--doom[aria-current="true"]::before {
  content: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-dim);
  cursor: pointer;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent-dim);
}

.icon-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .theme-toggle__dark {
  display: none;
}

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

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

.nav-toggle {
  display: none;
}

/* Mobile nav */
@media (max-width: 47.99rem) {
  .nav-toggle {
    display: inline-grid;
    margin-inline-start: auto;
  }

  .nav {
    position: absolute;
    inset: var(--header-h) 0 auto;
    margin: 0;
    /* --bg-elev sits only a shade off --bg, which is too subtle for a panel
       that overlays content. Lift it further so the dropdown reads as a
       separate surface rather than floating text. */
    background: color-mix(in srgb, var(--bg-elev) 90%, var(--fg) 10%);
    border-bottom: 1px solid var(--border-bright);
    box-shadow: 0 16px 32px -16px rgb(0 0 0 / 70%);
    display: none;
  }

  .site-header.is-open .nav {
    display: block;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3);
    gap: var(--space-1);
  }

  .nav__link {
    padding: var(--space-3);
    font-size: var(--step-0);
  }

  .nav__link--doom {
    margin-inline-start: 0;
  }
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

main {
  display: block;
}

.section {
  padding-block: var(--space-8);
  border-top: 1px solid var(--border);
}

.section:first-of-type {
  border-top: 0;
}

/* The sticky header would otherwise swallow the heading on anchor jumps. */
[id] {
  scroll-margin-top: calc(var(--header-h) + var(--space-5));
}

.section__head {
  margin-bottom: var(--space-6);
}

.cmd {
  font-size: var(--step--1);
  color: var(--fg-faint);
  margin-bottom: var(--space-2);
  overflow-wrap: anywhere;
}

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

.section__title {
  color: var(--fg);
}

.section__title::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2px;
  margin-top: var(--space-3);
  background: var(--accent);
}

.lede {
  max-width: var(--measure);
  color: var(--fg-dim);
}

.lede + .lede {
  margin-top: var(--space-4);
}

.stack > * + * {
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-block: var(--space-8) var(--space-7);
}

.hero__inner {
  display: flex;
  flex-wrap: wrap-reverse;
  align-items: center;
  gap: var(--space-7);
}

.hero__body {
  flex: 1 1 22rem;
  min-width: 0;
}

.hero__name {
  margin-block: var(--space-2) var(--space-3);
  letter-spacing: -0.02em;
}

.hero__tagline {
  font-size: var(--step-2);
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.hero__meta {
  color: var(--fg-dim);
  max-width: var(--measure);
}

.hero__meta strong {
  color: var(--fg);
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent);
  margin-inline-start: 0.15em;
}

@media (prefers-reduced-motion: no-preference) {
  .cursor {
    animation: blink 1.1s steps(1, end) infinite;
  }
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

/* Avatar — sized entirely by CSS so the box never shifts, whether or not a
   photo exists. Initials sit underneath and show through if the image is
   absent. See images/README.md for the file contract. */
.avatar {
  position: relative;
  flex: none;
  width: clamp(8rem, 28vw, 13rem);
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-bright);
  background: linear-gradient(145deg, var(--bg-elev), var(--bg-sunken));
  box-shadow: 0 0 0 1px var(--bg), 0 0 40px -12px var(--accent-glow);
  display: grid;
  place-items: center;
}

.avatar__initials {
  font-size: clamp(2.5rem, 9vw, 4rem);
  font-weight: 700;
  color: var(--accent-dim);
  letter-spacing: 0.05em;
  user-select: none;
}

.avatar__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--step--1);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--accent);
  color: var(--on-accent);
}

.btn:hover,
.btn:focus-visible {
  filter: brightness(1.12);
}

.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-bright);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
  filter: none;
}

.btn svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentcolor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Experience timeline
   CityTech holds three sequential roles; they render as one company node with
   a nested rail so the intern -> trainee -> associate progression is legible.
   -------------------------------------------------------------------------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-6);
}

.timeline__item {
  position: relative;
  padding-inline-start: var(--space-6);
  border-inline-start: 1px solid var(--border-bright);
}

.timeline__item::before {
  content: "";
  position: absolute;
  inset-inline-start: -5px;
  top: 0.55rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}

.org {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.org__name {
  font-size: var(--step-1);
  color: var(--fg);
}

.org__place {
  font-size: var(--step--1);
  color: var(--fg-faint);
}

.badge {
  font-size: var(--step--1);
  padding: 0.1rem var(--space-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-pill);
  color: var(--accent-dim);
  background: var(--accent-glow);
}

.role-list {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-5);
}

.timeline__item--multi .role-list {
  padding-inline-start: var(--space-5);
  border-inline-start: 1px dashed var(--border);
}

.role {
  position: relative;
}

.timeline__item--multi .role::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--space-5) * -1 - 3px);
  top: 0.6rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--fg-faint);
}

.role__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.role__title {
  font-size: var(--step-0);
  font-weight: 700;
  color: var(--accent);
}

.role__period {
  font-size: var(--step--1);
  color: var(--fg-faint);
  white-space: nowrap;
}

.bullets {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-2);
  max-width: var(--measure);
}

.bullets li {
  position: relative;
  padding-inline-start: var(--space-5);
  color: var(--fg-dim);
  font-size: var(--step--1);
  line-height: 1.7;
}

.bullets li::before {
  content: "-";
  position: absolute;
  inset-inline-start: 0;
  color: var(--accent-dim);
}

/* --------------------------------------------------------------------------
   Skills
   -------------------------------------------------------------------------- */

.skills {
  display: grid;
  gap: var(--space-5);
}

.skill-group__label {
  font-size: var(--step--1);
  color: var(--amber);
  margin-bottom: var(--space-3);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.chip {
  font-size: var(--step--1);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--fg-dim);
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent-dim);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.grid-auto {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.card__title {
  font-size: var(--step-1);
  color: var(--fg);
}

.card__title::before {
  content: "# ";
  color: var(--accent-dim);
}

.card .bullets {
  flex: 1;
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Education
   -------------------------------------------------------------------------- */

.edu__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--step--1);
  color: var(--fg-faint);
}

details.coursework {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}

details.coursework summary {
  cursor: pointer;
  font-size: var(--step--1);
  color: var(--accent);
  list-style: none;
}

details.coursework summary::-webkit-details-marker {
  display: none;
}

details.coursework summary::before {
  content: "[+] ";
}

details.coursework[open] summary::before {
  content: "[-] ";
}

details.coursework > * + * {
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   Contact
   -------------------------------------------------------------------------- */

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
  max-width: 34rem;
}

.contact-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.contact-list .key {
  color: var(--fg-faint);
  font-size: var(--step--1);
  min-width: 6.5rem;
}

.contact-list a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  text-decoration-color: currentcolor;
}

.copy-btn {
  font-size: var(--step--1);
  padding: 0.1rem var(--space-2);
  background: transparent;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  color: var(--fg-faint);
  cursor: pointer;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent-dim);
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-6);
  color: var(--fg-faint);
  font-size: var(--step--1);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: center;
  justify-content: space-between;
}

.site-footer a {
  color: var(--fg-dim);
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Scroll reveal — only when motion is welcome, and only when JS is running.
   Without the .js class the content is simply visible.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 500ms ease, transform 500ms ease;
  }

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