/*
 * Hero polish + upgrades to the Experience, Awards, and Contact sections.
 * Colors come from the theme variables in index.html (:root / html.darkmode).
 */

/* ------------------------------------------------------------------ */
/*  Hero                                                              */
/* ------------------------------------------------------------------ */
/* keep the copy crisp now that the light-mode art is at full strength */
html:not(.darkmode) .hero-panel .hero-intro,
html:not(.darkmode) .hero-panel .hero-title {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 22px rgba(246, 249, 244, 0.95), 0 0 42px rgba(246, 249, 244, 0.7);
}

html:not(.darkmode) .hero-panel .hero-school {
  background: rgba(246, 249, 244, 0.72);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

html:not(.darkmode) .hero-panel .pixel-portrait {
  box-shadow: 0 0 0 6px rgba(246, 249, 244, 0.55), 0 28px 60px rgba(15, 23, 42, 0.32);
}

/* the pixel landscape hero-art.js paints behind the copy */
.hero-panel > .hero-scene {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  image-rendering: pixelated;
  pointer-events: none;
}

.hero-panel.has-scene::before {
  display: none;
}

/* hand the near ridge over to the About section in the last stretch */
.hero-panel.has-scene::after {
  background: linear-gradient(180deg, transparent 0%, transparent 86%, var(--surface) 100%);
}

/* the code-drawn portrait: crisp pixels, and the peek over the glasses is the hover */
.hero-panel .hero-me {
  image-rendering: pixelated;
  cursor: pointer;
  touch-action: manipulation;
}

.hero-panel .hero-me:hover {
  transform: none;
}

/* isolation keeps the hover fill (a z-index:-1 pseudo-element) above this backdrop */
html:not(.darkmode) .hero-panel .resume-button--hero {
  isolation: isolate;
  background: rgba(246, 249, 244, 0.8);
  backdrop-filter: blur(6px);
}

/* ------------------------------------------------------------------ */
/*  Experience + Education                                            */
/* ------------------------------------------------------------------ */
.edex-rail__progress {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--accent), var(--accent-warm));
  box-shadow: 0 0 12px var(--accent-soft);
  transform: scaleY(0);
  transform-origin: top center;
  transition: transform 120ms linear;
}

.edex-rail .edex-card::after {
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 320ms ease, filter 320ms ease;
}

.edex-rail .edex-card:not(.is-passed)::after {
  filter: opacity(0.7);
}

.edex-rail .edex-card.is-passed::after {
  transform: scale(1.12);
}

.edex-rail .edex-card.is-current::after {
  animation: edex-now 2.2s ease-out infinite;
}

@keyframes edex-now {
  0% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.95), 0 0 0 11px var(--edex-accent-soft), 0 0 0 11px var(--edex-accent-soft); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.95), 0 0 0 11px var(--edex-accent-soft), 0 0 0 22px rgba(255, 255, 255, 0); }
}

html.darkmode .edex-rail .edex-card.is-current::after {
  animation-name: edex-now-dark;
}

@keyframes edex-now-dark {
  0% { box-shadow: 0 0 0 6px rgba(7, 17, 32, 0.96), 0 0 0 11px var(--edex-accent-soft), 0 0 0 11px var(--edex-accent-soft); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(7, 17, 32, 0.96), 0 0 0 11px var(--edex-accent-soft), 0 0 0 22px rgba(7, 17, 32, 0); }
}

.edex-card__duration {
  color: var(--edex-accent);
  letter-spacing: 0.08em;
}

.edex-card.is-current .edex-card__range::before {
  content: "Now";
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: var(--edex-accent);
  color: #ffffff;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  vertical-align: 1px;
}

.edex-meta-pill--duration {
  border-color: var(--spotlight-accent-soft) !important;
  color: var(--spotlight-accent) !important;
}

/* ------------------------------------------------------------------ */
/*  Awards: achievement unlock + tilt                                  */
/* ------------------------------------------------------------------ */
#awards-affiliations .award-card,
#awards-affiliations .affiliation-card {
  transform-style: preserve-3d;
}

#awards-affiliations .award-card.is-tilting,
#awards-affiliations .affiliation-card.is-tilting {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateY(-8px);
  transition: transform 80ms linear, box-shadow 250ms ease, border-color 250ms ease;
}

.tilt-glare {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 0%), rgba(255, 255, 255, 0.55), transparent 45%);
  opacity: 0;
  mix-blend-mode: soft-light;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.is-tilting > .tilt-glare {
  opacity: 1;
}

.affiliation-card {
  position: relative;
}

.award-unlock {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem 0.55rem 0.6rem;
  border-radius: 0.9rem;
  background: linear-gradient(120deg, #111827, #1f2937);
  border: 1px solid rgba(250, 193, 35, 0.45);
  color: #f8fafc;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.3), 0 0 22px rgba(250, 193, 35, 0.22);
  opacity: 0;
  transform: translateY(-10px) scale(0.92);
  pointer-events: none;
}

.award-unlock__icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 0.6rem;
  background: rgba(250, 193, 35, 0.16);
  font-size: 1.05rem;
}

.award-unlock strong {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fcd34d;
}

.award-unlock small {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #f8fafc;
}

.award-card.is-unlocking .award-unlock {
  animation: award-unlock 2.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.award-card.is-unlocking .award-body img {
  animation: award-pop 700ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms both;
}

.award-card.is-unlocking::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: award-shine 1s ease 200ms both;
  pointer-events: none;
}

@keyframes award-unlock {
  0% { opacity: 0; transform: translateY(-10px) scale(0.92); }
  12%, 80% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px) scale(0.96); }
}

@keyframes award-pop {
  0% { transform: scale(0.6) rotate(-12deg); }
  60% { transform: scale(1.12) rotate(4deg); }
  100% { transform: none; }
}

@keyframes award-shine {
  to { transform: translateX(120%); }
}

/* ------------------------------------------------------------------ */
/*  Contact: CRT TV                                                   */
/* ------------------------------------------------------------------ */
.crt {
  margin: 0 auto;
  max-width: 560px;
  padding: 1.1rem 1.1rem 0;
  border-radius: 2rem 2rem 1.4rem 1.4rem;
  background: linear-gradient(160deg, #3b3a36 0%, #262522 60%, #1c1b19 100%);
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.28), inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -6px 0 rgba(0, 0, 0, 0.3);
}

.crt__screen {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 1.4rem / 1.1rem;
  overflow: hidden;
  background: #000000;
  box-shadow: inset 0 0 0 6px #121210, inset 0 0 40px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.crt__screen:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 4px;
}

/* the channels are drawn by tv-channels.js at 168x126 and scaled up crisp */
.crt .crt__canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  image-rendering: pixelated;
}

.crt__scanlines {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.crt__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, transparent 28%);
  pointer-events: none;
}

.crt__static {
  position: absolute;
  inset: -50%;
  opacity: 0;
  background-image:
    repeating-radial-gradient(circle at 17% 32%, rgba(255, 255, 255, 0.9) 0 1px, transparent 1px 3px),
    repeating-radial-gradient(circle at 71% 64%, rgba(0, 0, 0, 0.8) 0 1px, transparent 1px 2px);
  background-size: 7px 9px, 5px 6px;
  pointer-events: none;
}

.crt__screen.is-flipping .crt__static {
  animation: crt-static 520ms steps(6) both;
}

.crt__screen.is-flipping .crt__canvas {
  animation: crt-roll 520ms ease both;
}

@keyframes crt-static {
  0% { opacity: 0.95; transform: translate(0, 0); }
  50% { opacity: 0.85; transform: translate(-6%, 4%); }
  100% { opacity: 0; transform: translate(4%, -3%); }
}

@keyframes crt-roll {
  0% { transform: scaleY(0.02) scaleX(1.05); }
  45% { transform: scaleY(1) translateY(-8%); }
  100% { transform: none; }
}

.crt__channel {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #86efac;
  text-shadow: 0 0 6px rgba(134, 239, 172, 0.9);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}

.crt__screen:hover .crt__channel,
.crt__screen.is-flipping .crt__channel,
.crt__screen:focus-visible .crt__channel {
  opacity: 1;
}

.crt__base {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.4rem 0.85rem;
}

.crt__brand {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: #c8c2b4;
}

.crt__grille {
  flex: 1;
  height: 0.9rem;
  border-radius: 0.3rem;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.45) 0 3px, rgba(255, 255, 255, 0.05) 3px 6px);
}

.crt__knob {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #8a867c, #3a3833 70%);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

.crt__led {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.9);
  animation: crt-led 3s ease-in-out infinite;
}

@keyframes crt-led {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.crt__caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 -1.1rem;
  padding: 0.7rem 1rem;
  border-radius: 0 0 1.4rem 1.4rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.crt__caption time {
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.crt__caption-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #10b981;
  animation: clock-pulse 2.4s ease-out infinite;
}

@keyframes clock-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  80%, 100% { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
}

html.darkmode .crt {
  box-shadow: 0 30px 60px rgba(2, 6, 23, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -6px 0 rgba(0, 0, 0, 0.3);
}

/* ------------------------------------------------------------------ */
/*  Contact: note composer                                            */
/* ------------------------------------------------------------------ */
.composer {
  margin-top: 1.5rem;
  border-radius: 1.1rem;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  overflow: hidden;
}

.composer__toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.composer__toggle::-webkit-details-marker {
  display: none;
}

.composer__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 1.1rem;
}

.composer__pencil {
  width: 1.9rem;
  height: 1.9rem;
  display: inline-grid;
  place-items: center;
  border-radius: 0.6rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.composer__chev {
  margin-left: auto;
  width: 0.6rem;
  height: 0.6rem;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 200ms ease;
}

.composer[open] .composer__chev {
  transform: rotate(225deg) translateY(-2px);
}

.composer__form {
  display: grid;
  gap: 0.75rem;
  padding: 0 1.1rem 1.1rem;
  animation: composer-in 260ms ease;
}

@keyframes composer-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.composer__topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  border: none;
}

.composer__topics legend {
  margin-bottom: 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.composer__topic {
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.composer__topic:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.composer__topic.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--surface);
}

.composer__topic:focus-visible,
.composer__send:focus-visible,
.composer__copy:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.composer__label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.composer__message {
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
  padding: 0.8rem 0.9rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
}

.composer__message:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.composer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.composer__send,
.composer__copy {
  padding: 0.65rem 1.05rem;
  border-radius: 0.8rem;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.composer__send {
  background: var(--accent-strong);
  color: var(--surface);
}

.composer__copy {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
}

.composer__send:hover,
.composer__copy:hover {
  transform: translateY(-2px);
}

html.darkmode .composer__topic.is-active,
html.darkmode .composer__send {
  background: linear-gradient(120deg, #0f766e, #38bdf8);
  border-color: transparent;
  color: #f8fffe;
}

@media (prefers-reduced-motion: reduce) {
  .edex-rail .edex-card.is-current::after,
  .crt__led,
  .crt__caption-dot {
    animation: none !important;
  }
}
