/* ───────────────────────── themes ───────────────────────── */

:root {
  --font-serif: "Cormorant Garamond", Georgia, serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-hand: "Caveat", cursive;
  --font-mono: "DM Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* matches the filmstrip repo: hsl(0 0% 4%) bg, hsl(40 20% 90%) ink, hsl(72 100% 63%) lime */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #101010;
  --ink: #ebe7e0;
  --ink-soft: #a3a098;
  --ink-faint: #66645e;
  --accent: #d9ff42;
  --accent-soft: #313b0e;
  --card: #0f0f0f;
  --line: #1f1f1f;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.55);
  --glow-opacity: 1;
}

[data-theme="light"] {
  --bg: #f4f2ea;
  --bg-soft: #ebe9de;
  --ink: #131310;
  --ink-soft: #565449;
  --ink-faint: #8b887b;
  --accent: #66830a;
  --accent-soft: #dde6b4;
  --card: #fdfdf8;
  --line: #d9d6c8;
  --shadow: 0 2px 4px rgba(40, 40, 25, 0.06), 0 12px 32px rgba(40, 40, 25, 0.09);
  --glow-opacity: 0;
}

/* ───────────────────────── base ───────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.6s var(--ease), color 0.6s var(--ease);
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bg); }

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 28px;
}

a { color: inherit; }

/* film grain */
.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 50;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 0.9s steps(3) infinite;
}

@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ───────────────────────── the lamp ───────────────────────── */

.lamp {
  position: fixed;
  top: 0;
  right: clamp(20px, 7vw, 90px);
  z-index: 100;
  background: none;
  border: none;
  cursor: pointer;
  transform-origin: 20px 0;
}

.lamp svg { display: block; overflow: visible; }

.lamp-wire, .lamp-cord {
  stroke: var(--ink-soft);
  stroke-width: 2;
  transition: stroke 0.6s var(--ease);
}

.lamp-bulb {
  fill: var(--card);
  stroke: var(--ink-soft);
  stroke-width: 2;
  transition: fill 0.6s var(--ease), stroke 0.6s var(--ease);
}

.lamp-glow {
  fill: var(--accent);
  opacity: var(--glow-opacity);
  filter: blur(10px);
  transition: opacity 0.6s var(--ease);
}

[data-theme="dark"] .lamp-bulb { fill: var(--accent); stroke: var(--accent); }

.lamp-knob {
  fill: var(--accent);
  transition: fill 0.6s var(--ease);
}

.lamp-hint {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-hand);
  font-size: 17px;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity 0.3s;
}

.lamp:hover .lamp-hint { opacity: 1; }
.lamp:hover { animation: sway 1.6s ease-in-out infinite; }

@keyframes sway {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(2.5deg); }
  75% { transform: rotate(-2.5deg); }
}

.lamp.tugged { animation: tug 0.45s var(--ease); }

@keyframes tug {
  0% { transform: translateY(0); }
  35% { transform: translateY(14px); }
  100% { transform: translateY(0); }
}

/* ───────────────────────── reveal on scroll ───────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.in { opacity: 1; transform: translateY(0); }

.d1 { transition-delay: 0.08s; }
.d2 { transition-delay: 0.16s; }
.d3 { transition-delay: 0.26s; }
.d4 { transition-delay: 0.36s; }
.d5 { transition-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .grain { animation: none; }
}

/* ───────────────────────── hero ───────────────────────── */

.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  gap: 40px;
  padding-top: 60px;
}

.hero-text { flex: 1; }

/* taped-in polaroid photo */
.hero-photo {
  position: relative;
  width: clamp(180px, 22vw, 250px);
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px 10px 6px;
  border-radius: 4px;
  box-shadow: var(--shadow);
  transform: rotate(3deg);
  transition: transform 0.4s var(--ease), background 0.6s var(--ease);
}

.hero-photo:hover { transform: rotate(0.5deg) translateY(-4px); }

.hero-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
}

.hero-photo figcaption {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--ink-faint);
  text-align: center;
  padding: 6px 0 2px;
}

/* a piece of tape */
.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 86px;
  height: 26px;
  background: var(--accent-soft);
  opacity: 0.75;
  border-left: 1px dashed rgba(0, 0, 0, 0.08);
  border-right: 1px dashed rgba(0, 0, 0, 0.08);
  z-index: 2;
}

@media (max-width: 760px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; justify-content: center; }
  .hero-photo { transform: rotate(2deg); width: 170px; }
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 26px;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(64px, 12vw, 120px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

/* the name + its doodles */
.hero-name {
  position: relative;
  display: inline-block;
  padding: 0 10px;
}

.doodle {
  position: absolute;
  pointer-events: none;
  color: var(--accent);
  transition: color 0.6s var(--ease);
}

/* hand-drawn underline — draws itself in */
.doodle-underline {
  left: 4px;
  bottom: -14px;
  width: calc(100% - 8px);
  height: 26px;
}

.doodle-underline path {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
}

.doodle-underline path:last-child { stroke-width: 3; opacity: 0.55; }

.hero-name.in .doodle-underline path {
  animation: scribble 0.7s var(--ease) 0.55s forwards;
}

.hero-name.in .doodle-underline path:last-child { animation-delay: 0.85s; }

@keyframes scribble {
  to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .doodle-underline path { stroke-dashoffset: 0; animation: none; }
}

.hero-roles {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: clamp(12px, 1.8vw, 14.5px);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

/* clip-on social tags */
.clipons {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 38px;
}

.clipon {
  transform: rotate(var(--tilt));
  transition: transform 0.3s var(--ease);
}

.clipon:hover { transform: rotate(0deg) translateY(-3px); }

.clipon a {
  display: inline-block;
  position: relative;
  padding: 7px 16px 7px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.25s, border-color 0.25s, background 0.6s var(--ease);
}

.clipon a:hover { color: var(--accent); border-color: var(--accent); }

/* the "clip" — a little ring punched through the tag */
.clipon a::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border: 2px solid var(--ink-faint);
  border-radius: 50%;
}

/* ───────────────────────── section heads ───────────────────────── */

section { padding: 90px 0; }

.section-head { margin-bottom: 48px; }

.annot {
  font-family: var(--font-hand);
  font-size: 21px;
  color: var(--accent);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(28px, 4.4vw, 42px);
  letter-spacing: -0.01em;
  margin-top: 2px;
}

.section-sub {
  margin-top: 10px;
  color: var(--ink-soft);
  max-width: 480px;
}

/* ───────────────────────── projects ───────────────────────── */

.project {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 18px;
  padding: 44px 0;
  border-top: 1px solid var(--line);
}

.project:last-of-type { border-bottom: 1px solid var(--line); }

.project-index {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-faint);
  padding-top: 8px;
}

.project-body h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(22px, 3.2vw, 30px);
  letter-spacing: -0.01em;
}

.oss-tag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 10px;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.project-why {
  margin-top: 12px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 18.5px;
  color: var(--ink);
  max-width: 560px;
}

.project-what {
  margin-top: 12px;
  color: var(--ink-soft);
  max-width: 620px;
}

/* taped-in demo video */
.project-media {
  position: relative;
  margin-top: 24px;
  max-width: 620px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 4px;
  box-shadow: var(--shadow);
  transform: rotate(var(--media-tilt, -1deg));
  transition: transform 0.4s var(--ease), background 0.6s var(--ease);
}

.project-media:hover { transform: rotate(0deg) scale(1.012); }

.project-media video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 848 / 478;
  border-radius: 2px;
  background: #000;
}

.project-meta {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  transition: border-color 0.6s var(--ease);
}

.project-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s;
}

.project-link:hover { border-bottom-color: var(--accent); }

.project-links { display: flex; gap: 18px; }

/* ───────────────────────── client work ───────────────────────── */

.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 18px;
}

.client-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--ease), border-color 0.35s, background 0.6s var(--ease);
}

.client-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.client-card h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 20px;
  margin-top: 10px;
}

.client-card p {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.client-card.placeholder {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.client-card.placeholder:hover { border-color: var(--line); transform: none; }

/* ───────────────────────── the shelf ───────────────────────── */

.shelf {
  position: relative;
  overflow: hidden;
  cursor: grab;
  /* a wooden ledge under the cards */
  padding-bottom: 18px;
  margin: 0 -28px;
}

.shelf.dragging { cursor: grabbing; }

.shelf::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 8px;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
}

.shelf-track {
  display: flex;
  gap: 22px;
  padding: 14px 28px 22px;
  width: max-content;
  will-change: transform;
}

.shelf-card {
  display: block;
  width: 264px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 18px;
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt));
  transition: transform 0.35s var(--ease), background 0.6s var(--ease), border-color 0.6s var(--ease);
  user-select: none;
  text-decoration: none;
  color: inherit;
}

.shelf-card:hover { transform: rotate(0deg) translateY(-6px); border-color: var(--accent); }

.shelf-card.ghost { border-style: dashed; background: transparent; box-shadow: none; padding: 20px; }
.shelf-card.ghost:hover { border-color: var(--line); }

.card-img {
  display: block;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.card-img img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  filter: saturate(0.4);
  transition: filter 0.5s var(--ease), transform 0.5s var(--ease);
  pointer-events: none;
}

.shelf-card:hover .card-img img { filter: saturate(1); transform: scale(1.04); }

.card-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.card-tag.win { color: var(--accent); font-weight: 500; }

.shelf-card h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.3;
  margin-top: 8px;
}

.shelf-card p {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
}

.card-date {
  display: block;
  font-family: var(--font-hand);
  font-size: 17px;
  color: var(--ink-faint);
}

.card-links {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.card-links a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.card-links a:hover { border-bottom-color: var(--accent); }

/* ───────────────────────── writing ───────────────────────── */

.writing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.writing-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.35s var(--ease), border-color 0.35s, background 0.6s var(--ease);
}

.writing-card:hover { transform: translateY(-5px); border-color: var(--accent); }

.writing-img {
  display: block;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.writing-img img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  filter: saturate(0.5);
  transition: filter 0.5s var(--ease);
}

.writing-card:hover .writing-img img { filter: saturate(1); }

.writing-body { padding: 18px 20px 20px; }

.writing-body h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 19px;
  line-height: 1.3;
}

.writing-body p {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.writing-date {
  display: block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ───────────────────────── proof of work ───────────────────────── */

.proof { padding-top: 0; }

.ghchart {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  transition: background 0.6s var(--ease), border-color 0.6s var(--ease);
}

.ghchart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.ghchart-head a {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
}

.ghchart-head a:hover { text-decoration: underline; }

[data-theme="dark"] {
  --cell-0: #1c1c1c;
  --cell-1: #3a4410;
  --cell-2: #6b7d1d;
  --cell-3: #a4c52e;
  --cell-4: #d9ff42;
}

[data-theme="light"] {
  --cell-0: #e4e1d3;
  --cell-1: #cdda9b;
  --cell-2: #a4bf4d;
  --cell-3: #82a124;
  --cell-4: #66830a;
}

.ghgrid-wrap { overflow-x: auto; padding-bottom: 4px; }

.ghgrid-months {
  position: relative;
  height: 18px;
  min-width: 742px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-faint);
}

.ghgrid-months span { position: absolute; top: 0; }

.ghgrid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 11px);
  grid-auto-columns: 11px;
  gap: 3px;
  min-width: 742px;
}

.ghgrid i {
  border-radius: 2.5px;
  background: var(--cell-0);
  transition: background 0.6s var(--ease);
}

.ghgrid i.l1 { background: var(--cell-1); }
.ghgrid i.l2 { background: var(--cell-2); }
.ghgrid i.l3 { background: var(--cell-3); }
.ghgrid i.l4 { background: var(--cell-4); }

.ghtotal {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

/* ───────────────────────── footer ───────────────────────── */

.footer {
  padding: 60px 0 80px;
  border-top: 1px solid var(--line);
}

.footer-big {
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.footer-big a {
  color: var(--accent);
  font-style: italic;
  text-decoration: none;
  border-bottom: 2px solid var(--accent-soft);
  transition: border-color 0.25s;
}

.footer-big a:hover { border-bottom-color: var(--accent); }


/* ───────────────────────── the cat ───────────────────────── */

.cat {
  position: fixed;
  bottom: -26px;
  right: 36px;
  z-index: 40;
  pointer-events: none;
  transition: transform 0.6s var(--ease);
  transform: translateY(12px);
}

.cat.up { transform: translateY(0); }

.cat-body {
  fill: var(--card);
  stroke: var(--ink-soft);
  stroke-width: 2;
  transition: fill 0.6s var(--ease), stroke 0.6s var(--ease);
}

.cat-eye { fill: var(--bg); transition: fill 0.6s var(--ease); }

.cat-pupil { fill: var(--ink); transition: fill 0.6s var(--ease); }

.cat-nose { fill: var(--accent); }

.cat-whisker {
  stroke: var(--ink-faint);
  stroke-width: 1.2;
  fill: none;
}

/* blink */
.cat .cat-eye-group { animation: blink 6s infinite; transform-origin: center; }

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.08); }
}

@media (max-width: 600px) { .cat { right: 12px; transform: translateY(16px) scale(0.8); } .cat.up { transform: translateY(2px) scale(0.8); } }

/* ───────────────────────── touch devices ───────────────────────── */

/* no hover on touch — never leave media stuck desaturated */
@media (hover: none) {
  .project-media video,
  .card-img img,
  .writing-img img { filter: saturate(1); }
}

/* ───────────────────────── small screens ───────────────────────── */

@media (max-width: 600px) {
  .project { grid-template-columns: 1fr; gap: 6px; }
  .lamp { right: 16px; }
  section { padding: 64px 0; }
  .hero { min-height: auto; padding-top: 110px; padding-bottom: 40px; gap: 28px; }
  .hero-title { font-size: clamp(56px, 18vw, 80px); }
  .project-media { transform: none; }
  .project-media:hover { transform: none; }
}
