/* marcsamouilhan.com — a day in Cape Town */

*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; background: #03060f; }
body {
  font-family: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.mono { font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace; }
.sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- scene ---------- */
.scene {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.scene.dragging { cursor: grabbing; }

.stars { position: absolute; z-index: 1; inset: 0 0 auto 0; height: 62%; pointer-events: none; }
.milky {
  position: absolute; left: 30%; top: -30%; width: 90%; height: 70%;
  transform: rotate(-28deg);
  background: radial-gradient(ellipse at center, rgba(205,214,255,.11) 0%, rgba(205,214,255,0) 68%);
}
.star { position: absolute; border-radius: 50%; animation: twinkle 4s ease-in-out infinite; }

.crux { position: absolute; z-index: 5; left: 72%; top: 9%; width: 150px; height: 150px; }
.crux .cs { position: absolute; border-radius: 50%; }
.crux-btn {
  position: absolute; left: -56px; top: -8px; width: 200px; height: 156px;
  background: transparent; border: 0; border-radius: 14px; cursor: pointer; color: #fff;
}
.crux-cap {
  position: absolute; left: -70px; top: 156px; width: 230px; margin: 0;
  font-size: 12px; line-height: 1.55; color: #fff;
}

.sun, .moon { position: absolute; z-index: 2; border-radius: 50%; pointer-events: none; will-change: left, top; }
.sun { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
.moon { width: 34px; height: 34px; margin: -17px 0 0 -17px; overflow: hidden; background: #efe9d4; }
.moon-shade { position: absolute; left: -1px; top: -1px; width: 36px; height: 36px; border-radius: 50%; }

.mtn { position: absolute; z-index: 3; left: 0; bottom: 16%; width: 100%; height: 42%; display: block; overflow: visible; pointer-events: none; }
.cloth { transition: opacity 1.6s ease; }
.cloth-drift { animation: clothDrift 14s ease-in-out infinite alternate; }
.cloth-pour { transform-box: fill-box; transform-origin: 50% 0; animation: clothPour 7s ease-in infinite; }
.p2 { animation-delay: -1.8s; } .p3 { animation-delay: -3.9s; } .p4 { animation-delay: -5.4s; }
.cable-car { animation: cable 22s ease-in-out infinite; transition: opacity 1s ease; }

.city { position: absolute; z-index: 4; left: 0; right: 0; bottom: 16%; height: 9%; pointer-events: none; }
.lt { position: absolute; border-radius: 1px; }

.sea { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: 16%; overflow: hidden; pointer-events: none; }
.glint {
  position: absolute; top: 0; width: 90px; height: 100%;
  transform: translateX(-50%); filter: blur(4px);
  animation: shimmer 4.5s ease-in-out infinite;
}
.sea-line { position: absolute; top: 0; left: 0; right: 0; height: 1px; }

/* ---------- interface ---------- */
.hdr {
  position: absolute; z-index: 10; top: 0; left: 0; right: 0;
  padding: 18px 5vw; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.hdr h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.hdr-right { display: flex; align-items: center; gap: 18px; font-size: 12px; letter-spacing: .02em; }
.live { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff6b57; animation: pulse 2.4s ease-in-out infinite; }

.pill {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid currentColor;
  background: transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .02em; white-space: nowrap;
}
.bar .pill { border-color: rgba(255,255,255,.7); }
.pill svg { flex: none; }

.tb {
  position: absolute; z-index: 10; top: 13%; left: 5vw; right: 5vw; max-width: 640px;
  display: flex; flex-direction: column; gap: 12px; pointer-events: none;
}
.tb p { margin: 0; }
.kicker { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.lead { font-size: 22px; font-weight: 300; letter-spacing: -0.01em; }
.head { font-size: clamp(40px, 5.4vw, 80px); font-weight: 700; line-height: .98; letter-spacing: -0.035em; text-wrap: balance; }
.body-copy { margin-top: 4px !important; max-width: 34em; font-size: 17px; line-height: 1.55; }
.visitor { margin-top: 2px !important; font-size: 12px; line-height: 1.6; letter-spacing: .02em; }

.hint {
  position: absolute; z-index: 9; left: 0; right: 0; bottom: 178px; margin: 0;
  display: flex; justify-content: center; align-items: center; gap: 10px;
  color: #fff; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; pointer-events: none;
  transition: opacity .6s ease;
}
.hint.gone { opacity: 0; }
.hint svg { animation: nudge 1.8s ease-in-out infinite; }

.bar { position: absolute; z-index: 10; left: 5vw; right: 5vw; bottom: 10px; color: #fff; display: flex; flex-direction: column; gap: 4px; }
.bar-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.readout { margin: 0; font-size: 12px; line-height: 1.5; letter-spacing: .02em; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.short { display: none; }

.ruler { position: relative; height: 88px; }
.seg {
  position: absolute; top: 0; height: 40px; padding: 10px 1px 0;
  background: transparent; border: 0; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 7px;
}
.seg-label {
  display: block; min-height: 13px; font-size: 10.5px; line-height: 13px; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: rgba(255,255,255,.74);
}
.seg-bar { display: block; height: 3px; border-radius: 2px; background: rgba(255,255,255,.38); transition: background .3s ease; }
.seg.on .seg-label { color: #fff; }
.seg.on .seg-bar { background: var(--accent, #ffd58a); }
.hour { position: absolute; top: 72px; font-size: 10.5px; line-height: 13px; color: rgba(255,255,255,.78); transform: translateX(-50%); }
.hour:first-child { transform: none; }

.dial {
  -webkit-appearance: none; appearance: none; position: absolute; left: 0; right: 0; top: 40px;
  width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; touch-action: none;
}
.dial::-webkit-slider-runnable-track { height: 2px; background: rgba(255,255,255,.42); border-radius: 2px; }
.dial::-moz-range-track { height: 2px; background: rgba(255,255,255,.42); border-radius: 2px; }
.dial::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -9px; border: 0; border-radius: 50%;
  background: #ffd58a; box-shadow: 0 0 0 5px rgba(255,213,138,.22), 0 0 22px rgba(255,213,138,.75);
}
.dial::-moz-range-thumb {
  width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: #ffd58a; box-shadow: 0 0 0 5px rgba(255,213,138,.22), 0 0 22px rgba(255,213,138,.75);
}
.dial.night::-webkit-slider-thumb { background: #ece6cf; box-shadow: 0 0 0 5px rgba(236,230,207,.18), 0 0 18px rgba(236,230,207,.5); }
.dial.night::-moz-range-thumb { background: #ece6cf; box-shadow: 0 0 0 5px rgba(236,230,207,.18), 0 0 18px rgba(236,230,207,.5); }
.dial:focus-visible { outline: 2px solid #fff; outline-offset: 6px; }

/* ---------- the whole day, as text ---------- */
.list {
  position: absolute; z-index: 30; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(3,6,15,.96); color: #fff; user-select: text; -webkit-user-select: text; cursor: auto;
  touch-action: pan-y; overscroll-behavior: contain;
}
.list[hidden] { display: none; }
.list-in { max-width: 780px; margin: 0 auto; padding: 72px 6vw 88px; display: flex; flex-direction: column; gap: 24px; }
.list-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.list h2 { margin: 0; font-size: clamp(36px, 5vw, 60px); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.close {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6);
  background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.list-intro { margin: 0; max-width: 36em; font-size: 18px; line-height: 1.6; color: #d9deea; }
.list ol { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 20px; padding: 22px 0; border-top: 1px solid rgba(255,255,255,.16); }
.row-time { margin: 2px 0 0; font-size: 12.5px; letter-spacing: .04em; color: #c7cfdf; }
.row-main { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.row h3 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.row p { margin: 0; font-size: 16px; line-height: 1.6; color: #d9deea; }
.show {
  min-height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #ffd58a;
}
.foot { margin: 8px 0 0; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.16); font-size: 12px; line-height: 1.7; color: #c7cfdf; }

/* ---------- motion ---------- */
@keyframes twinkle { 0%, 100% { transform: scale(1); } 50% { transform: scale(.4); } }
@keyframes flicker { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes clothDrift { from { transform: translateX(-12px); } to { transform: translateX(14px); } }
@keyframes clothPour { 0% { transform: scaleY(.3); opacity: 0; } 25% { opacity: 1; } 75% { opacity: .8; } 100% { transform: scaleY(1.25); opacity: 0; } }
@keyframes cable { 0%, 8% { transform: translate(0, 0); } 46%, 54% { transform: translate(46px, -146px); } 92%, 100% { transform: translate(0, 0); } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@keyframes shimmer { 0%, 100% { transform: translateX(-50%) scaleX(1); } 50% { transform: translateX(-50%) scaleX(.65); } }

/* ---------- smaller screens ---------- */
@media (max-width: 900px) {
  .seg-label { display: none; }
  .seg { height: 44px; }
}
@media (max-width: 640px) {
  .coords { display: none; }
  .hdr { padding: 12px 6vw; }
  .tb { top: 10%; left: 6vw; right: 6vw; gap: 10px; }
  .lead { font-size: 19px; }
  .head { font-size: clamp(34px, 10vw, 44px); }
  .body-copy { font-size: 15.5px; line-height: 1.5; }
  .mtn { height: 24%; bottom: 20%; }
  .city { bottom: 20%; height: 6%; }
  .sea { height: 20%; }
  .bar { left: 6vw; right: 6vw; bottom: 6px; }
  .long { display: none; }
  .short { display: inline; }
  .hint { bottom: 196px; font-size: 11px; }
  .crux { left: auto; right: 2%; top: 7%; transform: scale(.72); transform-origin: 100% 0; }
  .row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}
@media (max-height: 640px) and (min-width: 641px) {
  .tb { top: 11%; }
  .head { font-size: clamp(36px, 4.6vw, 64px); }
  .body-copy { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .star, .lt, .dot, .cloth-drift, .cloth-pour, .cable-car, .glint, .hint svg { animation: none !important; }
}
