/* ============================================================
   BC&V Claude Cup — Night Before Experience
   Layer stack (bottom to top):
   boot > office > overlays > captions > finale > endcard > skip
   ============================================================ */

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #060607;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: #efe7d2;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
}
.layer.visible {
  opacity: 1;
  pointer-events: auto;
}

.hidden { visibility: hidden; }

/* ============ BOOT SCREEN ============ */

#boot {
  background: #060607;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.9s ease;
  z-index: 10;
}

.boot-inner {
  text-align: center;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
}

.boot-line {
  color: #8fa89a;
  font-size: clamp(14px, 1.5vw, 20px);
  letter-spacing: 0.35em;
  margin: 0.9em 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.boot-line.on {
  opacity: 1;
  transform: none;
}
.boot-source {
  color: #d9885a;
}

.open-btn {
  margin-top: 3em;
  padding: 0.9em 2.6em;
  background: transparent;
  border: 1px solid #4a5c52;
  color: #b8cbbf;
  font-family: inherit;
  font-size: clamp(13px, 1.3vw, 17px);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 1.2s ease, background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.open-btn.on { opacity: 1; }
.open-btn:hover {
  background: #101613;
  border-color: #6ee7a0;
  color: #6ee7a0;
}

/* ============ OFFICE ============ */

#office {
  background: #14100b;
  transition: opacity 1.6s ease, filter 3s ease;
}
#office-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* darkening tint that grows as Claude takes over */
#office-tint {
  position: absolute;
  inset: 0;
  background: #04060a;
  opacity: 0;
  transition: opacity 3.5s ease;
  pointer-events: none;
}

/* takeover stages, applied to #office */
#office.stage-claude    { filter: saturate(0.9); }
#office.stage-claude    #office-tint { opacity: 0.18; }
#office.stage-build     { filter: saturate(0.72) brightness(0.92); }
#office.stage-build     #office-tint { opacity: 0.38; }
#office.stage-drain     { filter: saturate(0.35) brightness(0.7); }
#office.stage-drain     #office-tint { opacity: 0.62; }
#office.stage-dark      { filter: saturate(0.12) brightness(0.45); }
#office.stage-dark      #office-tint { opacity: 0.85; }

/* snow */
.snow-a { animation: snowfall 9s linear infinite; }
.snow-b { animation: snowfall 14s linear infinite reverse; }
@keyframes snowfall {
  from { transform: translateY(-460px); }
  to   { transform: translateY(0); }
}
#window { clip-path: none; }

/* garland lights: slow gentle twinkle */
.glight { animation: twinkle 3.4s ease-in-out infinite; }
.glight.g2 { animation-delay: 1.1s; }
.glight.g3 { animation-delay: 2.2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

/* mug steam */
.steam { animation: steam 4s ease-in-out infinite; }
.steam.s2 { animation-delay: 1.6s; }
@keyframes steam {
  0%, 100% { opacity: 0.15; transform: translateY(0); }
  50%      { opacity: 0.55; transform: translateY(-6px); }
}

/* notification badges pop in */
.notif {
  transition: opacity 0.25s ease;
  transform-origin: center;
}
.notif.on {
  opacity: 1;
  animation: notif-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes notif-pop {
  from { transform: scale(0.2); }
  to   { transform: scale(1); }
}

/* screens light up when Claude connects */
.screen { transition: fill 2.5s ease; }
#office-svg.claude-on .screenA { fill: #0a1f12; }
#office-svg.claude-on .screenB { fill: #081a0f; }
#office-svg.claude-on .screen-halo { opacity: 1; transition: opacity 2.5s ease; }
#office-svg.claude-on #timesheet-ui { opacity: 0; transition: opacity 1.8s ease; }
#office-svg.claude-on #terminalA,
#office-svg.claude-on #terminalB { opacity: 1; transition: opacity 1.2s ease 0.8s; }
#office-svg.claude-on #notifs { opacity: 0; transition: opacity 1.2s ease; }

.term-line {
  opacity: 0;
}
#office-svg.claude-on .term-line { animation: term-in 0.1s steps(1) forwards; }
#office-svg.claude-on #terminalA .term-line:nth-child(1) { animation-delay: 1.0s; }
#office-svg.claude-on #terminalA .term-line:nth-child(2) { animation-delay: 1.7s; }
#office-svg.claude-on #terminalA .term-line:nth-child(3) { animation-delay: 2.3s; }
#office-svg.claude-on #terminalA .term-line:nth-child(4) { animation-delay: 3.0s; }
#office-svg.claude-on #terminalB .term-line:nth-child(1) { animation-delay: 1.4s; }
#office-svg.claude-on #terminalB .term-line:nth-child(2) { animation-delay: 2.6s; }
@keyframes term-in { to { opacity: 1; } }

#term-cursor { opacity: 0; }
#office-svg.claude-on #term-cursor { animation: cursor-blink 1s steps(1) infinite 3.2s; }
@keyframes cursor-blink {
  0%, 49%  { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ============ SYSTEM OVERLAYS ============ */

#overlays { transition: opacity 1s ease; }

.sys-banner {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: clamp(15px, 1.6vw, 22px);
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  color: #6ee7a0;
  background: rgba(4, 10, 6, 0.82);
  border: 1px solid rgba(110, 231, 160, 0.4);
  padding: 0.8em 1.8em;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0s linear 0.7s;
  white-space: nowrap;
}
.sys-banner.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s ease;
}
.sys-dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: #6ee7a0;
  margin-right: 1.1em;
  vertical-align: baseline;
  animation: dot-pulse 1.6s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(110,231,160,0.5); }
  50%      { opacity: 0.5; box-shadow: 0 0 0 7px rgba(110,231,160,0); }
}

/* floating build fragments */
#fragments {
  position: absolute;
  inset: 0;
  visibility: hidden;
}
#fragments.on { visibility: visible; }
.frag {
  position: absolute;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: clamp(12px, 1.25vw, 17px);
  color: #9fd8b4;
  background: rgba(5, 12, 8, 0.78);
  border: 1px solid rgba(110, 231, 160, 0.22);
  padding: 0.7em 1.1em;
  opacity: 0;
  transform: translateY(24px);
}
#fragments.on .frag {
  animation: frag-in 0.8s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}
.frag.f1 { top: 18%; left: 7%;  animation-delay: 0.10s !important; }
.frag.f2 { top: 62%; left: 12%; animation-delay: 0.55s !important; }
.frag.f3 { top: 30%; right: 8%; animation-delay: 0.95s !important; }
.frag.f4 { top: 70%; right: 13%; animation-delay: 1.35s !important; }
.frag.f5 { top: 12%; left: 40%; animation-delay: 1.75s !important; }
.frag.f6 { top: 44%; left: 8%; animation-delay: 2.15s !important; }
@keyframes frag-in {
  to { opacity: 1; transform: none; }
}
.frag-k { display: block; margin-bottom: 0.5em; }
.frag-bar {
  display: block;
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, #6ee7a0 0%, #6ee7a0 60%, rgba(110,231,160,0.15) 60%);
  background-size: 200% 100%;
  animation: frag-fill 1.6s ease forwards;
}
@keyframes frag-fill {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}

/* dramatic metric */
.metric {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.metric.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}
.metric-label {
  font-size: clamp(15px, 1.6vw, 22px);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: #8fa89a;
}
.metric-value {
  font-size: clamp(90px, 13vw, 190px);
  font-weight: bold;
  color: #6ee7a0;
  line-height: 1.05;
  text-shadow: 0 0 60px rgba(110, 231, 160, 0.35);
}
.metric.on .metric-value {
  animation: metric-pop 0.6s cubic-bezier(0.2, 1.4, 0.3, 1);
}
@keyframes metric-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.metric-sub {
  font-size: clamp(10px, 1vw, 14px);
  letter-spacing: 0.3em;
  color: #57695f;
  margin-top: 1.2em;
}

/* CREATIVE ACCOUNTING */
.creative {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.creative.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s ease;
}
.creative-main {
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(56px, 8.5vw, 130px);
  line-height: 1.02;
  letter-spacing: 0.04em;
  color: #f3ead6;
  text-shadow: 0 0 90px rgba(232, 176, 75, 0.35);
}
.creative.on .creative-main {
  animation: creative-slam 0.55s cubic-bezier(0.15, 1.3, 0.3, 1);
}
@keyframes creative-slam {
  0%   { transform: scale(1.45); opacity: 0; letter-spacing: 0.25em; }
  100% { transform: scale(1); opacity: 1; letter-spacing: 0.04em; }
}
.creative-sub {
  margin-top: 2.4em;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: clamp(11px, 1.05vw, 15px);
  letter-spacing: 0.25em;
  color: #6d7a70;
  opacity: 0;
}
.creative.on .creative-sub {
  animation: fade-in 0.8s ease 0.9s forwards;
}
@keyframes fade-in { to { opacity: 1; } }

/* judges */
.judges {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.judges.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}
.judges-row {
  display: flex;
  gap: clamp(16px, 2.4vw, 40px);
}
.judge {
  width: clamp(130px, 16vw, 240px);
  background: linear-gradient(180deg, #101318 0%, #07090c 100%);
  border: 1px solid #23282f;
  padding: clamp(14px, 1.6vw, 26px) 0 clamp(16px, 1.8vw, 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9em;
  opacity: 0;
  transform: translateY(30px);
}
.judges.on .judge { animation: judge-in 0.6s cubic-bezier(0.2, 1, 0.3, 1) forwards; }
.judges.on .judge.j1 { animation-delay: 0.05s; }
.judges.on .judge.j2 { animation-delay: 0.30s; }
.judges.on .judge.j3 { animation-delay: 0.55s; }
.judges.on .judge.j4 { animation-delay: 0.80s; }
@keyframes judge-in {
  to { opacity: 1; transform: none; }
}
.judge svg {
  width: 62%;
  display: block;
  background:
    radial-gradient(circle at 50% 30%, #262c35 0%, #12161c 70%);
  border: 1px solid #2c333c;
}
.judge span {
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(14px, 1.5vw, 22px);
  letter-spacing: 0.28em;
  text-indent: 0.28em;
  color: #dfe4ea;
}
.judges-sub {
  margin-top: clamp(22px, 3vh, 44px);
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: clamp(11px, 1.1vw, 15px);
  letter-spacing: 0.4em;
  text-indent: 0.4em;
  color: #5d6871;
  opacity: 0;
}
.judges.on .judges-sub { animation: fade-in 0.8s ease 1.5s forwards; }

/* "barely will twitch": exactly one panel, exactly once.
   Overriding the entry animation drops its fill, so restate the resting state. */
.judge.twitch { animation: judge-twitch 0.16s ease 1 !important; opacity: 1; transform: none; }
@keyframes judge-twitch {
  0%, 100% { transform: none; }
  40%      { transform: translateY(-2px) rotate(0.7deg); }
}

/* ============ CAPTIONS (the poem) ============ */

#captions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 7vh;
  text-align: center;
}

.cap {
  max-width: 76%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.9vw, 46px);
  line-height: 1.35;
  color: #f3ead6;
  text-shadow: 0 2px 26px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s ease, transform 0.9s ease;
  margin: 0.18em 0;
}
.cap.on {
  opacity: 1;
  transform: none;
}
.cap.out {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* caption style shifts as the takeover progresses */
#captions.mode-system .cap {
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: clamp(20px, 2.3vw, 36px);
  color: #d8efe0;
}
#captions.mode-dark {
  justify-content: center;
  padding-bottom: 0;
}
#captions.mode-dark .cap {
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(30px, 3.8vw, 62px);
  line-height: 1.25;
  letter-spacing: 0.02em;
  color: #eef1f4;
  max-width: 84%;
}

/* subtle glitch on dark captions */
#captions.glitch .cap.on {
  animation: cap-glitch 2.4s steps(1) infinite;
}
@keyframes cap-glitch {
  0%, 91%, 100% { transform: none; opacity: 1; }
  92%  { transform: translateX(3px); opacity: 0.85; }
  94%  { transform: translateX(-3px) skewX(1.5deg); }
  96%  { transform: none; opacity: 1; }
}

/* ============ FINALE ============ */

#finale {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bigline {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 92%;
  text-align: center;
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(44px, 6.4vw, 108px);
  line-height: 1.08;
  color: #f5f6f7;
  letter-spacing: 0.01em;
  opacity: 0;
  visibility: hidden;
}
.bigline.on {
  visibility: visible;
  animation: big-in 0.5s cubic-bezier(0.1, 1.2, 0.3, 1) forwards;
}
.bigline.off {
  visibility: visible;
  opacity: 1;
  animation: big-out 0.35s ease forwards;
}
@keyframes big-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.18); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes big-out {
  to { opacity: 0; }
}

/* the stamp */
.stamp {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-14deg) scale(4);
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(60px, 9vw, 160px);
  letter-spacing: 0.06em;
  color: #e03131;
  border: 0.09em solid #e03131;
  border-radius: 0.12em;
  padding: 0.05em 0.35em 0.1em;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  mix-blend-mode: screen;
  text-shadow: 0 0 40px rgba(224, 49, 49, 0.4);
  box-shadow: 0 0 60px rgba(224, 49, 49, 0.25), inset 0 0 40px rgba(224, 49, 49, 0.12);
}
.stamp.on {
  visibility: visible;
  animation: stamp-slam 0.32s cubic-bezier(0.5, 0, 0.9, 0.3) forwards;
}
@keyframes stamp-slam {
  0%   { opacity: 0; transform: translate(-50%, -50%) rotate(-14deg) scale(4); }
  60%  { opacity: 1; }
  80%  { transform: translate(-50%, -50%) rotate(-13deg) scale(0.97); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-14deg) scale(1); }
}

/* impact shake, applied to #app */
#app.shake {
  animation: shake 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes shake {
  0%   { transform: translate(0, 0); }
  12%  { transform: translate(-14px, 10px) rotate(-0.5deg); }
  24%  { transform: translate(12px, -8px) rotate(0.4deg); }
  40%  { transform: translate(-8px, 6px); }
  60%  { transform: translate(6px, -4px); }
  80%  { transform: translate(-3px, 2px); }
  100% { transform: translate(0, 0); }
}

#flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
#flash.on {
  animation: flash 0.4s ease-out;
}
@keyframes flash {
  0%  { opacity: 0.85; }
  100% { opacity: 0; }
}

/* ============ CODA ============ */

#coda {
  background: #060607;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 1.8s ease;
}
.coda-line {
  max-width: 80%;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: clamp(26px, 3vw, 50px);
  line-height: 1.5;
  color: #f3ead6;
  margin: 0.3em 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.3s ease, transform 1.3s ease;
}
.coda-line.on {
  opacity: 1;
  transform: none;
}
.coda-line.out {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

/* ============ END CARD ============ */

#endcard {
  background: #060607;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: opacity 2.2s ease;
}
.end-title {
  font-family: "Arial Black", "Segoe UI Black", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 4.6vw, 76px);
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  color: #f3ead6;
}
.end-sub {
  margin-top: 3.2em;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: clamp(10px, 0.95vw, 13px);
  letter-spacing: 0.22em;
  color: #4d564f;
}
.again {
  margin-top: 4.5em;
  background: transparent;
  border: none;
  color: #6a736c;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  opacity: 0.4;
  cursor: pointer;
  padding: 8px 12px;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.again:hover { opacity: 1; color: #b8cbbf; }

/* ============ SKIP ============ */

.skip {
  position: fixed;
  right: 22px;
  bottom: 18px;
  z-index: 50;
  background: transparent;
  border: none;
  color: #6a736c;
  font-family: Consolas, "Cascadia Mono", Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.25em;
  opacity: 0.35;
  cursor: pointer;
  padding: 8px 10px;
  visibility: visible;
  transition: opacity 0.3s ease;
}
.skip:hover { opacity: 0.9; }
.skip.hidden { visibility: hidden; }

/* ============ NOSCRIPT ============ */

.noscript-card {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #060607;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8vw;
}
.noscript-kicker {
  font-family: Consolas, Menlo, monospace;
  letter-spacing: 0.35em;
  color: #8fa89a;
  font-size: 14px;
}
.noscript-title {
  margin: 1.4em 0;
  font-family: "Arial Black", Arial, sans-serif;
  font-size: clamp(28px, 4vw, 60px);
  color: #f3ead6;
  letter-spacing: 0.1em;
}
.noscript-body {
  font-family: Georgia, serif;
  color: #b8ab8d;
  max-width: 34em;
  line-height: 1.6;
}

/* ============ REDUCED MOTION ============ */

@media (prefers-reduced-motion: reduce) {
  .snow-a, .snow-b, .glight, .steam, .sys-dot,
  #term-cursor, .frag-bar {
    animation: none !important;
  }
  .layer { transition-duration: 0.6s; }
  .cap, .boot-line, .open-btn, .coda-line { transition-duration: 0.5s; }
  #captions.glitch .cap.on { animation: none; }
  .judge.twitch { animation: none !important; }
  .notif.on, .metric.on .metric-value, .creative.on .creative-main,
  .judges.on .judge, .bigline.on, .stamp.on, #flash.on,
  #fragments.on .frag {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
  }
  .judges.on .judge { opacity: 1; transform: none; }
  #app.shake { animation: none; }
}
