/* Interactive portfolio additions. The original hero keeps its own styles. */
/* scrollbar-gutter: the contact dialog locks scrolling; keep the page from shifting sideways. */
html { scroll-padding-bottom: 100px; scrollbar-gutter: stable; }
.section { padding-block: clamp(3.5rem, 7vw, 7rem); }
.section__head { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section__title { font-size: clamp(3rem, 6.5vw, 6.8rem); }
.project + .project { margin-top: clamp(4rem, 7vw, 7rem); }
.project__info { gap: 1.1rem; }
.project__desc { max-width: 38ch; }
.project__head, .studio-section, .contact { scroll-margin-top: 24px; }
.studio-kicker {
  margin-bottom: 1.1rem; color: var(--green); font-family: var(--ui);
  font-size: .8125rem; letter-spacing: .07em;
}
.ruler.ruler--editing {
  height: 118px; background: none; border: 0; overflow: hidden;
  animation: none; margin-bottom: clamp(1.75rem, 3vw, 2.75rem);
}
.ruler--editing::before, .ruler--editing::after { display: none; }
.ruler--editing canvas { display: block; width: 100%; height: 118px; }
.section__lede { max-width: 25rem; }
@media (max-width: 860px) { .section__lede { max-width: 30rem; } }
.contact { padding-block: clamp(5rem, 9vw, 9rem) clamp(4rem, 7vw, 7rem); }
.contact__title { font-size: clamp(3.5rem, 11vw, 11rem); }

.header-character {
  position: absolute; top: clamp(4.5rem, 8svh, 6rem); right: var(--gutter); z-index: 4;
  display: grid; align-items: end; width: 80px; height: 104px;
  padding: 0; border: 0; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.header-character__sprite {
  display: block; width: 80px; height: 80px;
  background: url('../gabriel-wave.png') 0 0 / 300% 200% no-repeat;
  image-rendering: pixelated;
  animation: character-wave 5.6s steps(1, end) infinite;
}
.header-character__greeting {
  position: absolute; top: 0; left: 24px; padding: 3px 8px;
  border: 1px solid #91b9a2; background: #e7efe6; color: #16271d;
  font: 600 11px/1.2 var(--ui); box-shadow: 3px 3px 0 #0b1715;
}
.header-character__greeting::after {
  content: ''; position: absolute; left: 9px; top: 100%;
  width: 5px; height: 5px; background: #e7efe6;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.header-character:hover .header-character__greeting,
.header-character:focus-visible .header-character__greeting { background: #9fe2b7; }
.hero.is-idle .header-character__sprite,
body:has(dialog[open]) .header-character__sprite { animation-play-state: paused; }
@keyframes character-wave {
  0%, 100% { background-position: 0 0; }
  44% { background-position: 50% 0; }
  50% { background-position: 100% 0; }
  56% { background-position: 0 100%; }
  62% { background-position: 50% 100%; }
  68% { background-position: 0 100%; }
  74% { background-position: 50% 100%; }
  80% { background-position: 50% 0; }
  86% { background-position: 100% 100%; }
  94% { background-position: 0 0; }
}
@media (max-width: 760px) {
  .header-character { top: 4.65rem; right: calc(var(--gutter) - 6px); width: 68px; height: 88px; }
  .header-character__sprite { width: 68px; height: 68px; }
  .header-character__greeting { left: 20px; font-size: 10px; padding: 2px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .header-character__sprite { animation: none; background-position: 0 0; }
}

.page-timeline {
  position: fixed; z-index: 35; bottom: 18px; left: 50%;
  width: min(1080px, calc(100% - 40px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 18px; padding: 9px 14px 5px;
  border: 1px solid #3a3b3e; border-radius: 4px;
  background: rgb(22 23 25 / .96); box-shadow: 0 12px 50px rgb(0 0 0 / .65);
  backdrop-filter: blur(16px);
  font-family: var(--ui);
  transition: opacity .25s ease-out, translate .25s ease-out;
}
.page-timeline[hidden] { display: none; }
.timeline-toggle {
  position: fixed; z-index: 35; right: 20px; bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 13px;
  border: 1px solid #414347; border-radius: 3px; background: #191b1ef2;
  color: var(--ink-2); font: .75rem var(--ui); cursor: pointer;
  transition: opacity .25s ease-out, translate .25s ease-out;
}
.timeline-toggle[hidden] { display: none; }
/* is-out: entering/leaving. is-ducked: out of the way while a control near the bottom is in use. */
.page-timeline.is-out, .page-timeline.is-ducked,
.timeline-toggle.is-out, .timeline-toggle.is-ducked { opacity: 0; translate: 0 12px; pointer-events: none; }
.timeline-toggle:hover { color: var(--ink); border-color: var(--green); }
.page-timeline__collapse {
  display: grid; place-items: center; width: 28px; height: 36px; flex: none;
  padding: 0; border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.page-timeline__collapse:hover { color: var(--green); }
.page-timeline__transport { display: flex; align-items: center; gap: 13px; flex: 0 0 156px; padding-bottom: 4px; }
.page-timeline__transport a {
  display: grid; place-items: center; min-width: 36px; height: 36px;
  border: 1px solid #414347; border-radius: 2px; color: var(--ink-2);
}
.page-timeline__transport a:hover { color: var(--green); background: #2c2f31; }
.page-timeline__readout { font-size: .75rem; color: var(--ink-2); }
.page-timeline__sequence { flex: 1; min-width: 0; }
.page-timeline__clips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.page-timeline__clips > a {
  position: relative; display: flex; align-items: center; min-height: 34px;
  padding: 5px 12px; text-decoration: none; font-size: .75rem; color: var(--ink-2);
  background: color-mix(in srgb, var(--track-color) 12%, #1a1b1d);
  border: 1px solid color-mix(in srgb, var(--track-color) 35%, #27282b);
  border-top: 2px solid var(--track-color); border-radius: 2px;
  transition: background-color .2s, color .2s;
}
.page-timeline__clips > a[aria-current="location"], .page-timeline__clips > a:hover {
  background: color-mix(in srgb, var(--track-color) 26%, #1a1b1d); color: var(--ink);
}
.page-timeline__scrub {
  display: block; width: 100%; height: 14px; margin: 0; cursor: ew-resize;
  appearance: none; -webkit-appearance: none; background: transparent; border-radius: 0;
}
.page-timeline__scrub::-webkit-slider-runnable-track {
  height: 2px; background: repeating-linear-gradient(90deg, #646568 0 1px, #333539 1px 10px);
}
.page-timeline__scrub::-webkit-slider-thumb {
  appearance: none; width: 9px; height: 12px; margin-top: -6px;
  border: 0; border-radius: 0; background: var(--green);
  clip-path: polygon(0 0, 100% 0, 100% 45%, 60% 70%, 60% 100%, 40% 100%, 40% 70%, 0 45%);
}
.page-timeline__scrub::-moz-range-track { height: 2px; background: #4a4c4f; }
.page-timeline__scrub::-moz-range-thumb { width: 7px; height: 12px; background: var(--green); border: 0; border-radius: 0; }
.page-timeline__preview {
  position: absolute; left: 50%; bottom: calc(100% + 16px); width: 220px;
  transform: translate(-50%, 5px); visibility: hidden; opacity: 0; pointer-events: none;
  border: 1px solid #46484c; border-radius: 3px; overflow: hidden;
  background: #17191b; box-shadow: 0 10px 35px #0009;
  transition: opacity .18s, transform .18s, visibility .18s;
}
.page-timeline__preview img { width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
.page-timeline__preview > span { display: block; padding: 9px 12px; }
.page-timeline__preview--type {
  display: grid; place-items: center; aspect-ratio: 16/9; padding: 16px;
  font: 2rem/1.05 var(--serif); color: var(--track-color);
  background: linear-gradient(145deg, #25272c, #0d0e10);
}
@media (hover: hover) {
  .page-timeline__clips > a:hover .page-timeline__preview {
    visibility: visible; opacity: 1; transform: translate(-50%, 0);
  }
}
.page-timeline__clips > a:focus-visible .page-timeline__preview {
  visibility: visible; opacity: 1; transform: translate(-50%, 0);
}
body:has(.lightbox[open]) .page-timeline, body:has(.lightbox[open]) .timeline-toggle { visibility: hidden; }
@media (max-width: 760px) {
  html { scroll-padding-bottom: 80px; }
  .page-timeline { width: calc(100% - 20px); bottom: max(10px, env(safe-area-inset-bottom)); padding: 6px; gap: 4px; }
  .page-timeline__transport { display: none; }
  /* On touch the clips are the navigation; the thin scrub is too small for a finger. */
  .page-timeline__scrub { display: none; }
  .page-timeline__clips > a { justify-content: center; padding: 6px 2px; font-size: .6875rem; min-height: 40px; }
  .page-timeline__collapse { width: 40px; height: 40px; }
  .page-timeline__preview { display: none; }
  .section__head { gap: 1.4rem; }
  .section__lede { font-size: .9375rem; max-width: 34ch; }
  .studio-kicker { margin-bottom: .8rem; }
  .project__desc { max-width: none; }
}

/* Shared faders keep the three studios feeling like one editing environment. */
.studio-section input[type="range"] {
  appearance: none; -webkit-appearance: none; height: 32px; min-width: 0;
  background: transparent; cursor: ew-resize; border: 0; border-radius: 0;
}
.studio-section input[type="range"]::-webkit-slider-runnable-track {
  height: 3px; border: 0; background: #4a504e;
}
.studio-section input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 8px; height: 16px;
  margin-top: -6.5px; border: 1px solid #e9e8e2; border-radius: 0;
  background: #c9d6cd; box-shadow: 0 0 0 3px #181b1b;
}
.studio-section input[type="range"]::-moz-range-track { height: 3px; border: 0; background: #4a504e; }
.studio-section input[type="range"]::-moz-range-thumb { width: 8px; height: 16px; border: 1px solid #e9e8e2; border-radius: 0; background: #c9d6cd; }
.studio-section input[type="range"]:disabled { opacity: .4; cursor: default; }
@media (pointer: coarse) {
  .studio-section input[type="range"] { height: 44px; }
  .studio-section input[type="range"]::-webkit-slider-thumb { width: 14px; height: 22px; margin-top: -9.5px; }
  .studio-section input[type="range"]::-moz-range-thumb { width: 14px; height: 22px; }
}
/* Landscape phones: the bar would cover a fifth of the screen. The top nav is enough there. */
@media (max-height: 500px) and (orientation: landscape) {
  .page-timeline, .timeline-toggle { display: none !important; }
  html { scroll-padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .page-timeline, .page-timeline *, .timeline-toggle { animation: none !important; transition: none !important; }
}
html:not(.js) .header-character { display: none; }
