/* =========================================================
   DayOne effects — viewport-triggered figure animations
   ========================================================= */

/* ---------- Page hero (inner pages) ---------- */
.page-hero {
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 5vw, 3.5rem);
  background:
    radial-gradient(ellipse 70% 50% at 90% 0%, rgba(15, 154, 143, 0.07), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  border-bottom: 1px solid var(--line);
}
.page-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 1.25rem;
}
.page-hero__title {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  max-width: 18ch;
  margin-bottom: 1rem;
}
.page-hero .lead { margin-bottom: 0; }
.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}
.subtabs a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  text-decoration: none;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.subtabs a:hover,
.subtabs a.is-active {
  color: var(--text);
  border-color: rgba(15, 154, 143, 0.45);
  background: rgba(15, 154, 143, 0.08);
  text-decoration: none;
}

/* ---------- Animated figure shell ---------- */
.fx-figure {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(15, 23, 32, 0.06);
}
.fx-figure__base {
  display: block;
  width: 100%;
  height: auto;
}
.fx-figure__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.fx-figure__cap {
  margin: 0.85rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.fx-figure__cap b {
  color: var(--accent-2);
  font-weight: 500;
}

/* ---------- Map: SG–Bintan fibre ---------- */
.fx-map .fx-pulse {
  transform-origin: center;
  opacity: 0;
  transform: scale(0.4);
}
.fx-map.is-on .fx-pulse {
  opacity: 0.85;
  transform: scale(1);
}
.fx-map .fx-pulse--b { animation-delay: 0.35s; }
.fx-map .fx-fibre {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 4 7;
  stroke-dashoffset: 0;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(15, 154, 143, 0.55));
}
.fx-map.is-on .fx-fibre {
  opacity: 1;
  animation: fx-flow 2.2s linear infinite, fx-fade-in 0.6s ease both;
}
.fx-map .fx-fibre--ring {
  stroke: #e85d3a;
  filter: drop-shadow(0 0 4px rgba(232, 93, 58, 0.55));
}
.fx-map.is-on .fx-fibre--ring {
  animation: fx-flow 3.1s linear infinite, fx-fade-in 0.6s ease both;
}
.fx-map .fx-fibre-glow--ring {
  stroke: rgba(232, 93, 58, 0.35);
}
.fx-map .fx-fibre-glow {
  fill: none;
  stroke: rgba(15, 154, 143, 0.25);
  stroke-width: 8;
  stroke-linecap: round;
  opacity: 0;
}
.fx-map.is-on .fx-fibre-glow {
  opacity: 1;
  transition: opacity 0.8s ease 0.2s;
}
.fx-map .fx-label {
  opacity: 0;
  transform: translateY(6px);
}
.fx-map.is-on .fx-label {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.fx-map.is-on .fx-label--1 { transition-delay: 0.45s; }
.fx-map.is-on .fx-label--2 { transition-delay: 0.7s; }
.fx-map.is-on .fx-label--3 { transition-delay: 0.95s; }

@keyframes fx-pulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.85); }
}
@keyframes fx-flow {
  to { stroke-dashoffset: -22; }
}
@keyframes fx-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Power chain sequential light ---------- */
.fx-power .fx-seg {
  fill: none;
  stroke: rgba(232, 93, 58, 0.18);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fx-power .fx-seg-flow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 8;
  stroke-dashoffset: 0;
  opacity: 0;
  filter: drop-shadow(0 0 5px rgba(232, 93, 58, 0.55));
}
.fx-power.is-on .fx-seg-flow {
  opacity: 1;
  animation: fx-flow 1.35s linear infinite;
}
.fx-power.is-on .fx-seg-flow--1 { animation-delay: 0s; transition: opacity 0.3s; }
.fx-power.is-on .fx-seg-flow--2 { animation-delay: 0.25s; }
.fx-power.is-on .fx-seg-flow--3 { animation-delay: 0.5s; }
.fx-power.is-on .fx-seg-flow--4 { animation-delay: 0.75s; }
.fx-power .fx-node {
  fill: #cbd5e1;
  stroke: #fff;
  stroke-width: 2;
  opacity: 0.5;
  transform-box: fill-box;
  transform-origin: center;
}
.fx-power.is-on .fx-node {
  fill: var(--accent);
  opacity: 1;
  animation: fx-node-pop 0.55s var(--ease-out) both;
}
.fx-power.is-on .fx-node--1 { animation-delay: 0.05s; }
.fx-power.is-on .fx-node--2 { animation-delay: 0.35s; }
.fx-power.is-on .fx-node--3 { animation-delay: 0.65s; }
.fx-power.is-on .fx-node--4 { animation-delay: 0.95s; }
.fx-power.is-on .fx-node--5 { animation-delay: 1.15s; }
.fx-power.is-on .fx-node--6 { animation-delay: 1.25s; }
.fx-power.is-on .fx-node--7 { animation-delay: 1.35s; }
.fx-power .fx-tag {
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  fill: var(--text-2);
}
.fx-power.is-on .fx-tag {
  opacity: 1;
  transition: opacity 0.5s ease;
}
.fx-power.is-on .fx-tag--1 { transition-delay: 0.2s; }
.fx-power.is-on .fx-tag--2 { transition-delay: 0.5s; }
.fx-power.is-on .fx-tag--3 { transition-delay: 0.8s; }
.fx-power.is-on .fx-tag--4 { transition-delay: 1.1s; }

@keyframes fx-node-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ---------- Cooling loop ---------- */
.fx-cool .fx-pipe {
  fill: none;
  stroke: rgba(15, 154, 143, 0.2);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fx-cool .fx-pipe-flow {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 5 8;
  stroke-dashoffset: 0;
  opacity: 0;
  filter: drop-shadow(0 0 4px rgba(15, 154, 143, 0.5));
}
.fx-cool.is-on .fx-pipe-flow {
  opacity: 1;
  animation: fx-flow 1.5s linear infinite;
}
.fx-cool .fx-hotspot {
  fill: rgba(15, 154, 143, 0.08);
  stroke: rgba(15, 154, 143, 0.35);
  stroke-width: 1.5;
  opacity: 0;
  rx: 8;
}
.fx-cool.is-on .fx-hotspot {
  opacity: 1;
  animation: fx-hotspot 2.8s ease-in-out infinite;
}
.fx-cool.is-on .fx-hotspot--1 { animation-delay: 0s; }
.fx-cool.is-on .fx-hotspot--2 { animation-delay: 0.45s; }
.fx-cool.is-on .fx-hotspot--3 { animation-delay: 0.9s; }
.fx-cool .fx-cool-label {
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  fill: var(--accent-2);
}
.fx-cool.is-on .fx-cool-label {
  opacity: 1;
  transition: opacity 0.6s ease;
}
.fx-cool.is-on .fx-cool-label--1 { transition-delay: 0.3s; }
.fx-cool.is-on .fx-cool-label--2 { transition-delay: 0.55s; }
.fx-cool.is-on .fx-cool-label--3 { transition-delay: 0.8s; }

@keyframes fx-hotspot {
  0%, 100% { fill: rgba(15, 154, 143, 0.06); stroke-opacity: 0.35; }
  50% { fill: rgba(15, 154, 143, 0.18); stroke-opacity: 0.85; }
}

/* ---------- Latency bars ---------- */
.latency {
  display: grid;
  gap: 0.85rem;
}
.latency__row {
  display: grid;
  grid-template-columns: 10rem 1fr 4.5rem;
  gap: 1rem;
  align-items: center;
}
.latency__name {
  font-size: 0.9rem;
  color: var(--text-2);
}
.latency__bar {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
}
.latency__bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 1.1s var(--ease-out);
}
.latency.is-on .latency__bar > span { width: var(--w, 50%); }
.latency__val {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  text-align: right;
}
@media (max-width: 640px) {
  .latency__row { grid-template-columns: 1fr 3.5rem; }
  .latency__name { grid-column: 1 / -1; }
}

/* ---------- Timeline (service) ---------- */
.tl {
  position: relative;
  display: grid;
  gap: 0;
  padding-left: 1.5rem;
}
.tl::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--bg-3);
  border-radius: 2px;
}
.tl__progress {
  position: absolute;
  left: 5px;
  top: 8px;
  width: 2px;
  height: 0;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 2px;
  transition: height 1.4s var(--ease-out);
}
.tl.is-on .tl__progress { height: calc(100% - 16px); }
.tl__item {
  position: relative;
  padding: 0 0 2rem 1.75rem;
  opacity: 0;
  transform: translateX(-10px);
}
.tl.is-on .tl__item {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}
.tl.is-on .tl__item:nth-child(2) { transition-delay: 0.1s; }
.tl.is-on .tl__item:nth-child(3) { transition-delay: 0.2s; }
.tl.is-on .tl__item:nth-child(4) { transition-delay: 0.35s; }
.tl.is-on .tl__item:nth-child(5) { transition-delay: 0.5s; }
.tl.is-on .tl__item:nth-child(6) { transition-delay: 0.65s; }
.tl__dot {
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent-2);
  box-shadow: 0 0 0 4px rgba(15, 154, 143, 0.12);
}
.tl__item.is-key .tl__dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(232, 93, 58, 0.15);
}
.tl__date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  display: block;
  margin-bottom: 0.35rem;
}
.tl__item.is-key .tl__date { color: var(--accent); }
.tl__item h3 {
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}
.tl__item p {
  margin: 0;
  max-width: 42rem;
  font-size: 0.95rem;
}

/* ---------- Tier cards ---------- */
.tier-flag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}
.card--rec {
  border-color: rgba(232, 93, 58, 0.35);
  box-shadow: 0 0 0 1px rgba(232, 93, 58, 0.12), 0 16px 40px rgba(15, 23, 32, 0.05);
}
.tier-months {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ---------- Spec table ---------- */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.specsheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.specsheet caption {
  text-align: left;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
}
.specsheet th,
.specsheet td {
  padding: 0.75rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: top;
}
.specsheet thead th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-2);
  font-weight: 500;
}
.specsheet tbody th {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.specsheet .num {
  font-family: var(--font-mono);
  color: var(--text);
}
.specsheet tr:last-child th,
.specsheet tr:last-child td { border-bottom: 0; }

/* ---------- Info chips under figures ---------- */
.chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
}
.chip b { color: var(--accent-2); font-weight: 500; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-map .fx-pulse,
  .fx-map .fx-fibre,
  .fx-power .fx-seg-flow,
  .fx-cool .fx-pipe-flow,
  .fx-cool .fx-hotspot {
    animation: none !important;
  }
  .fx-map .fx-pulse,
  .fx-map .fx-fibre,
  .fx-map .fx-fibre-glow,
  .fx-map .fx-label,
  .fx-power .fx-seg-flow,
  .fx-power .fx-node,
  .fx-power .fx-tag,
  .fx-cool .fx-pipe-flow,
  .fx-cool .fx-hotspot,
  .fx-cool .fx-cool-label,
  .tl__item {
    opacity: 1 !important;
    transform: none !important;
  }
  .fx-power .fx-node { fill: var(--accent); }
  .latency__bar > span { width: var(--w, 50%) !important; transition: none !important; }
  .tl__progress { height: calc(100% - 16px) !important; transition: none !important; }
}

/* ---------- Utilities used by inner pages ---------- */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.rule { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------- Modular assembly (autoplay timeline) ---------- */
.mod-morph {
  position: relative;
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(15, 154, 143, 0.06), transparent 60%),
    var(--bg);
  border-block: 1px solid var(--line);
}
.mod-morph__head { margin-bottom: 1.25rem; }
.mod-morph__head .h2 { max-width: 18ch; margin-bottom: 0.5rem; }
.mod-morph__head .lead { margin: 0; max-width: 46ch; color: var(--text-2); }
.mod-morph__viewport {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0b1218;
  box-shadow:
    0 24px 64px rgba(15, 23, 32, 0.12),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  aspect-ratio: 16 / 9;
  max-height: min(68vh, 720px);
}
.mod-morph__stack { position: absolute; inset: 0; }
.mod-morph__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  will-change: opacity, transform;
  pointer-events: none;
}
.mod-morph__frame[data-mod-frame="0"] { opacity: 1; transform: none; }
.mod-morph__frame.is-active { z-index: 2; }
.mod-morph__hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 3.5rem 1.25rem 1.35rem;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 14, 20, 0.72) 55%, rgba(8, 14, 20, 0.88) 100%);
  color: #f4f6f8;
  pointer-events: none;
}
.mod-morph__cap {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  max-width: 36ch;
}
.mod-morph__cap b {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7dd3c7;
  margin-bottom: 0.35rem;
  font-weight: 500;
}
.mod-morph__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  pointer-events: auto;
}
.mod-morph__steps button {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 246, 248, 0.55);
  border: 1px solid rgba(244, 246, 248, 0.18);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: transparent;
  cursor: pointer;
}
.mod-morph__steps button span {
  color: rgba(244, 246, 248, 0.35);
  margin-right: 0.25rem;
}
.mod-morph__steps button.is-done {
  color: rgba(244, 246, 248, 0.75);
  border-color: rgba(15, 154, 143, 0.35);
}
.mod-morph__steps button.is-on {
  color: #fff;
  background: rgba(15, 154, 143, 0.35);
  border-color: rgba(125, 211, 199, 0.65);
}
.mod-morph__steps button.is-on span { color: #7dd3c7; }
.mod-morph__rail {
  position: absolute;
  left: 1.15rem;
  right: 1.15rem;
  bottom: 0.55rem;
  height: 10px;
  z-index: 4;
  cursor: pointer;
  touch-action: none;
}
.mod-morph__rail::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.22);
}
.mod-morph__rail-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  height: 3px;
  border-radius: 99px;
  background: #7dd3c7;
  transform-origin: left center;
  transform: scaleX(0);
}

@media (max-width: 720px) {
  .mod-morph__viewport { max-height: 52vh; border-radius: 14px; }
  .mod-morph__hud { padding: 2.5rem 0.9rem 1.2rem; }
  .mod-morph__steps button { font-size: 0.58rem; padding: 0.3rem 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mod-morph__frame { transform: none !important; }
}
