/* Shared by Portfolio-Freelance and Portfolio-For-Recruitment. Keep both copies identical.
   Michael's palette, used as a pixel-art world: dusk scenes for art, paper pages for reading. */
:root {
  --ink: #0e1116;
  --dusk: #374a67;
  --grape: #616283;
  --mauve: #9e7b9b;
  --wisteria: #cb9cf2;
  --paper: #f7f4fb;
  --lilac: #ede4f8; /* paper with a breath of wisteria, for alternate bands */

  --text: var(--ink);
  --soft: var(--dusk);
  --edge: var(--ink);
  --focus: var(--ink);

  --pixel: "Pixelify Sans", "Courier New", monospace;
  --read: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --gutter: clamp(16px, 4.5vw, 56px);
  --max: 1200px;
  --header: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 16px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--read);
  font-size: clamp(1.05rem, 1rem + 0.25vw, 1.15rem);
  line-height: 1.65;
  overflow-x: clip;
}
img,
svg,
canvas {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}
figure {
  margin: 0;
}
a {
  color: inherit;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0;
  text-wrap: balance;
}
p {
  margin: 0;
  text-wrap: pretty;
}
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.pixelated {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 5px;
}
::selection {
  background: var(--wisteria);
  color: var(--ink);
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--wisteria);
  color: var(--ink);
  font-family: var(--pixel);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 10px;
}
.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

/* Dark areas flip the tokens */
.dark {
  --text: var(--paper);
  --soft: #d9cfe6;
  --edge: var(--paper);
  --focus: var(--wisteria);
  background: var(--ink);
  color: var(--text);
}

/* ---------- Pixel frame: a 3px border with notched corners ---------- */
.px {
  box-shadow:
    0 -3px 0 0 var(--edge),
    0 3px 0 0 var(--edge),
    -3px 0 0 0 var(--edge),
    3px 0 0 0 var(--edge);
}
.px-raised {
  box-shadow:
    0 -3px 0 0 var(--edge),
    0 3px 0 0 var(--edge),
    -3px 0 0 0 var(--edge),
    3px 0 0 0 var(--edge),
    6px 6px 0 0 var(--edge);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  --text: var(--paper);
  --focus: var(--wisteria);
  background: var(--ink);
  color: var(--paper);
}
.site-header::after {
  /* a stepped pixel edge under the bar */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 12px, transparent 12px 24px);
  pointer-events: none;
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--header);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  white-space: nowrap;
}
.brand svg {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.2vw, 30px);
  font-family: var(--pixel);
  font-size: 1.02rem;
  font-weight: 500;
}
.site-nav a {
  position: relative;
  padding: 6px 0;
  color: #d9cfe6;
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--wisteria);
}
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 3px;
  background: var(--wisteria);
}
.site-nav a.btn {
  padding: 6px 14px;
  color: var(--ink);
}
.site-nav .btn::after {
  display: none;
}
.menu-toggle {
  display: none;
}

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--wisteria);
  --fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin: 3px;
  padding: 10px 20px;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--pixel);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  box-shadow:
    0 -3px 0 0 var(--edge),
    0 3px 0 0 var(--edge),
    -3px 0 0 0 var(--edge),
    3px 0 0 0 var(--edge),
    inset 0 -4px 0 0 rgba(14, 17, 22, 0.22);
  transition: transform 0.06s steps(1);
}
.btn:hover {
  --bg: var(--paper);
}
.btn:active {
  transform: translateY(2px);
  box-shadow:
    0 -3px 0 0 var(--edge),
    0 3px 0 0 var(--edge),
    -3px 0 0 0 var(--edge),
    3px 0 0 0 var(--edge),
    inset 0 4px 0 0 rgba(14, 17, 22, 0.22);
}
.btn-ink {
  --bg: var(--ink);
  --fg: var(--paper);
}
.btn-ink:hover {
  --bg: var(--dusk);
}
.btn-line {
  --bg: transparent;
  --fg: var(--text);
}
.btn-line:hover {
  --bg: var(--wisteria);
  --fg: var(--ink);
}
.btn-small {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.95rem;
}
.btn[aria-disabled="true"] {
  --bg: transparent;
  --fg: var(--soft);
  cursor: default;
  box-shadow:
    0 -3px 0 0 currentColor,
    0 3px 0 0 currentColor,
    -3px 0 0 0 currentColor,
    3px 0 0 0 currentColor;
  opacity: 0.8;
}
.btn[aria-disabled="true"]:active {
  transform: none;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.link {
  font-family: var(--pixel);
  font-weight: 600;
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-decoration-color: var(--wisteria);
  text-underline-offset: 6px;
}
.link:hover {
  background: var(--wisteria);
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* ---------- Page structure ---------- */
.band {
  padding-block: clamp(64px, 9vw, 120px);
}
.band-lilac {
  background: var(--lilac);
}
.page-title {
  padding-block: clamp(56px, 8vw, 104px) clamp(40px, 6vw, 72px);
}
.page-title h1 {
  font-size: clamp(2.6rem, 1.4rem + 5.4vw, 5.6rem);
  max-width: 14ch;
}
.page-title p {
  max-width: 54ch;
  margin-top: 22px;
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  color: var(--soft);
}
.h2 {
  font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem);
}
.lede {
  max-width: 56ch;
  margin-top: 16px;
  color: var(--soft);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 10px;
  font-family: var(--pixel);
  font-size: 0.88rem;
  font-weight: 600;
  background: var(--ink);
  color: var(--paper);
}
.tag::before {
  content: "";
  width: 8px;
  height: 8px;
  background: currentColor;
}
.tag-ready {
  background: var(--wisteria);
  color: var(--ink);
}
.tag-next {
  background: var(--dusk);
  color: var(--paper);
}
.tag-planned {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 2px var(--text);
}
.tag-planned::before {
  background: transparent;
  box-shadow: inset 0 0 0 2px currentColor;
}

/* Window panel, like a dialog in an old game */
.win {
  background: var(--paper);
  color: var(--ink);
  --text: var(--ink);
  --soft: var(--dusk);
  --edge: var(--ink);
  --focus: var(--ink);
  margin: 3px;
}
.win-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--dusk);
  color: var(--paper);
  font-family: var(--pixel);
  font-size: 0.95rem;
  font-weight: 600;
}
.win-bar .dots {
  display: inline-flex;
  gap: 5px;
}
.win-bar .dots i {
  width: 9px;
  height: 9px;
  background: var(--wisteria);
}
.win-bar .dots i:nth-child(2) {
  background: var(--mauve);
}
.win-bar .dots i:nth-child(3) {
  background: var(--paper);
}
.shot {
  margin: 3px;
  background: var(--ink);
}
.shot img {
  width: 100%;
}

/* ---------- Project tiles + archived college projects ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 34px 28px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tile .shot {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.tile .shot img {
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.tile h3 {
  font-size: 1.5rem;
}
.tile p {
  color: var(--soft);
}
.stack {
  font-family: var(--pixel);
  font-size: 0.92rem;
  color: var(--grape);
}
.dark .stack {
  color: var(--wisteria);
}

.archive {
  margin-top: clamp(48px, 7vw, 88px);
}
.archive-heading {
  margin: 0;
  font-size: inherit;
}
.archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding: 6px 0;
  border: 0;
  background: none;
  text-align: left;
  font-family: var(--pixel);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem);
  line-height: 1;
}
.plus {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  margin: 3px;
  background: var(--wisteria);
  box-shadow:
    0 -3px 0 0 var(--ink),
    0 3px 0 0 var(--ink),
    -3px 0 0 0 var(--ink),
    3px 0 0 0 var(--ink),
    inset 0 -4px 0 0 rgba(14, 17, 22, 0.22);
}
.plus::before,
.plus::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 18px;
  width: 20px;
  height: 6px;
  background: var(--ink);
}
.plus::after {
  left: 19px;
  top: 11px;
  width: 6px;
  height: 20px;
}
.archive-toggle:hover .plus {
  background: var(--paper);
}
.archive-toggle[aria-expanded="true"] .plus::after {
  display: none;
}
.archive-count {
  font-family: var(--read);
  font-weight: 400;
  font-size: 1rem;
  color: var(--soft);
}
.archive-panel {
  margin-top: 28px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
}
.chip {
  min-height: 38px;
  margin: 2px;
  padding: 4px 14px;
  border: 0;
  background: transparent;
  font-family: var(--pixel);
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow:
    0 -2px 0 0 var(--edge),
    0 2px 0 0 var(--edge),
    -2px 0 0 0 var(--edge),
    2px 0 0 0 var(--edge);
}
.chip:hover {
  background: var(--lilac);
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
.college-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 22px;
}
.cp[hidden] {
  display: none;
}
.cp a,
.cp-static {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
}
.cp .shot {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.cp img {
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.cp-title {
  margin-top: 6px;
  font-family: var(--pixel);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.2;
}
.cp a:hover .cp-title {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-decoration-color: var(--wisteria);
  text-underline-offset: 4px;
}
.cp-note {
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--soft);
}
.cp-course {
  font-family: var(--pixel);
  font-size: 0.85rem;
  color: var(--grape);
}
@media (prefers-reduced-motion: no-preference) {
  .archive-panel.is-opening .cp {
    animation: pop 0.32s steps(4) both;
    animation-delay: calc(var(--i, 0) * 40ms);
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------- Footer with contact ---------- */
.site-foot {
  position: relative;
  margin-top: 6px;
}
.site-foot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 12px, transparent 12px 24px);
}
.foot-contact {
  padding-block: clamp(64px, 9vw, 112px) 56px;
}
.foot-contact h2 {
  font-size: clamp(2.4rem, 1.2rem + 5vw, 5rem);
  max-width: 13ch;
}
.foot-contact p {
  max-width: 50ch;
  margin-top: 20px;
  color: var(--soft);
}
.email {
  display: inline-block;
  margin-top: 30px;
  font-family: var(--pixel);
  font-size: clamp(1.3rem, 0.7rem + 3vw, 3rem);
  font-weight: 600;
  color: var(--wisteria);
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}
.email:hover {
  background: var(--wisteria);
  color: var(--ink);
}
.foot-contact .actions {
  margin-top: 28px;
}
.copy-status {
  min-height: 1.6em;
  margin-top: 12px;
  font-family: var(--pixel);
  color: var(--wisteria);
}
.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 28px;
  padding-block: 22px 32px;
  border-top: 3px solid var(--dusk);
  font-family: var(--pixel);
  font-size: 0.92rem;
  color: #d9cfe6;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}
.foot-links a {
  color: #d9cfe6;
}
.foot-links a:hover {
  color: var(--wisteria);
}

/* ---------- Small screens ---------- */
@media (max-width: 1000px) {
  .college-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    margin: 3px;
    padding: 6px 14px;
    border: 0;
    background: transparent;
    color: var(--paper);
    font-family: var(--pixel);
    font-weight: 600;
    box-shadow:
      0 -3px 0 0 var(--paper),
      0 3px 0 0 var(--paper),
      -3px 0 0 0 var(--paper),
      3px 0 0 0 var(--paper);
  }
  .menu-toggle .bars {
    display: grid;
    gap: 3px;
  }
  .menu-toggle .bars i {
    display: block;
    width: 15px;
    height: 3px;
    background: currentColor;
  }
  .menu-toggle[aria-expanded="true"] .bars i:nth-child(2) {
    opacity: 0;
  }
  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 26px;
    background: var(--ink);
    font-size: 1.35rem;
  }
  .site-nav a {
    padding: 14px 0;
    border-bottom: 3px solid var(--dusk);
  }
  .site-nav a[aria-current="page"]::after {
    display: none;
  }
  .site-nav .btn {
    margin-top: 20px;
    border-bottom: 0;
  }
  .site-nav:not(.is-open) {
    display: none;
  }
  .tiles {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }
  .college-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 16px;
  }
}
@media (max-width: 440px) {
  .cp-note {
    display: none;
  }
  .actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------- Live previews of real websites ---------- */
.live {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  /* the embedded site can never change this box's size or spill outside it */
  contain: strict;
}
.live > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.live iframe {
  max-width: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 1280px;
  height: 800px;
  border: 0;
  background: #fff;
  transform: scale(var(--s, 0.25));
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s steps(3);
}
.live.is-live iframe {
  opacity: 1;
}

/* ---------- Hover zoom on project previews ---------- */
.shot img,
.live iframe {
  transition:
    transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
    opacity 0.3s steps(3);
}
a.shot:hover img,
a:hover > .shot img,
a.shot:focus-visible img {
  transform: scale(1.07);
}
/* On hover the live site fades out and the matching screenshot underneath zooms instead. Zooming the
   shrunken live site makes the browser redraw it, and hairlines (like the border under Capo's menu bar)
   can snap into visible lines. The screenshot is a capture of the same 1280 x 800 view. */
a.live:hover iframe,
a:hover > .live iframe,
a.live:focus-visible iframe {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .shot img,
  .live iframe {
    transition: opacity 0.3s steps(3);
  }
}
