:root {
  --paper: #ece4cf;
  --ink: #1d1a15;
  --line: #1f1b15;
  --panel: rgba(247, 241, 223, 0.95);
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.14);
  --ring: rgba(255, 255, 255, 0.26);
  --ring-hover: rgba(255, 255, 255, 0.9);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% 0%, #f5eed9 0, transparent 70%),
    radial-gradient(1200px 700px at 90% 100%, #e8dcc3 0, transparent 72%),
    var(--paper);
  font-family: "Source Sans 3", sans-serif;
}

.page {
  width: min(1140px, 93vw);
  margin: 0 auto;
  padding: 2.25rem 0 3rem;
}

.hero {
  max-width: 860px;
  margin-bottom: 1.1rem;
}

h1,
h2 {
  margin: 0;
  font-family: "Libre Baskerville", serif;
  font-weight: 700;
}

h1 {
  margin-top: 0.25rem;
  font-size: clamp(1.46rem, 4.7vw, 3.8rem);
  line-height: 1.06;
  letter-spacing: -0.016em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  white-space: nowrap;
}

.name-suffix {
  white-space: nowrap;
}

.intro-row {
  margin-top: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.intro {
  margin: 0;
  font-size: clamp(1.12rem, 2.15vw, 1.54rem);
  font-weight: 500;
  max-width: 70ch;
  line-height: 1.35;
  letter-spacing: 0.004em;
  text-wrap: balance;
}

.menu-wrap {
  position: relative;
}

.menu-toggle {
  position: relative;
  width: 2.35rem;
  height: 2.35rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.menu-toggle span {
  display: block;
  width: 0.98rem;
  height: 1.7px;
  background: var(--line);
  margin: 0.09rem 0;
  border-radius: 2px;
}

.menu-toggle:is(:hover, :focus-visible) {
  background: #f0e6cb;
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--line);
  outline-offset: 2px;
}

.site-menu {
  position: absolute;
  right: 0.1rem;
  top: calc(100% + 0.45rem);
  width: min(26rem, 84vw);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 20;
  padding: 0.55rem;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-list li {
  margin: 0;
}

.menu-list a,
.menu-heading {
  display: block;
  font-family: "Libre Baskerville", serif;
  font-size: clamp(0.82rem, 1.28vw, 0.95rem);
  color: var(--ink);
  text-decoration: none;
  border-radius: 7px;
  padding: 0.33rem 0.46rem;
}

.menu-heading {
  opacity: 0.8;
}

.menu-list a:is(:hover, :focus-visible) {
  background: rgba(0, 0, 0, 0.08);
  outline: none;
}

.menu-indent a {
  padding-left: 1.4rem;
}

.canvas-wrap {
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  background: #f7f1df;
  border-radius: 12px;
  overflow: clip;
}

.portal-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 1255 / 1280;
  overflow: hidden;
}

.artwork {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.portal {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(0.8rem, 1.35vw, 1rem);
  height: clamp(0.8rem, 1.35vw, 1rem);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid var(--ring);
  text-decoration: none;
  background: rgba(0, 0, 0, 0.72);
  box-shadow:
    0 0 0 1.4px rgba(255, 255, 255, 0.35),
    0 0 0 5px rgba(0, 0, 0, 0.12);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
  cursor: pointer;
  touch-action: manipulation;
}

.portal span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(
    calc(-50% + var(--lx, 0px)),
    calc(-80% + var(--ly, 0px))
  );
  font-family: "Libre Baskerville", serif;
  font-size: clamp(0.68rem, 1.55vw, 0.96rem);
  font-weight: 700;
  color: #fff;
  background: rgba(16, 15, 12, 0.84);
  padding: 0.16rem 0.42rem;
  border-radius: 999px;
  letter-spacing: 0.004em;
  opacity: 1;
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24);
  cursor: pointer;
}

.portal-long span {
  width: min(24ch, 32vw);
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

.portal:hover,
.portal:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  border-color: var(--ring-hover);
  background: rgba(6, 6, 6, 0.85);
  box-shadow:
    0 0 0 1.8px rgba(255, 255, 255, 0.66),
    0 0 0 7px rgba(0, 0, 0, 0.14);
}

.portal:hover span,
.portal:focus-visible span {
  opacity: 1;
}

.portal:focus-visible {
  outline: none;
}

.p-work {
  --x: 38.2%;
  --y: 34.1%;
}

.p-about {
  --x: 11.8%;
  --y: 20.3%;
}

.p-press {
  --x: 62.3%;
  --y: 55.2%;
}

.p-writing {
  --x: 73.4%;
  --y: 30.6%;
}

.p-experiments {
  --x: 24.1%;
  --y: 67.3%;
}

.p-berkeley-css {
  --x: 80.6%;
  --y: 73.2%;
  --lx: -48px;
  --ly: -26px;
}

.p-berkeley-polisci {
  --x: 87.1%;
  --y: 78.1%;
  --lx: -32px;
  --ly: -48px;
}

.p-berkeley-pe {
  --x: 78.4%;
  --y: 77.8%;
  --lx: -20px;
  --ly: -4px;
}

.berkeley-label {
  position: absolute;
  left: 81.6%;
  top: 59.4%;
  transform: translate(-50%, -50%);
  font-family: "Libre Baskerville", serif;
  font-size: clamp(0.68rem, 1.55vw, 0.96rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: rgba(16, 15, 12, 0.82);
  padding: 0.14rem 0.36rem;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  z-index: 6;
}

.p-tshuva {
  --x: 13.7%;
  --y: 56.9%;
}

@media (max-width: 900px) {
  .portal {
    width: 0.88rem;
    height: 0.88rem;
  }
}

@media (max-width: 680px) {
  .page {
    width: min(1200px, 95vw);
    padding-top: 1.2rem;
  }

  .hero {
    margin-bottom: 0.7rem;
  }

  .menu-toggle {
    width: 2.2rem;
    height: 2.2rem;
  }

  .site-menu {
    top: calc(100% + 0.35rem);
    width: min(22rem, 92vw);
  }

  .portal span {
    font-size: 0.56rem;
    opacity: 1;
    background: rgba(0, 0, 0, 0.56);
    transform: translate(
      calc(-50% + var(--lx, 0px)),
      calc(-80% + var(--ly, 0px))
    );
  }

  .p-berkeley-css span,
  .p-berkeley-polisci span {
    font-size: 0.5rem;
  }

  .p-berkeley-css span {
    white-space: nowrap;
    width: auto;
  }

  .p-berkeley-pe span {
    font-size: 0.52rem;
  }

  .p-berkeley-polisci {
    --ly: -25px;
  }

  .berkeley-label {
    font-size: 0.52rem;
  }

  .portal {
    box-shadow:
      0 0 0 1.1px rgba(255, 255, 255, 0.6),
      0 0 0 4px rgba(0, 0, 0, 0.12);
  }
}

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

  .portal,
  .portal span {
    transition: none;
  }
}
