/* ==========================================================================
   color-words.css
   Full-bleed panel gallery. Panels open on hover, focus, or activation, so the
   piece works with a mouse, a keyboard, and a touchscreen.
   ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #000;
  color: #fff;
}

body { display: flex; flex-direction: column; }

:focus-visible { outline: 2px solid #fff; outline-offset: -6px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Framing --- */
.piece-header {
  position: relative;
  z-index: 30;
  padding: 20px 24px;
  background: #000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.piece-header h1 {
  margin: 0 0 6px 0;
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.piece-header p {
  margin: 0;
  max-width: 70ch;
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
}
.piece-header a { color: #fff; }

/* --- Gallery --- */
.gallery {
  flex: 1;
  display: flex;
  width: 100%;
  min-height: 0;
}

.panel {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: flex 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.panel:last-child { border-right: none; }

.panel:hover,
.panel:focus-visible,
.panel[aria-expanded="true"] { flex: 6; }

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.panel-label {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 82%;
  align-items: center;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.panel:hover .content,
.panel:focus-visible .content,
.panel[aria-expanded="true"] .content { opacity: 1; transition-delay: 0.3s; }

.static-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  margin-bottom: 3rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.nodes {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.color-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.9);
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.name { font-size: 1.25rem; font-weight: 300; margin-bottom: 0.5rem; }
.gloss { font-size: 0.75rem; opacity: 0.8; margin-bottom: 0.35rem; text-transform: none; letter-spacing: 0.05em; }
.hex { font-family: "Courier New", Courier, monospace; font-size: 0.6875rem; letter-spacing: 0.2em; opacity: 0.6; }

/* --- Background gradients --- */
@keyframes flow-horizontal {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes flow-vertical {
  0%   { background-position: 50% 0%; }
  50%  { background-position: 50% 100%; }
  100% { background-position: 50% 0%; }
}

.bg-tiv {
  background: linear-gradient(270deg, #0A0A0A, #1B262C, #F8F9FA, #E3E8ED, #8B0000, #D2691E);
  background-size: 400% 400%;
  animation: flow-horizontal 24s ease-in-out infinite;
}
.bg-greek {
  background: linear-gradient(180deg, #FFFFFF, #D3D9DF, #111A22, #050505, #2A0800);
  background-size: 300% 300%;
  animation: flow-vertical 20s ease-in-out infinite;
}
.bg-qing {
  background: radial-gradient(circle at center, #006064, #004D40, #013220, #080A0F, #1A1A24);
  background-size: 200% 200%;
  animation: flow-horizontal 18s ease-in-out infinite;
}
.bg-russian {
  background: linear-gradient(135deg, #000040, #0000CD, #1E90FF, #87CEEB, #E0F7FA);
  background-size: 400% 400%;
  animation: flow-horizontal 16s ease-in-out infinite;
}
.bg-japanese {
  background: linear-gradient(45deg, #004D00, #228B22, #2E8B57, #20B2AA, #1E90FF, #0000CD);
  background-size: 400% 400%;
  animation: flow-horizontal 20s ease-in-out infinite;
}

/* --- Narrow screens: stack the panels --- */
@media (max-width: 900px) {
  .gallery { flex-direction: column; }
  .panel {
    flex: 1 1 auto;
    min-height: 96px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: min-height 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .panel:hover,
  .panel:focus-visible,
  .panel[aria-expanded="true"] { flex: 1 1 auto; min-height: 340px; }
  .content { width: 88%; }
  .nodes { flex-wrap: wrap; justify-content: center; gap: 24px; }
}

/* --- Motion preferences --- */
@media (prefers-reduced-motion: reduce) {
  .bg { animation: none; background-position: 50% 50%; }
  .panel, .content { transition: none; }
}

/* --- Per-term colors (data, kept out of the markup) --- */
.bar-tiv { background: linear-gradient(90deg, #0A0A0A, #1B262C, #F8F9FA, #E3E8ED, #8B0000, #D2691E); }
.bar-greek { background: linear-gradient(90deg, #FFFFFF, #D3D9DF, #111A22, #050505, #2A0800); }
.bar-qing { background: linear-gradient(90deg, #006064, #004D40, #013220, #080A0F, #1A1A24); }
.bar-russian { background: linear-gradient(90deg, #000040, #0000CD, #1E90FF, #87CEEB, #E0F7FA); }
.bar-japanese { background: linear-gradient(90deg, #004D00, #228B22, #2E8B57, #20B2AA, #1E90FF, #0000CD); }
.sw-0000cd { background: #0000CD; }
.sw-004d40 { background: #004D40; }
.sw-006064 { background: #006064; }
.sw-013220 { background: #013220; }
.sw-050505 { background: #050505; }
.sw-0a0a0a { background: #0A0A0A; }
.sw-20b2aa { background: #20B2AA; }
.sw-228b22 { background: #228B22; }
.sw-2a0800 { background: #2A0800; }
.sw-87ceeb { background: #87CEEB; }
.sw-8b0000 { background: #8B0000; }
.sw-f8f9fa { background: #F8F9FA; }
.sw-ffffff { background: #FFFFFF; }
