/* guide.css - the look of the figures of the guide to the Internet
 * Protocol, on top of ../../engine.css: the fields of the header in their
 * colours, bytes and bits, strips of bits, the AND of a mask, the tables
 * of routing and of NAT, the diagram of the header, the checksum, the
 * terminal of traceroute, the legend of the map and IPv6.
 */

/* cores dos campos do cabeçalho IP */
:root {
  --f-ver: #5C7394;
  --f-ihl: #7B8DA4;
  --f-dscp: #1F9483;
  --f-len: #B3800E;
  --f-id: #8E6A3C;
  --f-flags: #C04E73;
  --f-off: #C06F92;
  --f-ttl: #7A4EC2;
  --f-proto: #2A7FBD;
  --f-csum: #D4691F;
  --f-src: #2A8A55;
  --f-dst: #C73E3B;
  --f-flow: #1B93AA;
}
@media (prefers-color-scheme: dark) {
  :root {
    --f-ver: #93A7C6;
    --f-ihl: #AAB8CA;
    --f-dscp: #4FC4B2;
    --f-len: #E9BB4E;
    --f-id: #C9A57A;
    --f-flags: #E88AA8;
    --f-off: #EBA7C3;
    --f-ttl: #AC89EC;
    --f-proto: #6DB6EA;
    --f-csum: #F29B58;
    --f-src: #62C48F;
    --f-dst: #F07471;
    --f-flow: #6BCFE0;
  }
}
.f-ver { color: var(--f-ver); font-weight: 600; }
 .f-ihl { color: var(--f-ihl); font-weight: 600; }
.f-dscp { color: var(--f-dscp); font-weight: 600; }
 .f-len { color: var(--f-len); font-weight: 600; }
.f-id { color: var(--f-id); font-weight: 600; }
 .f-flags { color: var(--f-flags); font-weight: 600; }
.f-off { color: var(--f-off); font-weight: 600; }
 .f-ttl { color: var(--f-ttl); font-weight: 600; }
.f-proto { color: var(--f-proto); font-weight: 600; }
 .f-csum { color: var(--f-csum); font-weight: 600; }
.f-src { color: var(--f-src); font-weight: 600; }
 .f-dst { color: var(--f-dst); font-weight: 600; }
.f-flow { color: var(--f-flow); font-weight: 600; }
/* no IP e no TCP, o chip escolhido é vermelho */
.chip.on { background: color-mix(in srgb, var(--s-red) 14%, var(--card)); border-color: var(--c-red); color: var(--head); font-weight: 500; }
/* bytes */
.bytes-out { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.ch { border: 1px solid color-mix(in srgb, var(--h) 45%, var(--line)); background: color-mix(in srgb, var(--h) 7%, var(--card)); border-radius: 10px; padding: 0.4rem 0.5rem 0.45rem; text-align: center; }
.ch-glyph { font-family: var(--sans); font-weight: 600; font-size: 1.35rem; color: var(--h); line-height: 1.2; }
.ch-bytes { display: flex; gap: 0.35rem; margin-top: 0.2rem; }
.byte .hex { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }
.byte .bin { font-family: var(--mono); font-size: 0.86rem; letter-spacing: 0.02em; }
.byte .bin .one { color: var(--head); font-weight: 600; }
.byte .bin .zero { color: var(--muted); opacity: 0.75; }
.bytes-sum { margin-top: 0.8rem; font-size: 0.97rem; color: var(--muted); }
.bytes-sum b { color: var(--head); }
/* 32 bits */
.octets { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 0.8rem 0.3rem; margin-top: 1.1rem; --bw: 1.25rem; }
.octet { display: grid; justify-items: center; gap: 2px; }
.octet-dot { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; color: var(--muted); line-height: 2rem; }
.bitrow, .weights { display: grid; grid-template-columns: repeat(8, var(--bw)); gap: 2px; }
.bit {
  width: var(--bw); height: 2.1rem; font-family: var(--mono); font-size: 1rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted); border-radius: 6px; cursor: pointer; padding: 0;
}
.bit:hover { border-color: var(--muted); }
.bit.on { background: var(--s-blue); border-color: var(--s-blue); color: #fff; }
.weights span { font-family: var(--mono); font-size: 0.6rem; color: var(--muted); text-align: center; }
.octet-dec { margin-top: 0.25rem; text-align: center; line-height: 1.2; }
.octet-dec b { display: block; font-family: var(--mono); font-size: 1.35rem; color: var(--head); }
.octet-dec small { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
@media (max-width: 760px) {
  .octets { --bw: 1.7rem; gap: 0.9rem 1.2rem; }
  .octet-dot { display: none; }
}
@media (max-width: 420px) { .octets { --bw: 1.1rem; gap: 0.8rem 0.4rem; } .bit { height: 1.9rem; font-size: 0.86rem; } }
@media (max-width: 350px) { .octets { --bw: 0.95rem; } .bit { font-size: 0.78rem; } }
/* faixas de bits */
.strip { display: inline-flex; align-items: stretch; gap: 1px; font-family: var(--mono); font-size: 0.86rem; }
.strip span { width: 1.08em; text-align: center; border-radius: 3px; padding-block: 0.12em; }
.strip .sep { width: 0.35em; }
.strip span.net { background: color-mix(in srgb, var(--s-blue) 20%, transparent); color: var(--c-blue); font-weight: 600; }
.strip span.host { background: color-mix(in srgb, var(--s-amber) 22%, transparent); color: var(--c-amber); font-weight: 600; }
.strip span.zero { color: var(--muted); opacity: 0.7; }
.strip span.diff { background: color-mix(in srgb, var(--s-red) 30%, transparent); color: var(--c-red); font-weight: 700; }
.prefix-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; }
.cidr { font-family: var(--mono); font-size: 1.45rem; font-weight: 600; }
.strips { margin-top: 0.9rem; overflow-x: auto; }
.strip-row { display: flex; align-items: center; gap: 0.7rem; margin-block: 0.25rem; }
.strip-label { width: 5.6rem; flex: none; font-size: 0.88rem; color: var(--muted); }
.strip-legend { display: flex; gap: 1rem; margin: 0.5rem 0 0 6.3rem; font-size: 0.86rem; }
.lg-net { color: var(--c-blue); font-weight: 600; }
 .lg-host { color: var(--c-amber); font-weight: 600; }
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem 1.2rem; margin: 1rem 0 0; }
.info div { border-top: 1px solid var(--line); padding-top: 0.4rem; }
.info dt { font-size: 0.82rem; color: var(--muted); }
.info dd { margin: 0; font-family: var(--mono); font-size: 1rem; color: var(--head); font-weight: 500; }
@media (max-width: 640px) {
  .strip { font-size: 0.72rem; }
  .strip-label { width: auto; }
  .strip-row { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
  .strip-legend { margin-left: 0; }
}
/* E bit a bit */
.and-grid { display: grid; gap: 1rem; margin-top: 1rem; overflow-x: auto; }
.and-col { min-width: 0; }
.and-title { font-size: 0.95rem; color: var(--head); font-weight: 600; margin-bottom: 0.35rem; }
.and-title code { font-size: 0.92em; background: var(--code); border-radius: 0.3em; padding: 0.02em 0.3em; }
.and-line { display: flex; align-items: center; gap: 0.6rem; margin-block: 0.18rem; flex-wrap: wrap; }
.and-lbl { width: 5.6rem; flex: none; font-size: 0.82rem; color: var(--muted); }
.and-val { font-family: var(--mono); font-size: 0.86rem; color: var(--ink); }
.and-line.res .and-val { color: var(--head); font-weight: 600; }
.and-line.res { border-top: 1px dashed var(--line); padding-top: 0.25rem; }
.verdict { margin-top: 0.9rem; padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--card2); font-size: 1rem; line-height: 1.5; }
.verdict code { font-family: var(--mono); font-size: 0.92em; }
.verdict .ok { color: var(--ok); }
 .verdict .no { color: var(--bad); }
@media (max-width: 640px) { .and-lbl { width: auto; min-width: 4.5rem; } }
.rt tr.nomatch td { color: var(--muted); }
.rt tr.win td { background: color-mix(in srgb, var(--ic) 16%, transparent); color: var(--head); font-weight: 600; }
.rt .iface { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 6px; background: var(--ic); color: #fff; font-weight: 700; font-size: 0.85rem; }
.rt.nat tr.hit td { animation: hit 1.6s ease-out; }
.rt.nat tr.empty td { color: var(--muted); font-style: italic; }
@keyframes hit { from { background: color-mix(in srgb, var(--s-orange) 35%, transparent); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .rt.nat tr.hit td { animation: none; background: color-mix(in srgb, var(--s-orange) 20%, transparent); } }
.panel.slim > .row-wrap { margin-bottom: 0.7rem; }
/* diagrama do cabeçalho */
.hdr-grid { display: grid; grid-template-columns: repeat(32, minmax(1.1rem, 1fr)); gap: 3px 0; min-width: 34rem; }
.bitnum { font-family: var(--mono); font-size: 0.6rem; color: var(--muted); text-align: center; opacity: 0.55; }
.bitnum.major { opacity: 1; }
.fld {
  font: inherit; margin: 0 1.5px; min-height: 2.9rem; border-radius: 6px; cursor: pointer; padding: 0.2rem 0.25rem;
  border: 1px solid color-mix(in srgb, var(--fc) 55%, transparent); background: color-mix(in srgb, var(--fc) 14%, var(--card));
  color: var(--head); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; overflow: hidden;
}
.fld .fld-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fld .fld-bits { font-size: 0.66rem; color: var(--muted); white-space: nowrap; }
.fld.on { background: var(--fc); border-color: var(--fc); color: #fff; }
.fld.on .fld-bits { color: rgba(255,255,255,0.85); }
.hdr-info { margin-block: 0.9rem; padding: 0.7rem 0.9rem; border-left: 4px solid var(--fc); background: var(--card2); border-radius: 0 10px 10px 0; min-height: 7.2rem; }
.hi-head b { color: var(--head); font-size: 1.05rem; }
.hi-head span { color: var(--muted); font-size: 0.9rem; }
.hi-val { margin-top: 0.2rem; display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: baseline; font-size: 0.95rem; }
.hi-val b { font-family: var(--mono); color: var(--head); }
.hi-val code { font-size: 0.82rem; color: var(--muted); }
.hdr-info p { margin: 0.35rem 0 0; font-size: 0.97rem; line-height: 1.5; padding: 0; }
.hexdump { font-family: var(--mono); font-size: 0.92rem; min-width: 30rem; }
.hx-line { display: flex; gap: 0.32rem; padding-block: 0.1rem; }
.hx-off { color: var(--muted); margin-right: 0.6rem; opacity: 0.8; }
.hx { padding: 0 0.12rem; border-radius: 4px; color: var(--head); }
.hx.pl { color: var(--muted); }
.hx.gap { margin-left: 0.6rem; }
.hx.on { background: var(--fc); color: #fff; }
.hx-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; }
.hl-h { color: var(--head); }
/* terminal */
.term {
  max-width: 44rem; background: var(--term-bg); color: var(--term-ink); border-radius: 12px; padding: 0.9rem 1rem;
  font-family: var(--mono); font-size: 0.84rem; line-height: 1.55; overflow-x: auto;
  margin-block: 0 1rem; min-height: 11.5rem; white-space: pre; border: 0;
}
.term .prompt { color: #7FD8E4; }
.term .newline { background: rgba(127,216,228,0.16); border-radius: 3px; }
.term .cursor { display: inline-block; width: 0.6em; background: var(--term-ink); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term .cursor { animation: none; } }
/* checksum */
.cs { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
.cs th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 600; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cs td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cs td.mono { font-family: var(--mono); }
.cs tr.later td { color: var(--muted); opacity: 0.55; }
.cs tr.later td.sum { opacity: 0; }
.cs tr.cur td { background: color-mix(in srgb, var(--s-orange) 13%, transparent); }
.cs tr.zero td:nth-child(3) { color: var(--muted); }
.cs .carry { color: var(--c-red); font-weight: 600; }
.cs td.sum { color: var(--head); font-weight: 600; }
.cs-foot { margin-top: 0.8rem; font-size: 1rem; line-height: 1.5; min-height: 3rem; }
.cs-foot .mono { font-family: var(--mono); }
.cs-final { display: grid; gap: 0.2rem; margin-bottom: 0.5rem; }
.cs-final > div { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; align-items: baseline; }
.cs-final .lbl { width: 8.2rem; color: var(--muted); font-size: 0.9rem; }
.cs-final .hx { font-weight: 700; }
@media (max-width: 640px) { .bin-col { display: none; } }
.vbits { display: grid; grid-template-columns: repeat(32, minmax(1.05rem, 1fr)); gap: 2px; min-width: 34rem; }
.vb {
  font-family: var(--mono); font-size: 0.72rem; height: 1.6rem; padding: 0; border-radius: 4px; cursor: pointer;
  color: var(--muted); background: color-mix(in srgb, var(--fc) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--fc) 40%, transparent);
}
.vb.one { color: var(--head); font-weight: 700; background: color-mix(in srgb, var(--fc) 30%, var(--card)); }
.vb.flip { outline: 2px solid var(--c-red); outline-offset: -2px; color: var(--c-red); }
.verify { flex: 1 1 18rem; font-size: 1rem; line-height: 1.45; padding: 0.55rem 0.8rem; border-radius: 10px; margin-top: 0.8rem; }
.verify.ok { background: color-mix(in srgb, var(--s-green) 13%, transparent); }
.verify.bad { background: color-mix(in srgb, var(--s-red) 13%, transparent); }
.verify b { color: var(--head); }
#csum2 .btn { margin-top: 0.8rem; }
/* legenda do mapa */
.map-info { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0.2rem 0.9rem; margin-top: 0.6rem; font-size: 0.98rem; min-height: 1.6rem; }
.map-info .blk { font-family: var(--mono); font-weight: 600; color: var(--c-blue); font-size: 1.08rem; }
.map-info .cnt { color: var(--ink); }
.map-info .sel { color: var(--muted); }
.map-info .sel b { font-family: var(--mono); color: var(--c-red); font-weight: 600; }
/* IPv6 */
.v6-out { margin-top: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.7rem; }
.v6-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
.v6-lbl { font-size: 0.84rem; color: var(--muted); }
.v6-groups { display: flex; flex-wrap: wrap; align-items: center; font-family: var(--mono); font-size: 1.12rem; font-weight: 600; }
.v6-groups i { font-style: normal; color: var(--muted); padding-inline: 1px; }
.grp { border-radius: 5px; padding: 0.05rem 0.2rem; }
.g-net { background: color-mix(in srgb, var(--s-blue) 18%, transparent); color: var(--c-blue); }
.g-sub { background: color-mix(in srgb, var(--s-cyan) 20%, transparent); color: var(--c-cyan); }
.g-if { background: color-mix(in srgb, var(--s-amber) 22%, transparent); color: var(--c-amber); }
.v6-bar { display: flex; gap: 3px; font-size: 0.74rem; font-weight: 600; min-width: 0; }
.v6-bar span { padding: 0.3rem 0.4rem; text-align: center; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.v6-line { font-size: 1.05rem; color: var(--head); word-break: break-all; }
.v6-line.strong { font-weight: 600; font-size: 1.2rem; color: var(--c-orange); }
.v6-line .zrun { background: color-mix(in srgb, var(--s-red) 18%, transparent); color: var(--c-red); border-radius: 3px; }
.v6-kind { font-size: 0.97rem; color: var(--ink); }
.v6-kind b { color: var(--head); font-weight: 600; }
