/* Friends Packaging: styles for the code-drawn graphics in fx.js */
:root {
  --kraft: #c8975f; --kraft-d: #9c6b37; --kraft-l: #e2bf8f; --kraft-line: #7a4f24;
  --fx-panel: color-mix(in srgb, var(--p-surface, #ddd0b9) 70%, #fff 30%);
  --fx-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.mono, .fx .mono { font-family: var(--fx-mono); font-size: 0.86em; letter-spacing: 0; }
.fx { --r: var(--r-lg, 16px); display: grid; gap: var(--s-5, 20px); color: var(--ink, #062b8a); }
.fx svg { display: block; width: 100%; height: auto; overflow: visible; }
.fx button { font: inherit; color: inherit; }

/* segmented switch */
.fx-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--fx-panel); justify-self: start; border: 1px solid var(--line); }
.fx-seg button { border: 0; background: transparent; padding: 10px 18px; border-radius: 999px; cursor: pointer; font-weight: 500; min-height: 40px; }
.fx-seg button[aria-pressed="true"] { background: var(--p-ink, #062b8a); color: var(--p-bg, #e6dbc7); }
.fx-seg button:focus-visible { outline: 2px solid var(--p-ink); outline-offset: 2px; }

/* readouts */
.fx-read { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-3) var(--s-5); margin: 0; }
.fx-read > div { border-top: 1px solid var(--line); padding-top: var(--s-2); }
.fx-read dt { font: 500 12px/1.4 var(--fx-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.fx-read dd { margin: 4px 0 0; font-size: var(--t-body, 17px); font-variant-numeric: tabular-nums; }
.fx-read__wide { grid-column: 1 / -1; }
.ground-inverse .fx-read dt { color: var(--p-inv-muted); }
.fx-note { color: var(--muted); max-width: 60ch; }
.fx-hint { position: absolute; left: 16px; bottom: 12px; font: 500 12px/1 var(--fx-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); pointer-events: none; }

/* ---------- ply explorer ---------- */
.fx-ply__stage { position: relative; border-radius: var(--r); background: var(--fx-panel); padding: 36px 28px 40px; cursor: pointer; touch-action: none; user-select: none; overflow: hidden;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 24px 24px; background-position: -1px -1px; }
.ground-inverse .fx-ply__stage { background-color: var(--p-inv-surface); background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); }
.fx-ply__stage:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.fx-liner { fill: var(--kraft); stroke: var(--kraft-line); stroke-width: 0.8; }
.fx-flute__wave { fill: none; stroke: var(--kraft-d); stroke-width: 3; stroke-linejoin: round; }
.fx-tag { font: 500 13px var(--fx-mono); fill: currentColor; opacity: .7; }
.fx-ply__board { transform-origin: 50% 50%; transform-box: fill-box; transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
.fx-ply.is-pressed .fx-ply__board { transform: scaleY(calc(1 - var(--give, .2))); transition-duration: .5s; transition-timing-function: cubic-bezier(.2,.7,.3,1); }
.fx-weight { position: absolute; top: 0; left: 50%; translate: -50% -110%; width: 120px; height: 34px; border-radius: 8px; background: var(--p-ink); color: var(--p-bg); display: grid; place-items: center; font: 600 13px var(--fx-mono); transition: translate .45s cubic-bezier(.2,.7,.3,1); pointer-events: none; }
.ground-inverse .fx-weight { background: var(--p-bg); color: var(--p-ink); }
.fx-ply.is-pressed .fx-weight { translate: -50% 4px; }
.fx-ply.is-in .fx-liner, .fx-rec.is-in .fx-liner { animation: fx-slide .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d); }
.fx-ply.is-in .fx-flute, .fx-rec.is-in .fx-flute { animation: fx-slide .6s cubic-bezier(.2,.7,.2,1) both; animation-delay: var(--d); }
.fx-flute__wave { animation: fx-run 1.6s linear infinite; }
@keyframes fx-slide { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
@keyframes fx-run { to { transform: translateX(-26px); } }
.fx-gauge { display: grid; gap: 6px; }
.fx-gauge__bar { display: block; height: 10px; border-radius: 99px; background: var(--fx-panel); position: relative; overflow: hidden; border: 1px solid var(--line); }
.fx-gauge__bar::after { content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--v, .5)); background: repeating-linear-gradient(90deg, var(--p-ink) 0 10px, color-mix(in srgb, var(--p-ink) 80%, transparent) 10px 12px); transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.ground-inverse .fx-gauge__bar { background: var(--p-inv-surface); }
.ground-inverse .fx-gauge__bar::after { background: var(--p-bg); }
.fx-gauge__scale { display: flex; justify-content: space-between; font: 12px var(--fx-mono); color: var(--muted); }
.fx-gauge__scale i { font-style: normal; }
.fx-more { justify-self: start; }

/* ---------- production line ---------- */
.fx-proc { gap: var(--s-6, 24px); }
.fx-proc__stage { border-radius: var(--r); background: var(--fx-panel); padding: 20px 16px 8px; overflow: hidden; }
.fx-grid { stroke: var(--line); stroke-width: 1; fill: none; }
.fx-floor { stroke: var(--ink); stroke-width: 2; opacity: .5; }
.fx-web { fill: none; stroke: var(--kraft-d); stroke-width: 4; }
.fx-web--board { stroke-width: 3; }
.fx-run { fill: none; stroke: var(--p-bg, #e6dbc7); stroke-width: 2; stroke-dasharray: 3 22; opacity: .9; }
.fx-proc.is-live .fx-run { animation: fx-dash 1s linear infinite; }
@keyframes fx-dash { to { stroke-dashoffset: -25; } }
.fx-reel { fill: #efe6d6; stroke: var(--kraft-d); stroke-width: 3; }
.fx-ring { fill: none; stroke: var(--kraft); stroke-width: 2; }
.fx-axle { fill: var(--ink); }
.fx-stand { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; opacity: .6; }
.fx-body { fill: var(--p-ink, #062b8a); }
.fx-dot { fill: #f2c14e; }
.fx-roll { fill: #c9ced8; stroke: #8a93a6; stroke-width: 2; }
.fx-ink { fill: #3253a4; }
.fx-blade { fill: #c9ced8; }
.fx-mark { fill: var(--p-ink); opacity: 0; }
.fx-box__side { fill: var(--kraft-d); } .fx-box__front { fill: var(--kraft); } .fx-box__top { fill: var(--kraft-l); }
.fx-box__tape { stroke: #b88a55; stroke-width: 7; opacity: .7; }
.fx-box__print { font: 700 14px var(--font-display); fill: var(--p-ink); }
.fx-lab { font: 500 14px var(--fx-mono); fill: var(--ink); text-anchor: middle; opacity: .55; }
.fx-m { opacity: .38; transition: opacity .4s; }
.fx-m.is-on { opacity: 1; }
.fx-m.is-on .fx-lab { opacity: 1; font-weight: 700; }
.fx-spin { transform-box: fill-box; transform-origin: center; }
.fx-proc.is-live .fx-m.is-on .fx-spin { animation: fx-rot 2.4s linear infinite; }
.fx-proc.is-live .fx-m.is-on .fx-spin--rev { animation-direction: reverse; }
@keyframes fx-rot { to { transform: rotate(360deg); } }
.fx-proc.is-live .fx-m.is-on .fx-mark { animation: fx-ink 2.4s ease-out infinite; animation-delay: calc(var(--i) * .3s); }
.fx-m:not(.is-on) .fx-mark { opacity: .35; }
@keyframes fx-ink { 0% { opacity: 0; } 15%, 100% { opacity: 1; } }
.fx-press { transition: transform .3s; }
.fx-proc.is-live .fx-m.is-on .fx-press { animation: fx-stamp 1.4s cubic-bezier(.6,0,.4,1) infinite; }
@keyframes fx-stamp { 0%, 100% { transform: translateY(0); } 45%, 55% { transform: translateY(42px); } }
.fx-proc.is-live .fx-m.is-on .fx-box { animation: fx-pop 1.6s cubic-bezier(.2,.7,.3,1.4) infinite alternate; }
@keyframes fx-pop { from { transform: translate(1146px, 236px) scale(.92); } to { transform: translate(1146px, 236px) scale(1.06); } }
.fx-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.fx-steps button { all: unset; box-sizing: border-box; display: grid; gap: 6px; align-content: start; width: 100%; height: 100%; padding: 16px 0 0; border-top: 2px solid var(--line); cursor: pointer; position: relative; }
.fx-steps button:focus-visible { outline: 2px solid var(--p-ink); outline-offset: 4px; }
.fx-steps__n { font: 500 12px var(--fx-mono); color: var(--muted); }
.fx-steps__t { font: 500 var(--t-lead, 20px)/1.3 var(--font-text); }
.fx-steps__p { color: var(--muted); font-size: var(--t-small, 15px); line-height: 1.5; }
.fx-steps__bar { position: absolute; left: 0; top: -2px; height: 2px; width: 100%; background: var(--p-ink); transform: scaleX(0); transform-origin: left; }
.fx-steps button[aria-pressed="true"] .fx-steps__p { color: var(--ink); }
.fx-steps button[aria-pressed="true"] .fx-steps__bar { transform: scaleX(1); }
.fx-proc.is-live:not(.is-manual) .fx-steps button[aria-pressed="true"] .fx-steps__bar { animation: fx-fill 4.2s linear both; }
@keyframes fx-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (max-width: 760px) { .fx-steps { grid-template-columns: 1fr 1fr; } .fx-proc__stage { padding: 10px 4px 2px; } }

/* ---------- recommender ---------- */
.fx-rec__in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-7, 40px); align-items: start; }
.fx-rec__q { display: grid; gap: var(--s-6, 28px); }
.fx-chips { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.fx-chips legend { width: 100%; margin-bottom: 10px; font-weight: 500; padding: 0; }
.fx-chips label { position: relative; display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: var(--t-small); font-weight: 500; transition: background .2s, color .2s; }
.fx-chips input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.fx-chips label:has(input:checked) { background: var(--p-ink); color: var(--p-bg); border-color: var(--p-ink); }
.fx-chips label:has(input:focus-visible) { outline: 2px solid var(--p-ink); outline-offset: 2px; }
.fx-field { display: grid; gap: 10px; }
.fx-field label, .fx-field > span { font-weight: 500; display: flex; justify-content: space-between; gap: 12px; }
.fx-field input[type="range"] { width: 100%; accent-color: var(--p-ink); height: 36px; }
.fx-field input[type="text"] { min-height: 48px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: var(--p-bg); font: inherit; color: inherit; }
.fx-rec__a { border-radius: var(--r); background: var(--p-ink); color: var(--p-bg); padding: clamp(24px, 3vw, 40px); display: grid; gap: var(--s-4); }
.fx-rec__a .t-label, .fx-rec__a .fx-note { color: color-mix(in srgb, var(--p-bg) 75%, transparent); }
.fx-rec__ply { font: var(--display-weight, 400) clamp(56px, 7vw, 96px)/0.95 var(--font-display); letter-spacing: -0.04em; margin: 0; }
.fx-rec__svg { margin: 4px 0; }
.fx-rec__a .fx-liner { fill: var(--kraft-l); }
.fx-rec__a .fx-flute__wave { stroke: var(--kraft); }
.fx-rec__why { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; list-style: disc; }
.fx-rec__why li::marker { color: var(--kraft); }
.fx-rec__a .btn--primary { background: var(--p-bg); color: var(--p-ink); border-color: var(--p-bg); }
.fx-rec__a .btn--secondary { color: var(--p-bg); border-color: color-mix(in srgb, var(--p-bg) 45%, transparent); background: transparent; }
@media (max-width: 860px) { .fx-rec__in { grid-template-columns: minmax(0, 1fr); } }

/* ---------- map ---------- */
.fx-map__stage { border-radius: var(--r); background: var(--fx-panel); padding: 12px; overflow: hidden; }
.fx-coord { font: 11px var(--fx-mono); fill: var(--muted); }
.fx-route { fill: none; stroke: var(--p-ink); stroke-width: 1.6; stroke-dasharray: 5 7; opacity: .45; }
.fx-map.is-in .fx-route { animation: fx-dash 1.2s linear infinite; }
.fx-route.is-focus, .fx-route.is-hot { opacity: 1; stroke-width: 2.6; }
.fx-town circle { fill: var(--p-bg); stroke: var(--p-ink); stroke-width: 2.5; transition: r .2s; }
.fx-town--port circle { fill: #f2c14e; }
.fx-town text, .fx-home text { font: 500 15px var(--font-text); fill: var(--ink); }
.fx-town { cursor: pointer; outline: none; }
.fx-town.is-focus text, .fx-town.is-hot text { font-weight: 700; }
.fx-town.is-hot circle, .fx-town.is-focus circle { stroke-width: 4; }
.fx-town--far path { fill: none; stroke: var(--p-ink); stroke-width: 3; }
.fx-home circle { fill: var(--p-ink); }
.fx-home text { font-weight: 700; }
.fx-home__pulse { fill: var(--p-ink) !important; opacity: .35; transform-box: fill-box; transform-origin: center; }
.fx-map.is-in .fx-home__pulse { animation: fx-pulse 2s ease-out infinite; }
@keyframes fx-pulse { from { transform: scale(1); opacity: .45; } to { transform: scale(4); opacity: 0; } }
.fx-map__read { padding: 12px 4px 0; min-height: 2.4em; }

/* ---------- dieline + paper ---------- */
.fx-die__in, .fx-paper__in { display: grid; gap: var(--s-5); }
.fx-dims { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.fx-dims legend { width: 100%; font-weight: 500; margin-bottom: 8px; padding: 0; }
.fx-dims label { display: inline-flex; align-items: center; gap: 8px; font: 600 14px var(--fx-mono); }
.fx-dims input { width: 96px; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--p-bg); font: 500 16px var(--fx-mono); color: inherit; }
.fx-die__stage { border-radius: var(--r); background: var(--fx-panel); padding: 14px; overflow: hidden;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 20px 20px; }
.fx-die__stage svg { max-height: 420px; }
.fx-die__panel { fill: var(--kraft-l); } .fx-die__panel.is-alt { fill: #ead0a8; }
.fx-die__flap { fill: #edd8b8; }
.fx-die__glue { fill: var(--kraft); }
.fx-die__cut { fill: none; stroke: var(--p-ink); stroke-linejoin: round; }
.fx-die__crease { fill: none; stroke: #c0392b; stroke-dasharray: 8 6; }
.fx-die__t { fill: var(--kraft-line); font-family: var(--fx-mono); font-weight: 700; }
.fx-die__dim path { fill: none; stroke: var(--muted); }
.fx-die__dim text { fill: var(--ink); font-family: var(--fx-mono); }
.fx-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); }
.fx-key { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--p-ink); }
.fx-key--crease { border-top: 3px dashed #c0392b; }
.fx-key--glue { height: 10px; border: 0; background: var(--kraft); }
.fx-bars { display: grid; gap: 12px; }
.fx-bars__row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 140px; gap: 12px; align-items: center; }
.fx-bars__k { font: 600 14px var(--fx-mono); }
.fx-bars__track { height: 26px; border-radius: 6px; background: var(--fx-panel); overflow: hidden; border: 1px solid var(--line); }
.fx-bars__fill { display: block; height: 100%; transform-origin: left; transform: scaleX(var(--v, .5)); transition: transform .5s cubic-bezier(.2,.7,.2,1);
  background: repeating-linear-gradient(90deg, var(--kraft) 0 14px, var(--kraft-d) 14px 16px); }
.fx-bars__v { text-align: right; font-size: 13px; }
@media (max-width: 520px) { .fx-bars__row { grid-template-columns: 48px minmax(0, 1fr); } .fx-bars__v { grid-column: 2; text-align: left; } }

/* ---------- printbox ---------- */
.fx-printbox { grid-template-columns: minmax(0, 1fr); }
.fx-printbox__stage { aspect-ratio: 5 / 4; border-radius: var(--r); background: var(--fx-panel); overflow: hidden; position: relative; }
.fx-printbox__stage > .box3d__canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.fx-printbox__stage > .box3d__fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.fx-printbox__stage:has(> .box3d__canvas) > .box3d__fallback { display: none; }
.fx-printbox__form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 520px) { .fx-printbox__form { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .fx *, .fx *::before, .fx *::after { animation: none !important; transition: none !important; }
  .fx-mark { opacity: 1; }
}

.fx svg.fx-clip { overflow: hidden; }
.ground-inverse .fx-seg { background: var(--p-inv-surface); border-color: rgba(255,255,255,.18); }
.ground-inverse .fx-seg button { color: var(--p-bg); }
.ground-inverse .fx-seg button[aria-pressed="true"] { background: var(--p-bg); color: var(--p-ink); }
.fx-home__lab { font-weight: 700 !important; font-size: 16px !important; paint-order: stroke; stroke: var(--fx-panel); stroke-width: 5px; }
.fx-home__sub { font: 500 12px var(--fx-mono) !important; fill: var(--muted) !important; paint-order: stroke; stroke: var(--fx-panel); stroke-width: 5px; }
.fx-town text { paint-order: stroke; stroke: var(--fx-panel); stroke-width: 4px; }

.fx-map .fx-town text { font-size: 22px; }
.fx-map .fx-home__lab { font-size: 24px !important; }
.fx-map .fx-home__sub { font-size: 16px !important; }
.fx-map .fx-coord { font-size: 14px; }
.fx-lead { stroke: var(--p-ink); stroke-width: 1.5; fill: none; }
.fx-town--port circle { r: 9px; }
.fx-town circle { r: 8px; }
@media (max-width: 640px) {
  .fx-proc__stage { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 10px 0 2px; }
  .fx-proc__stage svg { min-width: 760px; }
  .fx-ply .fx-tag { display: none; }
  .fx-ply__stage { padding: 28px 14px 34px; }
  .fx-map .fx-town text { font-size: 26px; }
}

/* 3D size labels inside the tool frames (the home page styles its own) */
.fx-printbox__stage > .box3d__dim { position: absolute; left: 0; top: 0; z-index: 2; padding: 2px 8px; border-radius: 999px; pointer-events: none;
  background: var(--p-ink); color: var(--p-bg); font: 500 13px/20px var(--font-text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fx-more { padding-block: 8px; }

/* ---------- production line v2: the parts of a real corrugator line ---------- */
.fx-proc .fx-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: var(--s-6); }
.fx-gear { fill: var(--kraft-l); stroke: var(--kraft-d); stroke-width: 1; }
.fx-hub { fill: var(--p-ink); }
.fx-web--sf { stroke-width: 5; }
.fx-web--sheet { stroke-width: 5; stroke: var(--kraft); }
.fx-boardside .fx-flute-s { fill: none; stroke: var(--kraft-d); stroke-width: 2; }
.fx-boardside .fx-liner-s { stroke: var(--kraft-d); stroke-width: 2.5; }
.fx-sub { font: 500 13px var(--fx-mono); fill: var(--muted); }
.fx-glue { fill: #f2c14e; }
.fx-belt { fill: var(--p-ink); opacity: .85; }
.fx-plate { fill: #d9822b; }
.fx-heat path { fill: none; stroke: #d9822b; stroke-width: 2; opacity: .3; stroke-linecap: round; }
.fx-knife { fill: #c9ced8; stroke: #8a93a6; stroke-width: 2; }
.fx-blade-l { stroke: #6b7488; stroke-width: 3; }
.fx-sheet { fill: var(--kraft); stroke: var(--kraft-d); stroke-width: 1; }
.fx-plate-r { fill: none; stroke: var(--p-ink); stroke-width: 6; }
.fx-flatbox { fill: var(--kraft); stroke: var(--kraft-d); stroke-width: 1; }
.fx-strap { fill: var(--p-ink); }
.fx-proc.is-live .fx-m.is-on .fx-heat path { animation: fx-heat 1.2s ease-in-out infinite; animation-delay: calc(var(--i) * .12s); }
@keyframes fx-heat { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
.fx-proc.is-live .fx-m.is-on .fx-sheet:last-child { animation: fx-drop 2.4s cubic-bezier(.5,0,.7,.4) infinite; }
@keyframes fx-drop { 0% { transform: translateY(-26px); opacity: 0; } 30% { opacity: 1; } 60%, 100% { transform: translateY(0); opacity: 1; } }
.fx-proc.is-live .fx-m.is-on .fx-glue { animation: fx-glow 1.2s ease-in-out infinite; }
@keyframes fx-glow { 50% { opacity: .4; } }
@media (max-width: 760px) { .fx-proc .fx-steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .fx-proc__stage svg { min-width: 940px; } }
