/* Days without an emergency patch — a concrete wall, an LED safety sign, a sticky note. */

@font-face {
  font-family: "Montserrat";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Montserrat-400.woff2") format("woff2");
}
@font-face {
  font-family: "Montserrat";
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/Montserrat-600.woff2") format("woff2");
}

:root {
  --led: #ff2d22;
  --amber: #ffb21e;
  --rim: #ececec;
  --note: #ffe46b;
  --ink: #161616;
  --hole: radial-gradient(circle, #2f3133 0 3px, rgba(0, 0, 0, .3) 4px, rgba(255, 255, 255, .12) 5px, transparent 6.5px);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #f4f4f4;
  overflow-x: hidden;
  /* Concrete: light falloff, cloudy stains, grain, form-tie holes and panel joints. */
  background-color: #9fa2a5;
  background-image:
    radial-gradient(ellipse 80% 60% at 18% 0%, rgba(255, 255, 255, .32), transparent 70%),
    radial-gradient(ellipse 90% 70% at 90% 105%, rgba(0, 0, 0, .38), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='700'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .2 0 0 0 0 .2 0 0 0 .55 -.18'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .32 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(to right, rgba(0, 0, 0, .22) 0 1px, rgba(255, 255, 255, .16) 1px 2px, transparent 2px),
    linear-gradient(to bottom, rgba(0, 0, 0, .22) 0 1px, rgba(255, 255, 255, .16) 1px 2px, transparent 2px);
  background-size: 100% 100%, 100% 100%, 700px 700px, 240px 240px, 360px 240px, 360px 240px;
  background-repeat: no-repeat, no-repeat, repeat, repeat, repeat, repeat;
}

/* Six form-tie holes per 360×240 concrete panel (each layer draws one hole, shifted into place). */
body { position: relative; }
body::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--hole), var(--hole), var(--hole), var(--hole), var(--hole), var(--hole);
  background-size: 360px 240px;
  background-position: -126px -66px, -6px -66px, 114px -66px, -126px 54px, -6px 54px, 114px 54px;
  background-repeat: repeat;
  opacity: .9;
  z-index: 0;
}

.scene {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 56px);
  padding: clamp(56px, 9vh, 96px) 16px 120px;
  perspective: 1600px;
  overflow-x: clip; /* the 3D tilt and the warning-light beam must never cause sideways scrolling */
}

/* ---------- The sign ---------- */

.sign {
  position: relative;
  margin: 0;
  width: min(860px, 100%);
  transform: rotateY(-12deg) rotateX(2.5deg);
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.sign:hover { transform: rotateY(-8deg) rotateX(1.5deg); }

.sign__panel {
  position: relative;
  border-radius: clamp(16px, 2.6vw, 26px);
  padding: clamp(16px, 3.2vw, 34px) clamp(18px, 4vw, 42px) clamp(18px, 3.4vw, 34px);
  background:
    radial-gradient(ellipse 70% 55% at 50% 30%, rgba(255, 40, 30, .10), transparent 70%),
    linear-gradient(160deg, #2a2a2a 0%, #151515 45%, #0c0c0c 100%);
  box-shadow:
    9px 6px 0 -1px #0d0d0d,
    16px 10px 0 -2px #060606,
    48px 56px 70px rgba(0, 0, 0, .42),
    14px 22px 26px rgba(0, 0, 0, .35),
    inset 0 1px 0 rgba(255, 255, 255, .10);
}
/* The white inner rim from the photo. */
.sign__panel::before {
  content: "";
  position: absolute;
  inset: clamp(8px, 1.4vw, 15px);
  border: clamp(2px, .32vw, 3.5px) solid var(--rim);
  border-radius: clamp(10px, 1.8vw, 18px);
  opacity: .92;
  pointer-events: none;
}
/* A soft glare across the acrylic front. */
.sign__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(112deg, rgba(255, 255, 255, .075) 0 32%, rgba(255, 255, 255, 0) 32.2%);
  pointer-events: none;
}

.led {
  position: relative;
  width: 80%;
  margin: clamp(6px, 1.4vw, 14px) auto 0;
  padding: 3.5% 6% 3%;
  border-radius: clamp(12px, 2vw, 22px);
  background: radial-gradient(ellipse at 50% 45%, #200807 0%, #0b0504 75%);
  box-shadow:
    inset 0 3px 18px rgba(0, 0, 0, .95),
    inset 0 0 0 1px rgba(255, 255, 255, .05),
    0 0 60px rgba(255, 40, 30, .16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.led svg { display: block; width: 100%; height: auto; overflow: visible; }
.led .off { fill: #3b1512; opacity: .62; }
.led .on { animation: power-on 1.4s ease-out both; }
.led.flicker .on { animation: flicker .7s linear; }

.sign__label {
  margin: .45em 0 0;
  text-align: center;
  text-transform: uppercase;
  font-weight: 600;
  font-size: clamp(25px, 5.6vw, 60px);
  line-height: 1.04;
  letter-spacing: .005em;
  color: #f7f7f7;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}

/* Status line centered, badge in the bottom-right corner, no overlap with the label. */
.sign__foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 12px;
  margin-top: clamp(10px, 1.6vw, 18px);
}
.sign__status {
  grid-column: 2;
  margin: 0 0 .15em;
  text-align: center;
  font: 600 clamp(10px, 1.35vw, 13.5px)/1.4 ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 178, 30, .55);
  min-height: 1.4em;
}

.badge {
  grid-column: 3;
  justify-self: end;
  margin-right: clamp(4px, 1vw, 10px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-size: clamp(8px, .95vw, 11px);
  font-weight: 600;
  color: #e6e6e6;
}
.badge b {
  padding: .25em 1.15em;
  font-size: 1.25em;
  letter-spacing: .06em;
  color: #111;
  background: #ffd21f;
  clip-path: polygon(9% 0, 91% 0, 100% 50%, 91% 100%, 9% 100%, 0 50%);
}

/* ---------- Incident mode (day 0) ---------- */

.beacon {
  position: absolute;
  left: 50%;
  top: 0;
  width: clamp(54px, 7vw, 76px);
  height: clamp(30px, 3.8vw, 40px);
  transform: translate(-50%, -100%);
  border-radius: 50% 50% 6px 6px / 90% 90% 6px 6px;
  background: radial-gradient(circle at 40% 35%, #ff8a80, #c4120b 60%, #6e0703);
  box-shadow: inset 0 -6px 8px rgba(0, 0, 0, .4);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.beacon::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -8px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(#333, #111);
}
.beacon span {
  display: none; /* only rendered in incident mode, so the big beam never widens the page */
  position: absolute;
  left: 50%;
  top: 55%;
  width: 900px;
  height: 900px;
  margin: -450px 0 0 -450px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255, 40, 30, .32), transparent 9%, transparent 50%, rgba(255, 40, 30, .32) 50%, transparent 59%);
  filter: blur(6px);
  animation: spin 1.6s linear infinite;
  mix-blend-mode: screen;
}

.is-incident .beacon { opacity: 1; }
.is-incident .beacon span { display: block; }
.is-incident .led .on { animation: power-on 1s ease-out both, blink 1.2s linear 1s infinite; }
.is-incident .sign__status { color: #ff4a3f; text-shadow: 0 0 10px rgba(255, 60, 50, .7); }
.is-incident .sign__panel { animation: alarm 1.1s ease-in-out infinite; }

/* ---------- Below the sign: sticky note + break-glass box ---------- */

.below {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(24px, 6vw, 80px);
  width: min(860px, 100%);
  flex-wrap: wrap;
}

.note {
  position: relative;
  width: min(330px, 100%);
  padding: 30px 24px 22px;
  color: #2b2410;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .05), transparent 18%),
    var(--note);
  font-family: "Segoe Print", "Bradley Hand", "Marker Felt", "Comic Sans MS", "Chalkboard SE", cursive;
  transform: rotate(-3.2deg);
  box-shadow: 0 14px 18px -10px rgba(0, 0, 0, .45), 0 2px 3px rgba(0, 0, 0, .15);
  clip-path: polygon(0 0, 100% 0, 100% 93%, 94% 100%, 0 100%);
}
.note::after {
  /* the curled corner */
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 6%;
  height: 7%;
  min-width: 18px;
  min-height: 18px;
  background: linear-gradient(135deg, #d9bf44 0 50%, transparent 50%);
}
.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 104px;
  height: 28px;
  transform: translateX(-50%) rotate(2deg);
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  backdrop-filter: blur(1px);
}
.note h2 {
  margin: 0 0 .5em;
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-family: "Montserrat", system-ui, sans-serif;
  font-weight: 600;
  color: #7a5b00;
}
.note__what { margin: 0; font-size: 1.12rem; line-height: 1.35; overflow-wrap: anywhere; }
.note__what a { color: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: rgba(122, 91, 0, .45); text-underline-offset: 3px; }
.note__what a:hover { text-decoration-color: #b4231b; color: #7a1410; }
.note__what a:focus-visible { outline: 2px dashed #7a5b00; outline-offset: 3px; }
.note__meta { margin: .45em 0 0; font-size: .92rem; opacity: .8; }
.note__record { margin: .9em 0 0; padding-top: .7em; border-top: 2px dashed rgba(43, 36, 16, .25); font-size: .98rem; }

.breakglass {
  position: relative;
  width: 168px;
  height: 168px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(160deg, #e2261c, #a80f08);
  box-shadow:
    0 0 0 8px #c8170f,
    0 0 0 10px #7d0b06,
    14px 18px 26px rgba(0, 0, 0, .45);
  transform: rotate(1.5deg);
  transition: transform .2s;
  font: inherit;
}
.breakglass:hover { transform: rotate(0) scale(1.03); }
.breakglass:focus-visible { outline: 3px solid var(--amber); outline-offset: 14px; }
.breakglass__text {
  position: relative;
  z-index: 1;
  display: block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.5;
  text-transform: uppercase;
}
.breakglass__text strong { font-size: 1.45rem; letter-spacing: .02em; }
.breakglass__glass {
  position: absolute;
  inset: 10px;
  z-index: 2;
  border-radius: 6px;
  background: linear-gradient(125deg, rgba(255, 255, 255, .34) 0 18%, rgba(255, 255, 255, .06) 18.5% 60%, rgba(255, 255, 255, .18) 60.5% 66%, rgba(255, 255, 255, .04) 66.5%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
  transition: opacity .4s .9s;
}
.breakglass__crack { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.breakglass__crack path { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 1.1; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.breakglass.is-broken { animation: shake .45s; }
.breakglass.is-broken .breakglass__crack { opacity: 1; }
.breakglass.is-broken .breakglass__glass { opacity: 0; }

/* ---------- Ticker ---------- */

.ticker {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content; /* a centered fixed element would otherwise shrink to half the screen */
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(18, 18, 18, .86);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .06);
  backdrop-filter: blur(6px);
  font: 500 clamp(11px, 1.4vw, 13.5px)/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace;
}
.ticker__label {
  flex: none;
  padding: 2px 8px;
  border-radius: 4px;
  color: #111;
  background: var(--amber);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .8em;
}
.ticker__tip {
  color: #ffd27a;
  text-shadow: 0 0 6px rgba(255, 178, 30, .35);
  transition: opacity .45s, transform .45s;
}
.ticker__tip.is-out { opacity: 0; transform: translateY(6px); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  z-index: 5;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  transform: translate(-50%, calc(-100% - 40px));
  visibility: hidden;
  border-radius: 12px;
  background: #151515;
  color: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(255, 255, 255, .08);
  font-weight: 600;
  text-align: center;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), visibility 0s .35s;
}
.toast.is-on { transform: translate(-50%, 0); visibility: visible; transition: transform .35s cubic-bezier(.2, .9, .3, 1.3); }

/* ---------- Animations ---------- */

@keyframes power-on {
  0% { opacity: 0; }
  12% { opacity: .9; }
  16% { opacity: .1; }
  28% { opacity: 1; }
  34% { opacity: .35; }
  50%, 100% { opacity: 1; }
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  15% { opacity: .2; }
  30% { opacity: 1; }
  45% { opacity: .05; }
  60% { opacity: .9; }
  75% { opacity: .3; }
}
/* Alarm rhythm: mostly on, briefly off. */
@keyframes blink { 0%, 64% { opacity: 1; } 66%, 98% { opacity: .1; } 100% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes alarm {
  0%, 100% { box-shadow: 9px 6px 0 -1px #0d0d0d, 16px 10px 0 -2px #060606, 48px 56px 70px rgba(0, 0, 0, .42), 14px 22px 26px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .10), 0 0 0 rgba(255, 40, 30, 0); }
  50% { box-shadow: 9px 6px 0 -1px #0d0d0d, 16px 10px 0 -2px #060606, 48px 56px 70px rgba(0, 0, 0, .42), 14px 22px 26px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .10), 0 0 70px rgba(255, 40, 30, .45); }
}
@keyframes shake {
  0%, 100% { transform: rotate(1.5deg) translate(0, 0); }
  20% { transform: rotate(-1deg) translate(-6px, 2px); }
  40% { transform: rotate(3deg) translate(6px, -2px); }
  60% { transform: rotate(0) translate(-4px, 1px); }
  80% { transform: rotate(2deg) translate(3px, 0); }
}

/* ---------- Small screens & motion preferences ---------- */

@media (max-width: 680px) {
  .sign, .sign:hover { transform: none; }
  .led { width: 92%; }
  .sign__foot { grid-template-columns: 1fr; justify-items: center; }
  .sign__status, .badge { grid-column: 1; }
  .badge { justify-self: center; align-items: center; margin: 4px 0 0; }
  .note { transform: rotate(-1.5deg); }
  .breakglass { width: 140px; height: 140px; }
  .ticker { border-radius: 14px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sign, .sign:hover { transform: rotateY(-8deg); }
}
