/* ============================================================
   components.css — 控件、图表、卡片、潮间带示意、物种列表
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.68rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}
.btn:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: rgba(95, 211, 243, 0.08);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--abyss);
  font-weight: 600;
}
.btn--primary:hover {
  background: #7adcff;
  border-color: #7adcff;
  color: var(--abyss);
  box-shadow: 0 8px 26px -10px rgba(95, 211, 243, 0.8);
}
.btn--ghost { color: var(--ink-mute); }
.btn__icon { font-size: 0.7em; line-height: 1; }
.btn.is-playing { border-color: var(--accent-warm); color: var(--accent-warm); }

/* ---------- 滑块 ---------- */
.control { display: flex; flex-direction: column; gap: 0.5rem; flex: 1 1 220px; }
.control--stack { flex: 1 1 100%; }
.control__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.control__label output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.control__hint {
  font-size: 0.7rem;
  color: #5d7386;
  letter-spacing: 0.04em;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-deep), var(--line-strong));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--deep);
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px rgba(95, 211, 243, 0.6);
  transition: transform 0.2s var(--ease-out);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--line-strong);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--deep);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---------- 工具面板通用 ---------- */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
  padding: clamp(1.2rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, rgba(12, 28, 44, 0.7), rgba(5, 11, 20, 0.85));
}
.tool__panel { display: flex; flex-direction: column; gap: 1.6rem; }
.tool__stage { position: relative; }
.tool__legend { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tool--zone { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.tool--profile { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }

/* ---------- 潮汐曲线 ---------- */
.tidechart { margin: 0; position: relative; }
.tidechart__svg {
  width: 100%;
  height: auto;
  display: block;
  background: linear-gradient(180deg, rgba(3, 8, 16, 0.7), rgba(3, 6, 12, 0.35));
  border-radius: var(--radius);
}
.tidechart__readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.4rem;
  padding: 1.1rem 1.2rem 0.2rem;
}
.readout { display: flex; flex-direction: column; gap: 0.15rem; }
.readout__k {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.readout__v {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.readout__v.is-warm { color: var(--accent-warm); }
.readout__v.is-green { color: var(--accent-green); }

/* SVG 内部元素 */
.grid-line { stroke: rgba(150, 195, 225, 0.1); stroke-width: 1; }
.axis-line { stroke: rgba(150, 195, 225, 0.28); stroke-width: 1; }
.axis-text {
  fill: #6d8598;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.series-m2 { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.series-k1 { fill: none; stroke: var(--accent-warm); stroke-width: 1.6; stroke-dasharray: 5 4; opacity: 0.9; }
.series-total { fill: none; stroke: var(--accent-green); stroke-width: 2.8; stroke-linecap: round; }
.series-area { fill: url(#tideFill); opacity: 0.5; }
.marker-line { stroke: var(--accent-warm); stroke-width: 1; stroke-dasharray: 3 3; }
.marker-dot { fill: var(--accent-warm); filter: drop-shadow(0 0 6px rgba(242, 184, 128, 0.9)); }
.peak-label {
  fill: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 10px;
}
.trough-label { fill: var(--accent); font-family: var(--font-mono); font-size: 10px; }

/* ---------- 海洋剖面 ---------- */
.profile { width: 100%; height: auto; display: block; }
.profile-grid { stroke: rgba(150, 195, 225, 0.08); stroke-width: 1; }
.profile-axis { stroke: rgba(150, 195, 225, 0.24); stroke-width: 1; }
.profile-text {
  fill: #6d8598;
  font-family: var(--font-mono);
  font-size: 10px;
}
.profile-range {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.profile-range--v { fill: #6d8598; font-size: 9px; }
.profile-line { fill: none; stroke-width: 2.2; stroke-linecap: round; transition: opacity 0.35s var(--ease-out); }
.profile-line.is-off { opacity: 0; }
.profile-line--temp { stroke: var(--temp); }
.profile-line--sal  { stroke: var(--sal); }
.profile-line--dens { stroke: var(--dens); }
.profile-line--light{ stroke: var(--light); }
.profile-dot { transition: opacity 0.35s var(--ease-out); }
.profile-dot.is-off { opacity: 0; }
.profile-dot--temp { fill: var(--temp); }
.profile-dot--sal  { fill: var(--sal); }
.profile-dot--dens { fill: var(--dens); }
.profile-dot--light{ fill: var(--light); }
.probe-marker { stroke: #fff; stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.75; }
.probe-tag {
  fill: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  paint-order: stroke fill;
  stroke: rgba(3, 8, 16, 0.85);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.zone-band { opacity: 0.16; }
.zone-band-label {
  fill: #7d94a6;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-mute);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
}
.legend__item.is-active { color: var(--ink); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.legend__item:hover { border-color: var(--accent); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend__swatch--temp { background: var(--temp); }
.legend__swatch--sal  { background: var(--sal); }
.legend__swatch--dens { background: var(--dens); }
.legend__swatch--light{ background: var(--light); }

/* ---------- 探针读数 ---------- */
.probes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.probe {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(3, 6, 12, 0.4);
}
.probe__k { font-size: 0.7rem; letter-spacing: 0.12em; color: var(--ink-mute); text-transform: uppercase; }
.probe__v {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- 潮间带示意 ---------- */
.zone {
  position: relative;
  height: clamp(400px, 62vh, 560px);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, #0a2438 0%, #07202f 55%, #041521 100%);
  border: 1px solid var(--line);
}
.zone__bands { position: absolute; inset: 0; z-index: 1; }
.zone__band {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
}
.zone__band-label {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  white-space: nowrap;
}
.zone__water {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(95, 211, 243, 0.34), rgba(42, 159, 208, 0.18) 55%, rgba(42, 159, 208, 0.07));
  transition: height 0.35s var(--ease-io);
  pointer-events: none;
}
.zone__water::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -6px;
  height: 10px;
  background:
    radial-gradient(14px 8px at 12% 60%, rgba(95, 211, 243, 0.6), transparent 70%),
    radial-gradient(20px 10px at 38% 40%, rgba(95, 211, 243, 0.5), transparent 70%),
    radial-gradient(16px 9px at 66% 55%, rgba(95, 211, 243, 0.55), transparent 70%),
    radial-gradient(22px 11px at 88% 35%, rgba(95, 211, 243, 0.45), transparent 70%);
  animation: waveDrift 7s linear infinite;
}
.zone__tide {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(242, 184, 128, 0.75);
  transition: bottom 0.35s var(--ease-io);
  pointer-events: none;
  z-index: 3;
}
.zone__tide-label {
  position: absolute;
  left: 4.8rem;
  top: 0.4rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(4, 12, 22, 0.7);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: var(--accent-warm);
  white-space: nowrap;
}
.zone__hw {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(111, 214, 168, 0.55);
  pointer-events: none;
  z-index: 2;
}
.zone__hw-label {
  position: absolute;
  right: 0.9rem;
  top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--accent-green);
  white-space: nowrap;
}
.zone__axis { position: absolute; left: 0; top: 0; bottom: 0; width: 58px; z-index: 4; }
.zone__edge {
  position: absolute;
  left: 58px;
  right: 0;
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 2;
}
.zone__edge-label {
  position: absolute;
  right: 0.6rem;
  top: -1.25rem;
  padding: 0 0.35rem;
  border-radius: 4px;
  background: rgba(4, 12, 22, 0.72);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.zone__edge--hw .zone__edge-label { color: var(--accent-green); }
.zone__edge--lw .zone__edge-label { color: var(--accent-warm); }
.zone__tick {
  position: absolute;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.7rem;
  transform: translateY(-50%);
}
.zone__tick-mark { width: 10px; height: 1px; background: rgba(255, 255, 255, 0.25); flex: none; }
.zone__tick-text {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.zone__note {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.8;
  padding: 0.95rem 1.1rem;
  border-left: 2px solid var(--accent-deep);
  background: rgba(3, 6, 12, 0.4);
  border-radius: 0 8px 8px 0;
}

/* ---------- 物种手风琴 ---------- */
.species { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.species__item { border-bottom: 1px solid var(--line); }
.species__item:first-child { border-top: 1px solid var(--line); }
.species__btn {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.85rem 0.2rem;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: color 0.25s var(--ease-out);
}
.species__btn::after {
  content: "+";
  margin-left: auto;
  color: var(--accent-deep);
  font-family: var(--font-mono);
  transition: transform 0.3s var(--ease-out);
}
.species__item.is-open .species__btn::after { transform: rotate(45deg); }
.species__btn:hover { color: var(--accent); }
.species__name { font-size: 1.05rem; font-family: var(--font-serif); }
.species__en { font-size: 0.74rem; color: var(--ink-mute); font-style: italic; }
.species__panel {
  overflow: hidden;
  height: 0;
  transition: height 0.4s var(--ease-out);
}
.species__panel p {
  margin: 0;
  padding: 0 0.2rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.85;
}

/* ---------- 说明卡片 ---------- */
.full__notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin-top: clamp(1.8rem, 4vw, 3rem);
}
.full__notes--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.note {
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 20, 32, 0.6);
  transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.note:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.note h3 {
  font-size: 1.08rem;
  margin-bottom: 0.6rem;
}
.note p { font-size: 0.9rem; color: var(--ink-mute); line-height: 1.85; }
.note--warn { border-color: rgba(242, 184, 128, 0.28); }
.note--warn h3 { color: var(--accent-warm); }

/* ---------- 数据网格 ---------- */
.datagrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.datagrid--wide { grid-template-columns: minmax(0, 1fr); margin-top: 1rem; }
.datacell {
  padding: 1.5rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(12, 28, 44, 0.6), rgba(5, 11, 20, 0.7));
  transition: border-color 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}
.datacell:hover { border-color: var(--accent-deep); transform: translateY(-4px); }
.datacell__num {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 1.4rem + 2.4vw, 3.1rem);
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.datacell__unit { font-family: var(--font-mono); font-size: 0.9rem; color: var(--accent-deep); margin-left: 0.3rem; }
.datacell h3 { font-size: 1.02rem; margin: 0.9rem 0 0.5rem; }
.datacell p { font-size: 0.85rem; color: var(--ink-mute); line-height: 1.8; }
.datacell--wide { max-width: 640px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .datagrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tool,
  .tool--zone { grid-template-columns: 1fr; }
  .full__notes,
  .full__notes--two { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .probes { grid-template-columns: 1fr; }
  .datagrid { grid-template-columns: 1fr; }
  /* 读数保持两列，避免移动端舞台被撑得过高 */
  .tidechart__readout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 1rem;
    padding: 0.85rem 1rem 0.15rem;
  }
}
