/* Project artifacts: working sketches of each project, framed like a viewfinder.
   Still black and white only. */

.artifact {
  --corner: rgba(255, 255, 255, 0.8);
  --l: 16px;
  position: relative;
  margin-top: 44px;
  padding: clamp(16px, 2.4vw, 28px);
  background:
    linear-gradient(var(--corner) 0 0) top left / var(--l) 1px,
    linear-gradient(var(--corner) 0 0) top left / 1px var(--l),
    linear-gradient(var(--corner) 0 0) top right / var(--l) 1px,
    linear-gradient(var(--corner) 0 0) top right / 1px var(--l),
    linear-gradient(var(--corner) 0 0) bottom left / var(--l) 1px,
    linear-gradient(var(--corner) 0 0) bottom left / 1px var(--l),
    linear-gradient(var(--corner) 0 0) bottom right / var(--l) 1px,
    linear-gradient(var(--corner) 0 0) bottom right / 1px var(--l),
    radial-gradient(circle, rgba(255, 255, 255, 0.13) 1px, transparent 1.4px) 7px 7px / 14px 14px;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, no-repeat, repeat;
}
.artifact__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 24px;
  margin-bottom: 20px;
}
.artifact__title { font: 700 clamp(26px, 2.8vw, 36px)/1.05 var(--black-letter); }
.artifact__note { color: var(--ink-3); font-size: 13px; }
.artifact canvas { display: block; width: 100%; height: 100%; }

/* Controls shared by every artifact */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button,
.chip-btn {
  font: inherit;
  font-size: 13.5px;
  line-height: 1.3;
  color: var(--ink-2);
  background: var(--black);
  border: 1px solid var(--rule);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.seg button:hover,
.chip-btn:hover { color: var(--white); border-color: var(--white); }
.seg button[aria-pressed="true"],
.seg button[aria-checked="true"] { background: var(--white); color: var(--black); border-color: var(--white); }
.btn--sm { min-height: 44px; padding: 8px 16px; font-size: 13.5px; cursor: pointer; font-family: inherit; }
.label { font-size: 13px; color: var(--ink-3); }

/* ---------- LeaRN: ask the course notes ---------- */

.rag__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; }
.rag__field { position: relative; min-height: 380px; border: 1px dotted var(--rule); }
.rag__field canvas { position: absolute; inset: 0; }
.rag__qs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rag__qs button { font: inherit; font-size: 13.5px; }
.rag__query {
  margin-top: 18px;
  min-height: 1.7em;
  padding: 10px 12px;
  border: 1px solid var(--white);
  font-weight: 500;
}
.rag__prompt { color: var(--ink-3); }
.rag__hits { margin-top: 14px; min-height: 10px; }
.rag__hits li { padding: 8px 0; border-top: 1px dotted var(--rule); animation: rag-in 0.35s ease both; }
.rag__hit-head { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.rag__rank { font-weight: 700; }
.rag__src { color: var(--ink-2); flex: 1; }
.rag__score { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.rag__chunk {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.rag__answer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--white); min-height: 4.6em; line-height: 1.6; }
@keyframes rag-in { from { opacity: 0; transform: translateY(4px); } }

@media (max-width: 900px) {
  .rag__grid { grid-template-columns: minmax(0, 1fr); }
  .rag__field { min-height: 300px; }
}
@media (max-width: 480px) {
  .rag__qs { grid-template-columns: minmax(0, 1fr); }
  .rag__field { min-height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
  .rag__hits li { animation: none; }
}

/* ---------- QuietNet: what your devices look up ---------- */

.dns__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.dns__status { min-height: 1.7em; margin-top: 12px; color: var(--ink-2); font-size: 13.5px; }
.dns__grid { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 28px; }
.dns__head,
.dns__row {
  display: grid;
  grid-template-columns: 5.6em minmax(0, 1fr) 6.6em 5.4em;
  gap: 12px;
  align-items: baseline;
}
.dns__head { font-size: 13px; color: var(--ink-3); padding: 0 8px 8px; border-bottom: 1px solid var(--white); }
.dns__rows { min-height: 360px; }
.dns__row {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--white);
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--rule);
  padding: 9px 8px;
  text-align: left;
  cursor: pointer;
}
.dns__row:hover { background: rgba(255, 255, 255, 0.08); }
.dns__row.is-new { animation: dns-in 0.45s ease both; }
.dns__t { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dns__d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dns__c { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dns__r { text-align: right; color: var(--ink-2); }
.dns__row.is-stopped .dns__d { text-decoration: line-through; color: var(--ink-3); }
.dns__row.is-stopped .dns__r { color: var(--black); background: var(--white); text-align: center; font-weight: 700; }
@keyframes dns-in { from { background: rgba(255, 255, 255, 0.28); } }

.dns__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 22px; }
.dns__stats div { border-top: 1px solid var(--white); padding-top: 8px; }
.dns__stats dt { font-size: 13px; color: var(--ink-3); }
.dns__stats b { font: 700 clamp(26px, 2.6vw, 34px)/1.1 var(--black-letter); font-variant-numeric: tabular-nums; }
.dns__bars { margin-top: 10px; }
.dns__bars li { display: grid; grid-template-columns: 6.6em minmax(0, 1fr) 2.4em; gap: 10px; font-size: 13px; padding: 4px 0; }
.dns__bb { letter-spacing: -0.06em; overflow: hidden; white-space: nowrap; }
.dns__bc { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dns__card { margin-top: 18px; padding: 16px; border: 1px solid var(--white); background: var(--black); }
.dns__cd { font-weight: 700; overflow-wrap: anywhere; }
.dns__cm { color: var(--ink-2); font-size: 13px; }
.dns__cw { margin-top: 10px; font-size: 13.5px; }
.dns__cv { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
.dns__rule { margin-top: 12px; display: grid; gap: 4px; }
.dns__rule code { overflow-wrap: anywhere; font-size: 13px; padding: 6px 8px; }
.dns__close { margin-top: 14px; }

@media (max-width: 900px) {
  .dns__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .dns__head,
  .dns__row { grid-template-columns: minmax(0, 1fr) 5.4em; }
  .dns__head span:nth-child(1), .dns__head span:nth-child(3),
  .dns__row .dns__t, .dns__row .dns__c { display: none; }
  .dns__rows { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dns__row.is-new { animation: none; }
}

/* ---------- Scam Shield: run the fusion rules ---------- */

/* Levels drawn without colour: from an empty box to solid white. */
[data-level="LOW"] { --fillp: none; }
[data-level="INCONCLUSIVE"] { --fillp: radial-gradient(circle, rgba(255,255,255,.55) 1px, transparent 1.3px) 0 0 / 5px 5px; }
[data-level="CAUTION"] { --fillp: repeating-linear-gradient(45deg, rgba(255,255,255,.5) 0 1px, transparent 1px 6px); }
[data-level="WARNING"] { --fillp: repeating-linear-gradient(45deg, rgba(255,255,255,.85) 0 2px, transparent 2px 5px); }
[data-level="HIGH"] { --fillp: linear-gradient(#fff, #fff); }

.shield__top { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.shield__timeline { flex: 1 1 320px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.shield__timeline li { display: grid; gap: 4px; }
.shield__bk { height: 22px; border: 1px solid var(--ink-3); background: none; transition: border-color 0.2s; }
.shield__timeline li.is-done .shield__bk { border-color: var(--white); background: var(--fillp); }
.shield__timeline li.is-now .shield__bk { outline: 1px solid var(--white); outline-offset: 2px; }
.shield__said { margin-top: 18px; display: grid; gap: 4px; min-height: 4.4em; }
.shield__quote { font-size: 17px; line-height: 1.5; }
.shield__quote:not(:empty)::before { content: "“"; }
.shield__quote:not(:empty)::after { content: "”"; }

.shield__grid { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
.shield__sig { border: 0; margin: 0; padding: 0; }
.shield__sig + .shield__sig { margin-top: 16px; }
.shield__sig legend { padding: 0; margin-bottom: 8px; font-weight: 500; }
.radios { display: flex; flex-wrap: wrap; gap: 6px; }
.radios label { position: relative; cursor: pointer; }
.radios input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radios span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 13.5px;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.radios label:hover span { color: var(--white); border-color: var(--white); }
.radios input:checked + span { background: var(--white); color: var(--black); border-color: var(--white); }
.radios input:focus-visible + span { outline: 2px solid var(--white); outline-offset: 3px; }
.shield__score { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.shield__card { padding: 20px; border: 1px solid var(--white); background: var(--black); transition: background-color 0.3s, color 0.3s; }
.shield__ladder { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.shield__ladder span { height: 8px; border: 1px solid currentColor; opacity: 0.35; }
.shield__ladder span.is-on { opacity: 1; background: currentColor; }
.shield__level { margin-top: 14px; font: 700 clamp(48px, 5.4vw, 76px)/1 var(--black-letter); }
.shield__head { margin-top: 8px; font-weight: 700; font-size: 16px; }
.shield__trap { margin-top: 16px; padding-top: 12px; border-top: 1px dotted currentColor; }
.shield__tt { font-weight: 700; margin-top: 2px; }
.shield__tp { margin-top: 2px; font-size: 13.5px; }
.shield__check { margin-top: 14px; font-size: 13.5px; }
.shield__1930 { margin-top: 14px; padding: 8px 10px; border: 1px solid currentColor; font-weight: 700; font-size: 13.5px; }
.shield__card[data-level="HIGH"] { background: var(--white); color: var(--black); }
.shield__card[data-level="HIGH"] .label,
.shield__card[data-level="HIGH"] .list li::before { color: rgba(0, 0, 0, 0.55); }
.shield__card[data-level="WARNING"] { border-width: 3px; }
.shield__card[data-level="CAUTION"] { border-style: dashed; }
.shield__card[data-level="INCONCLUSIVE"] { border-style: dotted; }
.shield__card[data-level="LOW"] { border-color: var(--ink-3); }

@media (max-width: 900px) {
  .shield__grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- LiDAR: project the scan ---------- */

.lidar__stage { position: relative; height: clamp(300px, 40vw, 470px); border: 1px dotted var(--rule); }
.lidar__stage canvas { position: absolute; inset: 0; cursor: grab; touch-action: pan-y; }
.lidar__stage canvas:active { cursor: grabbing; }
.lidar__hint { position: absolute; right: 10px; bottom: 8px; font-size: 13px; color: var(--ink-3); pointer-events: none; }
.lidar__controls { margin-top: 16px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; }
.lidar__slide { flex: 1 1 320px; display: flex; align-items: center; gap: 12px; }
.lidar__slide .label { white-space: nowrap; }
.lidar__view { flex: 1; min-width: 120px; height: 44px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.lidar__view::-webkit-slider-runnable-track { height: 1px; background: var(--white); }
.lidar__view::-moz-range-track { height: 1px; background: var(--white); }
.lidar__view::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -9px; background: var(--white); border: 0; }
.lidar__view::-moz-range-thumb { width: 18px; height: 18px; background: var(--white); border: 0; border-radius: 0; }
.lidar__view:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.lidar__note { margin-top: 12px; min-height: 3.2em; color: var(--ink-2); font-size: 13.5px; }
.lidar__foot { margin-top: 8px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: end; }
.lidar__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lidar__stats div { border-top: 1px solid var(--white); padding-top: 8px; }
.lidar__stats dt { font-size: 13px; color: var(--ink-3); }
.lidar__stats b { font: 700 clamp(24px, 2.4vw, 32px)/1.1 var(--black-letter); }
.lidar__math { font-size: 13px; line-height: 1.8; }
.lidar__math code { margin-right: 6px; white-space: nowrap; }

@media (max-width: 900px) {
  .lidar__foot { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Skills: the stack map ---------- */

.block--full .block__title { position: static; grid-column: 1 / -1; margin-bottom: 28px; }
.block--full .block__body { grid-column: 1 / -1; max-width: none; }
.stack__lede { color: var(--ink-2); max-width: 70ch; margin-bottom: 24px; }
.stack__wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 28px; align-items: start; }
.map { margin-top: 0; padding: 0; overflow: hidden; height: 620px; touch-action: pan-y; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.3s; }
.map line { stroke: rgba(255, 255, 255, 0.34); stroke-width: 1; stroke-dasharray: 1 4; stroke-linecap: round; transition: opacity 0.2s, stroke 0.2s; }
.map.is-focus line { opacity: 0.12; }
.map.is-focus line.is-lit { opacity: 1; stroke: var(--white); stroke-dasharray: none; }
.map__nodes { position: absolute; inset: 0; }
.map__hub,
.map__tool {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  background: var(--black);
  color: var(--white);
  cursor: pointer;
  will-change: transform;
  transition: opacity 0.2s, color 0.2s, border-color 0.2s, background-color 0.2s;
}
.map__hub { font: 700 clamp(22px, 2.1vw, 30px)/1.1 var(--black-letter); padding: 6px 12px 8px; border: 1px solid var(--white); }
.map__tool { font: 400 13px/1.2 var(--mono); min-height: 32px; padding: 6px 9px 6px 20px; color: var(--ink-2); border: 1px solid transparent; }
.map__tool::before { content: ""; position: absolute; left: 8px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; background: currentColor; }
.map__tool:hover,
.map__tool.is-lit { color: var(--white); border-color: rgba(255, 255, 255, 0.5); }
.map.is-focus .map__tool:not(.is-lit),
.map.is-focus .map__hub:not(.is-lit) { opacity: 0.26; }
.map__hub[aria-pressed="true"],
.map__tool[aria-pressed="true"] { background: var(--white); color: var(--black); border-color: var(--white); opacity: 1; }

.detail { position: sticky; top: calc(var(--nav-h) + 24px); border-top: 1px solid var(--white); padding-top: 14px; min-height: 240px; }
.detail__title { font: 700 clamp(30px, 3vw, 44px)/1.05 var(--black-letter); margin-top: 2px; }
.detail__text { color: var(--ink-2); margin-top: 8px; font-size: 14px; }
.detail__uses { margin-top: 14px; }
.detail__uses li { padding: 10px 0; border-top: 1px dotted var(--rule); font-size: 13.5px; }
.detail__uses p { color: var(--ink-2); margin-top: 2px; }
.detail__hub { font-weight: 700; }
.detail__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.detail__chips .chip-btn { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.detail__go { display: inline-block; margin-top: 16px; }
.skills__h { margin-top: 56px; }

/* "Built with" lists, turned into links to the map */
.stack--chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; line-height: 1.3; color: var(--ink-2); background: none; border: 1px solid var(--rule); padding: 6px 10px; min-height: 34px; cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.chip:hover { color: var(--white); border-color: var(--white); }
.chip--plain { cursor: default; border-style: dotted; display: inline-flex; align-items: center; }
.chip--plain:hover { color: var(--ink-2); border-color: var(--rule); }

@media (max-width: 900px) {
  .stack__wrap { grid-template-columns: minmax(0, 1fr); }
  .detail { order: -1; top: var(--nav-h); z-index: 5; background: var(--black); min-height: 0; max-height: 32svh; overflow: auto; padding-bottom: 12px; border-bottom: 1px dotted var(--rule); }
  .detail__title { font-size: 30px; }
}

/* ---------- Tool logos ---------- */
.logo { display: block; width: 1em; height: 1em; fill: currentColor; flex: none; }
.map__tool.is-logo { font-size: 26px; color: var(--white); min-height: 0; padding: 8px; display: grid; place-items: center; }
.map__tool.is-logo::before { display: none; }
.chip.is-logo,
.chip-btn.is-logo { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; min-width: 38px; padding: 7px 9px; }
.detail__chips .chip-btn.is-logo { min-height: 36px; font-size: 17px; }
.detail__title .logo { display: inline-block; width: 0.8em; height: 0.8em; vertical-align: -0.06em; margin-right: 0.1em; }
.skills .stack--chips { margin-top: 2px; }
.skills .chip--plain.is-logo { font-size: 20px; padding: 7px 9px; border-style: solid; }

/* ---------- The tool finder ("/" opens it, js/stack.js) ---------- */
.find {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid var(--white);
  font: 400 14px/1.4 var(--mono);
}
.find[hidden] { display: none; }
.find__ps { color: var(--white); font-weight: 700; }
.find__in {
  flex: 1 1 auto;
  min-width: 0;
  padding: 2px 0;
  font: inherit;
  color: var(--white);
  background: none;
  border: 0;
  outline: none;
  caret-color: var(--here);
}
.find__in::placeholder { color: var(--ink-3); }
.find__in::-webkit-search-cancel-button { display: none; }
.find__count { color: var(--ink-2); white-space: nowrap; }
.find__hint { color: var(--ink-3); white-space: nowrap; }
@media (max-width: 680px) { .find__hint { display: none; } }
