/* ==========================================================================
   Evefab Engineering Tools — single tool page
   Scoped under .etools so nothing leaks into the shared theme.

   Direction: measured, exact, workshop-worn.
   World: blueprint paper, calipers and a machined part drawing.
   One ink-tinted neutral ramp, one steel-blue accent, three text roles.
   The calculated figures are the one bright moment; the chrome stays quiet.
   Signature: a dimension line with short end ticks under each panel heading.
   ========================================================================== */

.etools {
    /* neutral ramp, tinted toward blueprint ink */
    --et-bg: #f5f7f9;
    --et-surface: #ffffff;
    --et-raised: #edf1f5;
    --et-line: rgba(17, 28, 41, .10);
    --et-line-soft: rgba(17, 28, 41, .06);
    --et-ink: #16212e;
    --et-ink-2: #4a5868;
    --et-ink-3: #6c7989;

    /* dark surfaces: night-blue graphite, not a brand-blue wash */
    --et-night: #121b27;
    --et-night-2: #1b2634;
    --et-on-night: #f2f5f9;
    --et-on-night-2: #b9c6d6;
    --et-on-night-3: #8d9cb0;
    --et-night-line: rgba(242, 245, 249, .14);

    /* one accent, taken from the drawing ink; white on it clears 4.5:1 */
    --et-accent: #1b5aa8;
    --et-accent-deep: #14467f;
    --et-accent-soft: #e9f0f8;

    --et-warn: #8a6412;
    --et-warn-bg: #faf5e8;
    --et-warn-line: #e3d3a8;

    --et-r-ctl: 8px;
    --et-r-card: 12px;
    --et-r-panel: 16px;
    --et-ease: cubic-bezier(.22, 1, .36, 1);
    --et-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

    color: var(--et-ink);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.etools * { box-sizing: border-box; }
/* The theme sets display on forms/panels; keep the HTML hidden attribute effective. */
.etools [hidden] { display: none !important; }

/* Type: hierarchy from size and colour, not weight. */
.etools h1, .etools h2, .etools h3, .etools h4 {
    color: var(--et-ink);
    font-weight: 500 !important;
    letter-spacing: 0 !important;
}

/* Small meta labels read like drawing annotations, not tracked caps. */
.et-eyebrow {
    margin: 0 0 12px;
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

/* ----------------------------------------------------------- page head --- */
.et-head {
    background: var(--et-night);
    border-bottom: 1px solid var(--et-night-line);
    color: var(--et-on-night);
    padding: 64px 0 56px;
}
.et-head h1 {
    margin: 0 0 16px;
    color: var(--et-on-night);
    font-size: clamp(28px, 3.2vw, 36px);
    line-height: 1.2;
    max-width: 20em;
}
.et-head .et-lead {
    margin: 0;
    max-width: 56em;
    font-size: 15px;
    line-height: 1.7;
    color: var(--et-on-night-2);
}
.et-head-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 0;
    margin-top: 24px;
}
/* A quiet meta row separated by hairlines, instead of glowing pills. */
.et-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 0 24px;
    border: 0;
    border-left: 1px solid var(--et-night-line);
    border-radius: 0;
    background: transparent;
    color: var(--et-on-night-3);
    font-family: var(--et-mono);
    font-size: 12px;
    line-height: 1.5;
}
.et-chip:first-child { padding-left: 0; border-left: 0; }
.et-chip b { color: var(--et-on-night); font-weight: 500; }
.et-back {
    display: inline-block;
    margin-bottom: 24px;
    color: var(--et-on-night-2);
    font-size: 13px;
    text-decoration: none;
    transition: color 160ms var(--et-ease);
}
.et-back:hover { color: var(--et-on-night); text-decoration: none; }

/* ------------------------------------------------------------- layout --- */
.et-body { padding: 48px 0 64px; background: var(--et-bg); }
.et-main, .et-side { min-width: 0; }
@media (min-width: 1200px) {
    .et-side-sticky { position: sticky; top: 24px; }
}

.et-panel {
    margin-bottom: 24px;
    padding: 24px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-panel);
    background: var(--et-surface);
}
.et-panel:last-child { margin-bottom: 0; }

/* Signature: a dimension line — hairline with a short tick at each end. */
.et-panel-head {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(17, 28, 41, .18);
}
/* Short end ticks turn the rule into a dimension line. */
.et-panel-head::before,
.et-panel-head::after {
    content: "";
    position: absolute;
    bottom: -1px;
    width: 1px;
    height: 5px;
    background: var(--et-ink-3);
    pointer-events: none;
}
.et-panel-head::before { left: 0; }
.et-panel-head::after { right: 0; }
.et-panel-head h2 { margin: 0; font-size: 20px; line-height: 1.3; }
.et-panel-head h3 { margin: 0; font-size: 16px; }
.et-panel-head .et-meta {
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
    line-height: 1.6;
}
.et-panel > p { color: var(--et-ink-2); line-height: 1.75; }
.et-panel > p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------- calculator --- */
.et-calc-form { max-width: 760px; }
.et-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.et-field label {
    display: block;
    margin-bottom: 8px;
    color: var(--et-ink-2);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
}
.et-field input,
.et-field select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-ctl);
    background: var(--et-surface);
    color: var(--et-ink);
    font-size: 14px;
    outline: none;
    transition: border-color 160ms var(--et-ease);
}
.et-field input::placeholder,
.et-field select::placeholder { color: var(--et-ink-3); }
.et-field input:hover,
.et-field select:hover { border-color: rgba(17, 28, 41, .22); }
.et-field input:focus,
.et-field select:focus {
    border-color: var(--et-accent);
    outline: 2px solid rgba(27, 90, 168, .28);
    outline-offset: 1px;
}
.et-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid var(--et-accent);
    border-radius: var(--et-r-ctl);
    background: var(--et-accent);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 160ms var(--et-ease), border-color 160ms var(--et-ease);
}
.et-btn:hover { background: var(--et-accent-deep); border-color: var(--et-accent-deep); color: #fff; }
.et-btn:active { transform: scale(.98); }
.et-btn:focus-visible { outline: 2px solid var(--et-accent-deep); outline-offset: 2px; }

.et-formula {
    margin: 16px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--et-line-soft);
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
    line-height: 1.7;
}

/* The calculated result is the one moment that gets the attention. */
.et-result {
    margin-top: 24px;
    padding: 20px 24px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-card);
    background: var(--et-surface);
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-line;
}
.et-result:empty { display: none; }
.et-result b { color: var(--et-ink); font-weight: 500; }
.et-result.is-warn {
    border-color: var(--et-warn-line);
    background: var(--et-warn-bg);
    color: var(--et-warn);
}
.et-result.is-warn b { color: var(--et-warn); }

/* -------------------------------------------------------------- tables --- */
.et-table-block { margin-top: 32px; }
.et-table-block:first-of-type { margin-top: 0; }
.et-table-title { margin: 0 0 8px; font-size: 16px; line-height: 1.4; }
.et-table-sub {
    margin: 0 0 12px;
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
    line-height: 1.7;
}
.et-tablewrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-ctl);
    background: var(--et-surface);
    -webkit-overflow-scrolling: touch;
}
.et-tablewrap table {
    width: 100% !important;
    /* the theme forces table{width:100%!important}; a min-width keeps wide
       reference tables readable and lets the wrapper scroll instead of
       squeezing the last column into one character per line */
    min-width: 820px;
    margin: 0 !important;
    border-collapse: collapse !important;
    font-size: 13px;
}
.et-tablewrap thead th {
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--et-line) !important;
    border-right: 0 !important;
    background: var(--et-raised) !important;
    color: var(--et-ink) !important;
    font-family: var(--et-mono);
    font-size: 12px;
    font-weight: 500 !important;
    letter-spacing: 0;
    white-space: nowrap;
    text-align: left !important;
}
.et-tablewrap tbody td {
    padding: 12px 16px !important;
    border-bottom: 1px solid var(--et-line-soft) !important;
    border-right: 0 !important;
    color: var(--et-ink-2) !important;
    vertical-align: top !important;
    line-height: 1.6;
    word-break: normal !important;
    overflow-wrap: break-word;
}
.et-tablewrap tbody tr:last-child td { border-bottom: 0 !important; }
/* Zebra shading is gone; a row state comes from a neutral surface step. */
.et-tablewrap tbody tr:nth-child(even) td { background: transparent !important; }
.et-tablewrap tbody tr:hover td { background: var(--et-raised) !important; }
.et-tablewrap tbody th[scope="row"] {
    background: transparent !important;
    color: var(--et-ink) !important;
    font-family: var(--et-mono);
    font-size: 12px;
    font-weight: 500 !important;
    white-space: nowrap;
    word-break: normal !important;
}
.et-table-wrap-hint {
    margin: 8px 0 0;
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
}
.et-table-empty {
    padding: 16px 20px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-ctl);
    background: var(--et-surface);
    color: var(--et-ink-3);
    font-size: 13px;
}

/* ------------------------------------------------------------- sources --- */
.et-source {
    display: block;
    padding: 16px 20px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-card);
    background: var(--et-surface);
    color: inherit;
    text-decoration: none;
    transition: border-color 160ms var(--et-ease), background-color 160ms var(--et-ease);
}
.et-source:hover { border-color: rgba(17, 28, 41, .22); background: var(--et-raised); color: inherit; }
.et-source strong { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.et-source span { display: block; color: var(--et-ink-3); font-size: 13px; line-height: 1.6; }

/* ------------------------------------------------------------ sidebar --- */
.et-side-card {
    margin-bottom: 24px;
    padding: 24px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-panel);
    background: var(--et-surface);
}
.et-side-card h3 {
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--et-line);
    font-size: 16px;
}
.et-side-card p { margin: 0 0 12px; color: var(--et-ink-2); font-size: 14px; line-height: 1.7; }
.et-side-card p:last-child { margin-bottom: 0; }
.et-side-card .et-eyebrow { margin-bottom: 12px; }
.et-related-link {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--et-line-soft);
    color: inherit;
    text-decoration: none;
    transition: color 160ms var(--et-ease);
}
.et-related-link:last-child { border-bottom: 0; padding-bottom: 0; }
.et-related-link strong { display: block; color: var(--et-ink); font-size: 14px; font-weight: 500; }
.et-related-link span { display: block; margin-top: 4px; color: var(--et-ink-3); font-size: 13px; line-height: 1.6; }
.et-related-link:hover strong { color: var(--et-accent-deep); }
.et-cta-card { border: 0; background: var(--et-night); color: var(--et-on-night); }
.et-cta-card h3 { color: var(--et-on-night); border-bottom-color: var(--et-night-line); }
.et-cta-card p { color: var(--et-on-night-2); }
.et-cta-card .et-btn { display: inline-flex; margin-top: 8px; }

/* ----------------------------------------------------------------- faq --- */
.et-faq {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    column-gap: 48px;
    border-top: 0;
}
.et-faq-item { border-bottom: 1px solid var(--et-line); }
.et-faq-item summary {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    cursor: pointer;
    list-style: none;
    color: var(--et-ink);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    transition: color 160ms var(--et-ease);
}
.et-faq-item summary::-webkit-details-marker { display: none; }
.et-faq-item summary::before {
    content: "+";
    flex: 0 0 auto;
    width: 16px;
    height: 20px;
    border-radius: 0;
    background: transparent;
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 16px;
    font-weight: 400;
    line-height: 20px;
    text-align: center;
}
.et-faq-item[open] summary::before { content: "\2212"; }
.et-faq-item summary:hover { color: var(--et-accent-deep); }
.et-faq-item summary:focus-visible { outline: 2px solid var(--et-accent); outline-offset: 2px; }
.et-faq-answer {
    padding: 0 0 20px 28px;
    color: var(--et-ink-2);
    font-size: 14px;
    line-height: 1.75;
}
.et-faq-answer p { margin: 0 0 12px; }
.et-faq-answer p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- cta --- */
.et-cta {
    padding: 64px 0;
    background: var(--et-night);
    color: var(--et-on-night);
}
.et-cta-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.et-cta h2 { margin: 0 0 8px; color: var(--et-on-night); font-size: clamp(20px, 2.4vw, 24px); }
.et-cta p { margin: 0; color: var(--et-on-night-2); max-width: 48em; font-size: 14px; line-height: 1.7; }
/* Bootstrap's .btn-primary is overridden here so the CTA stays in the ramp. */
.etools .et-cta .btn,
.etools .et-cta .et-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid var(--et-night-line);
    border-radius: var(--et-r-ctl);
    background: var(--et-surface);
    color: var(--et-ink);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 160ms var(--et-ease);
}
.etools .et-cta .btn:hover,
.etools .et-cta .et-btn:hover { background: var(--et-raised); color: var(--et-ink); }

@media (max-width: 991px) {
    .et-head { padding: 48px 0 40px; }
    .et-body { padding: 32px 0 48px; }
}
@media (max-width: 575px) {
    .et-panel { padding: 20px; }
    .et-head-chips { gap: 8px 0; }
    .et-chip { padding: 0 16px; }
    .et-faq-answer { padding-left: 0; }
    .et-faq { grid-template-columns: 1fr; }
}

/* ------------------------------------------- calculator enhancements --- */
.et-tip {
    display: block;
    margin-top: 8px;
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
    line-height: 1.6;
}
.et-btn-ghost {
    margin-left: 8px;
    border-color: var(--et-line);
    background: transparent;
    color: var(--et-ink-2);
}
.et-btn-ghost:hover {
    border-color: rgba(17, 28, 41, .22);
    background: var(--et-raised);
    color: var(--et-ink);
}

.et-result.is-html { white-space: normal; }
.et-result-title {
    margin: 0 0 16px;
    color: var(--et-ink);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
}
.et-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 12px;
}
.et-kpi {
    padding: 16px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-ctl);
    background: var(--et-surface);
}
.et-kpi small {
    display: block;
    color: var(--et-ink-3);
    font-family: var(--et-mono);
    font-size: 12px;
    line-height: 1.5;
}
.et-kpi strong {
    display: block;
    margin-top: 8px;
    color: var(--et-ink);
    font-family: var(--et-mono);
    font-size: 24px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
/* One leading figure carries the accent; the rest stay in the ink ramp. */
.et-kpi:first-child strong { color: var(--et-accent-deep); }
.et-result-note {
    margin: 16px 0 0;
    color: var(--et-ink-3);
    font-size: 13px;
    line-height: 1.7;
}

/* GD&T controls and colour swatches rendered inside the result panel. */
.et-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}
.et-card {
    padding: 16px;
    border: 1px solid var(--et-line);
    border-radius: var(--et-r-ctl);
    background: var(--et-surface);
    font-size: 13px;
    line-height: 1.6;
}
.et-card strong { display: block; margin-top: 8px; color: var(--et-ink); font-size: 14px; font-weight: 500; }
.et-card small { display: block; color: var(--et-ink-3); font-family: var(--et-mono); font-size: 12px; }
.et-card p { margin: 8px 0 0; color: var(--et-ink-2); }
.et-gdt-symbol { display: block; color: var(--et-ink); font-size: 28px; line-height: 1.1; }
/* A real colour sample is the product's content, so it keeps its own colour. */
.et-swatch-color { display: block; height: 32px; border-radius: 6px; border: 1px solid var(--et-line); }
.et-swatch-note { display: block; margin-top: 8px; color: var(--et-ink-3); font-size: 12px; }
.et-mini-btn {
    margin-top: 12px;
    padding: 4px 12px;
    min-height: 28px;
    border: 1px solid var(--et-line);
    border-radius: 6px;
    background: var(--et-surface);
    color: var(--et-ink-2);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 160ms var(--et-ease), color 160ms var(--et-ease);
}
.et-mini-btn:hover { border-color: rgba(17, 28, 41, .22); color: var(--et-ink); }

/* Reference tables sit directly under the calculator, in the main column. */
.et-ref-panel .et-tablewrap table { min-width: 680px; font-size: 13px; }
.et-ref-panel .et-tablewrap thead th,
.et-ref-panel .et-tablewrap tbody td { padding-top: 10px !important; padding-bottom: 10px !important; }

@media (max-width: 575px) {
    .et-btn-ghost { margin: 8px 0 0; }
    .et-kpis { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .et-kpi strong { font-size: 20px; }
}
