﻿/* ---------- "All solutions" (Views/Shared/_SolutionOverview.cshtml): the line's categories and their solutions as a tree ----------
   The whole tree starts open and each category folds on a click (user, 06/11). Desktops draw it left to right: the service,
   its categories on a dashed wire, each category's solutions on a solid one. Tablets and phones stand it upright (below).
   Calm palette (user, 06/11): one accent, the service; categories white with a cyan edge; solutions are teal text; wires a
   light cyan; hover a pale cyan, a match in the finder a pale yellow. */
.sov-tree {
  --sov-ink: #0e2a38;
  --sov-accent: #00c2cb;
  --sov-cyan: #9fe3e7;
  --sov-line: #d4eff1;
  --sov-gap: 4rem;
  --sov-half: calc(var(--sov-gap) / 2);
  /* No frame (user, 06/11): the tree sits on the section's own background, a little below the finder */
  padding-top: 2.4rem;
}
.sov-tree__root {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  border-radius: 1.2rem;
  border: 2px solid var(--sov-accent);
  background: #ffffff;
  font-weight: 800;
  line-height: 1.3;
  color: var(--sov-ink);
  /* The icon and the service's name on one row, the name on one line (user, 06/11) */
  white-space: nowrap;
}
.sov-tree__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.8rem;
  background: var(--sov-accent);
  color: #ffffff;
}
/* A category's head: a click folds or unfolds its solutions */
.sov-node__head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  min-height: 4.6rem;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--sov-line);
  border-radius: 1.2rem;
  background: #ffffff;
  box-shadow: inset 3px 0 0 var(--sov-accent);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  color: var(--sov-ink);
  cursor: pointer;
  scroll-margin-top: 14rem;
  transition: border-color 0.2s, background-color 0.2s;
}
.sov-node__head:hover,
.sov-node__head:focus-visible {
  border-color: #b9e6e9;
  background: #e6f9fa;
}
.sov-node__chevron {
  display: flex;
  flex: none;
  color: #00a3ab;
  transition: transform 0.2s;
}
/* Its chevron points down while it is open */
.sov-node.is-open .sov-node__chevron {
  transform: rotate(90deg);
}
/* Names on two or three lines split evenly ("Gia công / dự án", not "Gia công dự / án"); the line count stays the same */
.sov-node__name {
  text-wrap: balance;
}
/* Its solutions */
.sov-leaves {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sov-node.is-open .sov-leaves {
  display: flex;
}
.sov-leaves li {
  position: relative;
  max-width: 100%;
}
/* Its stub in from the wire */
.sov-leaves li::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: calc(var(--sov-half) + 1px);
  border-top: 2px solid var(--sov-cyan);
}
/* A link to the solution's page: a deep teal (the cyan family; user, 06/11: #00737a was hard to read), not underlined */
.sov-leaf {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  border-radius: 0.8rem;
  /* Large enough to read at a glance (user, 06/11: the solutions were too small) */
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.35;
  color: #005c63;
  text-decoration: none;
  /* Long tokens may break on the narrowest phones */
  overflow-wrap: anywhere;
  transition: background-color 0.2s;
}
.sov-leaf:hover,
.sov-leaf:focus-visible {
  background: #e6f9fa;
}
/* A solution that matches what is typed in the finder */
.sov-leaf.is-match {
  background: #fffaea;
  color: var(--sov-ink);
}
html[lang=ja] .sov-tree :is(.sov-tree__root, .sov-node__head, .sov-leaf) {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* Desktops: left to right. The service in the first column, centred on the whole tree; each category a row of the second
   column, its head centred on its solutions. Every branch draws its own piece of the wire it hangs from (the first from
   its middle down, the last from the top to its middle), so each wire runs from its first branch to its last, whatever is
   open; a head's line out meets it. The tree is as wide as its branches, centred in its frame. */
@media (min-width: 1024px) {
  .sov-tree {
    /* Wide enough that every category name fits on two lines in all three languages (the solutions' column beside it
       left room for it on 06/11), so the heads share one height */
    --sov-cat-w: 24rem;
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    column-gap: var(--sov-gap);
    padding-top: 3.2rem;
  }
  .sov-tree__root {
    grid-column: 1;
    grid-row: 1 / span var(--sov-rows);
    align-self: center;
    justify-self: end;
    padding: 0.7rem 1.4rem 0.7rem 0.7rem;
    font-size: 1.5rem;
  }
  /* Its line out to the categories' wire */
  .sov-tree__root::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    width: var(--sov-half);
    border-top: 1.5px dashed var(--sov-cyan);
  }
  /* A category: its head, then its solutions */
  .sov-node {
    position: relative;
    grid-column: 2;
    grid-row: var(--sov-row);
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 1.2rem 0;
  }
  /* Its piece of the dashed wire from the service */
  .sov-node::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--sov-half));
    border-left: 1.5px dashed var(--sov-cyan);
  }
  .sov-node:first-of-type::before {
    top: 50%;
  }
  .sov-node:last-of-type::before {
    bottom: 50%;
  }
  .sov-node:only-of-type::before {
    display: none;
  }
  .sov-node__head {
    flex: 0 0 var(--sov-cat-w);
    min-height: 5.6rem;
    font-size: 1.4rem;
  }
  /* Japanese category names break only at "・": a size that keeps "コンサルティング・" on one line */
  html[lang=ja] .sov-node__head {
    font-size: 1.35rem;
  }
  /* Its line in from the wire, and out to its solutions when open */
  .sov-node__head::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    width: calc(var(--sov-half) + 1px);
    border-top: 1.5px dashed var(--sov-cyan);
  }
  .sov-node.is-open .sov-node__head::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    width: calc(var(--sov-half) + 1px);
    border-top: 2px solid var(--sov-cyan);
  }
  .sov-node.is-open .sov-leaves {
    flex: 1;
    min-width: 0;
    margin-left: var(--sov-gap);
  }
  /* Each solution: its piece of the category's wire and its stub */
  .sov-leaves li {
    padding: 0.5rem 0;
  }
  .sov-leaves li::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(-1 * var(--sov-half) - 1px);
    border-left: 2px solid var(--sov-cyan);
  }
  .sov-leaves li:first-child::after {
    top: 50%;
  }
  .sov-leaves li:last-child::after {
    bottom: 50%;
  }
  .sov-leaves li:only-child::after {
    display: none;
  }
}
@media (min-width: 1200px) {
  .sov-tree {
    --sov-gap: 4.8rem;
  }
  .sov-tree__root {
    font-size: 1.6rem;
  }
  .sov-tree__icon {
    width: 3.6rem;
    height: 3.6rem;
  }
  .sov-tree__icon svg {
    width: 2rem;
    height: 2rem;
  }
  .sov-node {
    padding: 1.4rem 0;
  }
  .sov-node__head {
    gap: 1rem;
    min-height: 6.6rem;
    padding: 1rem 1.6rem;
    border-radius: 1.6rem;
    font-size: 1.6rem;
  }
  html[lang=ja] .sov-node__head {
    font-size: 1.5rem;
  }
  .sov-node__chevron svg {
    width: 1.8rem;
    height: 1.8rem;
  }
  .sov-leaf {
    font-size: 1.7rem;
  }
}

/* Tablets and phones: upright. The service's box on top (one compact row, user 06/11), its categories down a dashed wire
   that starts under its icon, each category's solutions hanging under it on a solid wire. */
@media (max-width: 1023px) {
  .sov-tree {
    --sov-half: 1.8rem;
    /* Where the categories' wire runs: under the middle of the service's icon */
    --sov-trunk: 2.2rem;
    --sov-stub: 1.4rem;
  }
  .sov-tree__root {
    display: flex;
    width: max-content;
    max-width: 100%;
    padding: 0.6rem 1.4rem 0.6rem 0.6rem;
    font-size: 1.5rem;
  }
  .sov-tree__icon {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 0.7rem;
  }
  .sov-node {
    position: relative;
    margin-left: calc(var(--sov-trunk) - 1px);
    padding: 1rem 0 0 var(--sov-stub);
  }
  /* Each category draws its piece of the dashed wire: the whole category, but the last one only down to its head's
     middle, so the wire ends at the last category; a stub runs into each head */
  .sov-node:not(:last-child)::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    border-left: 1.5px dashed var(--sov-cyan);
  }
  .sov-node:last-child .sov-node__head::after {
    content: "";
    position: absolute;
    top: calc(-1rem - 1px);
    bottom: 50%;
    left: calc(-1 * var(--sov-stub) - 1px);
    border-left: 1.5px dashed var(--sov-cyan);
  }
  .sov-node__head::before {
    content: "";
    position: absolute;
    top: 50%;
    right: 100%;
    width: calc(var(--sov-stub) + 1px);
    border-top: 1.5px dashed var(--sov-cyan);
  }
  .sov-node.is-open .sov-leaves {
    gap: 0.8rem;
    margin: 0.8rem 0 0.4rem 1.4rem;
    padding-left: var(--sov-half);
  }
  /* Each solution draws its piece of the wire (through the gap under it), the first from the category's head down, the
     last only to its middle, so the wire ends at the last solution */
  .sov-leaves li::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: -0.8rem;
    left: calc(-1 * var(--sov-half));
    border-left: 2px solid var(--sov-cyan);
  }
  .sov-leaves li:first-child::after {
    top: -0.8rem;
  }
  .sov-leaves li:last-child::after {
    bottom: 50%;
  }
}
@media (max-width: 767px) {
  .sov-node__head {
    min-height: 4.4rem;
    font-size: 1.45rem;
  }
  .sov-node.is-open .sov-leaves {
    margin-left: 1rem;
  }
  .sov-leaf {
    font-size: 1.5rem;
  }
}
/* Under 360px the service's name (one line, 06/11) ran past its frame in VI ("Phát triển phần mềm theo yêu cầu"): a smaller
   name and gaps keep it inside; the icon keeps its size, as the categories' wire runs under its middle */
@media (max-width: 359px) {
  .sov-tree__root {
    gap: 0.6rem;
    padding-right: 1rem;
    font-size: 1.35rem;
  }
}

/* Dedicated Teams, under the tree: the languages with their flags, then the AI tools */
.sov-extra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.2rem;
  margin-top: 2.4rem;
  padding: 1.8rem 2.4rem;
  border: 1px solid #d4eff1;
  border-radius: 1.6rem;
  background: #ffffff;
}
.sov-extra__label {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5a7380;
}
html[lang=ja] .sov-extra__label {
  letter-spacing: 0.02em;
}
.sov-extra__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1.4rem;
  border: 1px solid #d4eff1;
  border-radius: 999px;
  background: #ffffff;
  font-size: 1.4rem;
  font-weight: 700;
  color: #0e2a38;
}
.sov-extra__flag {
  width: 2rem;
  height: 1.4rem;
  border-radius: 0.3rem;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(14, 42, 56, 0.12);
}
.sov-extra__ai {
  flex: 1 1 28rem;
  font-size: 1.4rem;
  line-height: 1.5;
  color: #3e5662;
}
.sov-extra__ai strong {
  color: #00c2cb;
}
@media (min-width: 768px) {
  .sov-extra__ai {
    padding-left: 1.6rem;
    border-left: 1px solid #e3eef0;
  }
}
@media (max-width: 767px) {
  .sov-extra {
    padding: 1.6rem;
  }
  .sov-extra__label {
    flex-basis: 100%;
  }
}
