:root {
  --graphite: #262b33;
  --night: #161a21;
  --mist: #cfe0ec;
  --mist-light: #e8f1f7;
  --sky: #aac4dc;
  --steel: #4f77a0;
  --coral: #ff6f74;
  --coral-soft: #ffd6d8;
  --font-display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-head: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--graphite);
  background: var(--mist-light);
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

.display {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 0.95;
}

/* ---------- Header ---------- */
.site-header { background: var(--night); color: var(--mist); position: sticky; top: 0; z-index: 20; }
.site-header .bar {
  max-width: 1160px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { font-family: var(--font-head); font-weight: 600; text-decoration: none; }
.site-header nav { display: flex; gap: 0.5rem; }
.site-header nav a {
  text-decoration: none; padding: 0.4rem 1rem; border-radius: 999px;
  border: 1.5px solid transparent; transition: border-color .15s, transform .15s;
}
.site-header nav a:hover { border-color: var(--mist); transform: translateY(-1px); }
.site-header nav a[aria-current="page"] { background: var(--coral); color: var(--graphite); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(60% 80% at 85% 20%, rgba(79,119,160,.45), transparent 70%),
    radial-gradient(40% 50% at 5% 100%, rgba(255,111,116,.18), transparent 70%),
    var(--graphite);
  color: var(--mist-light);
  padding: 3rem 1.5rem 3.5rem;
  overflow: hidden;
}
.hero .inner {
  max-width: 1160px; margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 2rem; align-items: center;
}
.hero h1 { font-size: clamp(3.4rem, 9vw, 7.2rem); margin-bottom: 1.25rem; }
.hero h1 span { color: var(--coral); }
.hero .role { font-size: 1.2rem; color: var(--mist); max-width: 36ch; margin-bottom: 1.75rem; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 600; border: 0; cursor: pointer;
  font: inherit; font-weight: 600;
  padding: 0.8rem 1.5rem; border-radius: 10px; background: var(--coral); color: var(--graphite);
  transition: transform .15s, background .15s, box-shadow .15s;
}
.btn:hover { background: #ff878b; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255,111,116,.35); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; box-shadow: none; }

.topo-wrap { position: relative; }
.topo { width: 100%; height: auto; display: block; touch-action: manipulation; }
.topo .link { stroke: var(--mist); stroke-opacity: .45; stroke-width: 1.6; }
.topo .tnode { cursor: pointer; }
.topo .dot { fill: var(--mist); transition: transform .2s, fill .2s; transform-box: fill-box; transform-origin: center; }
.topo .tnode:hover .dot, .topo .tnode:focus-visible .dot, .topo .tnode.on .dot { transform: scale(1.7); fill: #fff; }
.topo .tnode.hit .dot { fill: var(--coral); transform: scale(2); }
.topo .me .dot { fill: var(--coral); }
.topo .halo { fill: none; stroke: var(--coral); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: ping 2.8s ease-out infinite; }
.topo .lbl { fill: var(--mist-light); font: 600 15px var(--font-head); text-anchor: middle; opacity: 0; transition: opacity .2s; pointer-events: none; }
.topo .tnode:hover .lbl, .topo .tnode:focus-visible .lbl, .topo .tnode.on .lbl, .topo .me .lbl { opacity: 1; }
.topo .packet { fill: var(--coral); stroke: #fff; stroke-width: 2; }
.topo-caption { text-align: center; color: var(--mist); font-size: .95rem; margin-top: .25rem; }
.topo-caption output { color: var(--coral); font-weight: 600; }
@keyframes ping { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.9); opacity: 0; } }

/* ---------- Tiles ---------- */
.section { max-width: 1160px; margin: 0 auto; padding: 4rem 1.5rem 1rem; }
.section-title { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: 1.5rem; }
.section-title span { color: var(--coral); }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tile {
  position: relative; overflow: hidden; border-radius: 6px; aspect-ratio: 1 / 1.02;
  padding: 1.25rem; display: flex; flex-direction: column; justify-content: flex-end;
  transform: perspective(800px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .25s ease, box-shadow .25s ease;
  box-shadow: 0 6px 18px rgba(38,43,51,.15);
  isolation: isolate;
}
.tile:hover, .tile.is-on { box-shadow: 0 18px 38px rgba(38,43,51,.28); }
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.28), transparent 55%);
  transition: opacity .25s;
}
.tile:hover::after, .tile.is-on::after { opacity: 1; }
.tile .art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.tile-title { position: relative; z-index: 2; font-size: clamp(2.3rem, 4.6vw, 3.6rem); margin-bottom: .6rem; }
.tile-title span { white-space: nowrap; }
.tile-tag { position: relative; z-index: 2; font-size: .85rem; line-height: 1.35; max-width: 24ch; padding-bottom: .55rem; }
.tile-tag::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 38px;
  background: var(--coral); transition: width .35s ease;
}
.tile:hover .tile-tag::after, .tile.is-on .tile-tag::after { width: 100%; }
.tile-brand { position: absolute; right: 1rem; bottom: .9rem; z-index: 2; font: 600 .72rem var(--font-head); letter-spacing: .08em; opacity: .7; }

.t-mist  { background: linear-gradient(160deg, #d4e4f0, var(--sky)); color: var(--graphite); }
.t-mist .tile-title span { color: var(--coral); }
.t-dark  { background: radial-gradient(90% 70% at 70% 15%, #2d3644, var(--night)); color: var(--mist-light); }
.t-dark .tile-title span { color: var(--coral); }
.t-coral { background: linear-gradient(160deg, #ff8a8e, var(--coral)); color: var(--graphite); }
.t-coral .tile-title span { color: #fff; }
.t-coral .tile-tag::after { background: var(--graphite); }
.t-steel { background: linear-gradient(160deg, #6a91b8, var(--steel)); color: #fff; }
.t-steel .tile-title span { color: var(--coral-soft); }

.outline { -webkit-text-stroke: 1.5px var(--mist-light); color: transparent !important; }

/* tile artwork motion (hover / tap only) */
.art .pkt { transform-box: fill-box; }
.tile:hover .pkt, .tile.is-on .pkt { animation: pktmove 1.6s linear infinite; }
.tile:hover .pkt:nth-of-type(2), .tile.is-on .pkt:nth-of-type(2) { animation-delay: .5s; }
.tile:hover .pkt:nth-of-type(3), .tile.is-on .pkt:nth-of-type(3) { animation-delay: 1s; }
@keyframes pktmove { 0% { transform: translateX(-50px); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { transform: translateX(170px); opacity: 0; } }

.art .wifi path { opacity: .25; transition: opacity .2s; }
.tile:hover .wifi path, .tile.is-on .wifi path { animation: wave 1.2s ease-in-out infinite; }
.tile:hover .wifi path:nth-child(2), .tile.is-on .wifi path:nth-child(2) { animation-delay: .2s; }
.tile:hover .wifi path:nth-child(3), .tile.is-on .wifi path:nth-child(3) { animation-delay: .4s; }
@keyframes wave { 0%,100% { opacity: .2; } 50% { opacity: 1; } }

.art .plug { transition: transform .5s cubic-bezier(.2,.9,.3,1.2); transform: translateX(-26px); }
.tile:hover .plug, .tile.is-on .plug { transform: translateX(42px); }

.art .bar { transform-box: fill-box; transform-origin: bottom; }
.tile:hover .bar, .tile.is-on .bar { animation: bounce .9s ease-in-out infinite alternate; }
.tile:hover .bar:nth-child(2n), .tile.is-on .bar:nth-child(2n) { animation-delay: .15s; }
.tile:hover .bar:nth-child(3n), .tile.is-on .bar:nth-child(3n) { animation-delay: .3s; }
@keyframes bounce { from { transform: scaleY(.45); } to { transform: scaleY(1.1); } }

.art .led { fill: var(--mist); }
.art .led.c { fill: var(--coral); }
.tile:hover .led, .tile.is-on .led { animation: blink .8s steps(2, jump-none) infinite; }
.tile:hover .led:nth-of-type(2n), .tile.is-on .led:nth-of-type(2n) { animation-delay: .25s; }
.tile:hover .led:nth-of-type(3n), .tile.is-on .led:nth-of-type(3n) { animation-delay: .5s; }
@keyframes blink { 0% { opacity: 1; } 100% { opacity: .15; } }

.art .flow { stroke-dasharray: 6 8; }
.tile:hover .flow, .tile.is-on .flow { animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }
.art .ring { transform-box: fill-box; transform-origin: center; opacity: 0; }
.tile:hover .ring, .tile.is-on .ring { animation: ring 1.8s ease-out infinite; }
.tile:hover .ring.r2, .tile.is-on .ring.r2 { animation-delay: .9s; }
@keyframes ring { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }

/* ---------- About band ---------- */
.about { background: var(--mist); margin-top: 3.5rem; border-top: 8px solid var(--coral); }
.about .wrap { max-width: 1160px; margin: 0 auto; padding: 3.5rem 1.5rem; display: grid; grid-template-columns: 1fr 1.4fr; gap: 2.5rem; }
.about h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.facts { list-style: none; border-top: 2px solid var(--graphite); }
.facts li { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #98b3c8; transition: padding-left .2s, background .2s; }
.facts li:hover { padding-left: .75rem; background: rgba(255,255,255,.35); }
.facts .k { font-weight: 600; }

/* ---------- Focus page ---------- */
.page-head { max-width: 1160px; margin: 0 auto; padding: 3.5rem 1.5rem 1.5rem; }
.page-head h1 { font-size: clamp(3rem, 8vw, 5.5rem); }
.page-head h1 span { color: var(--coral); }
.page-head p { max-width: 58ch; margin-top: 1rem; }
.tiles.four { grid-template-columns: repeat(4, 1fr); padding: 0; }
.tiles.four .tile { aspect-ratio: 1 / 1.38; }
.tiles.four .tile-title { font-size: clamp(1.9rem, 3.2vw, 2.7rem); }
.tiles.four .tile-tag { max-width: 28ch; }

.trace { background: var(--graphite); color: var(--mist-light); margin-top: 4rem; }
.trace .wrap { max-width: 1160px; margin: 0 auto; padding: 3.5rem 1.5rem 4rem; }
.trace h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin-bottom: .75rem; }
.trace h2 span { color: var(--coral); }
.trace p { color: var(--mist); max-width: 58ch; margin-bottom: 2rem; }
.hops { display: flex; align-items: flex-start; margin-bottom: 2rem; }
.hop { width: 92px; text-align: center; flex: none; }
.hop .node {
  width: 46px; height: 46px; border-radius: 50%; margin: 0 auto .5rem;
  background: var(--graphite-2, #36404d); border: 3px solid var(--mist);
  transition: background .25s, border-color .25s, transform .25s;
}
.hop.hit .node { background: var(--coral); border-color: #fff; transform: scale(1.18); }
.hop b { display: block; font: 600 .95rem var(--font-head); }
.hop small { display: block; color: var(--coral-soft); min-height: 1.4em; font-size: .9rem; }
.wire { flex: 1; height: 4px; margin-top: 21px; background: rgba(207,224,236,.25); position: relative; border-radius: 2px; }
.wire i { position: absolute; inset: 0; background: var(--coral); border-radius: 2px; transform: scaleX(0); transform-origin: left; transition: transform .55s linear; }
.wire.on i { transform: scaleX(1); }
.trace output { margin-left: 1rem; color: var(--mist-light); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: var(--mist); padding: 1.5rem; text-align: center; font-size: .95rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .tiles, .tiles.four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .hero .inner, .about .wrap { grid-template-columns: 1fr; }
  .topo-wrap { max-width: 420px; margin: 0 auto; }
  .facts li { grid-template-columns: 1fr; gap: .2rem; }
  .hops { flex-direction: column; align-items: flex-start; }
  .hop { display: flex; align-items: center; gap: .9rem; width: auto; text-align: left; }
  .hop .node { margin: 0; }
  .wire { width: 4px; height: 28px; margin: 0 0 0 21px; flex: none; }
  .wire i { transform: scaleY(0); transform-origin: top; }
  .wire.on i { transform: scaleY(1); }
  .trace output { display: block; margin: 1rem 0 0; }
}
@media (max-width: 520px) {
  .tiles, .tiles.four { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .topo .halo { animation: none; opacity: .5; }
  .tile, .tile * { animation: none !important; transition: none !important; }
  .tile { transform: none; }
}
