/**
 * This project's own styling, on top of the site's stylesheet and the tools
 * stylesheet from the site's tools/assets/css/style.css.
 *
 * Everything here is either the option grid (which every tool page in the site
 * defines for itself, at its own column width) or something only a laser page
 * has: the two previews, and the footer this project carries instead of the
 * site's.
 *
 * Nothing here invents a colour. The tools stylesheet has no .btn rule, so
 * buttons are .primary / .secondary inside .actions -- a Bootstrap .btn comes
 * out invisible on the dark card.
 */

.laser-page .opts .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px 22px;
}

/* A row of controls that belong together on one line: a number and its unit. */
.laser-page .unit { color: var(--ink-dim); font-weight: 400; font-size: 13px; }

/* A heading inside a card, splitting one long panel of options into parts. */
.laser-page .subhead {
    margin: 22px 0 12px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-dim);
    text-transform: none;
}

/* ---- saved machines and materials ---------------------------------------- */

.laser-page .presets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.laser-page .presets label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    margin: 0;
}
.laser-page .presets select {
    background: var(--panel-2);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 6px 9px;
    font-size: 13.5px;
    min-width: 200px;
}
.laser-page .presets .est { flex: 1 1 100%; }

/* The tools stylesheet sizes .primary and .secondary for a main action; these
   sit in a row of their own above the options and want to be quieter. */
.laser-page .presets .secondary,
.laser-page .actions .secondary.sm,
.laser-page .actions .sm { padding: 6px 12px; font-size: 13px; }
.laser-page .secondary[disabled] { opacity: .45; cursor: not-allowed; }

/* ---- the front door ------------------------------------------------------- */

.laser-page .toolcards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin: 18px 0 24px;
}
.laser-page .toolcard {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    background: var(--card-bg, var(--panel));
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
}
.laser-page .toolcard:hover { border-color: var(--accent); }
.laser-page .toolcard-icon {
    flex: 0 0 auto;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--accent);
    font-size: 18px;
}
.laser-page .toolcard-body { display: block; }
.laser-page .toolcard-body strong { display: block; margin-bottom: 5px; font-size: 15px; }
/* Marks the one tool here that needs nothing: it makes no file, so there is
   nothing to put behind Supporter Plus. */
.laser-page .freetag {
    display: inline-block;
    margin-left: 7px;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(var(--primary-rgb, 78, 161, 255), .14);
    color: var(--accent);
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    vertical-align: middle;
}
.laser-page .toolcard-body span { display: block; color: var(--ink-dim); font-size: 13.5px; line-height: 1.55; }

/* ---- the two previews ---------------------------------------------------- */

.laser-page .stage {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
    padding: 12px;
    /* A checked ground, so a preview that is mostly pale still reads as a
       picture sitting on something rather than as an empty panel. */
    background-image:
        linear-gradient(45deg, rgba(127,127,127,.07) 25%, transparent 25%, transparent 75%, rgba(127,127,127,.07) 75%),
        linear-gradient(45deg, rgba(127,127,127,.07) 25%, transparent 25%, transparent 75%, rgba(127,127,127,.07) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 9px 9px;
}
.laser-page .stage canvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 6px;
    /* The preview is one canvas pixel per laser dot. Letting the browser smooth
       it would show a softer picture than the machine will ever burn, which is
       exactly the wrong way for a preview to be wrong. */
    image-rendering: pixelated;
}
.laser-page .stage.path canvas { image-rendering: auto; }

.laser-page .previewtabs { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.laser-page .previewtabs button {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink-dim);
    border-radius: 999px;
    padding: 5px 13px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.laser-page .previewtabs button.on { border-color: var(--accent); color: var(--ink); }

/* The legend under the path view. The swatches have to match what the canvas
   draws, so both read their colours from the same custom properties. */
.laser-page .legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.laser-page .legend span { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-dim); font-size: 12.5px; }
.laser-page .legend i { width: 20px; height: 0; border-top-width: 2px; border-top-style: solid; display: inline-block; }
.laser-page .legend .burn { border-top-color: var(--accent); }
.laser-page .legend .jump { border-top-color: #e2574c; border-top-style: dashed; }

/* ---- tracing a picture ---------------------------------------------------- */

/* The picture and its controls side by side: judging a trace means watching the
   outlines move while the slider moves, so they cannot be one above the other
   on anything wider than a phone. */
.laser-page .tracewrap {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr);
    gap: 18px;
    align-items: start;
}
@media (max-width: 860px) {
    .laser-page .tracewrap { grid-template-columns: 1fr; }
}
.laser-page .tracewrap .stage { margin-top: 0; }
.laser-page .tracewrap .opts { margin-top: 0; border-top: 0; padding-top: 0; }

/* ---- one row per colour, on the cutting page ------------------------------ */

.laser-page .oprow {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 9px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
}
.laser-page .oprow.is-ignored { opacity: .5; }

/* The colour as it is in the drawing. A ring round it so that white, and
   anything near the panel colour, is still a visible swatch. */
.laser-page .opswatch {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border-radius: 6px;
    border: 1px solid var(--line);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
    margin-bottom: 3px;
}
.laser-page .opname { flex: 0 0 auto; min-width: 104px; }
.laser-page .opname b { display: block; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
.laser-page .opname em { display: block; font-style: normal; font-size: 12px; color: var(--ink-dim); }

.laser-page .oprow label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-dim);
    margin: 0;
}
.laser-page .oprow input[type=number] { width: 84px; display: block; margin-top: 3px; }
.laser-page .oprow select { display: block; margin-top: 3px; }
.laser-page .opmove { margin-left: auto; display: flex; gap: 5px; }
.laser-page .legend .score { border-top-color: #8bd17c; }
/* A tab is marked with a dot rather than drawn to length: at bed scale a
   1.5 mm gap is less than a pixel wide. */
.laser-page .legend .tabdot {
    width: 8px; height: 8px;
    border: 0; border-radius: 50%;
    background: #8bd17c;
}

/* ---- the simulator -------------------------------------------------------- */

/* The head marker sits on its own canvas over the burn, so moving it does not
   mean redrawing the work. Both are the same size and in the same place. */
.laser-page .stage { position: relative; }
.laser-page .simhead {
    position: absolute;
    left: 12px; top: 12px;          /* the stage's own padding */
    width: calc(100% - 24px);
    pointer-events: none;
}

.laser-page .simstate {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 4px;
}
.laser-page .simchip {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 12.5px;
    color: var(--ink-dim);
}
.laser-page .simchip i { color: var(--ink-dim); font-size: 12px; }
.laser-page .simchip b { font-weight: 600; color: var(--ink-dim); }
.laser-page .simchip em { font-style: normal; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Lit. The colour is the one the head marker uses, so the chip and the dot on
   the canvas say the same thing. */
.laser-page .simchip.on { border-color: #ffd54a; }
.laser-page .simchip.on i, .laser-page .simchip.on em { color: #ffd54a; }

.laser-page .simstate.paused .simchip { opacity: .6; }

.laser-page .simbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.laser-page .simbar input[type=range] { flex: 1 1 220px; accent-color: var(--accent); }
.laser-page .simclock { font-variant-numeric: tabular-nums; min-width: 96px; }
.laser-page .simspeed { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-dim); }
.laser-page .simspeed select {
    background: var(--panel-2); color: var(--ink);
    border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 13px;
}
.laser-page .legend .head { border-top-color: #ffd54a; }

/* ---- the G-code, when somebody wants to look before downloading ---------- */

.laser-page .peek {
    margin-top: 12px;
    max-height: 260px;
    overflow: auto;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 11px 13px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre;
    color: var(--ink-dim);
}

/* ---- footer -------------------------------------------------------------- */

.laser-foot {
    margin-top: 48px;
    padding: 22px 0 30px;
    border-top: 1px solid var(--line);
    color: var(--ink-dim);
    font-size: 13.5px;
    text-align: center;
}
.laser-foot a { color: var(--accent); text-decoration: none; }
.laser-foot a:hover { text-decoration: underline; }
.laser-foot .est { font-size: 12.5px; }
