/* Fonts (self-hosted, see .eleventy.js passthrough) */
@font-face {
  font-family: "Coiny";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/coiny-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Coiny";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/coiny-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/quicksand-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Quicksand";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/fonts/quicksand-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Design tokens
   Contrast against --bg: --text 11.6:1, --accent-text 4.8:1.
   --accent-deco and --highlight are decorative only — never use them for text. */
:root {
  --bg: #F6EBD8;
  --text: #3B2A1E;
  --accent-text: #8C5E00;
  --accent-deco: #D4A017;
  --highlight: #EDD77A;
  --max-width: 36rem;
}

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

html {
  min-width: 360px;
  background-color: var(--bg);
  color: var(--text);
}

body {
  margin: 0;
  font-family: "Quicksand", system-ui, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

::selection {
  background-color: var(--highlight);
  color: var(--text);
}

:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

.container {
  max-width: calc(var(--max-width) + 2rem);
  margin-inline: auto;
  padding-inline: 1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Typography */
h1, h2, h3 {
  font-family: "Coiny", cursive;
  font-weight: 400;
  color: var(--accent-text);
  margin: 0;
  line-height: 1.2;
}

h1 { font-size: 1.75rem; margin-bottom: 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h3 { font-size: 1rem; margin-bottom: 0.25rem; }

p { margin: 0; }

small, .small { font-size: 0.875rem; font-weight: 400; }

.muted { color: var(--text); opacity: 0.75; }

.lead { font-size: 1.125rem; margin-bottom: 0.5rem; }

.intro { margin-bottom: 1.5rem; }

/* Layout helpers */
.stack > * + * { margin-top: 1rem; }

.fieldlist > p + p { margin-top: 0.25rem; }

ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}

ul > li + li { margin-top: 0.25rem; }

/* Links */
.site-link {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.site-link[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--accent-deco);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.3em;
}

/* Header / navigation */
.site-header {
  margin-top: 2rem;
  margin-bottom: 1.5rem;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.25rem;
}

nav a {
  padding: 0.25rem 0.5rem;
}

.logo-link img {
  width: 4rem;
  height: auto;
  display: block;
  border-radius: 50%;
}

/* Home hero */
.hero {
  text-align: center;
}

/* Bule Made Scene — layout
   All sizes are relative to the scene width (cqw) so proportions hold at any viewport. */
.bule-made-scene {
  container-type: inline-size;
  display: grid;
  grid-template: auto auto / 30% 40% 30%;
  margin-bottom: 1.5rem;
}

/* <picture> wrappers from the image pipeline shouldn't create boxes inside the scene */
.bule-made-scene picture {
  display: contents;
}

.bule-made-scene img {
  display: block;
}

.window,
.contact-poster {
  grid-row: 1;
  z-index: 0;
}

.window {
  grid-column: 1;
  width: 100%;
  height: auto;
}

.contact-poster {
  grid-column: 3;
  position: relative;
}

.contact-poster img {
  width: 100%;
  height: auto;
}

.bule-cartoon {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  position: relative;
  height: 66cqw;
  z-index: 1;
  /* The link spans the column; only the visible pose should be clickable. */
  pointer-events: none;
}

.bule-cartoon .pose {
  position: absolute;
  bottom: 0;
  left: 50%;
  height: 100%;
  width: auto;
  max-width: none;
  transform: translateX(-50%);
  visibility: hidden;
  pointer-events: auto;
}

.bule-cartoon .pose-idle { visibility: visible; }

.bule-cartoon .pose-embroidery { left: auto; right: 0; transform: none; }
.bule-cartoon .pose-linocut { left: 0; transform: none; }
.bule-cartoon .pose-laptop { transform: translate(-50%, 10%); }

.table {
  grid-column: 1 / span 3;
  grid-row: 2;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 5% 30% 30% 30% 5%;
  align-items: center;
}

.table .table-top {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.on-table {
  position: relative;
  justify-self: center;
  width: 80%;
  display: grid;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.1s ease-in-out;
}

.on-table .item {
  grid-area: 1 / 1;
  width: 100%;
  height: auto;
}

.on-table .spot {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: auto;
  transform: translateY(-50%);
  visibility: hidden;
}

.embroidery { grid-column: 2; }
.laptop { grid-column: 3; }
.linocut { grid-column: 4; }

/* Labels: hidden on hover-capable devices (still read by screen readers),
   shown on touch devices so visitors know the objects are tappable. */
.scene-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (hover: none) {
  .scene-label {
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    padding: 0.1rem 0.6rem;
    border-radius: 1rem;
    background: var(--bg);
    border: 2px solid var(--text);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
    pointer-events: auto;
    z-index: 3;
  }

  .bule-cartoon .scene-label,
  .contact-poster .scene-label {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
  }

  .on-table .scene-label {
    position: static;
    grid-row: 2;
    justify-self: center;
    margin-top: 0.25rem;
  }
}

/* Bule Made Scene — reactions */
@keyframes bounce {
  25% { transform: translateY(5%) scaleY(0.9) scaleX(1.1); }
  50% { transform: translateY(-5%) scaleY(1.1) scaleX(0.9); }
  75% { transform: scale(100%); }
}

.bule-cartoon:is(:hover, :focus-visible),
.bule-made-scene:has(.on-table:is(:hover, :focus-visible)) .bule-cartoon {
  animation: 0.2s linear bounce;
}

/* Hovering Bule: waving "about" pose */
.bule-cartoon:is(:hover, :focus-visible) .pose-idle { visibility: hidden; }
.bule-cartoon:is(:hover, :focus-visible) .pose-about { visibility: visible; }

/* Hovering an object on the table: matching pose + highlighted object */
.bule-made-scene:has(.on-table:is(:hover, :focus-visible)) .pose-idle { visibility: hidden; }
.bule-made-scene:has(.embroidery:is(:hover, :focus-visible)) .pose-embroidery { visibility: visible; }
.bule-made-scene:has(.laptop:is(:hover, :focus-visible)) .pose-laptop { visibility: visible; }
.bule-made-scene:has(.linocut:is(:hover, :focus-visible)) .pose-linocut { visibility: visible; }

.on-table:is(:hover, :focus-visible) {
  transform: scale(1.3);
}
.on-table:is(:hover, :focus-visible) .item { visibility: hidden; }
.on-table:is(:hover, :focus-visible) .spot { visibility: visible; }

/* TODO add bule pointing to Contact */
/* TODO add bule interacting with Window */

/* Gallery carousel
   Native scroll-snap row (works without JS, swipeable); gallery.js adds arrows,
   keyboard, status and syncing. Slides share one fixed frame height so mixed
   portrait/landscape images don't make the page jump. */
.carousel {
  --slide-height: min(65vh, 28rem);
  margin-bottom: 1.5rem;
}

.carousel-viewport {
  position: relative;
  container-type: inline-size;
}

.carousel-track {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  border-radius: 0.5rem;
}

/* With JS the arrows and thumbnails take over, so the scrollbar can go */
.carousel--js .carousel-track { scrollbar-width: none; }
.carousel--js .carousel-track::-webkit-scrollbar { display: none; }

.carousel-track > li + li { margin-top: 0; }

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.carousel-slide figure {
  margin: 0;
  text-align: center;
}

.carousel-slide .gallery-link {
  display: block;
  border-radius: 0.5rem;
}

.carousel picture { display: contents; }

.carousel-slide img {
  display: block;
  width: 100%;
  height: var(--slide-height);
  object-fit: contain;
}

.carousel-slide figcaption {
  margin-top: 0.75rem;
  padding-inline: 3rem;
}

.carousel-title {
  display: block;
  font-weight: 700;
}

.carousel-description {
  display: block;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.carousel-btn {
  position: absolute;
  top: calc(var(--slide-height) / 2);
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font: 700 1.5rem/1 "Quicksand", system-ui, sans-serif;
  cursor: pointer;
}

.carousel-btn:hover { background: var(--highlight); }
.carousel-btn[hidden] { display: none; }
.carousel-prev { left: 0.25rem; }
.carousel-next { right: 0.25rem; }

.carousel-status {
  text-align: center;
  margin-top: 0.5rem;
}

.carousel-thumbs {
  display: flex;
  justify-content: safe center;
  gap: 0.5rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0.375rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.carousel-thumbs > li { flex: 0 0 auto; }
.carousel-thumbs > li + li { margin-top: 0; }

.carousel-thumb {
  display: block;
  border: 3px solid transparent;
  border-radius: 0.5rem;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.carousel-thumb:hover { opacity: 1; }

/* Current thumbnail: full opacity plus a solid frame, not colour alone */
.carousel-thumb[aria-current="true"] {
  opacity: 1;
  border-color: var(--text);
}

.carousel-thumb img {
  display: block;
  height: 3.5rem;
  width: auto;
  max-width: 6rem;
  object-fit: contain;
  border-radius: 0.25rem;
}

/* Round variant (embroidery): square crop around the centre, framed like a hoop */
.carousel--round .carousel-slide .gallery-link {
  width: min(100cqw, var(--slide-height));
  margin-inline: auto;
  border-radius: 50%;
}

.carousel--round .carousel-slide img {
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  border: 5px solid var(--accent-deco);
}

.carousel--round .carousel-btn {
  top: calc(min(100cqw, var(--slide-height)) / 2);
}

.carousel--round .carousel-thumb { border-radius: 50%; }

.carousel--round .carousel-thumb img {
  width: 3.5rem;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--accent-deco);
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track { scroll-behavior: auto; }
  .carousel-thumb { transition: none; }
}

/* Lightbox */
.lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  overflow: visible;
}

.lightbox::backdrop {
  background: rgb(59 42 30 / 0.88);
}

.lightbox figure {
  margin: 0;
  text-align: center;
}

.lightbox img {
  display: block;
  max-width: 92vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  margin-inline: auto;
  border-radius: 0.5rem;
}

.lightbox figcaption {
  margin-top: 0.75rem;
  color: var(--bg);
}

.lightbox-btn {
  position: fixed;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font: 700 1.5rem/1 "Quicksand", system-ui, sans-serif;
  cursor: pointer;
}

.lightbox-btn:hover { background: var(--highlight); }

.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-close { right: 1rem; top: 1rem; }

/* Digital section tab bar (links between pages, current one marked with aria-current) */
.tabs {
  display: block;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--text);
}

.tabs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tabs li + li { margin-top: 0; }

.tab-link {
  display: block;
  padding: 0.5rem 0.25rem;
  margin-bottom: -2px;
  border-bottom: 4px solid transparent;
  color: var(--text);
  text-decoration: none;
}

.tab-link:hover {
  color: var(--accent-text);
  border-bottom-color: var(--highlight);
}

/* Current tab: thick bar plus bold weight, not colour alone */
.tab-link[aria-current="page"] {
  font-weight: 700;
  color: var(--accent-text);
  border-bottom-color: var(--accent-deco);
}

/* Web / Apps projects */
.projects {
  list-style: none;
  padding: 0;
  margin: 0;
}

.projects > li + li { margin-top: 1.5rem; }

.project {
  padding: 1.25rem;
  border: 2px solid var(--text);
  border-radius: 1rem;
}

.project img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.project h2 .site-link { color: var(--accent-text); }

.tags {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tags > li + li { margin-top: 0; }

.tags li {
  padding: 0.1rem 0.6rem;
  border-radius: 1rem;
  background: var(--highlight);
  font-size: 0.8rem;
}

/* About */
.about-photo {
  display: block;
  width: 100%;
  max-width: 20rem;
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 1rem;
}

@media (min-width: 37rem) {
  .about {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  .about-photo {
    margin: 0;
  }
}

/* Contact — social list */
.social {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
}

.social li + li { margin-top: 0.5rem; }

.social a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  margin-bottom: 4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
}

@media (min-width: 48rem) {
  .site-footer {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }
}

/* Reduced motion: keep pose/highlight changes, drop movement */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .on-table:is(:hover, :focus-visible) {
    transform: none;
  }
}
