  *,*::before,*::after { box-sizing: border-box; }
  body { margin: 0; }
  img { max-width: 100%; }
  [hidden] { display: none !important; }

  /* ============ TOKENS ============
     Light lilac ground, deep plum ink, 80s candy pills.
     Swap values here to retheme the whole site. */
  :root {
    --lilac:      #e7defa;   /* page ground */
    --lilac-deep: #d8cbf5;   /* header band */
    --plum:       #2e1a55;   /* ink: text, borders, hard shadows */
    --plum-soft:  #5e4a8a;   /* captions */
    --paper:      #fbf8ff;   /* frames */

    /* 80s pill colours */
    --pink:   #ff5fa2;
    --teal:   #22c7b8;
    --sun:    #ffd23f;
    --tang:   #ff8a3d;
    --volt:   #5b7cff;

    --script: "Yellowtail", "Brush Script MT", cursive;
    --display: "Fraunces", Georgia, serif;
    --body: "Karla", "Helvetica Neue", Arial, sans-serif;

    --gutter: clamp(16px, 4vw, 56px);
    --ease: cubic-bezier(.22,.8,.24,1);
    --bounce: cubic-bezier(.34,1.56,.64,1);
  }

  html { background: var(--lilac); }
  body {
    background: var(--lilac);
    color: var(--plum);
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
    min-height: 100dvh;   /* on phones 100vh ignores the address bar and forces a scroll */
    display: flex;
    flex-direction: column;
  }
  a { color: inherit; }
  :focus-visible { outline: 3px solid var(--volt); outline-offset: 3px; border-radius: 6px; }

  /* ============ HEADER ============ */
  .top {
    background: var(--lilac-deep);
    border-bottom: 2px solid var(--plum);
    padding-inline: var(--gutter);
    padding-block: 22px 24px;
    position: relative;
    overflow: hidden;
  }
  .top-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 32px;
    flex-wrap: wrap;
  }
  .name {
    margin: 0;
    font-family: var(--script);
    font-weight: 400;
    font-size: clamp(3.2rem, 7vw, 4.6rem);
    line-height: 1.1;
    padding-inline: .05em .25em;   /* room for the script's swash */
    color: var(--plum);
    text-shadow: 3px 3px 0 var(--pink);
    transform: rotate(-3deg);
    transform-origin: left center;
    /* written-in reveal */
    clip-path: inset(0 100% 0 0);
    animation: write 1.6s .2s var(--ease) forwards;
  }
  @keyframes write { to { clip-path: inset(0 -10% 0 0); } }

  .social { display: flex; gap: 12px; }
  .social:empty { display: none; }
  .social a {
    display: grid; place-items: center;
    width: 38px; height: 38px;
    border: 2px solid var(--plum); border-radius: 50%;
    background: var(--paper); color: var(--plum);
    box-shadow: 3px 3px 0 var(--c, var(--pink));
    transition: transform .2s, box-shadow .2s;
  }
  .social a:nth-child(2n) { --c: var(--teal); }
  .social a:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--c, var(--pink)); }
  .social a:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--c, var(--pink)); }
  .social svg { width: 18px; height: 18px; fill: currentColor; }

  /* ============ 80s PILLS ============ */
  .cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 10px; margin: 0 0 22px; padding: 0 var(--gutter); list-style: none; }
  .cats li:nth-child(5n+1) button { --c: var(--pink);  --r: -2deg; }
  .cats li:nth-child(5n+2) button { --c: var(--teal);  --r: 1.5deg; }
  .cats li:nth-child(5n+3) button { --c: var(--sun);   --r: -1deg; }
  .cats li:nth-child(5n+4) button { --c: var(--tang);  --r: 2deg; }
  .cats li:nth-child(5n+5) button { --c: var(--volt);  --r: -1.5deg; }
  .cats button {
    font: 800 .68rem/1 var(--body);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--plum);
    background: var(--paper);
    border: 2px solid var(--plum);
    border-radius: 999px;
    padding: 7px 13px 6px;
    cursor: pointer;
    transform: rotate(var(--r));
    box-shadow: 3px 3px 0 var(--c);
    transition: transform .35s var(--bounce), box-shadow .2s, background .2s;
  }
  .cats button:hover { transform: rotate(0) translateY(-2px); box-shadow: 4px 5px 0 var(--c); }
  .cats button:active { transform: translate(3px,3px); box-shadow: 1px 1px 0 var(--c); }
  .cats button[aria-pressed="true"] {
    background: var(--c);
    box-shadow: 3px 3px 0 var(--plum);
  }

  /* ============ CAROUSEL ============ */
  main { flex: 1; display: flex; flex-direction: column; padding-block: 18px 16px; }
  .carousel {
    margin-block: auto;   /* spare height goes evenly above and below the piece */
    /* slide width: narrow enough that the whole piece, caption and counter fit on one screen */
    --sw: min(74vw, 400px, calc((100svh - 330px) * .8));
    position: relative;
  }
  .track {
    display: flex;
    align-items: flex-start;
    gap: clamp(14px, 2.2vw, 28px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    padding-block: 6px 14px;
    padding-inline: max(0px, calc(50% - var(--sw) / 2));   /* so the first and last piece can sit centred */
    scrollbar-width: none;
    cursor: grab;
  }
  .track::-webkit-scrollbar { display: none; }
  .track.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; }
  .track.dragging * { pointer-events: none; user-select: none; }

  .slide {
    flex: 0 0 var(--sw);
    margin: 0;
    scroll-snap-align: center;
    transition: opacity .5s var(--ease), transform .5s var(--ease);
    opacity: .6;
    transform: scale(.96);
  }
  .slide.is-active { opacity: 1; transform: scale(1); }
  .frame {
    height: calc(var(--sw) * 1.25);   /* 4:5, fixed so a tall image can't stretch the row */
    border-radius: 18px;
    overflow: hidden;
    background: var(--paper);
    border: 2px solid var(--plum);
    box-shadow: 6px 6px 0 var(--plum);
  }
  .frame img, .frame svg { width: 100%; height: 100%; object-fit: cover; display: block; }
  .slide figcaption { display: flex; flex-direction: column; gap: 2px; padding: 12px 4px 0; }
  .slide .t { font-family: var(--display); font-size: 1.15rem; font-style: italic; line-height: 1.25; }
  .slide .k { font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--plum-soft); white-space: nowrap; }

  .nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 10px; }
  .nav .arrow:disabled { visibility: hidden; }
  .arrow {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 2px solid var(--plum);
    background: var(--paper);
    color: var(--plum);
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--teal);
    transition: transform .2s, box-shadow .2s;
  }
  .arrow:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--teal); }
  .arrow:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--teal); }
  .arrow:disabled { opacity: .35; cursor: default; transform: none; box-shadow: none; }

  .count { margin: 0; min-width: 8ch; text-align: center; font-size: .75rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--plum-soft); font-variant-numeric: tabular-nums; }

  footer {
    padding-inline: var(--gutter);
    padding-block: 16px 18px;
    border-top: 2px solid var(--plum);
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
    font-size: .8rem; color: var(--plum-soft);
  }

  .slide.is-active .frame { cursor: zoom-in; }

  /* ============ LIGHTBOX ============ */
  .lightbox {
    width: min(1100px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 2px solid var(--plum);
    border-radius: 18px;
    background: var(--paper);
    color: var(--plum);
    box-shadow: 8px 8px 0 var(--pink);
    overflow: auto;
  }
  .lightbox::backdrop { background: rgb(46 26 85 / .55); }
  .lightbox[open] { animation: pop .35s var(--bounce); }
  @keyframes pop { from { transform: scale(.94); opacity: 0; } }
  .lb-close { position: absolute; top: 12px; right: 12px; z-index: 1; }
  .lb-body { display: grid; gap: 20px; padding: 20px; }
  .lb-media { background: var(--lilac); border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
  .lb-media img { width: 100%; max-height: 70dvh; object-fit: contain; display: block; }
  .lb-media svg { width: 100%; max-height: 70dvh; display: block; }
  .lb-info .k { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--plum-soft); }
  .lb-title { margin: 4px 0 12px; font-family: var(--display); font-style: italic; font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.15; padding-right: 48px; }
  .lb-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 12px; font-size: .9rem; }
  .lb-meta dt { font-weight: 800; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--plum-soft); padding-top: 3px; }
  .lb-meta dd { margin: 0; }
  .lb-desc { margin: 0 0 16px; max-width: 60ch; }

  /* ============ ABOUT ============ */
  .about-link {
    font: 800 .72rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase;
    color: var(--plum); background: var(--paper);
    border: 2px solid var(--plum); border-radius: 999px; padding: 8px 14px 7px;
    box-shadow: 3px 3px 0 var(--sun); cursor: pointer;
    transition: transform .2s, box-shadow .2s;
  }
  .about-link:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--sun); }
  .about-link:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--sun); }
  .lightbox.about { width: min(640px, calc(100vw - 32px)); box-shadow: 8px 8px 0 var(--teal); }
  .about-body { padding: 28px clamp(20px, 5vw, 40px) 32px; }
  .about-body .k { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--plum-soft); }
  .about-body p:not(.k) { margin: 0 0 14px; max-width: 60ch; line-height: 1.6; }
  .about-body .about-sign {
    margin: 22px 0 0; font-family: var(--display); font-style: italic;
    font-size: 1.25rem; line-height: 1.4; color: var(--plum);
  }
  .lb-desc:empty, .lb-links:empty, .lb-meta:empty { display: none; }
  .lb-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
  .lb-links a {
    font-weight: 800; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
    border: 2px solid var(--plum); border-radius: 999px; padding: 9px 16px 8px;
    background: var(--sun); box-shadow: 3px 3px 0 var(--plum);
    transition: transform .2s, box-shadow .2s;
  }
  .lb-links a:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--plum); }
  /* phones: tighter bands so header, piece, arrows and footer share one screen */
  /* ============ VISIT COUNTER ============ */
  footer { display: grid; grid-template-columns: 1fr auto 1fr; }
  footer .social { justify-self: end; }
  .visits { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--plum-soft); }
  .visits-n { display: flex; gap: 2px; }
  footer > span { white-space: nowrap; }
  @media (max-width: 600px) { .visits-l { display: none; } }   /* the digits speak for themselves */
  .visits .digit {
    display: inline-grid; place-items: center; width: 15px; height: 21px;
    font: 800 .8rem/1 var(--body); letter-spacing: 0; color: var(--paper);
    background: var(--plum); border-radius: 3px; box-shadow: 1px 1px 0 var(--pink);
    font-variant-numeric: tabular-nums;
  }

  /* ============ HEADER LINKS ============ */
  .name a { color: inherit; text-decoration: none; }
  .top-links { display: flex; align-items: center; gap: 10px; }
  .about-link, .lang-link { display: inline-block; text-decoration: none; }
  .lang-link {
    font: 800 .72rem/1 var(--body); letter-spacing: .14em;
    color: var(--plum); background: var(--paper);
    border: 2px solid var(--plum); border-radius: 999px; padding: 8px 10px 7px;
    box-shadow: 3px 3px 0 var(--teal);
    transition: transform .2s, box-shadow .2s;
  }
  .lang-link:hover { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--teal); }

  /* ============ PLAIN LIST OF WORKS ============
     Always in the HTML (search engines, no-JS visitors); the carousel
     replaces it once the script runs. */
  html:not(.js) #cats, html:not(.js) .carousel { display: none; }
  .js .works-index { display: none; }
  .works-index { padding-inline: var(--gutter); }
  .works-index h2 { font: italic 400 1.6rem/1.2 var(--display); margin: 0 0 16px; }
  .works-index ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px 18px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .works-index a { display: block; color: inherit; text-decoration: none; }
  .wi-frame {
    display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 14px;
    border: 2px solid var(--plum); box-shadow: 4px 4px 0 var(--plum); background: var(--paper);
  }
  .wi-frame img, .wi-frame svg { width: 100%; height: 100%; object-fit: cover; display: block; }
  .works-index .t { display: block; margin-top: 10px; font-family: var(--display); font-style: italic; font-size: 1.05rem; line-height: 1.25; }
  .works-index .k { display: block; font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--plum-soft); }

  /* ============ WORK & ABOUT PAGES ============ */
  .page main { padding: 24px var(--gutter) 32px; }
  .work, .about-page {
    margin: 0 auto; background: var(--paper);
    border: 2px solid var(--plum); border-radius: 18px; box-shadow: 8px 8px 0 var(--pink);
  }
  .work { max-width: 1100px; }
  .about-page { max-width: 680px; box-shadow: 8px 8px 0 var(--teal); }
  .work .lb-title, .about-page .lb-title { padding-right: 0; }
  .work-nav { display: flex; justify-content: center; align-items: center; gap: 20px; padding: 0 20px 22px; }
  a.arrow { display: grid; place-items: center; text-decoration: none; }
  .work-nav .all, .about-page .lb-links a {
    font-weight: 800; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; text-decoration: none; color: var(--plum);
    border: 2px solid var(--plum); border-radius: 999px; padding: 9px 16px 8px; background: var(--paper); box-shadow: 3px 3px 0 var(--sun);
  }

  @media (max-width: 600px) {
    .top { padding-block: 10px 12px; }
    .name { font-size: 2.5rem; }
    .top-row { flex-wrap: nowrap; gap: 10px; }   /* name and links stay on one line */
    .top-links { gap: 6px; flex-shrink: 0; }
    .about-link, .lang-link { padding: 7px 9px 6px; font-size: .64rem; }
    main { padding-block: 14px 12px; }
    .cats { margin-bottom: 12px; gap: 10px 8px; }
    footer { padding-block: 10px 12px; row-gap: 4px; }
  }
  .lb-nav { display: flex; justify-content: center; gap: 20px; padding: 0 20px 20px; }
  @media (min-width: 900px) {
    .lb-body { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: center; padding: 28px; }
    .lb-media img, .lb-media svg { max-height: 78dvh; }
  }

  /* desktop: slim header and footer so the piece gets the height; neighbours
     step back so the centred piece reads as the main one */
  @media (min-width: 900px) {
    .carousel { --sw: min(40vw, 640px, calc((100svh - 240px) * .8)); }
    .top { padding-block: 8px 10px; }
    .name { font-size: 2.9rem; }
    main { padding-block: 12px 10px; }
    .cats { margin-bottom: 12px; }
    footer { padding-block: 8px 10px; }
    .social a { width: 32px; height: 32px; }
    .social svg { width: 15px; height: 15px; }
    .slide { transform: scale(.82); }
  }

  @media (max-width: 350px) {   /* the smallest phones */
    .name { font-size: 2.05rem; }
    .about-link, .lang-link { padding: 6px 7px 5px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .track { scroll-behavior: auto; }
    .slide, .cats button { transition: none; }
    .name { animation: none; clip-path: none; }
    .lightbox[open] { animation: none; }
  }
