/* Reference pages -- static, crawlable content (the rebar size chart, and the
   tables that follow it) dressed in the app's header and footer. rebarCalc.css
   supplies the tokens and the header/footer; this file lets the page scroll
   like a document instead of filling the viewport like the app, and styles
   the article. These pages load no scripts and no engine. */

body.referenceBody {
    height: auto;
    min-height: 100vh;
    width: auto;
    overflow: auto;
}

.referenceBody #app {
    height: auto;
    min-height: 100vh;
}

/* The header's title is a link home here, not the page's h1. */
a.appTitle {
    color: inherit;
    text-decoration: none;
}

.reference {
    flex: 1 1 auto;
    padding: 28px max(20px, env(safe-area-inset-right)) 44px max(20px, env(safe-area-inset-left));
}

.reference article {
    max-width: 860px;
    margin: 0 auto;
}

.reference h1 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 650;
    letter-spacing: -0.4px;
}

.reference h2 {
    margin: 32px 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.reference p {
    margin: 0 0 12px;
    max-width: 72ch;
    line-height: 1.55;
}

.reference .lede {
    font-size: 16px;
    color: var(--text-secondary);
}

.reference .note {
    font-size: 14px;
    color: var(--text-secondary);
}

.reference a {
    color: var(--width-fg);
}

/* Tables sit in a card and scroll sideways on narrow screens rather than
   forcing the page to. */
.tableWrap {
    margin: 16px 0;
    overflow-x: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}

.reference table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.reference caption {
    caption-side: top;
    padding: 12px 16px 4px;
    text-align: left;
    font-size: 13px;
    color: var(--text-secondary);
}

.reference th,
.reference td {
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.reference thead th {
    border-top: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* The size column stays put while a narrow screen scrolls the rest of the
   row sideways, so a reader never loses which bar they are looking at. It
   paints its own background because sticky cells float over the others. */
.reference th:first-child,
.reference td:first-child {
    position: sticky;
    left: 0;
    text-align: left;
    background: var(--card-bg);
}

.reference tbody th {
    font-weight: 600;
}

.reference tbody tr:nth-child(even),
.reference tbody tr:nth-child(even) th:first-child {
    background: var(--input-bg);
}

/* A small calculator at the top of a reference page: the form on the left,
   the answer on the right, stacking on a narrow screen. The inputs reuse the
   app's .numberInput / .barSelect / .unit styling from rebarCalc.css. */
.calc {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 28px;
    align-items: flex-end;
    margin: 20px 0 8px;
    padding: 18px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}

.calcForm {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
    margin: 0;
}

.calcField {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.calcLabel {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.calcField .numberInput {
    width: 4.4em;
}

#weightInches {
    width: 3.8em;
}

.calcResult {
    flex: 1 1 220px;
    min-width: 0;
}

.calcTotal {
    font-size: 34px;
    font-weight: 650;
    letter-spacing: -0.6px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.calcUnit {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
}

.calcDetail {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* The on-ramp into the app, at the end of every reference page. */
.cta {
    margin: 36px 0 0;
    padding: 18px 20px;
    background: var(--width-bg);
    border-radius: var(--radius-card);
}

.cta p {
    margin: 0 0 12px;
    max-width: none;
}

.ctaLinks {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cta a {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    background: var(--width-accent);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.cta a.secondary {
    background: var(--card-bg);
    color: var(--width-fg);
    border: 1px solid var(--border-strong);
}

/* The 404 page: the digits are bars. A bar is a thick round-ended line in
   the app's width-bar blue (horizontal) or height-bar orange (vertical),
   with a wider, dashed, translucent line over it whose dashes stick out
   past both edges -- the ribs of a deformed bar. Ties sit where bars
   cross. */
.notFound .rebar404 {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 12px 0 8px -4px;
}

.rebar404 line {
    fill: none;
    stroke-width: 13;
    stroke-linecap: round;
}

.rebar404 .barX { stroke: var(--width-accent); }
.rebar404 .barY { stroke: var(--height-accent); }

.rebar404 line.thin {
    stroke-width: 9;
}

.rebar404 .rib {
    stroke: rgba(27, 30, 36, 0.3);
    stroke-width: 19;
    stroke-linecap: butt;
    stroke-dasharray: 2 9;
}

.rebar404 .rib.thin {
    stroke-width: 14;
    stroke-dasharray: 2 8;
}

.rebar404 .tie {
    fill: #2b2f36;
}

.notFound code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    padding: 1px 5px;
    background: var(--track-bg);
    border-radius: 5px;
}

.siteLinks {
    margin: 8px 0 0;
    padding: 0 0 0 1.2em;
    line-height: 1.8;
}

@media print {
    .viewSwitch,
    .cta {
        display: none;
    }

    .tableWrap {
        border: none;
    }
}
