/* Frengine Portal */
:root {
  --bg: #f1f3f5;
  --sheet: #f8f9fa;
  --ink: #14171a;
  --muted: #59626b;
  --steel: #8a939c;
  --faint: #c9d0d6;
  --accent: #f2c230;
  --hot: color-mix(in srgb, var(--accent) 38%, transparent);
  --font: "DIN Alternate", "DIN Next", "Bahnschrift", "Barlow", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --sheet: #16191c;
    --ink: #e6e9ec;
    --muted: #9aa3ac;
    --steel: #6e7781;
    --faint: #2a3036;
    --hot: color-mix(in srgb, var(--accent) 22%, transparent);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2rem;
  padding: clamp(20px, 4vw, 56px);
  overflow-x: hidden;
}

.mark {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.mark span { font-weight: 400; color: var(--muted); letter-spacing: 0; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  grid-template-areas: "copy sheet" "bom sheet";
  column-gap: clamp(2rem, 6vw, 6rem);
  row-gap: 2.5rem;
  align-items: start;
}
.copy  { grid-area: copy; align-self: end; }
.bom   { grid-area: bom; }
.sheet { grid-area: sheet; align-self: center; }

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5.2vw, 4.4rem);
  font-weight: 700;
  line-height: 0.94;
  letter-spacing: -0.035em;
}
.lede {
  margin: 1.4rem 0 0;
  max-width: 34ch;
  font-size: clamp(1.05rem, 1.5vw, 1.2rem);
  line-height: 1.5;
}
.note {
  margin: 0.6rem 0 0;
  max-width: 40ch;
  color: var(--muted);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.18em;
}
a:hover { background: var(--hot); }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* --- bill of materials --------------------------------------------------- */
.bom table {
  width: 100%;
  max-width: 560px;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.bom caption {
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  padding-bottom: 0.5rem;
}
.bom th, .bom td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--faint);
}
.bom thead th {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
  border-bottom: 1.5px solid var(--ink);
}
.bom td:first-child, .bom th:first-child { width: 3.2rem; font-variant-numeric: tabular-nums; }
.bom tbody tr { cursor: default; transition: background-color 0.15s; }
.bom tbody tr.is-hot { background: var(--hot); }
.bom tbody tr:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

.status { white-space: nowrap; }
.status::before {
  content: "";
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-right: 0.45em;
  border: 1.5px solid var(--ink);
  vertical-align: 0.02em;
}
.status[data-s="ready"]::before { background: var(--ink); }
.status[data-s="assembly"]::before { background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.status[data-s="missing"]::before { border-style: dashed; }

/* --- drawing sheet ------------------------------------------------------- */
.sheet {
  margin: 0;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  border: 1.5px solid var(--ink);
  background: var(--sheet);
}
.sheet svg { display: block; width: 100%; height: auto; max-height: 74vh; }
.sheet figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1.5px solid var(--ink);
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* svg styles */
.ln    { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.body  { fill: var(--sheet); stroke: var(--ink); stroke-width: 1.5; transition: fill 0.15s; }
.body.cut { fill: url(#fp-hatch); }
.cl    { fill: none; stroke: var(--steel); stroke-width: 0.9; stroke-dasharray: 18 4 3 4; }
.ph    { fill: none; stroke: var(--steel); stroke-width: 1; stroke-dasharray: 6 4; }
.lead  { fill: none; stroke: var(--steel); stroke-width: 0.9; }
.dot   { fill: var(--steel); }
.hatch { stroke: var(--steel); stroke-width: 0.8; }
.balloon { fill: var(--sheet); stroke: var(--ink); stroke-width: 1.3; transition: fill 0.15s; }
.balloon-txt { fill: var(--ink); font-family: var(--font); font-size: 12px; font-weight: 700; }
.part { cursor: default; }
.part.is-hot .body, .callout.is-hot .balloon { fill: var(--accent); }
.callout.is-hot .balloon-txt { fill: #14171a; }

footer { color: var(--muted); font-size: 0.875rem; }

@media (max-width: 860px) {
  main {
    grid-template-columns: 1fr;
    grid-template-areas: "sheet" "copy" "bom";
  }
  .sheet { max-width: 380px; }
  .bom td:nth-child(2), .bom th:nth-child(2) { display: none; }   /* drop the mechanical part column */
}
