:root {
    --primary: #0a71b4;
    --primary-dark: #132e75;
    --tertiary: #3c60be;
    --ink: #132e75;
    --ink-soft: #4f5e68;
    --paper: #f4f4f4;
    --paper-bright: #ffffff;
    --line: #d9d9d9;
    --line-strong: #8e8e8e;
    --accent: #ee650f;
    --accent-dark: #c94f00;
    --mint: #dcecf6;
    --green: #0a71b4;
    --danger: #9f2d20;
    --shadow: 0 18px 50px rgba(19, 46, 117, 0.12);
    --radius: 10px;
    --content: 1440px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(10, 113, 180, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 113, 180, 0.045) 1px, transparent 1px);
    background-size: 32px 32px;
    font-family: Poppins, Roboto, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

button, input, select { font: inherit; }
a { color: inherit; }
img { max-width: 100%; }

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    transform: translateY(-150%);
    padding: 10px 14px;
    color: white;
    background: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 0 clamp(18px, 4vw, 68px);
    color: var(--primary-dark);
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 3px solid var(--accent);
    box-shadow: 0 4px 18px rgba(19, 46, 117, 0.10);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-logo { width: 58px; height: 58px; object-fit: contain; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: 0.02em; }
.brand strong b { color: var(--primary); }
.brand small { display: block; color: #777777; font-size: 0.64rem; letter-spacing: 0.09em; text-transform: uppercase; }

.main-nav { display: flex; align-items: stretch; align-self: stretch; }
.main-nav a {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 92px;
    padding: 0 18px;
    color: var(--primary-dark);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
}
.main-nav a::after {
    position: absolute;
    right: 18px;
    bottom: 12px;
    left: 18px;
    height: 2px;
    background: var(--accent);
    content: "";
    opacity: 0;
    transform: scaleX(0.4);
    transition: 160ms ease;
}
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--primary); }
.main-nav a:hover::after, .main-nav a[aria-current="page"]::after { opacity: 1; transform: scaleX(1); }
.menu-button { display: none; }

main { min-height: calc(100vh - 230px); }

.hero,
.utility-section,
.field-strip,
.page-intro,
.data-panel,
.technical-note,
.thread-family-nav,
.thread-family-hero,
.measure-explainer,
.inch-family-grid,
.family-comparison,
.admin-grid,
.image-catalog,
.site-footer {
    width: min(calc(100% - 40px), var(--content));
    margin-right: auto;
    margin-left: auto;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.65fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
    min-height: 410px;
    padding: 44px 0 40px;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--accent-dark);
    font-size: 0.73rem;
    font-weight: 850;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 780px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.8rem, 4.5vw, 5rem);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.94;
}
.page-intro h1 {
    max-width: 900px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3.3rem, 7vw, 7.2rem);
    font-weight: 500;
    letter-spacing: -0.065em;
    line-height: 0.9;
}
.hero h1 em { color: var(--accent); font-weight: 500; }
.hero-lead {
    max-width: 650px;
    margin: 20px 0 0;
    color: var(--ink-soft);
    font-size: clamp(0.94rem, 1.2vw, 1.1rem);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { color: white; background: var(--primary); border-color: var(--primary); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: var(--accent-dark); background: white; border-color: var(--accent); }
.button-secondary:hover { color: white; background: var(--accent); }

.thread-gauge {
    position: relative;
    overflow: hidden;
    padding: 20px;
    color: #eff2eb;
    background: var(--ink);
    border: 1px solid #4e5a54;
    border-radius: 6px;
    box-shadow: 14px 16px 0 var(--mint), var(--shadow);
}
.thread-gauge::before {
    position: absolute;
    top: -88px;
    right: -68px;
    width: 210px;
    height: 210px;
    border: 28px solid rgba(238, 101, 15, 0.18);
    border-radius: 50%;
    content: "";
}
.gauge-head, .gauge-meta { display: flex; justify-content: space-between; gap: 12px; }
.gauge-head { position: relative; align-items: center; padding-bottom: 13px; border-bottom: 1px solid #5b6761; color: #9fab9f; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.16em; }
.gauge-head b { display: grid; place-items: center; width: 34px; height: 34px; color: white; border: 1px solid #6d786f; border-radius: 50%; }
.gauge-reading { position: relative; padding: 28px 0 24px; }
.gauge-reading small { display: block; margin-bottom: 8px; color: #aab5ae; text-transform: uppercase; letter-spacing: 0.12em; }
.gauge-reading strong { display: block; color: white; font-family: "Courier New", monospace; font-size: clamp(2.1rem, 3vw, 3.6rem); line-height: 1; }
.gauge-reading span { display: block; margin-top: 12px; color: #bdc7c0; }
.gauge-reading span b { color: #f79270; }
.gauge-scale { display: flex; align-items: end; justify-content: space-between; height: 22px; border-bottom: 1px solid #839087; }
.gauge-scale i { display: block; width: 1px; height: 10px; background: #839087; }
.gauge-scale i:nth-child(5n + 1) { height: 25px; background: var(--accent); }
.gauge-meta { padding-top: 10px; color: #89948c; font-size: 0.6rem; font-weight: 800; letter-spacing: 0.15em; }

.utility-section { padding: 44px 0 64px; border-top: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 32px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.7rem); font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.section-heading > p { max-width: 470px; margin: 0; color: var(--ink-soft); }
.thread-menu-section { scroll-margin-top: 92px; }
.thread-menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.thread-menu-card {
    display: grid;
    grid-template-columns: 68px 1fr auto;
    gap: 16px;
    align-items: center;
    min-height: 112px;
    padding: 18px 20px;
    overflow: hidden;
    color: var(--ink);
    background: var(--paper-bright);
    border: 1px solid var(--line);
    border-top: 4px solid var(--primary);
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.thread-menu-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: var(--shadow); }
.thread-menu-card-featured { color: white; background: var(--primary-dark); border-color: var(--primary-dark); border-top-color: var(--accent); }
.thread-menu-card-tapered { border-top-color: var(--accent); }
.thread-menu-code { display: grid; place-items: center; min-height: 52px; padding: 5px; color: var(--primary); background: var(--mint); font: 800 0.95rem "Courier New", monospace; }
.thread-menu-card-featured .thread-menu-code { color: var(--primary-dark); background: white; }
.thread-menu-card > span:nth-child(2) { display: grid; gap: 3px; }
.thread-menu-card strong { font-family: Georgia, serif; font-size: 1.35rem; font-weight: 600; line-height: 1.05; }
.thread-menu-card small { color: var(--ink-soft); font-size: 0.76rem; }
.thread-menu-card-featured small { color: #dcecf6; }
.thread-menu-card > b { color: var(--accent); font-size: 1.35rem; }
.utility-grid { display: grid; grid-template-columns: 1.15fr 1fr 0.8fr; gap: 14px; }
.utility-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 390px;
    padding: 26px;
    overflow: hidden;
    background: var(--paper-bright);
    border: 1px solid var(--line);
    text-decoration: none;
    transition: transform 170ms ease, box-shadow 170ms ease;
}
a.utility-card:hover { z-index: 1; transform: translateY(-7px); box-shadow: var(--shadow); }
.utility-card-featured { color: white; background: var(--primary); border-color: var(--primary); }
.card-number { align-self: end; color: #7e8681; font: 700 0.75rem "Courier New", monospace; }
.utility-card-featured .card-number { color: #8e9a92; }
.card-symbol { display: grid; place-items: center; width: 96px; height: 96px; margin: 28px 0 38px; color: var(--accent); border: 2px solid currentColor; border-radius: 50%; font-family: Georgia, serif; font-size: 2rem; font-weight: 700; }
.utility-card h3 { margin: 0 0 12px; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; letter-spacing: -0.03em; }
.utility-card p { margin: 0; color: var(--ink-soft); }
.utility-card-featured p { color: #bdc7c0; }
.card-kicker { margin-bottom: 7px !important; color: var(--accent) !important; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.card-link { display: flex; justify-content: space-between; gap: 14px; margin-top: auto; padding-top: 24px; color: var(--accent-dark); border-top: 1px solid var(--line); font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.utility-card-featured .card-link { color: #ff9a77; border-color: #46504b; }
.utility-card-muted { background: #ebe8df; }
.utility-card-muted .card-symbol { color: #8c918b; border-style: dashed; }

.field-strip {
    display: grid;
    grid-template-columns: repeat(3, auto) 1fr;
    gap: clamp(24px, 5vw, 75px);
    align-items: center;
    padding: 26px 0;
    border-top: 1px solid var(--line-strong);
    border-bottom: 1px solid var(--line-strong);
}
.field-strip div { display: flex; align-items: baseline; gap: 9px; }
.field-strip strong { color: var(--accent-dark); font: 500 2.2rem Georgia, serif; }
.field-strip span { color: var(--ink-soft); font-size: 0.73rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.field-strip p { margin: 0; color: var(--ink-soft); text-align: right; }

.page-intro {
    display: flex;
    justify-content: space-between;
    gap: 44px;
    align-items: end;
    padding: 68px 0 46px;
}
.page-intro h1 { font-size: clamp(3.6rem, 8vw, 7.5rem); }
.page-intro > div:first-child > p:last-child { max-width: 760px; margin: 24px 0 0; color: var(--ink-soft); font-size: 1.05rem; }
.intro-code {
    flex: 0 0 auto;
    min-width: 160px;
    padding: 18px;
    color: white;
    background: var(--ink);
    border-left: 5px solid var(--accent);
}
.intro-code span { display: block; color: #9eaaa3; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.14em; }
.intro-code strong { display: block; margin-top: 5px; font: 700 1.55rem "Courier New", monospace; }

.data-panel { margin-bottom: 28px; background: var(--paper-bright); border: 1px solid var(--line); box-shadow: var(--shadow); }
.toolbar { display: flex; gap: 16px; align-items: end; padding: 20px; border-bottom: 1px solid var(--line); }
.search-field, .select-field { display: grid; gap: 7px; min-width: min(100%, 260px); }
.search-field { flex: 1; max-width: 560px; }
.search-field-wide { max-width: 760px; }
.search-field span, .select-field span, .login-form label span { font-size: 0.7rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
input[type="search"], input[type="password"], select {
    width: 100%;
    min-height: 46px;
    padding: 9px 12px;
    color: var(--ink);
    background: #f9f7f1;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(238, 101, 15, 0.45); outline-offset: 2px; }
.result-count { display: flex; gap: 8px; align-items: baseline; margin-left: auto; padding: 8px 13px; color: var(--ink-soft); background: var(--mint); }
.result-count strong { color: var(--ink); font: 700 1.6rem "Courier New", monospace; }
.result-count span { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }

.table-scroll { max-width: 100%; overflow: auto; scrollbar-color: var(--accent) #dedbd2; }
.thread-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.84rem; }
.thread-table th { position: sticky; top: 0; z-index: 2; padding: 13px 12px; color: white; background: var(--primary); border-right: 1px solid rgba(255,255,255,0.22); font-size: 0.68rem; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.thread-table th small { display: block; color: #aab5ae; font-size: 0.58rem; }
.thread-table td { padding: 11px 12px; background: var(--paper-bright); border-right: 1px solid #dedbd2; border-bottom: 1px solid #dedbd2; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.thread-table tbody tr:nth-child(even) td { background: #f2f0e9; }
.thread-table tbody tr:hover td { background: #fff0e8; }
.thread-table td:first-child, .thread-table th:first-child, .thread-table td:nth-child(2), .thread-table th:nth-child(2) { text-align: left; }
.thread-table tr[hidden] { display: none; }
.metric-table { min-width: 900px; }
.npt-table { min-width: 2100px; }
.designation { color: var(--accent-dark); font: 700 1rem "Courier New", monospace; }
.type-badge { display: inline-flex; padding: 4px 8px; border-radius: 20px; font-size: 0.68rem; font-weight: 850; text-transform: uppercase; }
.type-normal { color: #194c38; background: #cfe4d8; }
.type-fino { color: #77311c; background: #f5d2c4; }
.thread-table code, .image-name, .catalog-row code, .admin-card code { font-family: "Courier New", monospace; }
.thread-image { position: relative; display: grid; place-items: center; width: 130px; height: 78px; overflow: hidden; color: #78817c; background: #e5e3dc; border: 1px dashed #aeb1ab; }
.thread-image img { width: 100%; height: 100%; object-fit: cover; }
.thread-image.has-image { border-style: solid; }
.image-placeholder { display: grid; gap: 2px; place-items: center; }
.image-placeholder b { color: var(--ink-soft); font: 700 0.82rem "Courier New", monospace; }
.image-placeholder i { font-size: 0.58rem; font-style: normal; text-transform: uppercase; letter-spacing: 0.06em; }
.thread-image.has-image .image-placeholder { display: none; }
.image-name { display: block; width: 130px; margin-top: 5px; overflow: hidden; color: #777d78; font-size: 0.58rem; text-overflow: ellipsis; }
.empty-state { margin: 0; padding: 36px; color: var(--ink-soft); text-align: center; }
.technical-note { display: flex; gap: 24px; margin-bottom: 76px; padding: 18px 22px; color: #f3f4ee; background: var(--ink); border-left: 5px solid var(--accent); }
.technical-note strong { flex: 0 0 auto; color: #ff9b78; text-transform: uppercase; letter-spacing: 0.08em; }
.technical-note p { margin: 0; }

.thread-family-nav {
    display: flex;
    gap: 8px;
    margin-top: -20px;
    margin-bottom: 24px;
    padding: 8px;
    overflow-x: auto;
    background: #e6e2d8;
    border: 1px solid var(--line);
}
.thread-family-nav a {
    flex: 1 0 auto;
    min-width: 105px;
    padding: 11px 14px;
    color: var(--ink-soft);
    background: var(--paper-bright);
    border: 1px solid transparent;
    text-align: center;
    text-decoration: none;
    font: 800 0.74rem "Courier New", monospace;
    letter-spacing: 0.06em;
}
.thread-family-nav a:hover { border-color: var(--accent); }
.thread-family-nav a[aria-current="page"] { color: white; background: var(--primary); border-color: var(--primary); }

.thread-family-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.75fr);
    margin-bottom: 24px;
    overflow: hidden;
    background: var(--paper-bright);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.family-visual { min-width: 0; background: #f8f6ef; }
.family-visual img { display: block; width: 100%; height: 100%; min-height: 300px; object-fit: cover; }
.family-facts { padding: clamp(24px, 4vw, 46px); background: var(--primary-dark); color: white; }
.family-facts h2 { margin: 0 0 26px; font-family: Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.7rem); font-weight: 500; line-height: 1.05; }
.family-facts dl { display: grid; gap: 0; margin: 0; }
.family-facts dl div { display: grid; grid-template-columns: 95px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid #46504b; }
.family-facts dt { color: #9faaa4; font-size: 0.67rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.family-facts dd { margin: 0; color: #f1f0e9; font-size: 0.85rem; }
.family-facts code { color: #ff9a77; font-weight: 700; }
.unified-table { min-width: 1180px; }
.bsp-table { min-width: 1050px; }

.measure-explainer {
    margin-bottom: 24px;
    padding: clamp(22px, 4vw, 42px);
    background: var(--paper-bright);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    scroll-margin-top: 24px;
}
.measure-explainer-heading { display: flex; justify-content: space-between; gap: 28px; align-items: end; margin-bottom: 32px; }
.measure-explainer-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.9rem, 4vw, 3.2rem); font-weight: 500; line-height: 1; }
.selected-measure { flex: 0 0 auto; min-width: 210px; padding: 14px 18px; color: white; background: var(--primary); border-left: 5px solid var(--accent); }
.selected-measure span { display: block; color: #aab5ae; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em; }
.selected-measure strong { display: block; margin-top: 4px; color: #ff9a77; font: 700 1.15rem "Courier New", monospace; }
.measure-explainer-grid { display: grid; grid-template-columns: minmax(270px, 1fr) minmax(270px, 1fr) minmax(220px, 0.68fr); gap: 32px; align-items: center; }
.graphic-title { margin: 0 0 18px; color: var(--ink-soft); font-size: 0.68rem; font-weight: 850; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.diameter-circle { --drill-ratio: 80%; position: relative; display: grid; place-items: center; width: min(100%, 250px); aspect-ratio: 1; margin: auto; background: radial-gradient(circle, #f8f6ef 0 69%, #e8e5dd 70% 100%); border: 4px solid var(--ink); border-radius: 50%; }
.drill-circle { width: var(--drill-ratio); aspect-ratio: 1; background: var(--paper-bright); border: 4px solid var(--accent); border-radius: 50%; transition: width 220ms ease; }
.diameter-line { position: absolute; right: 4%; left: 4%; top: calc(50% - 1px); height: 2px; background: var(--ink); }
.diameter-line::before, .diameter-line::after { position: absolute; top: -6px; width: 2px; height: 14px; background: var(--ink); content: ""; }
.diameter-line::before { left: 0; }
.diameter-line::after { right: 0; }
.outer-label, .drill-label { position: absolute; z-index: 1; padding: 3px 6px; background: rgba(255, 253, 247, 0.88); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.05em; text-align: center; }
.outer-label { top: 8%; left: 50%; transform: translateX(-50%); }
.drill-label { top: 53%; left: 50%; transform: translate(-50%, -50%); }
.outer-label b, .drill-label b { font: 700 0.76rem "Courier New", monospace; letter-spacing: 0; }
.diameter-circle.has-no-drill .drill-circle { width: 38%; background: transparent; border-color: var(--line-strong); border-style: dashed; }
.graphic-caption { max-width: 330px; margin: 14px auto 0; color: var(--ink-soft); font-size: 0.72rem; text-align: center; }
.profile-graphic { min-width: 0; }
.profile-axis { position: relative; display: grid; place-items: center; height: 180px; overflow: hidden; border-bottom: 1px solid var(--line); }
.profile-axis i { position: absolute; right: 4%; left: 4%; top: 50%; height: 1px; background: var(--ink-soft); }
.thread-profile-shape { position: relative; z-index: 1; width: 90%; height: 112px; background-color: var(--mint); background-image: repeating-linear-gradient(125deg, transparent 0 15px, var(--accent) 16px 20px, transparent 21px 34px); border: 2px solid var(--ink); transition: clip-path 220ms ease; }
.profile-graphic.is-parallel .thread-profile-shape { clip-path: polygon(0 15%, 100% 15%, 100% 85%, 0 85%); }
.profile-graphic.is-tapered .thread-profile-shape { clip-path: polygon(3% 36%, 100% 8%, 100% 92%, 3% 64%); }
.profile-graphic > strong { display: block; margin-top: 14px; color: var(--accent-dark); font: 700 1rem "Courier New", monospace; text-align: center; }
.profile-graphic > span { display: block; max-width: 360px; margin: 6px auto 0; color: var(--ink-soft); font-size: 0.76rem; text-align: center; }
.measure-values { margin: 0; border-top: 1px solid var(--line); }
.measure-values div { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.measure-values dt { color: var(--ink-soft); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.measure-values dd { margin: 0; color: var(--ink); font: 700 0.82rem "Courier New", monospace; text-align: right; }
.measure-instruction { margin: 28px 0 0; padding-top: 16px; color: var(--ink-soft); border-top: 1px solid var(--line); font-size: 0.78rem; text-align: center; }
.row-visual-button { display: block; margin-top: 8px; padding: 6px 9px; color: var(--accent-dark); background: transparent; border: 1px solid var(--accent); border-radius: 2px; cursor: pointer; font-size: 0.64rem; font-weight: 850; letter-spacing: 0.04em; text-transform: uppercase; }
.row-visual-button:hover, .row-visual-button[aria-pressed="true"] { color: white; background: var(--accent-dark); }
.thread-table tbody tr.is-measure-selected td { background: #ffe5d8; }

.inch-family-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 82px;
}
.inch-card {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    color: var(--ink);
    background: var(--paper-bright);
    border: 1px solid var(--line);
    text-decoration: none;
    transition: transform 170ms ease, box-shadow 170ms ease;
}
.inch-card:first-child { grid-row: span 2; }
.inch-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.inch-card img { display: block; width: 100%; aspect-ratio: 1280 / 560; object-fit: cover; border-bottom: 1px solid var(--line); }
.inch-card-copy { display: flex; flex-direction: column; padding: 24px; }
.inch-card h2 { margin: 0 0 8px; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 500; }
.inch-card p { margin: 0; color: var(--ink-soft); }
.inch-card .card-link { margin-top: 24px; }
.family-comparison { margin-bottom: 78px; }
.comparison-table { min-width: 720px; }
.comparison-table a { color: var(--accent-dark); }

.image-admin-intro { align-items: center; }
.private-admin-intro { padding-bottom: 34px; }
.private-login-panel { width: min(calc(100% - 40px), 700px); margin: 0 auto 78px; }
.private-login-panel .admin-card { box-shadow: 12px 14px 0 var(--mint); }
.admin-session-tools { display: grid; justify-items: end; }
.sync-status { display: grid; min-width: 200px; padding: 20px; color: white; background: var(--ink); text-align: center; }
.sync-status strong { color: #ff9a77; font: 700 2.3rem "Courier New", monospace; }
.sync-status span { color: #bdc7c0; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.alert { width: min(calc(100% - 40px), var(--content)); margin: 0 auto 10px; padding: 13px 16px; border-left: 5px solid; }
.alert-success { color: #184c37; background: #d6eadf; border-color: var(--green); }
.alert-error { color: #732319; background: #f4d8d2; border-color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 66px; }
.admin-card { padding: 28px; background: var(--paper-bright); border: 1px solid var(--line); }
.admin-card h2 { margin: 0 0 24px; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; }
.step-list { display: grid; gap: 17px; margin: 0; padding: 0; list-style: none; }
.step-list li { display: grid; grid-template-columns: 36px 1fr; gap: 13px; align-items: start; }
.step-list span { display: grid; place-items: center; width: 32px; height: 32px; color: white; background: var(--ink); border-radius: 50%; font: 700 0.8rem "Courier New", monospace; }
.step-list p { margin: 4px 0 0; }
.small-note { margin: 25px 0 0; padding-top: 18px; color: var(--ink-soft); border-top: 1px solid var(--line); font-size: 0.82rem; }
.locked-state { display: flex; gap: 18px; align-items: center; min-height: 150px; padding: 22px; background: #eeeae1; border: 1px dashed var(--line-strong); }
.locked-state > span { color: var(--accent); font-size: 3rem; }
.locked-state p { display: grid; gap: 7px; margin: 0; }
.login-form { display: flex; gap: 10px; align-items: end; min-height: 150px; }
.login-form label { display: grid; flex: 1; gap: 7px; }
.upload-form { display: grid; gap: 14px; }
.upload-zone { position: relative; display: grid; place-items: center; min-height: 155px; padding: 18px; background: #f0eee7; border: 2px dashed #9da19b; cursor: pointer; text-align: center; }
.upload-zone:hover { border-color: var(--accent); }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone small { color: var(--ink-soft); }
.upload-icon { color: var(--accent); font-size: 2rem; line-height: 1; }
.selected-files { margin: 0; color: var(--ink-soft); font-size: 0.8rem; }
.check-field { display: flex; gap: 8px; align-items: start; font-size: 0.84rem; }
.logout-form { margin-top: 10px; text-align: right; }
.logout-form button { padding: 0; color: var(--danger); background: none; border: 0; text-decoration: underline; cursor: pointer; }

.image-catalog { margin-bottom: 78px; }
.compact-heading { align-items: end; }
.compact-heading h2 { font-size: 2.8rem; }
.catalog-tools { display: flex; gap: 12px; align-items: end; }
.catalog-tools .button { min-height: 46px; white-space: nowrap; }
.catalog-list { overflow: hidden; background: var(--paper-bright); border: 1px solid var(--line); }
.catalog-row { display: grid; grid-template-columns: 68px minmax(210px, 1fr) minmax(230px, 0.8fr) auto; gap: 16px; align-items: center; min-height: 82px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.catalog-row:last-child { border-bottom: 0; }
.catalog-row[hidden] { display: none; }
.catalog-preview { display: grid; place-items: center; width: 64px; height: 58px; overflow: hidden; color: #818984; background: #e8e5dd; border: 1px dashed var(--line-strong); font: 700 1.1rem Georgia, serif; }
.catalog-preview img { width: 100%; height: 100%; object-fit: cover; }
.catalog-preview.has-image > span { display: none; }
.catalog-description { display: grid; }
.catalog-description span { color: var(--ink-soft); font-size: 0.72rem; }
.catalog-row code { font-size: 0.78rem; }
.copy-button { padding: 8px 10px; color: var(--ink); background: transparent; border: 1px solid var(--line-strong); border-radius: 3px; cursor: pointer; }
.copy-button:hover { color: white; background: var(--ink); }

.site-footer { display: flex; justify-content: space-between; gap: 36px; margin-top: 72px; padding: 36px 0 50px; border-top: 3px solid var(--primary); }
.site-footer strong { font-family: Georgia, serif; font-size: 1.45rem; }
.site-footer p { margin: 4px 0 0; color: var(--ink-soft); }
.footer-brand { display: flex; gap: 14px; align-items: center; }
.footer-brand img { width: 62px; height: 62px; object-fit: contain; }
.footer-note { max-width: 620px; text-align: right; font-size: 0.8rem; }
.footer-note a { display: inline-block; margin-top: 8px; color: var(--primary); font-weight: 800; }

@media (max-width: 1050px) {
    .hero { grid-template-columns: minmax(0, 1fr) minmax(310px, 0.7fr); gap: 28px; min-height: auto; }
    .thread-gauge { max-width: 660px; }
    .thread-menu-grid { grid-template-columns: repeat(2, 1fr); }
    .utility-grid { grid-template-columns: 1fr 1fr; }
    .utility-card-muted { grid-column: 1 / -1; min-height: 260px; }
    .field-strip { grid-template-columns: repeat(3, 1fr); }
    .field-strip p { grid-column: 1 / -1; text-align: left; }
    .thread-family-hero { grid-template-columns: 1fr; }
    .family-visual img { min-height: auto; }
    .measure-explainer-grid { grid-template-columns: 1fr 1fr; }
    .measure-values { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .site-header { min-height: 66px; padding: 0 18px; }
    .brand-logo { width: 48px; height: 48px; }
    .brand small { display: none; }
    .menu-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 11px; color: var(--primary-dark); background: transparent; border: 1px solid var(--primary); border-radius: 3px; font-weight: 700; }
    .main-nav { position: absolute; top: 100%; right: 0; left: 0; display: none; height: auto; padding: 10px 18px 18px; background: white; border-bottom: 3px solid var(--accent); box-shadow: 0 12px 22px rgba(19, 46, 117, 0.14); }
    .main-nav.is-open { display: grid; }
    .main-nav a { justify-content: start; min-height: 46px; padding: 0; border-bottom: 1px solid #445049; }
    .main-nav a::after { display: none; }
    .hero, .utility-section, .field-strip, .page-intro, .data-panel, .technical-note, .thread-family-nav, .thread-family-hero, .measure-explainer, .inch-family-grid, .family-comparison, .admin-grid, .image-catalog, .site-footer { width: min(calc(100% - 24px), var(--content)); }
    .private-login-panel { width: min(calc(100% - 24px), 700px); }
    .hero { grid-template-columns: 1fr; gap: 24px; padding: 34px 0 40px; }
    .hero h1 { font-size: clamp(2.65rem, 13vw, 4.1rem); }
    .thread-gauge { width: calc(100% - 10px); padding: 18px; box-shadow: 8px 10px 0 var(--mint); }
    .gauge-reading { padding: 22px 0 18px; }
    .utility-section { padding: 36px 0 48px; }
    .section-heading, .page-intro, .site-footer { display: grid; }
    .thread-menu-grid { grid-template-columns: 1fr; }
    .thread-menu-card { min-height: 96px; }
    .utility-grid, .admin-grid { grid-template-columns: 1fr; }
    .utility-card { min-height: 340px; }
    .utility-card-muted { grid-column: auto; }
    .field-strip { grid-template-columns: 1fr; gap: 6px; }
    .field-strip div { justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .field-strip p { grid-column: auto; padding-top: 18px; }
    .page-intro { align-items: start; padding: 50px 0 32px; }
    .page-intro h1 { font-size: clamp(3.5rem, 18vw, 6rem); }
    .intro-code { justify-self: start; }
    .toolbar { display: grid; grid-template-columns: 1fr; }
    .search-field, .select-field { width: 100%; max-width: none; }
    .result-count { justify-self: start; margin-left: 0; }
    .technical-note { display: grid; }
    .thread-family-nav { margin-top: 0; }
    .thread-family-hero { display: block; }
    .family-facts dl div { grid-template-columns: 82px 1fr; }
    .inch-family-grid { grid-template-columns: 1fr; margin-bottom: 58px; }
    .inch-card:first-child { grid-row: auto; }
    .measure-explainer-heading, .measure-explainer-grid { display: grid; grid-template-columns: 1fr; }
    .selected-measure { min-width: 0; }
    .measure-values { grid-column: auto; }
    .sync-status { justify-self: start; }
    .admin-session-tools { justify-items: start; }
    .login-form { display: grid; }
    .catalog-row { grid-template-columns: 58px 1fr; gap: 10px; }
    .catalog-tools { display: grid; width: 100%; }
    .catalog-preview { width: 54px; height: 52px; grid-row: span 2; }
    .catalog-row code { grid-column: 2; overflow-wrap: anywhere; }
    .copy-button { grid-column: 1 / -1; }
    .footer-note { text-align: left; }
    .footer-brand { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
