:root {
  --bg: #2a1b12;
  --text: #cfc7ba;
  --dim: #9a8e7f;
  --strong: #f4eee3;
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
  /* the typewriter face the tree is drawn in, for the small print */
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --tip: #3a281c;
  --veil: rgba(30, 19, 12, 0.82);
  --band: 46vh;                  /* height of the tree band on phones */
}
/* summer: the same page on a deep blue */
:root[data-theme="summer"] {
  --bg: #2b3dc3;
  --text: #e3e7ff;
  --dim: #aab4f2;
  --strong: #ffffff;
  --tip: #1f2c98;
  --veil: rgba(22, 32, 120, 0.8);
}
@supports (height: 1svh) { :root { --band: 46svh; } }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ tree */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#scene {
  cursor: grab;
  touch-action: pan-y;
}
#scene.dragging { cursor: grabbing; }
#scene.pointing { cursor: pointer; }

/* low-res copy of the scene, blurred, for a soft bloom */
#glow {
  pointer-events: none;
  filter: blur(9px) saturate(1.3);
  opacity: 0.45;
  mix-blend-mode: screen;
}

:root[data-theme="summer"] #glow { opacity: 0.28; }   /* less haze on the bright blue */

.tip {
  position: absolute;
  padding: 3px 8px;
  font-size: 13px;
  color: var(--strong);
  background: var(--tip);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.tip.on { opacity: 1; }

/* the switch between the winter and summer scenes */
.season {
  position: fixed;
  left: 26px;
  top: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 16px var(--font);
  cursor: pointer;
}
.season:hover, .season:focus-visible { color: var(--strong); }
.season-dot {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform 0.4s ease;
}
:root[data-theme="summer"] .season-dot { transform: rotate(180deg); }

/* --------------------------------------------------------- content */
.nav {
  position: fixed;
  top: 22px;
  right: clamp(24px, 6vw, 110px);
  z-index: 2;
  display: flex;
  gap: 18px;
}
.nav a { color: var(--dim); text-decoration: none; }
.nav a:hover, .nav a:focus-visible { color: var(--strong); }

.content {
  position: relative;
  z-index: 1;
  width: min(480px, 42vw);
  margin: 0 clamp(24px, 6vw, 110px) 0 auto;
  padding-bottom: 45vh;
  pointer-events: none;          /* let drags reach the tree between entries */
}
.content > section > * { pointer-events: auto; }

section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20vh 0;
}
.hero { min-height: 100vh; justify-content: center; gap: 10px; padding: 0; }

h1, h2, h3 { margin: 0; color: var(--strong); font-size: 1em; font-weight: 600; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-weight: 400; color: var(--dim); }
.key { opacity: 0.7; }
p { margin: 0; }

.meta, .hint, .detail { color: var(--dim); }
.meta { flex: none; }
.meta, .hint, .nav, .foot { font-family: var(--mono); font-size: 12px; }
/* a quiet sign-off at the very bottom of the page */
.foot { position: absolute; left: 0; bottom: 28px; color: var(--dim); }

.card {
  display: flex;
  flex-direction: column;
  outline: none;
}
/* clicking an ornament briefly marks the entry it belongs to */
.card h3 { transition: color 0.3s; }
.card.is-lit h3, .card:focus-visible h3 { color: var(--accent, var(--strong)); }

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

/* education and experience: a bare logo in front of the entry's title */
.entry + .entry { margin-top: 22px; }
.entry .row { align-items: center; gap: 10px; margin-bottom: 8px; }
.entry .row h3 { flex: 1; }
.logo {
  flex: none;
  width: auto;                     /* each as wide as its own shape, so the gap to the title is even */
  height: var(--h, 28px);           /* set --h on a logo to balance a wide or narrow one */
  transform: translateY(var(--lift, 0));   /* set --lift on a logo whose weight sits low or high */
}

/* experience: each job stands apart, with a large image of the work beneath it */
#experience .entry + .entry { margin-top: 96px; }
#projects .card + .card { margin-top: 15px; }
#projects .detail { margin-top: 2px; }
#projects .shot, #projects .shots { margin-top: 14px; }
#projects .shots .shot { margin-top: 0; }
/* a photo with a softer, slightly faded look and darkened edges */
.shot.soft { position: relative; }
.shot.soft img { filter: saturate(0.82) contrast(0.92) brightness(1.04) blur(0.3px); }
.shot.soft::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(20, 12, 6, 0.5));
  pointer-events: none;
}
.shot {
  display: block;
  margin-top: 18px;
  border-radius: 6px;
  overflow: hidden;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: opacity 0.2s;
}
a.shot:hover img, a.shot:focus-visible img { opacity: 0.85; }
div.shot img { aspect-ratio: auto; }      /* an image that links nowhere, shown whole */
video.shot { width: 100%; aspect-ratio: 16 / 9; background: #000; }
/* projects: a row of small images */
.shots { display: flex; gap: 12px; margin-top: 12px; }
.shots .shot { flex: 1; margin-top: 0; }
.shot.banner { margin-top: 12px; }
.shot.banner img { aspect-ratio: auto; }

.detail a { color: inherit; text-underline-offset: 3px; }
.detail a:hover, .detail a:focus-visible { color: var(--strong); }
.links { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.links a { color: var(--strong); text-underline-offset: 3px; text-decoration-color: var(--dim); }
.links a:hover, .links a:focus-visible { text-decoration-color: currentColor; }

/* hobbies: the entry opens its photo, as the polaroid on the tree does */
.photo { cursor: zoom-in; }
.photo + .photo { margin-top: 6px; }

/* the photos of a polaroid: wheels of photos over the blurred site */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: var(--veil);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  cursor: zoom-out;
  touch-action: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }
.lightbox img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  /* on the rim the photos are a little faded and soft; the large one is clear */
  filter: saturate(0.8) brightness(0.8) blur(0.5px);
  transition: filter 0.4s ease, box-shadow 0.4s ease;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox img.hot { filter: none; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6); cursor: zoom-out; }
.wheel-hint {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 12px;
  pointer-events: none;
}

/* ----------------------------------------------------------- phone */
/* the tree gets a band of its own at the top, and the text scrolls below it */
@media (max-width: 899px) {
  .stage { bottom: auto; height: var(--band); z-index: 2; }
  .stage::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -24px;
    height: 24px;
    background: linear-gradient(var(--bg), transparent);
    pointer-events: none;
  }
  .nav { display: none; }
  .foot { left: 24px; }
  .season { left: 14px; top: 8px; font-size: 15px; }
  .content {
    width: auto;
    margin: 0;
    padding: var(--band) 24px 30vh;
    pointer-events: auto;
  }
  section { padding: 56px 0; scroll-margin-top: var(--band); }
  #experience .entry + .entry { margin-top: 64px; }
  .hero { min-height: calc(100vh - var(--band)); justify-content: flex-start; padding: 40px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card h3, .shot img, .lightbox, .lightbox img, .season-dot { transition: none; }
}
