/* ---------- Tokens ---------- */
:root {
  --paper: #f3f5f0;
  --paper-raised: #fbfcf9;
  --ink: #1f2a24;
  --ink-soft: #5b6760;
  --line: #dde3d8;
  --accent: #2f5d50;
  --accent-wash: #e1ebdc;
  --accent-marker: #cfe0c4;

  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Figtree", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1040px;
  --gutter: 24px;
  --nav-h: 60px;
  --radius: 14px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font: 400 18px/1.6 var(--font-sans);
  /* Dot-grid paper */
  background:
    radial-gradient(circle, rgba(31, 42, 36, 0.09) 1px, transparent 1.5px) 0 0 / 22px 22px,
    var(--paper);
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }

/* Headlines are set in the serif; everything else in the sans */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 500;
}
ul { padding: 0; list-style: none; }

a { color: inherit; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* Small monospace label used across the page */
.label {
  font: 500 13px/1.4 var(--font-mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 245, 240, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.nav.is-scrolled { border-bottom-color: var(--line); }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--wrap);
  height: var(--nav-h);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.nav__name {
  font-weight: 600;
  font-size: 19px;
  text-decoration: none;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  gap: 4px;
}

.nav__links a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  font: 500 14px/1.4 var(--font-mono);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.nav__links a:hover { background: var(--accent-wash); }

.nav__links a.is-active {
  background: var(--accent);
  color: #fff;
}

/* ---------- Hero ---------- */
.hero {
  padding-top: clamp(48px, 9vw, 96px);
  padding-bottom: clamp(48px, 9vw, 96px);
}

.hero__text { animation: rise-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }

.hero h1 {
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1;
}

.hero__tagline {
  max-width: none;
  margin-top: 12px;
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.35;
}

/* Blob-shaped portrait. Mobile: under the text; desktop: to its right. */
.hero__portrait {
  position: relative;
  width: min(220px, 58vw);
  margin: 40px auto 0;
}

.hero__portrait img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 58% 42% 47% 53% / 46% 55% 45% 54%;
}

/* A thin circle sitting slightly down and left of the blob */
.hero__portrait::after {
  content: "";
  position: absolute;
  inset: -3%;
  border: 1.2px solid var(--ink);
  border-radius: 50%;
  opacity: 0.7;
  transform: translate(-6%, 4%);
  pointer-events: none;
}

.hero__marks {
  position: absolute;
  z-index: 2;
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.4;
  stroke-linecap: round;
}

.hero__marks--plus { top: -2%; right: -4%; width: 13%; }
.hero__marks--slash { left: -12%; bottom: 20%; width: 18%; }

/* Desk objects. Mobile first: a tidy two-column grid, nothing rotated. */
.desk {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 16px;
  align-items: center;
  justify-items: center;
  margin-top: 40px;
}

.obj {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  filter: drop-shadow(0 6px 10px rgba(31, 42, 36, 0.16));
  animation: rise-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  animation-delay: calc(var(--i) * 90ms + 150ms);
  -webkit-user-select: none;
  user-select: none;
}

.obj--photo    { max-width: 150px; }
.obj--cat-desk { max-width: 124px; }
.obj--kitchen  { max-width: 300px; grid-column: 1 / -1; }
.obj--city     { max-width: 150px; }
.obj--cat-nap  { max-width: 170px; }

/* Torn-paper photo scraps. The tear is a clip-path on the inner paper, so the
   drop shadow (a filter on the figure) follows the torn edge. */
.scrap__paper {
  padding: 9px 9px 0;
  background: #ebe5d6;
  clip-path: polygon(1% 3%, 9% 0, 18% 2%, 29% 0, 41% 3%, 53% 0, 64% 2%, 76% 0, 88% 3%, 99% 1%,
    100% 13%, 98% 27%, 100% 41%, 97% 55%, 100% 69%, 98% 83%, 100% 97%,
    89% 100%, 77% 97%, 65% 100%, 52% 98%, 40% 100%, 27% 97%, 15% 100%, 2% 98%,
    0 85%, 2% 71%, 0 57%, 3% 43%, 0 29%, 2% 15%);
}

.scrap__paper img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.scrap__paper figcaption {
  padding: 7px 2px 11px;
  font: 400 11px/1.2 var(--font-mono);
  color: var(--ink-soft);
}

/* A strip of washi tape holding each scrap down */
.scrap__tape {
  position: absolute;
  z-index: 1;
  top: -8px;
  left: 50%;
  width: 56px;
  height: 18px;
  margin-left: -28px;
  background: rgba(207, 224, 196, 0.8);
  transform: rotate(-4deg);
}

.obj--kitchen .scrap__tape { left: 18%; transform: rotate(6deg); }
.obj--cat-nap .scrap__tape { left: 80%; transform: rotate(-8deg); }

/* Polaroid frame around the photo */
.obj--photo {
  padding: 8px 8px 0;
  background: #fff;
  border-radius: 3px;
}

.obj--photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  pointer-events: none;
}

.obj--photo figcaption {
  padding: 8px 0 10px;
  font: 400 12px/1.2 var(--font-mono);
  text-align: center;
  color: var(--ink-soft);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px); }
}

/* Desktop: objects are scattered around the headline */
@media (min-width: 760px) {
  .hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(32px, 6vw, 72px);
    align-items: center;
    min-height: clamp(380px, 42vw, 500px);
  }

  .hero__text { max-width: none; }

  .hero__portrait {
    width: clamp(190px, 22vw, 260px);
    margin: 0;
  }

  .desk {
    position: absolute;
    inset: 0;
    display: block;
    margin: 0;
    pointer-events: none;
  }

  /* --r is the resting angle; --dx/--dy are set by dragging (script.js) */
  .obj {
    --dx: 0px;
    --dy: 0px;
    --lift: 0px;
    position: absolute;
    max-width: none;
    pointer-events: auto;
    transform: translate(var(--dx), calc(var(--dy) - var(--lift))) rotate(var(--angle, var(--r)));
    transition: transform 0.25s ease, filter 0.25s ease;
    animation-name: drop-in;
  }

  .obj:hover,
  .obj.is-dragging {
    --lift: 6px;
    --angle: calc(var(--r) * 0.35);
    filter: drop-shadow(0 16px 18px rgba(31, 42, 36, 0.22));
  }

  .obj.is-dragging { transition: filter 0.25s ease; }

  .obj--city     { --r: -5deg; left: 56%; top: 3%;  width: 20%; }
  .obj--photo    { --r: 4deg;  left: 77%; top: 7%;  width: 20%; }
  .obj--kitchen  { --r: 3deg;  left: 59%; top: 45%; width: 25%; }
  .obj--cat-desk { --r: -6deg; left: 84%; top: 42%; width: 14%; }
  .obj--cat-nap  { --r: -3deg; left: 39%; top: 67%; width: 20%; }

  @keyframes drop-in {
    from {
      opacity: 0;
      transform: translate(var(--dx), calc(var(--dy) - 26px)) rotate(calc(var(--r) * 2.2)) scale(0.95);
    }
  }
}

@media (min-width: 760px) and (pointer: fine) {
  .obj { cursor: grab; touch-action: none; }
  .obj.is-dragging { cursor: grabbing; }
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(48px, 8vw, 88px);
}

.section__head { margin-bottom: 32px; }

.section__head h2 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
}

.section__intro {
  max-width: 52ch;
  margin-bottom: 28px;
  color: var(--ink-soft);
}

/* Dashed "something goes here" box */
.placeholder {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1.5px dashed #c5cfc0;
  border-radius: var(--radius);
  background: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(31, 42, 36, 0.035) 10px 20px);
  color: var(--ink-soft);
  font: 400 13px/1.4 var(--font-mono);
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  gap: clamp(24px, 5vw, 56px);
  align-items: start;
}


/* Hand-drawn accents on key phrases (inline SVGs in index.html) */
.hl,
.ul,
.starred {
  position: relative;
  font-weight: 600;
  white-space: nowrap;
}

.hl,
.ul { isolation: isolate; }

.hl svg {
  position: absolute;
  z-index: -1;
  top: 0.02em;
  left: -5px;
  width: calc(100% + 10px);
  height: 1.35em;
  fill: var(--accent-marker);
}

.ul svg {
  position: absolute;
  left: 0;
  bottom: -0.32em;
  width: 100%;
  height: 0.45em;
  overflow: visible;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.ul svg path { vector-effect: non-scaling-stroke; }

.star {
  width: 1.05em;
  height: 1.05em;
  margin-left: 0.2em;
  vertical-align: -0.16em;
  fill: var(--accent);
  stroke: var(--ink);
  stroke-width: 1.2;
  stroke-linejoin: round;
  transform: rotate(-10deg);
}

.about__body p + p { margin-top: 16px; }
.about__body p { max-width: 56ch; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--line);
}

.facts dt {
  font: 500 12px/1.4 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.facts dd { font-weight: 500; }

/* ---------- Work ---------- */
.cards {
  display: grid;
  gap: 24px;
}

/* One card per row: cover on the left, text on the right */
.card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 44px);
  align-items: center;
  padding: 14px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(31, 42, 36, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(31, 42, 36, 0.1);
}

.placeholder--cover {
  aspect-ratio: 16 / 10;
  min-height: 0;
  border-radius: 8px;
}

.card__body { padding-right: 14px; }

/* A card that links to a case study */
.card--link {
  color: inherit;
  text-decoration: none;
}

.card__cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card__body .card__cta {
  margin-top: 14px;
  font: 500 14px/1.4 var(--font-mono);
  color: var(--accent);
}

.card h3 {
  margin-top: 8px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.2;
}

.card__body h3 + p {
  margin-top: 8px;
  color: var(--ink-soft);
}

/* ---------- Playground ---------- */
/* One featured project: a short write-up beside a working demo */
.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
  gap: clamp(24px, 5vw, 56px);
  align-items: start;
}

.project__icon {
  display: block;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  filter: drop-shadow(0 1px 2px rgba(31, 42, 36, 0.12)); /* a light, Dock-like shadow */
}

.project__title {
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.1;
}

.project__text {
  margin-top: 10px;
  font-size: 16px;
}

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--paper-raised);
  font: 500 0.8em/1.6 var(--font-mono);
  text-align: center;
}

/* ---------- Playground: a junk journal ---------- */
.jj {
  display: grid;
  gap: clamp(32px, 5vw, 48px);
}

.jj-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 5vw, 48px);
  align-items: start;
}

/* A journal page: cream paper with a faint grid, set down slightly crooked */
.jj-page {
  position: relative;
  padding: clamp(24px, 4vw, 40px);
  background:
    linear-gradient(rgba(31, 42, 36, 0.045) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(31, 42, 36, 0.045) 1px, transparent 1px) 0 0 / 22px 22px,
    #fbfaf4;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(31, 42, 36, 0.06), 0 12px 28px rgba(31, 42, 36, 0.08);
}

.jj-page--ramble { transform: rotate(-0.4deg); }
.jj-page--home   { transform: rotate(0.7deg); background-color: #f4efe2; }
.jj-page--cat    { transform: rotate(-0.8deg); }

/* Striped washi tape */
.jj-tape {
  position: absolute;
  z-index: 2;
  top: -12px;
  left: 50%;
  width: 96px;
  height: 24px;
  margin-left: -48px;
  background: repeating-linear-gradient(45deg,
    rgba(207, 224, 196, 0.9) 0 6px, rgba(188, 208, 176, 0.9) 6px 12px);
  transform: rotate(-3deg);
}

.jj-tape--left  { left: 12%; transform: rotate(-8deg); }
.jj-tape--right { left: 88%; transform: rotate(6deg); }

.jj-tape--small {
  top: -10px;
  width: 60px;
  height: 18px;
  margin-left: -30px;
  transform: rotate(5deg);
}

/* A ticket-stub label with notched ends */
.jj-ticket {
  display: inline-block;
  margin-bottom: 20px;
  padding: 6px 18px;
  background: var(--ink);
  color: #f3f5f0;
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-mask:
    radial-gradient(circle at 0 50%, transparent 6px, #000 6.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 6px, #000 6.5px) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 50%, transparent 6px, #000 6.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 6px, #000 6.5px) right / 51% 100% no-repeat;
  transform: rotate(-2deg);
}

/* Torn-paper photo scraps (the torn edge comes from .scrap__paper) */
.jj-scrap {
  position: relative;
  margin: 0;
  filter: drop-shadow(0 6px 10px rgba(31, 42, 36, 0.16));
  transform: rotate(var(--r, 0deg));
}

.jj-collage--home {
  position: relative;
  padding-bottom: 22%;
}

.jj-scrap--main { width: 88%; }

.jj-scrap--inset {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 40%;
}

.jj-collage--cat {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: center;
}

.jj-collage--cat .jj-scrap + .jj-scrap { margin-left: -8%; }

/* Paint-chip swatches of the kitchen's materials */
.jj-swatches {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  font: 400 12px/1.3 var(--font-mono);
  color: var(--ink-soft);
}

.jj-swatches li {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.jj-swatches span {
  width: 46px;
  height: 56px;
  background: var(--c);
  border: 4px solid #fff;
  box-shadow: 0 2px 4px rgba(31, 42, 36, 0.15);
}

.jj-swatches .jj-swatch--marble {
  background:
    linear-gradient(115deg, transparent 40%, rgba(150, 140, 140, 0.55) 42%, transparent 45%),
    linear-gradient(160deg, transparent 60%, rgba(150, 140, 140, 0.4) 61%, transparent 63%),
    #f2f0ec;
}

/* A rubber-stamped paw print */
.jj-stamp {
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 78px;
  height: 78px;
  color: var(--accent);
  fill: currentColor;
  opacity: 0.7;
  transform: rotate(-14deg);
}

/* ---------- Cursor ---------- */
/* Standard system cursors. */
html { cursor: auto; }

a,
button:not(:disabled),
[role="radio"],
summary { cursor: pointer; }

input,
textarea,
[contenteditable] { cursor: text; }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 32px 48px;
  border-top: 1px dashed var(--line);
}

.footer a { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .project { grid-template-columns: 1fr; }
  .jj-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  :root { --gutter: 16px; --nav-h: 54px; }
  body { font-size: 17px; }

  .nav__name { font-size: 17px; }
  .nav__links { gap: 0; }
  .nav__links a { padding: 6px 8px; font-size: 13px; }

  .card { grid-template-columns: 1fr; gap: 16px; }
  .card__body { padding: 0 4px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* Cover for the work-in-progress Unified Filters deck. */
.filter-cover { min-height: 240px; padding: 32px; display: flex; flex-direction: column; justify-content: center; gap: 24px; background: var(--accent-wash); }
.filter-cover > span { font: 500 32px/1.1 var(--font-serif); }
.filter-cover > div { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-cover i { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper-raised); font: normal 14px var(--font-sans); }
.filter-cover small { font: 13px var(--font-mono); color: var(--ink-soft); }

/* Doodle reveal: a brief introduction that settles into the hero. */
.hero--doodle .hero__text { animation: none; }
.hero--doodle h1 { animation: hero-doodle-rise .8s .1s ease both; }
.hero--doodle .hero__portrait img { animation: hero-doodle-rise .8s ease both; }
.hero--doodle .hero__portrait::after { animation: hero-doodle-ring 1.1s ease both; }
.hero--doodle .hero__marks path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: hero-doodle-draw 1.8s .3s ease both; }
@keyframes hero-doodle-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hero-doodle-ring { from { opacity: 0; transform: translate(-6%,4%) rotate(-25deg) scale(.9); } to { opacity: .7; transform: translate(-6%,4%) rotate(0) scale(1); } }
@keyframes hero-doodle-draw { to { stroke-dashoffset: 0; } }
@media(prefers-reduced-motion: reduce) {
  .hero--doodle h1, .hero--doodle .hero__portrait img, .hero--doodle .hero__portrait::after, .hero--doodle .hero__marks path { animation: none; }
  .hero--doodle .hero__marks path { stroke-dashoffset: 0; }
}

/* Bring Selected Work 40px closer while retaining the hero composition. */
.hero { padding-top: calc(clamp(48px, 9vw, 96px) - 20px); padding-bottom: calc(clamp(48px, 9vw, 96px) - 20px); }
@media(min-width:760px) { .hero { min-height: calc(clamp(380px, 42vw, 500px) - 40px); } }

/* About shares the full content width and sits closer to selected work. */
#about {margin-top:-80px;}
#about .about {grid-template-columns:minmax(0,1fr);}
#about .about__body,#about .about__body p {width:100%;max-width:none;}
