/* chika.webcam — Swiss observatory in earth-tones */

:root {
  --cream: #f1ead8;
  --peat: #1f1a14;
  --terracotta: #b8543a;
  --umber: #6e4f2e;
  --tobacco: #8a6d4a;
  --kelp: #3e5142;
  --bronze: #5a4a32;
  --hair-base: #3a2e22;
  --peat-hair: rgba(58, 46, 34, 0.24);
}

/* Bubble drift base keyframes (per-bubble variants injected at runtime) */
@keyframes drift {
  0%   { transform: translate3d(0, 0, 0); }
  25%  { transform: translate3d(8px, -6px, 0); }
  50%  { transform: translate3d(-4px, 10px, 0); }
  75%  { transform: translate3d(-9px, 3px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}
@keyframes ripple-fade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  display: grid;
  grid-template-columns: minmax(320px, 25vw) 1fr;
  background: var(--cream);
  color: var(--peat);
  font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===================== SIDEBAR ===================== */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 64px 32px 32px 48px;
  background: var(--cream);
  border-right: 1px solid var(--peat-hair);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wordmark {
  font-family: 'Big Shoulders Display', 'Helvetica Neue', sans-serif;
  font-weight: 800;
  font-size: 5.5rem;
  line-height: 0.86;
  letter-spacing: -0.025em;
  color: var(--peat);
  text-transform: lowercase;
  margin-top: 32px;
  word-break: break-word;
}

.hairline {
  height: 1px;
  background: var(--peat-hair);
  margin: 24px 0;
}

.datestamp {
  font-family: 'Inter', monospace;
  font-feature-settings: "tnum";
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--umber);
}

.block-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--tobacco);
  margin-bottom: 16px;
}

/* Stream index */
.stream-index ol {
  list-style: none;
  counter-reset: stream;
}

.stream-index li {
  counter-increment: stream;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  letter-spacing: -0.005em;
  font-weight: 500;
  color: var(--umber);
  cursor: pointer;
  transition: color 240ms ease;
}

.stream-index li::before {
  content: counter(stream, decimal-leading-zero) ".";
  font-feature-settings: "tnum";
  font-size: 0.72rem;
  color: var(--tobacco);
  width: 1.6em;
  flex-shrink: 0;
}

.stream-index .marker {
  width: 8px;
  height: 8px;
  border: 1px solid var(--umber);
  flex-shrink: 0;
  align-self: center;
  transition: background 240ms ease, border-color 240ms ease;
}

.stream-index li.active {
  color: var(--peat);
}

.stream-index li.active .marker {
  background: var(--terracotta);
  border-color: var(--terracotta);
}

.stream-index li:hover {
  color: var(--peat);
}

/* Specifications */
.specs {
  background: rgba(90, 74, 50, 0.04);
  margin: 0 -8px;
  padding: 16px 8px;
}

.specs dl {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.specs dl > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.specs dt, .specs dd {
  font-size: 0.7rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-feature-settings: "tnum";
  font-weight: 400;
}

.specs dt { color: var(--tobacco); }
.specs dd { color: var(--peat); font-weight: 500; }

.foot-line {
  margin-top: auto;
  padding-top: 24px;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--umber);
  font-feature-settings: "tnum";
}

/* ===================== MAIN STAGE ===================== */

.stage {
  padding: 96px 0 192px 0;
  position: relative;
}

.plate {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 8.333%;
  padding-right: 8.333%;
  position: relative;
  margin-bottom: 96px;
}

.plate:last-child { margin-bottom: 0; }

/* Plate numeral */
.plate-num {
  position: absolute;
  top: 0;
  right: 8.333%;
  font-family: 'Big Shoulders Display', sans-serif;
  font-weight: 700;
  font-size: 4rem;
  line-height: 1;
  color: var(--umber);
  letter-spacing: -0.01em;
}

/* Specimen tag leaf */
.specimen-tag {
  position: absolute;
  top: 8px;
  left: calc(8.333% - 80px);
  width: 64px;
  height: 64px;
}
.specimen-tag svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--kelp);
  stroke-width: 1.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Lens / photograph frame */
.lens {
  aspect-ratio: 4 / 5;
  max-width: 64%;
  width: 64%;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 0 var(--peat) inset, 0 0 0 1px var(--kelp) inset;
  background: var(--bronze);
  margin-top: 32px;
}

.lens .photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.lens canvas.ripple {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Inner kelp border accent */
.lens::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(62, 81, 66, 0.18);
  pointer-events: none;
}

/* Bubbles */
.bubble {
  position: absolute;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1.5px rgba(31, 26, 20, 0.14),
    inset 1px 1px 2px rgba(241, 234, 216, 0.6);
  backdrop-filter: blur(2px) saturate(1.05);
  -webkit-backdrop-filter: blur(2px) saturate(1.05);
  pointer-events: none;
  will-change: transform;
}
.bubble::before {
  content: "";
  position: absolute;
  top: 14%;
  left: 16%;
  width: 32%;
  height: 18%;
  border-radius: 50%;
  background: rgba(241, 234, 216, 0.6);
  transform: rotate(-25deg);
}

/* Caption */
.lens-caption {
  margin-top: 16px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--tobacco);
  position: relative;
  display: inline-block;
}
.lens-caption::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: calc(100% + 32px);
  height: 1px;
  background: var(--peat-hair);
}

/* Hidden cursor over photos + ring cursor */
.lens, .lens * { cursor: none; }

.ring-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--peat);
  box-shadow: inset 0 0 0 2px var(--cream);
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: 9999;
}
.ring-cursor.visible { opacity: 1; }

/* ===================== SCROLL RAIL ===================== */

.scroll-rail {
  position: fixed;
  top: 0;
  right: 0;
  width: 1px;
  height: 100vh;
  background: var(--peat-hair);
  z-index: 50;
}
.scroll-leaf {
  position: absolute;
  right: -6px;
  top: 0;
  width: 12px;
  height: 12px;
}
.scroll-leaf svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--kelp);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* ===================== RESPONSIVE ===================== */

@media (max-width: 880px) {
  body { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--peat-hair);
  }
  .wordmark { font-size: 3.5rem; }
  .stage { padding: 48px 0 96px 0; }
  .plate { padding-left: 6%; padding-right: 6%; }
  .lens, .lens.lens { max-width: 92%; width: 92%; }
  .plate-num { right: 6%; font-size: 2.6rem; }
  .specimen-tag { left: 6%; top: -8px; width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bubble { animation: none !important; }
}
