@font-face {
  font-family: "Untitled Sans";
  src: url("fonts/UntitledSans-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Untitled Sans";
  src: url("fonts/UntitledSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Untitled Sans";
  src: url("fonts/UntitledSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Untitled Sans";
  src: url("fonts/UntitledSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg:      #F6F3F3;
  --ink:     #332B2B;
  --mute-md: #776969;
  --mute-lt: #D0C8C8;
  --accent:  #FF8888;
  --pop:     #DB4343;
  --line: rgba(27, 26, 23, 0.14);
  --line-soft: rgba(27, 26, 23, 0.08);
  --surface: #ffffff;
  /* matches the Google Font family name loaded in index.html's <head> */
  --font-serif: "Crimson Pro", Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-sans: "Untitled Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-outer: 20px;
  --radius-inner: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  transition: top 150ms ease;
  z-index: 100;
}
.skip-link:focus { top: 1rem; }

a:link, a:visited { color: var(--pop); transition: all 200ms;}
a:hover, a:active { color: var(--ink); text-decoration: none; background: var(--mute-lt); padding: 3px; margin: -3px; }

h1, h2, h3 {
  font-family: var(--font-serif); 
  font-weight: 400; 
  line-height: 0.9; 
  letter-spacing: -2%;
  margin-block: 1.5rem; 
  text-wrap: balance; 
}
p, blockquote { text-wrap: pretty; }
h1 {
  font-size: clamp(2.5rem, 5vw, 4.2rem);
}
  .xxl {
    font-size: clamp(3.5rem, 7vw, 5.2rem);
  }
  .yowza { 
    font-size: clamp(2.5rem, 5vw, 4.2rem); 
    font-family: var(--font-serif);
    margin: 0;
    line-height: 1;
    display: inline-block;
    color: var(--mute-ink);
  }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); }
p { 
  color: var(--ink); 
  font-size: 1.25rem;
}
.list li { 
  color: var(--ink); 
  font-size: 1.25rem;
  margin-block: 12px;
}
.lede { 
  font-size: 1.25rem; 
  color: var(--ink); 
  max-width: 44ch; 
}
  .small {
    font-size: 0.875rem;
    line-height: 1;
    margin: 0;
  }
  .caps {
    font-variant: small-caps;
    font-weight: 500;
  }
  .text-right {
    text-align: right;
  }
.mute-lt {
  color: var(--mute-lt);
}
.mute-md {
  color: var(--mute-md);
}
.accent {
  color: var(--accent);
}
.pop {
  color: var(--pop);
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.sans { font-family: var(--font-sans); }
.larger  { font-size: 1.5rem; line-height: 1.3; }
.smaller { font-size: 1rem; }

.pattern {
  background-image: url("assets/halftone-pattern.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hilite span {
  background: linear-gradient(0deg, #f882 0%, #f885 32%, #f881 100%);
  padding: 0 2px;
  margin: 0 -2px;
  /* white-space: nowrap; */
  border-radius: 6px;
}

.brow {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1%;
  text-transform: uppercase;
  color: var(--ink);
  margin-block: 5px;
}
.eyebrow {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--mute-lt);
}
.lowbrow {
  padding-top: 4px;
  border-top: 1px solid var(--mute-lt);
}
.spacer-top {
  margin-top: 24px;
}
.spacer-bottom {
  margin-bottom: 24px;
}

blockquote {
  margin: 1.5rem 0.25rem;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--ink);
}

/* Slides */

main { display: block; }

html {
  scroll-snap-type: y mandatory;
}

.slide {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 4rem clamp(1.5rem, 6vw, 4rem);
  padding-top: 2.5rem;
  position: relative;
  scroll-snap-align: start;
}

.slide-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.slide[data-layout="text"] .slide-inner { max-width: 720px; }

.slide[data-layout="split"] .slide-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.slide[data-layout="split-12"] .slide-inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.grid-start {
  align-items: start !important;
}

.slide[data-layout="visual"] .slide-inner { max-width: 1200px; }

/* .slide[data-layout="split-header"] .slide-inner { text-align: center; } */
.slide[data-layout="split-header"] .eyebrow { margin-bottom: clamp(2rem, 5vw, 3rem); }
.slide[data-layout="split-header"] .split-header-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  text-align: left;
}
.slide[data-layout="split-header-uneven"] .slide-inner { text-align: center; }
.slide[data-layout="split-header-uneven"] .eyebrow { margin-bottom: clamp(2rem, 5vw, 3rem); }
.slide[data-layout="split-header-uneven"] .split-header-cols {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  text-align: left;
}

@media (max-width: 760px) {
  .slide[data-layout="split"] .slide-inner,
  .slide[data-layout="split-header"] .split-header-cols {
    grid-template-columns: 1fr;
  }
  .slide { padding: 5rem 1.5rem; }
}

.placeholder-visual {
  aspect-ratio: 5 / 4;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  border-radius: var(--radius-inner);
  background: none;
  outline: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  color: var(--mute-md);
  font-size: 0.95rem;
  text-align: center;
}
.placeholder-visual:has(img) { align-items: flex-start; }

.placeholder-visual--full { aspect-ratio: 16 / 7; }

/* Gallery */

.gallery-viewport { 
  position: relative;
  aspect-ratio: 5 / 4;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  border-radius: var(--radius-inner);
}
  .ratio-32 {
    aspect-ratio: 3 / 2;
  }
  .ratio-54 {
    aspect-ratio: 5 / 4;
  }
  .ratio-169 {
    aspect-ratio: 16 / 9;
  }

  
  .gallery-viewport img {
    width: 100%;
    height: auto;
    display: block;
    outline: 1px solid rgba(0, 0, 0, 0.1);
    outline-offset: -1px;
    border-radius: var(--radius-inner);
  }
  .no-ol > .gallery-viewport img,
  .no-ol {
    outline: none !important;
  }
  
.gallery-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.gallery-label {
  text-align: left;
}

.gallery-nav-group {
  display: flex;
  justify-self: end;
  gap: 0.5rem;
}

.gallery-nav {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(27, 26, 23, 0.08), 0 6px 16px rgba(27, 26, 23, 0.1);
  cursor: pointer;
  transition-property: scale, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.gallery-nav:hover { box-shadow: 0 2px 4px rgba(27, 26, 23, 0.1), 0 10px 24px rgba(27, 26, 23, 0.14); }
.gallery-nav:active { scale: 0.96; }

.gallery-dots {
  display: flex;
  align-items: center;
  justify-self: start;
  gap: 0.5rem;
}
.gallery-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: none;
  padding: 0;
  background: var(--line);
  cursor: pointer;
  transition: background 150ms, scale 150ms;
}
.gallery-dot::before {
  content: "";
  position: absolute;
  inset: -16px;
}
.gallery-dot.active { background: var(--accent); scale: 1.25; }

.embed-frame {
  border-radius: var(--radius-inner);
  outline: 1px solid var(--line-soft);
  box-shadow: 0 1px 2px rgba(27, 26, 23, 0.06), 0 12px 32px rgba(27, 26, 23, 0.08);
  overflow: hidden;
  aspect-ratio: 4 / 2.3;
}
.embed-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* Side quests */

.sidequest-trigger {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(27, 26, 23, 0.08), 0 6px 16px rgba(27, 26, 23, 0.1);
  cursor: pointer;
  transition-property: scale, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.sidequest-trigger:hover { box-shadow: 0 2px 4px rgba(27, 26, 23, 0.1), 0 10px 24px rgba(27, 26, 23, 0.14); }
.sidequest-trigger:active { scale: 0.96; }

.sidequest-trigger--text {
  all: unset;
  cursor: pointer;
  color: var(--pop);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sidequest-trigger--text:hover { color: var(--ink); }
.sidequest-trigger--text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

dialog {
  border: none;
  border-radius: var(--radius-outer);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  max-width: 520px;
  width: calc(100% - 3rem);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 8px rgba(27, 26, 23, 0.08), 0 24px 64px rgba(27, 26, 23, 0.2);
  position: relative;
}
dialog.dialog--large { max-width: 800px; }
dialog::backdrop { background: rgba(27, 26, 23, 0.35); backdrop-filter: blur(2px); }
dialog h3 { font-size: 1.5rem; margin-bottom: 0.75rem; }
dialog p { color: var(--mute-md); margin: 0; }
dialog p + p { margin-block: 1.5rem; }
dialog img,
dialog .placeholder-visual {
  display: block;
  width: 100%;
  outline: 1px solid var(--line-soft);
  margin: 1.5rem 0;
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--mute-md);
  cursor: pointer;
  transition-property: background, scale;
  transition-duration: 120ms;
}
.dialog-close:hover { background: var(--line-soft); }
.dialog-close:active { scale: 0.96; }

/* Minimap */

.minimap {
  position: fixed;
  left: clamp(1rem, 3vw, 2.5rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
}
.minimap ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.minimap a {
  display: flex;
  flex-direction: row-reverse; /* markup is label-then-dot; show dot first */
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--mute-md);
  background: none;;
  padding: 0.35rem 0.25rem;
  margin: unset;
}
.minimap .dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--mute-lt);
  flex-shrink: 0;
  transition: background 200ms, border-color 200ms, scale 200ms;
}
.minimap a.visited .dot { background: var(--line); border-color: var(--line); }
.minimap a.active .dot { background: var(--accent); border-color: var(--accent); scale: 1.25; }
.minimap .label {
  font-size: 0.875rem;
  color: var(--ink);
  white-space: nowrap;
  text-align: left;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 150ms, transform 150ms;
  background: var(--bg);
  padding: 2px 8px 2px 8px;
  border-radius: 999px;
}
.minimap a:hover .label,
.minimap a:focus-visible .label {
  opacity: 1;
  transform: translateX(0);
}
.minimap a.active { color: var(--ink); font-weight: 500; }

@media (max-width: 760px) {
  .minimap .label { display: none; }
  .minimap { left: 0.75rem; }
}


.globo {
  border: 8px solid transparent;
  border-radius: 16px;
  background:
    linear-gradient(var(--card-bg, #F1EEEE), var(--card-bg, #F1EEEE)) padding-box,
    conic-gradient(from var(--a), #fff, #f88, #fff) border-box;
  animation: rotate 3s linear infinite;
}
@keyframes rotate { to { --a: 360deg; } }
@property --a {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.zen {
  background: linear-gradient(120deg, hsla(0, 14%, 88%, 0.5), hsla(20, 88%, 88%, 0.5), hsla(106, 85%, 88%, 0.5)), var(--bg);
  background-size: 400% 400%;
  animation: gradientShift 30s ease infinite;
  z-index: 0; /* own stacking context keeps the welcome collage's z-index values inside the slide */
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.zen.pattern {
  background-image: url("assets/halftone-pattern.svg"),
    linear-gradient(120deg, hsla(0, 14%, 88%, 1), hsla(20, 88%, 88%, 1), hsla(106, 85%, 88%, 1));
  background-size: cover, 400% 400%;
  background-position: center, 0% 50%;
  background-repeat: no-repeat;
  animation: zenPatternShift 30s ease infinite;
}

@keyframes zenPatternShift {
  0%   { background-position: center, 0% 50%; }
  50%  { background-position: center, 100% 50%; }
  100% { background-position: center, 0% 50%; }
}

/* Welcome collage. Press E to toggle edit mode (see script.js). */

.collage { position: absolute; inset: 0; pointer-events: none; }
.collage img {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: auto;
  transform: translate(-50%, -50%) rotate(calc(var(--r) * 1deg));
  z-index: var(--z);
  user-select: none;
  -webkit-user-drag: none;
}
#welcome .slide-inner { z-index: 10; }

/* Entrance: images fade, unblur, and rise into place in DOM order.
   Uses `translate` (not `transform`) so it doesn't clobber the rotation.
   script.js adds .collage-out once the slide is off screen: images hide and the animation
   resets, so removing the class on return replays it from hidden. */
@media (prefers-reduced-motion: no-preference) {
  .collage img { animation: collage-in 700ms cubic-bezier(0.22, 1, 0.36, 1) backwards; }
  .collage-out .collage img { animation: none; visibility: hidden; }
  .collage img:nth-child(1) { animation-delay: 200ms; }
  .collage img:nth-child(2) { animation-delay: 320ms; }
  .collage img:nth-child(3) { animation-delay: 440ms; }
  .collage img:nth-child(4) { animation-delay: 560ms; }
  .collage img:nth-child(5) { animation-delay: 680ms; }
  .collage img:nth-child(6) { animation-delay: 800ms; }
}
@keyframes collage-in {
  from { opacity: 0; filter: blur(8px); translate: 0 24px; }
}

.collage-edit .collage img { pointer-events: auto; cursor: grab; }
.collage-edit .collage img:active { cursor: grabbing; }
.collage-edit .collage img:hover { outline: 1px dashed var(--ink); }
.collage-edit .collage img.selected { outline: 2px solid var(--accent); }
.collage-edit #welcome .slide-inner { pointer-events: none; }

.collage-toolbar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  translate: -50% 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: max-content;
  max-width: calc(100vw - 2rem);
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--mute-lt);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink);
}
.collage-toolbar > * { white-space: nowrap; }
.collage-toolbar[hidden] { display: none; }
.collage-toolbar button { font: inherit; cursor: pointer; }
