/* Owned by S3. Skills: periodic table, filter chips, inspector. Sits on the forest ground (base.css). */
.skills {
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 200ms;
  --t-mid: 450ms;
  --t-slow: 700ms;
  --stagger: 55ms;
}

/* Chips */
.skills__filters {
  max-width: var(--content);
  margin: 0 auto 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skills__chip {
  padding: .55em 1em;
  transition: background-color var(--t-fast), color var(--t-fast);
}
@media (hover: hover) and (pointer: fine) {
  .skills__chip:hover:not([aria-pressed="true"]) {
    background: color-mix(in srgb, var(--chip-bg) 86%, var(--on-dark));
    color: var(--on-dark);
  }
}

/* Layout */
.skills__layout {
  max-width: var(--content);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

/* Table */
.ptable {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
}
.tile {
  min-height: 110px;
  transition: opacity 380ms var(--ease), transform 380ms var(--ease);
  transition-delay: calc(var(--dg, 0) * 12ms);
}
html.js .tile { min-height: 0; aspect-ratio: 1; }
.tile.is-dim { opacity: .16; transform: scale(.94); }

.tile__btn {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 9px 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--hair);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: background-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.tile__num { font: 500 10.5px / 1 var(--font-mono); color: var(--ink-2); }
.tile__sym {
  align-self: center;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1;
  font-size: 2.1rem;
  color: var(--ink);
}
.tile__name {
  font-weight: 500;
  font-size: 11px;
  line-height: 1.2;
  min-height: 3.6em;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile__fam { display: block; font: 500 9px / 1.2 var(--font-mono); color: var(--mute-text); }
html.js .tile__fam {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Family mark: a muted hue per family, drawn in family order */
.tile__btn::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.tile[data-family="ai"] .tile__btn::after { background: var(--fam-ai); }
.tile[data-family="sw"] .tile__btn::after { background: var(--fam-sw); }
.tile[data-family="infra"] .tile__btn::after { background: var(--fam-infra); }
.tile[data-family="ep"] .tile__btn::after { background: var(--fam-ep); }
.tile[data-family="net"] .tile__btn::after { box-shadow: inset 0 0 0 1.5px var(--fam-net); }
.tile[data-family="itsm"] .tile__btn::after { box-shadow: inset 0 0 0 1.5px var(--fam-itsm); }

/* Current */
.tile.is-current .tile__btn { background: var(--accent); color: var(--accent-ink); }
.tile.is-current .tile__num, .tile.is-current .tile__sym, .tile.is-current .tile__name, .tile.is-current .tile__fam { color: var(--accent-ink); }
.tile.is-current .tile__btn::after { background: var(--accent-ink); }
.tile.is-current[data-family="net"] .tile__btn::after,
.tile.is-current[data-family="itsm"] .tile__btn::after { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent-ink); }

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .tile__btn:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 60%, transparent), 0 14px 24px -16px var(--dark);
  }
}

/* Entrance wave */
@keyframes tile-in { from { opacity: 0; transform: translateY(16px) scale(.92); } }
@media (prefers-reduced-motion: no-preference) {
  html.js .ptable:not(.is-in) .tile { opacity: 0; }
  html.js .ptable.is-in .tile {
    animation: tile-in 700ms var(--ease) backwards;
    animation-delay: calc(var(--dg, 0) * 35ms);
  }
}
@media (prefers-reduced-motion: reduce) {
  .skills__chip, .tile, .tile__btn { transition: none; }
}

/* Inspector */
.inspector {
  position: sticky;
  top: 96px;
  min-height: 360px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--hair);
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "num logo" "sym sym" "name name" "fam fam" "used used";
  align-content: start;
  row-gap: 6px;
}
.inspector [hidden] { display: none; }
.inspector__num { grid-area: num; font: 500 12px var(--font-mono); letter-spacing: .14em; color: var(--mute-text); }
.inspector__logo {
  grid-area: logo;
  width: 56px;
  height: 56px;
  padding: 8px;
  border-radius: 14px;
  background: var(--on-dark);
  object-fit: contain;
}
.inspector__sym {
  grid-area: sym;
  font: 500 6rem / 1 var(--font-display);
  letter-spacing: -.02em;
  margin-top: 12px;
  color: var(--accent);
}
.inspector__name { grid-area: name; font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; line-height: 1.15; letter-spacing: -.02em; }
.inspector__fam {
  grid-area: fam;
  font: 500 11px / 1.4 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--mute-text);
}
.inspector__used {
  grid-area: used;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.5;
}

@media (min-width: 1024px) and (max-width: 1439.98px) {
  .tile__btn { padding-inline: 7px; }
  .tile__name { font-size: 10.5px; }
}

/* S12: a real periodic table (from 1100 px, only with scripts on: every rule below sits behind :where(html.js), which adds no
   specificity; with scripts off the page keeps the old grid with every name visible, because the names below 1440 px
   are only readable in the inspector, and the inspector needs scripts).
   Tile n sits where element n sits on a printed table: 18 groups across, 6 periods down.
   Row of n: 1-2 -> 1, 3-10 -> 2, 11-18 -> 3, 19-36 -> 4, 37-54 -> 5, 55-56 -> 6.
   Column of n: 1 -> 1, 2 -> 18, 3-4 -> n-2, 5-10 -> n+8, 11-12 -> n-10, 13-18 -> n, 19-36 -> n-18, 37-54 -> n-36, 55-56 -> n-54.
   The table is a subgrid of .skills__layout, so the inspector can sit in the same 18 x 6 grid, in the empty
   block (groups 3-12, periods 1-3) where a printed table puts its key. Placement is CSS only.
   Tiles are 53 px wide at 1100 px; the skill names (10 px) only fit from 1440 px, so below that the name is in the inspector. */
/* R3: from 1024 to 1099 px a tile is 48-52 px wide and a name cannot fit whole; with scripts on, the inspector shows the name. */
/* Q1: with scripts off there is no inspector (it only says "hover, tap or tab"), so from 1024 px the table takes the whole width
   and every name sits whole on its tile, at every width. */
@media (min-width: 1024px) {
  html:not(.js) .skills__layout { grid-template-columns: minmax(0, 1fr); }
  html:not(.js) .inspector { display: none; }
}
@media (min-width: 1024px) and (max-width: 1099.98px) {
  html.js .tile__name { display: none; }
  html.js .tile__sym { font-size: 1.8rem; } /* the symbol has the room the name used to take; a little air under the number */
}

@media (min-width: 1100px) {
  @supports (grid-template-columns: subgrid) {
    :where(html.js) .skills { --pt-gap: 3px; }
    :where(html.js) .skills__layout {
      position: relative;
      grid-template-columns: repeat(18, minmax(0, 1fr));
      grid-template-rows: repeat(6, auto);
      gap: var(--pt-gap);
    }
    :where(html.js) .ptable {
      grid-column: 1 / -1;
      grid-row: 1 / -1;
      grid-template-columns: subgrid;
      grid-template-rows: subgrid;
      gap: normal;
    }

    /* Placement */
    :where(html.js) .ptable > .tile[data-number="1"] { grid-area: 1 / 1; }
    :where(html.js) .ptable > .tile[data-number="2"] { grid-area: 1 / 18; }
    :where(html.js) .ptable > .tile[data-number="3"] { grid-area: 2 / 1; }
    :where(html.js) .ptable > .tile[data-number="4"] { grid-area: 2 / 2; }
    :where(html.js) .ptable > .tile[data-number="5"] { grid-area: 2 / 13; }
    :where(html.js) .ptable > .tile[data-number="6"] { grid-area: 2 / 14; }
    :where(html.js) .ptable > .tile[data-number="7"] { grid-area: 2 / 15; }
    :where(html.js) .ptable > .tile[data-number="8"] { grid-area: 2 / 16; }
    :where(html.js) .ptable > .tile[data-number="9"] { grid-area: 2 / 17; }
    :where(html.js) .ptable > .tile[data-number="10"] { grid-area: 2 / 18; }
    :where(html.js) .ptable > .tile[data-number="11"] { grid-area: 3 / 1; }
    :where(html.js) .ptable > .tile[data-number="12"] { grid-area: 3 / 2; }
    :where(html.js) .ptable > .tile[data-number="13"] { grid-area: 3 / 13; }
    :where(html.js) .ptable > .tile[data-number="14"] { grid-area: 3 / 14; }
    :where(html.js) .ptable > .tile[data-number="15"] { grid-area: 3 / 15; }
    :where(html.js) .ptable > .tile[data-number="16"] { grid-area: 3 / 16; }
    :where(html.js) .ptable > .tile[data-number="17"] { grid-area: 3 / 17; }
    :where(html.js) .ptable > .tile[data-number="18"] { grid-area: 3 / 18; }
    :where(html.js) .ptable > .tile[data-number="19"] { grid-area: 4 / 1; }
    :where(html.js) .ptable > .tile[data-number="20"] { grid-area: 4 / 2; }
    :where(html.js) .ptable > .tile[data-number="21"] { grid-area: 4 / 3; }
    :where(html.js) .ptable > .tile[data-number="22"] { grid-area: 4 / 4; }
    :where(html.js) .ptable > .tile[data-number="23"] { grid-area: 4 / 5; }
    :where(html.js) .ptable > .tile[data-number="24"] { grid-area: 4 / 6; }
    :where(html.js) .ptable > .tile[data-number="25"] { grid-area: 4 / 7; }
    :where(html.js) .ptable > .tile[data-number="26"] { grid-area: 4 / 8; }
    :where(html.js) .ptable > .tile[data-number="27"] { grid-area: 4 / 9; }
    :where(html.js) .ptable > .tile[data-number="28"] { grid-area: 4 / 10; }
    :where(html.js) .ptable > .tile[data-number="29"] { grid-area: 4 / 11; }
    :where(html.js) .ptable > .tile[data-number="30"] { grid-area: 4 / 12; }
    :where(html.js) .ptable > .tile[data-number="31"] { grid-area: 4 / 13; }
    :where(html.js) .ptable > .tile[data-number="32"] { grid-area: 4 / 14; }
    :where(html.js) .ptable > .tile[data-number="33"] { grid-area: 4 / 15; }
    :where(html.js) .ptable > .tile[data-number="34"] { grid-area: 4 / 16; }
    :where(html.js) .ptable > .tile[data-number="35"] { grid-area: 4 / 17; }
    :where(html.js) .ptable > .tile[data-number="36"] { grid-area: 4 / 18; }
    :where(html.js) .ptable > .tile[data-number="37"] { grid-area: 5 / 1; }
    :where(html.js) .ptable > .tile[data-number="38"] { grid-area: 5 / 2; }
    :where(html.js) .ptable > .tile[data-number="39"] { grid-area: 5 / 3; }
    :where(html.js) .ptable > .tile[data-number="40"] { grid-area: 5 / 4; }
    :where(html.js) .ptable > .tile[data-number="41"] { grid-area: 5 / 5; }
    :where(html.js) .ptable > .tile[data-number="42"] { grid-area: 5 / 6; }
    :where(html.js) .ptable > .tile[data-number="43"] { grid-area: 5 / 7; }
    :where(html.js) .ptable > .tile[data-number="44"] { grid-area: 5 / 8; }
    :where(html.js) .ptable > .tile[data-number="45"] { grid-area: 5 / 9; }
    :where(html.js) .ptable > .tile[data-number="46"] { grid-area: 5 / 10; }
    :where(html.js) .ptable > .tile[data-number="47"] { grid-area: 5 / 11; }
    :where(html.js) .ptable > .tile[data-number="48"] { grid-area: 5 / 12; }
    :where(html.js) .ptable > .tile[data-number="49"] { grid-area: 5 / 13; }
    :where(html.js) .ptable > .tile[data-number="50"] { grid-area: 5 / 14; }
    :where(html.js) .ptable > .tile[data-number="51"] { grid-area: 5 / 15; }
    :where(html.js) .ptable > .tile[data-number="52"] { grid-area: 5 / 16; }
    :where(html.js) .ptable > .tile[data-number="53"] { grid-area: 5 / 17; }
    :where(html.js) .ptable > .tile[data-number="54"] { grid-area: 5 / 18; }
    :where(html.js) .ptable > .tile[data-number="55"] { grid-area: 6 / 1; }
    :where(html.js) .ptable > .tile[data-number="56"] { grid-area: 6 / 2; }

    /* Family hue: a 3 px top edge and a faint wash on the tile */
    :where(html.js) .ptable > .tile[data-family="ai"], :where(html.js) .skills__chip[data-filter="ai"] { --fam: var(--fam-ai); }
    :where(html.js) .ptable > .tile[data-family="sw"], :where(html.js) .skills__chip[data-filter="sw"] { --fam: var(--fam-sw); }
    :where(html.js) .ptable > .tile[data-family="infra"], :where(html.js) .skills__chip[data-filter="infra"] { --fam: var(--fam-infra); }
    :where(html.js) .ptable > .tile[data-family="ep"], :where(html.js) .skills__chip[data-filter="ep"] { --fam: var(--fam-ep); }
    :where(html.js) .ptable > .tile[data-family="net"], :where(html.js) .skills__chip[data-filter="net"] { --fam: var(--fam-net); }
    :where(html.js) .ptable > .tile[data-family="itsm"], :where(html.js) .skills__chip[data-filter="itsm"] { --fam: var(--fam-itsm); }

    /* Tiles: square, number top-left, family dot top-right, big symbol */
    :where(html.js) .skills .ptable > .tile { min-height: 0; aspect-ratio: 1; align-self: start; }
    :where(html.js) .ptable .tile__btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 3px 1px 0;
      border-radius: 6px;
      background:
        linear-gradient(var(--fam), var(--fam)) top / 100% 3px no-repeat,
        color-mix(in srgb, var(--fam) 12%, var(--card));
      text-align: center;
    }
    :where(html.js) .ptable .tile__btn:focus-visible { outline-offset: 1px; z-index: 1; }
    :where(html.js) .ptable .tile__num { position: absolute; top: 6px; left: 5px; font-size: 9px; }
    :where(html.js) .ptable .tile__btn::after { top: 7px; right: 5px; width: 6px; height: 6px; }
    :where(html.js) .ptable .tile__sym { align-self: auto; font-size: clamp(1.35rem, calc(1.2vw + .55rem), 1.75rem); }
    :where(html.js) .ptable .tile__name { display: none; }
    :where(html.js) .ptable .tile__fam {
      position: absolute;
      width: 1px;
      height: 1px;
      margin: -1px;
      padding: 0;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    /* The key: the inspector fills groups 3-12 of periods 1-3 */
    :where(html.js) .inspector {
      grid-column: 3 / 13;
      grid-row: 1 / 4;
      position: absolute;
      inset: 0;
      min-height: 0;
      overflow: hidden;
      padding: 14px 20px;
      border-radius: 14px;
      grid-template-columns: auto minmax(0, 1fr) auto;
      grid-template-areas: "sym num logo" "sym name logo" "sym fam logo" "used used used";
      align-content: center;
      align-items: center;
      column-gap: 20px;
      row-gap: 0;
    }
    :where(html.js) .inspector:has(.inspector__sym:empty) { column-gap: 0; } /* nothing picked yet: the heading starts at the left edge */
    :where(html.js) .inspector__sym { font-size: 4.25rem; margin: 0; }
    :where(html.js) .inspector__num { align-self: end; }
    :where(html.js) .inspector__name { font-size: 1.3rem; }
    :where(html.js) .inspector__logo { width: 48px; height: 48px; padding: 7px; border-radius: 12px; }
    :where(html.js) .inspector__used { margin-top: 10px; padding-top: 8px; font-size: .9rem; line-height: 1.4; }

    /* The chips double as the key: the same family mark as on the tiles */
    :where(html.js) .skills__chip[data-filter]:not([data-filter="all"])::before {
      content: "";
      flex: none;
      width: 8px;
      height: 8px;
      margin-right: .6em;
      border-radius: 50%;
      background: var(--fam);
    }
    :where(html.js) .skills__chip[data-filter="net"]::before,
    :where(html.js) .skills__chip[data-filter="itsm"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--fam); }
    :where(html.js) .skills__chip[aria-pressed="true"]::before { background: var(--accent-ink); }
    :where(html.js) .skills__chip[aria-pressed="true"][data-filter="net"]::before,
    :where(html.js) .skills__chip[aria-pressed="true"][data-filter="itsm"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent-ink); }

    /* Wide enough for the names (10 px; the longest word, ManageEngine, is 65 px) */
    @media (min-width: 1440px) {
      :where(html.js) .skills .ptable > .tile { aspect-ratio: 7 / 9; }
      :where(html.js) .ptable .tile__btn { justify-content: flex-start; padding: 10px 1.5px 4px; gap: 3px; }
      :where(html.js) .ptable .tile__name {
        display: block;
        flex: none;
        align-self: stretch;
        min-height: 0;
        font-size: 10px;
        line-height: 1.12;
        letter-spacing: -.03em;
        text-wrap: balance;
        overflow-wrap: anywhere;
        overflow: visible;
        -webkit-line-clamp: unset;
      }
      :where(html.js) .inspector { padding: 20px 28px; column-gap: 28px; }
      :where(html.js) .inspector:has(.inspector__sym:empty) { column-gap: 0; }
      :where(html.js) .inspector__sym { font-size: 5.5rem; }
      :where(html.js) .inspector__name { font-size: 1.75rem; }
      :where(html.js) .inspector__logo { width: 56px; height: 56px; padding: 8px; border-radius: 14px; }
      :where(html.js) .inspector__used { margin-top: 14px; padding-top: 12px; font-size: 1rem; }
    }
  }
}

/* Tablet and phone */
@media (max-width: 1023.98px) {
  .skills__layout { grid-template-columns: minmax(0, 1fr); }
  .ptable { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tile__sym { font-size: 1.8rem; }
  .tile__name { font-size: 11.5px; }
  .inspector {
    order: -1;
    top: 84px;
    z-index: 2;
    min-height: 0;
    margin-bottom: 16px;
    padding: 16px 18px;
    background: var(--dark);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent), 0 18px 40px -20px var(--dark);
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "sym name logo" "sym fam logo" "used used used";
    align-items: center;
    column-gap: 16px;
    row-gap: 0;
  }
  .inspector__num { display: none; }
  .inspector__logo { width: 40px; height: 40px; padding: 6px; border-radius: 10px; }
  .inspector__sym { font-size: 3rem; margin: 0; }
  .inspector__name { font-size: 1.125rem; }
  .inspector__used { margin-top: 10px; padding-top: 10px; font-size: .9rem; }
}
@media (max-width: 699.98px) {
  .skills__filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: -5px calc(-1 * var(--gutter)) 15px;
    padding: 5px var(--gutter);
  }
  .skills__filters::-webkit-scrollbar { display: none; }
  .skills__chip { flex: none; }
  .ptable { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .tile__sym { font-size: 1.6rem; }
  .tile__name { font-size: 11px; }
  .inspector {
    order: 0;
    top: auto;
    bottom: 12px;
    margin: 16px 0 0;
  }
  .inspector__sym { font-size: 2.5rem; }
}
@media (max-width: 480px) {
  .ptable { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
