/* ==========================================================================
   ATOM-85 board tile — a live miniature of the БЩУ-2 main board
   Palette and type follow atom-85.html (Severnaya NPP · Unit 2).
   ========================================================================== */

.a85 {
  --a85-coal: #211818;
  --a85-panel: #302222;
  --a85-plate: #2a1d1c;
  --a85-brass: #dbb45b;
  --a85-red: #a42b2b;
  --a85-paper: #f1e7d4;
  --a85-dim: #c0ad98;
  --a85-faint: #8f7c6c;
  --a85-rule: #5c4841;
  --a85-coolant: #8dc7b3;
  --a85-hot: #e79a70;
  --a85-alarm: #f5a18f;
  --card-accent: var(--a85-brass);

  gap: 0.75rem;
  padding: 0 clamp(0.85rem, 2vw, 1.15rem) clamp(0.85rem, 2vw, 1.15rem);
  color: var(--a85-paper);
  border-color: #6b5346;
  background:
    radial-gradient(ellipse at 12% 0%, #432925 0%, transparent 58%),
    linear-gradient(180deg, #2a1c1b, var(--a85-coal) 70%);
  box-shadow: 0 24px 48px -30px #000, inset 0 1px 0 rgb(255 230 200 / 0.05);
}
.a85::after {
  /* red header stripe, as on the station board */
  content: ""; position: absolute; inset-inline: 0; inset-block-start: 0; block-size: 3px;
  background: linear-gradient(90deg, var(--a85-red), #c2412f 50%, var(--a85-red));
}
.a85 .corners { --c: var(--a85-brass); }
.a85 [lang="ru"] { display: block; color: var(--a85-faint); font-size: 0.68rem; line-height: 1.25; letter-spacing: 0; text-transform: none; font-weight: 400; }
.a85-mono, .a85 .label { font-family: "IBM Plex Mono", var(--mono); }

/* ---- header ------------------------------------------------------------ */
.a85-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem;
  margin-inline: calc(-1 * clamp(0.85rem, 2vw, 1.15rem));
  padding: 1rem clamp(0.85rem, 2vw, 1.15rem) 0.75rem;
  border-block-end: 1px solid var(--a85-rule);
}
.a85-unit {
  display: grid; place-items: center; inline-size: 2.9rem; block-size: 2.9rem;
  border: 1px solid #d0574a; background: var(--a85-red); color: #fff1da;
  font-family: var(--mono); line-height: 1; box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.18);
}
.a85-unit b { font-size: 1.3rem; }
.a85-unit small { font-size: 0.55rem; letter-spacing: 0.12em; text-transform: uppercase; }
.a85-title .tile-kicker { color: var(--a85-brass); font-size: 0.68rem; }
.a85-title h3 { margin-block: 0.05rem 0.1rem; font-family: var(--mono); font-size: clamp(1.5rem, 2.6vw, 1.95rem); letter-spacing: -0.02em; line-height: 1; }
.a85-station { color: var(--a85-paper); font-size: 0.78rem; line-height: 1.25; }
.a85-clock { display: grid; justify-items: end; font-family: var(--mono); line-height: 1.15; }
.a85-type { color: var(--a85-brass); font-size: 0.7rem; letter-spacing: 0.08em; }
.a85-time { color: var(--a85-faint); font-size: 0.62rem; }
.a85-time b { color: #f0c870; font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgb(240 200 112 / 0.35); }
.a85-date { color: var(--a85-dim); font-size: 0.62rem; letter-spacing: 0.06em; }

/* ---- annunciator lamps ------------------------------------------------- */
.a85-lamps { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font: 600 0.64rem/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--a85-faint); }
.a85-lamp { display: inline-flex; align-items: center; gap: 0.4rem; transition: color 200ms; }
.a85-lamp::before {
  content: ""; inline-size: 7px; block-size: 7px; border: 1px solid currentColor; background: transparent;
  transition: background-color 200ms, box-shadow 200ms;
}
.a85-lamp.is-on { color: var(--a85-coolant); }
.a85-lamp.is-on::before { background: var(--a85-coolant); box-shadow: 0 0 6px var(--a85-coolant); }
.a85-lamp--trip { color: rgb(245 161 143 / 0.35); }
.a85-lamp--trip.is-on { color: var(--a85-alarm); animation: a85-alarm 0.7s steps(1) infinite; }
.a85-lamp--trip.is-on::before { background: var(--a85-alarm); box-shadow: 0 0 8px var(--a85-alarm); }
@keyframes a85-alarm { 50% { opacity: 0.25; } }

/* ---- instruments ------------------------------------------------------- */
.a85-instruments { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0.6rem; }
.a85-module {
  display: grid; gap: 0.35rem; padding: 0.45rem;
  border: 1px solid var(--a85-rule); background: linear-gradient(180deg, var(--a85-panel), var(--a85-plate));
  box-shadow: inset 0 1px 0 rgb(255 230 200 / 0.05), 0 2px 0 rgb(0 0 0 / 0.35);
  position: relative;
}
.a85-module::before, .a85-module::after {
  /* panel screws */
  content: ""; position: absolute; inset-block-start: 5px; inline-size: 4px; block-size: 4px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #8a7462, #3c2e29);
}
.a85-module::before { inset-inline-start: 5px; }
.a85-module::after { inset-inline-end: 5px; }
.a85-module figcaption { text-align: center; font-size: 0.74rem; font-weight: 600; line-height: 1.2; }
.a85-reading { text-align: center; font: 700 1.2rem/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--a85-paper); }
.a85-reading small { margin-inline-start: 0.25rem; color: var(--a85-faint); font-size: 0.6rem; font-weight: 600; }

.a85-dial { display: block; inline-size: 100%; border-radius: 3px; box-shadow: inset 0 0 0 1px #000; }
.a85-face { fill: url(#a85FaceGrad); stroke: #1a1210; stroke-width: 2; }
.a85-scale { fill: none; stroke: #3a2d2a; stroke-width: 1.2; }
.a85-redzone { fill: none; stroke: #b5432f; stroke-width: 3.4; }
.a85-ticks line { stroke: #3a2d2a; stroke-width: 0.8; }
.a85-ticks line.major { stroke-width: 1.4; }
.a85-ticks text, .a85-dial .a85-dial-unit { fill: #3a2d2a; font: 600 7px var(--mono); text-anchor: middle; }
.a85-needle { transform-box: view-box; transform-origin: 80px 80px; transform: rotate(63deg); will-change: transform; }
.a85-needle path { fill: #1a1210; }
.a85-hub { fill: #2b201d; stroke: #6b5346; stroke-width: 1.2; }
.a85-glass { fill: url(#a85GlassGrad); pointer-events: none; }

.a85-core canvas { display: block; inline-size: 100%; aspect-ratio: 1; max-inline-size: 9.5rem; margin-inline: auto; }

/* ---- process mimic ----------------------------------------------------- */
.a85-mimic-wrap { padding: 0.5rem 0.5rem 0.35rem; }
.a85-mimic-head { display: flex; justify-content: space-between; align-items: baseline; font: 600 0.62rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--a85-brass); }
.a85-mimic-head span:last-child { color: var(--a85-faint); }
.a85-mimic { display: block; inline-size: 100%; margin-block-start: 0.3rem; background:
  linear-gradient(rgb(219 180 91 / 0.05) 1px, transparent 1px) 0 0 / 10px 10px,
  linear-gradient(90deg, rgb(219 180 91 / 0.05) 1px, transparent 1px) 0 0 / 10px 10px, #1b1312;
  border: 1px solid #3f302c; }
.a85-mimic text { font: 600 6.2px var(--mono); letter-spacing: 0.04em; fill: var(--a85-dim); }
.a85-mimic .t-brass { fill: var(--a85-brass); }
.a85-mimic .t-center { text-anchor: middle; }
.a85-mimic .t-end { text-anchor: end; }
.a85-pipe { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: square; }
.a85-pipe--steam { stroke: rgb(219 180 91 / 0.38); }
.a85-pipe--loop { stroke: rgb(141 199 179 / 0.32); }
.a85-pipe--feed { stroke: rgb(141 199 179 / 0.22); }
.a85-pipe--grid { stroke: rgb(219 180 91 / 0.5); stroke-width: 1.4; }
.a85-flow { fill: none; stroke-width: 1.3; stroke-dasharray: 3 7; stroke-linecap: round; animation: a85-flow 0.9s linear infinite; }
.a85-flow--steam { stroke: #f0c870; animation-duration: 0.55s; }
.a85-flow--loop { stroke: var(--a85-coolant); }
.a85-flow--feed { stroke: rgb(141 199 179 / 0.7); stroke-dasharray: 2 8; animation-duration: 1.4s; }
@keyframes a85-flow { to { stroke-dashoffset: -10; } }
.a85-box { fill: #231918; stroke: var(--a85-rule); stroke-width: 1; }
.a85-drum { fill: #2b201d; stroke: var(--a85-coolant); stroke-opacity: 0.6; stroke-width: 1; }
.a85-corebox { fill: #1a1110; stroke: var(--a85-brass); stroke-width: 1.2; }
.a85-channels { stroke: #f0c870; stroke-width: 1.6; opacity: var(--a85-core, 0.85); filter: drop-shadow(0 0 2px rgb(240 200 112 / 0.8)); }
.a85-turbine { fill: #2b201d; stroke: var(--a85-brass); stroke-width: 1; transition: stroke 300ms, fill 300ms; }
.a85-gen { fill: #2b201d; stroke: var(--a85-brass); stroke-width: 1; transition: stroke 300ms; }
.a85-gen-g { fill: var(--a85-brass); font-size: 7px; text-anchor: middle; }
.a85-pump circle { fill: #231918; stroke: var(--a85-coolant); stroke-width: 1; }
.a85-pump path { fill: none; stroke: var(--a85-coolant); stroke-width: 0.9; }
.a85-pump.is-on circle { fill: rgb(141 199 179 / 0.25); }
.a85-pump.is-on path { fill: var(--a85-coolant); }
.a85-pump.is-standby circle { stroke-dasharray: 2 2; stroke-opacity: 0.6; }

/* tripped: rods in, steam stops, turbines coast down */
.a85[data-state="trip"] .a85-flow--steam { animation-play-state: paused; opacity: 0.15; }
.a85[data-state="trip"] .a85-flow--loop { animation-duration: 2.2s; }
.a85[data-state="trip"] .a85-turbine,
.a85[data-state="trip"] .a85-gen { stroke: var(--a85-faint); }
.a85[data-state="trip"] .a85-gen-g { fill: var(--a85-faint); }
.a85[data-state="trip"] { border-color: rgb(245 161 143 / 0.55); }
.a85[data-state="trip"] .a85-reading { color: var(--a85-alarm); }

/* ---- readout strip ----------------------------------------------------- */
.a85-read { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--a85-rule); background: var(--a85-rule); }
.a85-read div { padding: 0.35rem 0.45rem; background: #1b1312; }
.a85-read dt { color: var(--a85-faint); font: 600 0.58rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.a85-read dd { color: #f0c870; font: 700 0.86rem/1.3 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.a85-read dd small { color: var(--a85-faint); font-size: 0.58rem; font-weight: 600; margin-inline-start: 0.15rem; }

/* ---- turn photograph --------------------------------------------------- */
.a85-photo { display: grid; gap: 0.35rem; padding: 0.4rem; border: 1px solid var(--a85-rule); background: #1b1312; }
.a85-photo-frame { position: relative; aspect-ratio: 3 / 1; overflow: hidden; background: #000; }
.a85-photo-frame span {
  position: absolute; inset: 0;
  /* 2×2 contact sheet: 200% wide keeps each quadrant's true 2:1 shape, the 3:1 frame crops it */
  background-image: url("assets/atom85/control-room.webp"); background-size: 200% auto; background-repeat: no-repeat;
  opacity: 0; transition: opacity 900ms ease;
  filter: sepia(0.25) saturate(0.9) contrast(1.05);
  animation: a85-drift 12s ease-in-out infinite alternate;
  will-change: opacity, transform;
}
.a85-photo-frame span.is-shown { opacity: 1; }
.a85-photo-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgb(0 0 0 / 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgb(20 10 8 / 0.65));
}
@keyframes a85-drift { from { transform: scale(1.02); } to { transform: scale(1.1) translate3d(-1.5%, 1%, 0); } }
.a85-photo figcaption { display: flex; justify-content: space-between; gap: 0.5rem; color: var(--a85-dim); font-size: 0.62rem; }
.a85-photo figcaption b { color: var(--a85-brass); font-weight: 600; }

.a85-status { margin: 0; font: 0.74rem/1.4 var(--mono); color: var(--a85-coolant); }
.a85[data-state="trip"] .a85-status { color: var(--a85-alarm); }

/* ---- actions: launch + AZ-5 mushroom button ---------------------------- */
.a85-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-block-start: auto; padding-block-start: 0.25rem; }
.a85 .btn--primary { background: var(--a85-red); border-color: #d0574a; color: #fff1da; }
.a85 .btn--primary:hover { background: #c2412f; color: #fff; }

.a85-az5 {
  display: inline-flex; align-items: center; gap: 0.6rem; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--a85-dim); font: 600 0.66rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; text-align: start;
}
.a85-az5-collar {
  position: relative; display: grid; place-items: center; inline-size: 3.6rem; block-size: 3.6rem; border-radius: 50%;
  background: repeating-conic-gradient(#d9b23a 0 12deg, #1d1514 12deg 24deg);
  box-shadow: 0 2px 0 #000, inset 0 0 0 3px #1d1514;
}
.a85-az5-cap {
  display: grid; place-items: center; inline-size: 2.65rem; block-size: 2.65rem; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #e46a55, #a42b2b 55%, #6d1717);
  color: #fff1da; font: 700 0.72rem/1 var(--mono); letter-spacing: 0.02em;
  box-shadow: 0 4px 0 #4a0f0f, 0 6px 10px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.3);
  transform: translateY(-3px);
  transition: transform 90ms var(--ease-slam, ease-in), box-shadow 90ms;
}
.a85-az5:hover .a85-az5-cap { background: radial-gradient(circle at 38% 32%, #f07a63, #b83226 55%, #7a1a1a); }
.a85-az5:active .a85-az5-cap,
.a85[data-state="trip"] .a85-az5-cap {
  transform: translateY(1px);
  box-shadow: 0 0 0 #4a0f0f, 0 1px 3px rgb(0 0 0 / 0.6), inset 0 2px 4px rgb(0 0 0 / 0.45);
}
.a85[data-state="trip"] .a85-az5-cap { background: radial-gradient(circle at 38% 32%, #b8463a, #7f1f1f 55%, #4d1010); }
.a85-az5-text b { display: block; color: var(--a85-paper); font-size: 0.74rem; }
.a85-az5:focus-visible { outline: 2px solid var(--a85-brass); outline-offset: 4px; border-radius: 4px; }

/* layout tweaks */
@media (max-width: 40rem) {
  .a85-head { grid-template-columns: auto minmax(0, 1fr); }
  .a85-clock { grid-column: 1 / -1; grid-template-columns: auto auto auto; justify-content: start; gap: 0.6rem; align-items: baseline; }
  .a85-read { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* pause motion: freeze flows and photo drift (handled globally), keep states instant */
.motion-paused .a85-photo-frame span { transition: none; }
.motion-paused .a85-az5-cap { transition: none; }
