/* Valerio Corso · personal site
   One Unity Profiler capture: toolbar, sample header, timeline of threads, selected-sample detail,
   hierarchy table, and the Console for contact. Light = Personal skin, dark = Pro skin. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-var.woff2") format("woff2");
  font-weight: 400 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Personal skin */
  --ground: #c2c2c2;
  --panel: #d6d6d6;
  --panel-2: #cbcbcb;
  --line: #999999;
  --line-soft: #b4b4b4;
  --text: #0b0b0b;
  --text-2: #3b3b3b;
  --track: #b8b8b8;
  --select: #1a5fb4;
  --select-ink: #ffffff;
  --focus: #1a5fb4;
  --playhead: #9e2318;
  --rec: #d13a2a;
  --thumb: #8f8f8f;
  /* profiler categories */
  --scripts: #3d8fd6;
  --render: #7fb83e;
  --ui: #9d73d6;
  --other: #c4874a;
  --gc: #e3c33b;
  --bar-ink: #08121c;

  --display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 3vw, 40px);
  --lab: 150px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Pro skin */
    --ground: #191919; --panel: #282828; --panel-2: #303030; --line: #111111; --line-soft: #3a3a3a;
    --text: #d2d2d2; --text-2: #9a9a9a; --track: #232323; --select: #3a79c9; --select-ink: #ffffff; --focus: #6aa7f0;
    --playhead: #ff6e5c; --rec: #ff5a47; --thumb: #555555;
    --scripts: #4f9de4; --render: #8fc650; --ui: #ad86e3; --other: #cf9458; --gc: #e8cb4c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #191919; --panel: #282828; --panel-2: #303030; --line: #111111; --line-soft: #3a3a3a;
  --text: #d2d2d2; --text-2: #9a9a9a; --track: #232323; --select: #3a79c9; --select-ink: #ffffff; --focus: #6aa7f0;
  --playhead: #ff6e5c; --rec: #ff5a47; --thumb: #555555;
  --scripts: #4f9de4; --render: #8fc650; --ui: #ad86e3; --other: #cf9458; --gc: #e8cb4c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.45;
}
::selection { background: var(--select); color: var(--select-ink); }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p, ul { margin: 0; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { max-width: 1440px; margin: 0 auto; padding-inline: var(--gutter); padding-block: 0 32px; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding-block: 12px 0; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--text-2);
}
.tab {
  padding: 6px 12px; text-decoration: none; color: var(--text-2);
  border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab[aria-current="page"] {
  color: var(--text); font-weight: 600; background: var(--panel);
  border-color: var(--line); margin-bottom: -1px; padding-bottom: 7px;
}
.rec {
  display: inline-flex; align-items: center; gap: 7px; margin: 0 0 6px 6px;
  padding: 4px 10px; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px;
}
.rec::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--rec); }
.rec:hover { background: var(--panel); }
.rec[aria-pressed="true"]::before { animation: blink .6s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.frame { margin-bottom: 6px; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- sample header ---------- */
.sample {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  gap: 20px 48px; padding-block: clamp(32px, 6vw, 72px) clamp(20px, 3vw, 32px);
}
h1 {
  font-weight: 850; font-stretch: 125%;
  font-size: clamp(2.6rem, 8.4vw, 6rem); line-height: .88; letter-spacing: -.035em;
  text-wrap: balance;
}
.summary { margin-top: 16px; max-width: 62ch; font-size: clamp(1.02rem, 1.4vw, 1.18rem); text-wrap: pretty; }
.budget { display: grid; gap: 4px; justify-items: end; text-align: right; }
.budget b {
  font-weight: 800; font-stretch: 62%; letter-spacing: -.01em; line-height: 1;
  font-size: clamp(2.6rem, 4.8vw, 3.8rem); font-variant-numeric: tabular-nums;
}
.budget span { font-family: var(--mono); font-size: 12px; color: var(--text-2); max-width: 26ch; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }

/* ---------- timeline ---------- */
.timeline { overflow: hidden; }
.tl-scroll { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--thumb) var(--panel-2); }
.tl-inner {
  --y0: 2012; --y1: 2027; --now: 2026.79; --sweep: 1;
  --frac: calc((var(--now) - var(--y0)) / (var(--y1) - var(--y0)));
  position: relative; min-width: 980px;
}
.ruler, .thread { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); }
.ruler { background: var(--panel-2); border-bottom: 1px solid var(--line); }
.thread { border-bottom: 1px solid var(--line); }
.thread:last-of-type { border-bottom: 0; }
.lab {
  position: sticky; left: 0; z-index: 4;
  padding: 7px 10px; border-right: 1px solid var(--line); background: var(--panel-2);
  font-size: 12.5px; font-weight: 600;
}
.ruler .lab { font-weight: 400; font-size: 12px; color: var(--text-2); }
.lab small { display: block; font-weight: 400; font-size: 11px; color: var(--text-2); }
.ticks { position: relative; height: 30px; font-family: var(--mono); font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ticks span {
  position: absolute; top: 6px; transform: translateX(-50%);
  left: calc((var(--a) - var(--y0)) / (var(--y1) - var(--y0)) * 100%);
}
.ticks span:first-child { transform: none; }
.ticks span::after { content: ""; position: absolute; left: 50%; top: 17px; width: 1px; height: 6px; background: var(--text-2); }
.ticks span:first-child::after { left: 0; }
.track { position: relative; display: grid; gap: 3px; padding-block: 6px; background: var(--track); }
.lane { position: relative; height: 26px; }
.lane.sub { height: 20px; }
.bar {
  position: absolute; top: 0; height: 100%;
  left: calc((var(--a) - var(--y0)) / (var(--y1) - var(--y0)) * 100%);
  width: calc((var(--b) - var(--a)) / (var(--y1) - var(--y0)) * 100%);
  padding: 0 6px; border-radius: 2px;
  color: var(--bar-ink); font-size: 12px; font-weight: 600; text-decoration: none;
  line-height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / .18);
  transition: filter .15s ease-out, box-shadow .15s ease-out;
}
.sub .bar { line-height: 20px; font-size: 11px; font-weight: 500; }
a.bar:hover { filter: brightness(1.1); }
a.bar:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }
a.bar[aria-current="true"] { box-shadow: inset 0 0 0 2px var(--text), inset 0 -2px 0 rgb(0 0 0 / .18); }
.bar.root { cursor: default; }
.c-scripts { background: var(--scripts); }
.c-render { background: var(--render); }
.c-ui { background: var(--ui); }
.c-other { background: var(--other); }
.c-gc { background: var(--gc); }
.playhead {
  position: absolute; top: 0; bottom: 0; z-index: 3; width: 2px; pointer-events: none;
  background: var(--playhead);
  left: calc(var(--lab) + (100% - var(--lab)) * var(--frac) * var(--sweep));
}
.playhead::before {
  content: attr(data-label); position: absolute; bottom: 6px; right: 6px;
  padding: 1px 5px; white-space: nowrap; background: var(--panel-2); border-radius: 2px;
  font-family: var(--mono); font-size: 11px; color: var(--playhead);
  transition: opacity .2s ease-out;
}
.is-recording .playhead::before { opacity: 0; }
.tl-inner.is-recording .lane { clip-path: inset(0 calc((1 - var(--frac) * var(--sweep)) * 100%) 0 0); }
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 12px;
  border-top: 1px solid var(--line); font-size: 12px; color: var(--text-2);
}
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; }
.legend .hint { display: none; margin-left: auto; font-style: italic; }

/* ---------- detail + hierarchy ---------- */
.split {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(12px, 2vw, 20px); margin-top: clamp(12px, 2vw, 20px); align-items: start;
}
.detail { padding: clamp(20px, 3vw, 32px); display: grid; gap: 40px; }
.js .sample-detail:not(.is-active) { display: none; }
.path { font-family: var(--mono); font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.sample-detail h3 {
  margin-top: 12px; font-weight: 850; font-stretch: 112%; letter-spacing: -.02em; line-height: 1;
  font-size: clamp(1.9rem, 3.6vw, 2.8rem); text-wrap: balance;
}
.role { margin-top: 8px; font-size: 1.05rem; font-weight: 600; }
.meta { margin-top: 2px; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.sample-detail ul { margin-top: 20px; padding: 0; list-style: none; display: grid; gap: 9px; max-width: 64ch; }
.sample-detail li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.sample-detail li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--sw, var(--scripts)); }
.sample-detail em { font-style: italic; }
.stack { margin-top: 20px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }

.hier-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--thumb) var(--panel-2); }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 0; text-align: left; white-space: nowrap; }
thead th {
  padding: 9px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.num { text-align: right; font-family: var(--mono); font-size: 12px; }
tbody td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child td { border-bottom: 0; }
tr.group th, tr.group td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); font-weight: 700; }
tbody td:first-child { padding: 0; }
tbody td a {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 26px;
  color: inherit; text-decoration: none;
}
tbody td a:focus-visible { outline-offset: -2px; }
tbody tr[data-sample]:hover { background: var(--panel-2); }
tbody tr.is-active { background: var(--select); color: var(--select-ink); }
tbody tr.is-active:hover { background: var(--select); }
.sw { width: 9px; height: 9px; border-radius: 2px; flex: none; }

/* ---------- console ---------- */
.console { margin-top: clamp(12px, 2vw, 20px); scroll-margin-top: 16px; }
.con-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.con-head h2 { font-size: 12.5px; font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.btn:hover { background: var(--ground); }
.btn svg { width: 14px; height: 14px; }
.log { list-style: none; padding: 4px 0; font-family: var(--mono); font-size: 13px; }
.log li {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 9px 12px; border-bottom: 1px solid var(--line-soft);
}
.log li:last-child { border-bottom: 0; }
.log svg { width: 16px; height: 16px; margin-top: 2px; color: var(--text-2); }
.log p { min-width: 0; overflow-wrap: anywhere; }
.log .key { display: inline-block; min-width: 10ch; margin-right: 8px; color: var(--text-2); }
.log a { font-weight: 600; }
.log .cta p {
  font-family: var(--display); font-weight: 800; font-stretch: 112%; letter-spacing: -.015em; line-height: 1.1;
  font-size: clamp(1.35rem, 2.6vw, 2rem); text-wrap: balance;
}
.log .cta svg { margin-top: .35em; }
.con-status { min-height: 1.4em; padding: 0 12px 10px 40px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }

.foot { padding-top: 20px; font-size: 12px; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sample, .split { grid-template-columns: minmax(0, 1fr); }
  .budget { justify-items: start; text-align: left; }
}
@media (max-width: 700px) {
  :root { --lab: 92px; }
  .tl-inner { min-width: 760px; }
  .lab-wide, .ticks .odd { display: none; }
  .lab { padding-inline: 8px; font-size: 12px; }
  .legend .hint { display: inline; margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 480px) {
  .where { display: none; }
  .log .key { min-width: 0; display: block; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rec { display: none; }
}
