/* ------------------------------------------------------------------ *
 * About Dyno — hero, corner menu, meta bar
 * Palette and type carried over from the previous site.
 * ------------------------------------------------------------------ */

:root {
  --ink: #15130e;
  --sand: #d2c899;
  --font-mono: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
  color: var(--sand);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--sand);
  color: var(--ink);
}

/* ------------------------------------------------------------------ *
 * Stage
 * ------------------------------------------------------------------ */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

.hero {
  position: absolute;
  inset: 0;
}

#fluid {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

body.has-fluid #fluid {
  display: block;
}

#face {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  outline: none;
  opacity: 0;
  transition: opacity 900ms ease;
}

body.is-ready #face {
  opacity: 1;
}

body.is-dragging #face {
  cursor: grabbing;
}

#face:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.32);
  outline-offset: -14px;
}

/* ------------------------------------------------------------------ *
 * Live visit counter (top-right)
 * ------------------------------------------------------------------ */

.counter {
  position: fixed;
  top: max(20px, calc(env(safe-area-inset-top, 0px) + 18px));
  right: clamp(18px, 3vw, 40px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: clamp(12px, 0.65vw, 15px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(210, 200, 153, 0.56);
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms ease;
}

body.is-ready .counter {
  opacity: 1;
  transition-delay: 700ms;
}

.counter-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sand);
  opacity: 0.82;
  animation: counter-blink 1100ms step-end infinite;
}

@keyframes counter-blink {
  0% {
    opacity: 0.82;
  }
  50% {
    opacity: 0.12;
  }
}

.counter-label {
  color: rgba(210, 200, 153, 0.56);
}

.counter-value {
  min-width: 2ch;
  color: rgba(210, 200, 153, 0.8);
  font-variant-numeric: tabular-nums;
  text-align: right;
  transition: color 450ms ease;
}

.counter.is-updated .counter-value {
  color: var(--sand);
}

/* ------------------------------------------------------------------ *
 * Bottom-left section menu
 * ------------------------------------------------------------------ */

.sections {
  position: fixed;
  left: clamp(18px, 3vw, 40px);
  bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 18px));
  z-index: 4;
  display: flex;
  align-items: baseline;
  gap: clamp(18px, 1.25vw, 30px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}

body.is-ready .sections {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 1150ms;
}

.section-link {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 2px 0;
  font: inherit;
  font-size: clamp(12px, 0.65vw, 15px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(210, 200, 153, 0.56);
  cursor: pointer;
  transition: color 170ms ease;
}

.section-link:hover,
.section-link:focus-visible {
  color: var(--sand);
}

.section-link:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.45);
  outline-offset: 4px;
}

/* ------------------------------------------------------------------ *
 * Corner panel
 * ------------------------------------------------------------------ */

.panel {
  position: fixed;
  left: clamp(18px, 3vw, 40px);
  bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 18px));
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: clamp(480px, 33vw, 780px);
  max-height: min(70vh, 800px);
  background: var(--ink);
  color: var(--sand);
  border: 1px solid rgba(210, 200, 153, 0.34);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
  transform-origin: 50% 100%;
  opacity: 0;
  transform: translate3d(0, 10px, 0);
  clip-path: inset(100% 0 0 0);
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    clip-path 440ms cubic-bezier(0.4, 0.1, 0.2, 1);
}

.panel.is-open {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  clip-path: inset(0 0 0 0);
  pointer-events: auto;
}

/* A moving top edge so the drawer's leading border stays visible while the
   clip-path reveal expands upward. It lands exactly on the real top border. */
.panel {
  --panel-edge: rgba(210, 200, 153, 0.34);
}

.panel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 1px;
  background: var(--panel-edge);
  pointer-events: none;
  transition: top 440ms cubic-bezier(0.4, 0.1, 0.2, 1);
}

.panel.is-open::after {
  top: -1px; /* land exactly on the real top border, not inside it */
}

.panel-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(16px, 0.68vw, 22px) clamp(20px, 0.95vw, 27px);
  border-bottom: 1px dotted rgba(210, 200, 153, 0.3);
}

.panel-title {
  margin: 0;
  font-size: clamp(12px, 0.68vw, 16px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.24em;
}

.panel-close {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 2px 0;
  font: inherit;
  font-size: clamp(11px, 0.56vw, 13.5px);
  line-height: 1;
  letter-spacing: 0.18em;
  color: rgba(210, 200, 153, 0.45);
  cursor: pointer;
  transition: color 160ms ease;
}

.panel-close:hover,
.panel-close:focus-visible {
  color: var(--sand);
}

.panel-close:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.45);
  outline-offset: 3px;
}

.panel-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: clamp(12px, 0.6vw, 18px) clamp(20px, 0.95vw, 27px) clamp(18px, 0.8vw, 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(210, 200, 153, 0.22) transparent;
}

.panel-body::-webkit-scrollbar {
  width: 6px;
}

.panel-body::-webkit-scrollbar-thumb {
  background: rgba(210, 200, 153, 0.22);
}

.panel-body::-webkit-scrollbar-track {
  background: transparent;
}

/* --- rows --- */

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: clamp(20px, 1vw, 28px);
  padding: clamp(12px, 0.55vw, 17px) 0;
  border-bottom: 1px dotted rgba(210, 200, 153, 0.22);
}

.row:last-child {
  border-bottom: 0;
}

.row-label {
  flex: 0 0 auto;
  font-size: clamp(11px, 0.58vw, 14px);
  font-weight: 700;
  letter-spacing: 0.16em;
  color: rgba(210, 200, 153, 0.52);
  white-space: nowrap;
}

.row-link,
.row-copy,
.row-value {
  font-size: clamp(13px, 0.7vw, 17px);
  line-height: 1.55;
  color: rgba(210, 200, 153, 0.9);
  text-align: right;
  word-break: break-all;
}

.row-link,
.row-copy {
  text-decoration: none;
  transition: color 160ms ease;
}

.row-link:hover,
.row-link:focus-visible,
.row-copy:hover,
.row-copy:focus-visible {
  color: var(--sand);
  text-decoration: underline;
  text-decoration-color: rgba(210, 200, 153, 0.45);
  text-underline-offset: 4px;
}

.row-link:focus-visible,
.row-copy:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.45);
  outline-offset: 3px;
}

.row-copy {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.row-copy.is-copied {
  color: var(--sand);
  text-decoration: none;
}

/* --- setup --- */

.sub-title {
  margin: clamp(22px, 1vw, 28px) 0 clamp(8px, 0.4vw, 12px);
  font-size: clamp(11px, 0.58vw, 14px);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: rgba(210, 200, 153, 0.52);
}

.panel-body > .sub-title:first-child {
  margin-top: 4px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(3px, 0.2vw, 5px) clamp(18px, 0.9vw, 24px);
  padding-bottom: clamp(10px, 0.55vw, 15px);
}

.app {
  overflow: hidden;
  font-size: clamp(12px, 0.62vw, 15px);
  line-height: 1.9;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(210, 200, 153, 0.66);
  text-decoration: none;
  transition: color 160ms ease;
}

.app:hover,
.app:focus-visible {
  color: var(--sand);
}

.app:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.45);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ *
 * Bottom-right meta
 * ------------------------------------------------------------------ */

.meta {
  position: fixed;
  right: clamp(18px, 3vw, 40px);
  bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 18px));
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: clamp(12px, 0.65vw, 15px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(210, 200, 153, 0.56);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}

body.is-ready .meta {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 1300ms;
}

.meta-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color 170ms ease;
}

.meta-link:hover,
.meta-link:focus-visible {
  color: var(--sand);
}

.meta-link:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.45);
  outline-offset: 4px;
}

.meta-dot {
  opacity: 0.7;
}

.meta-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.meta-name {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: default;
}

.meta-name:focus-visible {
  outline: 1px dotted rgba(210, 200, 153, 0.45);
  outline-offset: 4px;
}

.meta-name .ch {
  display: inline-block;
  transition: opacity 120ms linear;
}

.meta-name .ch.is-noise {
  opacity: 0.45;
}

.meta-name .ch.is-resolved {
  opacity: 1;
}

/* ------------------------------------------------------------------ *
 * Fallback / a11y
 * ------------------------------------------------------------------ */

.fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(48px, 12vw, 160px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--sand);
}

body.is-ready .fallback {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ *
 * Small screens: stack the menu, make the panel full-screen
 * ------------------------------------------------------------------ */

@media (max-width: 680px) {
  .sections {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    left: 18px;
    bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 16px));
  }

  .meta {
    right: 18px;
    bottom: max(18px, calc(env(safe-area-inset-bottom, 0px) + 16px));
    gap: 0.5em;
  }

  .panel {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: auto;
    max-height: none;
    border: 0;
    box-shadow: none;
    transform-origin: 50% 100%;
    transform: translate3d(0, 18px, 0);
  }

  .panel.is-open {
    transform: translate3d(0, 0, 0);
  }

  .panel-head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 16px;
    background: var(--ink);
  }

  .panel-body {
    padding: 10px 18px calc(34px + env(safe-area-inset-bottom, 0px));
  }

  .panel-title {
    font-size: 13px;
  }

  .panel-close {
    font-size: 11px;
  }

  .row {
    flex-direction: column;
    gap: 5px;
    padding: 12px 0;
  }

  .row-label {
    font-size: 11px;
  }

  .row-link,
  .row-copy,
  .row-value {
    font-size: 14px;
    text-align: left;
  }

  .sub-title {
    font-size: 11px;
  }

  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app {
    font-size: 14px;
  }

}

/* ------------------------------------------------------------------ *
 * 404 page
 * ------------------------------------------------------------------ */

/* The 404 page has no face canvas to own touch gestures, so the stage does it. */
body.error-page .hero {
  touch-action: none;
}

.error-copy {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(18px, 4vw, 48px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease;
}

body.is-ready .error-copy {
  opacity: 1;
  transition-delay: 320ms;
}

.error-code {
  margin: 0 0 clamp(10px, 1.4vh, 18px);
  padding-left: 0.18em;
  font-size: clamp(48px, 9vw, 118px);
  font-weight: 700;
  line-height: 0.86;
  letter-spacing: 0.18em;
  color: var(--sand);
}

.error-title {
  margin: 0;
  padding-left: 0.3em;
  font-size: clamp(10px, 0.62vw, 15px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(210, 200, 153, 0.62);
}

.error-nav .section-link {
  text-decoration: none;
}

.nojs-note {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--sand);
}

.nojs-note p {
  margin: 0;
}

.nojs-note a {
  color: inherit;
  text-underline-offset: 4px;
}

@media (max-height: 620px) {
  .error-code {
    font-size: clamp(38px, 7vw, 72px);
  }
}

/* ------------------------------------------------------------------ *
 * Reduced motion
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  #face,
  .counter,
  .counter-dot,
  .sections,
  .meta,
  .panel,
  .meta-name .ch,
  .panel::after {
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }

  .counter-dot {
    animation: none !important;
    opacity: 0.6;
  }
}
