/* =========================================================
   PET AGE CALCULATOR - 2026 UI/UX DESIGN SYSTEM
   Calculator logic remains independent from this stylesheet.
   ========================================================= */

:root {
    --primary-color: #0f766e;
    --primary-hover: #0b5f59;
    --primary-light: #d8f3ef;
    --primary-soft: #effaf8;
    --primary-gradient: linear-gradient(135deg, #0f766e 0%, #159a8c 100%);

    --accent-color: #f59e0b;
    --accent-soft: #fff7e6;
    --danger-color: #c2413a;

    --background-color: #f6f8f9;
    --background-gradient:
        radial-gradient(circle at 12% 8%, rgba(15, 118, 110, 0.07), transparent 30rem),
        radial-gradient(circle at 92% 14%, rgba(245, 158, 11, 0.06), transparent 26rem),
        #f6f8f9;
    --surface-color: #ffffff;
    --surface-elevated: #ffffff;
    --surface-muted: #f9fafb;
    --glass-effect: rgba(255, 255, 255, 0.94);

    --text-primary: #17212b;
    --text-secondary: #4b5b68;
    --text-muted: #75838e;
    --text-accent: #0f766e;

    --border-color: #e2e8ec;
    --border-strong: #cdd8dd;
    --border-focus: #0f766e;
    --divider-color: #e9eef1;

    --shadow-xs: 0 1px 2px rgba(20, 34, 45, 0.04);
    --shadow-sm: 0 4px 12px rgba(20, 34, 45, 0.055);
    --shadow-md: 0 10px 30px rgba(20, 34, 45, 0.075);
    --shadow-lg: 0 22px 55px rgba(20, 34, 45, 0.10);
    --shadow-xl: 0 30px 80px rgba(20, 34, 45, 0.13);
    --shadow-glow: 0 12px 34px rgba(15, 118, 110, 0.18);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 30px;
    --border-radius-sm: var(--radius-sm);
    --border-radius: var(--radius-md);
    --border-radius-lg: var(--radius-lg);
    --border-radius-xl: var(--radius-xl);

    --content-width: 1160px;
    --reading-width: 900px;
    --nav-height: 76px;

    --transition-fast: 160ms ease;
    --transition-normal: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-slow: 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
    --primary-color: #48c9b8;
    --primary-hover: #68d8ca;
    --primary-light: #173f3c;
    --primary-soft: #102f2d;
    --primary-gradient: linear-gradient(135deg, #32b8a7 0%, #65d5c6 100%);

    --accent-color: #f6b94d;
    --accent-soft: #362a14;
    --danger-color: #f08078;

    --background-color: #0e151b;
    --background-gradient:
        radial-gradient(circle at 12% 8%, rgba(72, 201, 184, 0.08), transparent 30rem),
        radial-gradient(circle at 92% 14%, rgba(246, 185, 77, 0.05), transparent 26rem),
        #0e151b;
    --surface-color: #151f27;
    --surface-elevated: #19262f;
    --surface-muted: #111b22;
    --glass-effect: rgba(14, 21, 27, 0.94);

    --text-primary: #edf3f5;
    --text-secondary: #b4c1c8;
    --text-muted: #85959f;
    --text-accent: #64d4c5;

    --border-color: #273740;
    --border-strong: #354852;
    --border-focus: #57cbbb;
    --divider-color: #22323b;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 22px 55px rgba(0, 0, 0, 0.34);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.42);
    --shadow-glow: 0 12px 34px rgba(72, 201, 184, 0.14);
}

/* =========================
   RESET / BASE
   ========================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 24px);
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    padding-top: var(--nav-height);
    overflow-x: hidden;
    background: var(--background-gradient);
    color: var(--text-primary);
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: -0.005em;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

body.nav-open {
    overflow: hidden;
}

a {
    color: var(--primary-color);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-hover);
}

img {
    max-width: 100%;
}

button,
input,
select {
    font: inherit;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: var(--primary-light);
    color: var(--text-primary);
}

/* =========================
   GLOBAL NAVIGATION
   ========================= */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 2000;
    height: var(--nav-height);
    border-bottom: 1px solid rgba(205, 216, 221, 0.78);
    background: var(--glass-effect);
    backdrop-filter: saturate(150%) blur(18px);
    -webkit-backdrop-filter: saturate(150%) blur(18px);
    box-shadow: 0 1px 0 rgba(20, 34, 45, 0.02);
}

[data-theme="dark"] .navbar {
    border-bottom-color: rgba(53, 72, 82, 0.72);
}

.nav-container {
    width: min(100% - 40px, var(--content-width));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-logo {
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text-primary);
    text-decoration: none;
}

.nav-logo:hover {
    color: var(--text-primary);
}

.nav-logo-image {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    border-radius: 13px;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.nav-brand-text {
    font-size: 1.04rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.035em;
    white-space: nowrap;
}

.nav-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-item {
    position: relative;
}

.nav-parent-row {
    display: flex;
    align-items: center;
}

.nav-link {
    min-height: 44px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.91rem;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link[aria-current="page"] {
    color: var(--text-primary);
    background: var(--surface-muted);
}

.nav-parent-link {
    padding-right: 5px;
}

.submenu-toggle {
    width: 34px;
    height: 38px;
    margin-left: -2px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.submenu-toggle:hover,
.submenu-toggle:focus-visible {
    color: var(--text-primary);
    background: var(--surface-muted);
}

.submenu-toggle i {
    font-size: 0.68rem;
    transition: transform var(--transition-normal);
}

.submenu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 256px;
    padding: 9px;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--surface-elevated);
    box-shadow: var(--shadow-lg);
    list-style: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.submenu::before {
    content: '';
    position: absolute;
    top: -11px;
    left: 0;
    width: 100%;
    height: 12px;
}

.submenu a {
    min-height: 42px;
    padding: 9px 11px;
    display: flex;
    align-items: center;
    border-radius: 9px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: color var(--transition-fast), background var(--transition-fast), padding var(--transition-fast);
}

.submenu a:hover,
.submenu a:focus-visible,
.submenu a[aria-current="page"] {
    padding-left: 14px;
    color: var(--primary-color);
    background: var(--primary-soft);
}

.nav-item-has-submenu:hover > .submenu,
.nav-item-has-submenu:focus-within > .submenu,
.nav-item-has-submenu.is-submenu-open > .submenu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.nav-item-has-submenu:hover .submenu-toggle i,
.nav-item-has-submenu:focus-within .submenu-toggle i,
.nav-item-has-submenu.is-submenu-open .submenu-toggle i {
    transform: rotate(180deg);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle,
.nav-toggle {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-color);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.nav-toggle:hover,
.nav-toggle:focus-visible {
    color: var(--primary-color);
    border-color: var(--border-strong);
    background: var(--primary-soft);
}

.theme-toggle:active,
.nav-toggle:active {
    transform: scale(0.96);
}

.theme-toggle i {
    font-size: 1rem;
}

.nav-toggle {
    display: none;
    position: relative;
    padding: 0 11px;
}

.nav-toggle-line {
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform var(--transition-normal), opacity var(--transition-fast), top var(--transition-normal);
}

.nav-toggle-line:nth-child(1) { top: 13px; }
.nav-toggle-line:nth-child(2) { top: 19px; }
.nav-toggle-line:nth-child(3) { top: 25px; }

.nav-toggle.is-open .nav-toggle-line:nth-child(1) {
    top: 19px;
    transform: rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open .nav-toggle-line:nth-child(3) {
    top: 19px;
    transform: rotate(-45deg);
}

.nav-backdrop {
    display: none;
}

/* =========================
   PAGE LAYOUT / TYPOGRAPHY
   ========================= */
.container {
    width: min(100% - 40px, var(--content-width));
    margin: 0 auto;
    padding: 34px 0 0;
}

.container > h1,
.container > p,
.container > .jump-links,
.container > .snippet-answer,
.container > section:not(.calculator-container) {
    width: min(100%, var(--reading-width));
    margin-left: auto;
    margin-right: auto;
}

.container > h1 {
    margin-top: 50px;
    margin-bottom: 18px;
    color: var(--text-primary);
    font-size: clamp(2rem, 4vw, 3.15rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -0.045em;
    text-align: center;
}

.container > h1 i {
    margin-right: 0.35rem;
    color: var(--primary-color);
    font-size: 0.78em;
}

h2 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: clamp(1.55rem, 2.7vw, 2.15rem);
    font-weight: 720;
    line-height: 1.22;
    letter-spacing: -0.035em;
}

h3 {
    margin-top: 30px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: clamp(1.12rem, 2vw, 1.35rem);
    font-weight: 680;
    line-height: 1.34;
    letter-spacing: -0.02em;
}

p,
li {
    color: var(--text-secondary);
}

strong {
    color: var(--text-primary);
    font-weight: 650;
}

.container > section:not(.calculator-container) {
    margin-top: 34px;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

.container > section:not(.calculator-container) + section:not(.calculator-container) {
    margin-top: 26px;
}

.container section ul,
.container section ol {
    padding-left: 1.3rem;
}

.container section li + li {
    margin-top: 8px;
}

.container br + br {
    display: none;
}

/* =========================
   CALCULATOR EXPERIENCE
   ========================= */
.calculator-container {
    position: relative;
    width: min(100%, 930px);
    margin: 18px auto 34px;
    padding: clamp(24px, 4vw, 46px);
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-lg);
}

.calculator-container::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: var(--primary-gradient);
}

.calculator-container::after {
    content: '';
    position: absolute;
    width: 260px;
    height: 260px;
    top: -150px;
    right: -100px;
    border-radius: 50%;
    background: rgba(15, 118, 110, 0.055);
    pointer-events: none;
}

.input-section {
    position: relative;
    z-index: 1;
    width: min(100%, 760px);
    margin: 0 auto;
}

.pet-selection,
.breed-selection-wrapper {
    margin-bottom: 22px;
}

.pet-selection label,
.breed-selection-wrapper > label,
.breed-selection label,
.age-input label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.92rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.pet-dropdown,
.age-input input {
    width: 100%;
    min-height: 55px;
    padding: 0 16px;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    outline: 0;
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
    font-size: 0.96rem;
    font-weight: 500;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.pet-dropdown {
    padding-right: 42px;
    cursor: pointer;
}

.pet-dropdown:hover,
.age-input input:hover {
    border-color: #a9b9c0;
}

.pet-dropdown:focus,
.age-input input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.11), var(--shadow-xs);
}

[data-theme="dark"] .pet-dropdown:focus,
[data-theme="dark"] .age-input input:focus {
    box-shadow: 0 0 0 4px rgba(72, 201, 184, 0.12), var(--shadow-xs);
}

.pet-dropdown option {
    background: var(--surface-color);
    color: var(--text-primary);
}

.pet-dropdown optgroup {
    color: var(--primary-color);
    font-weight: 700;
}

.pet-dropdown.disabled {
    cursor: not-allowed;
    opacity: 0.58;
    background: var(--surface-muted);
}

.breed-selection-wrapper {
    display: none;
}

.breed-selection {
    margin: 0;
}

#noBreedMessage {
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text-muted) !important;
    font-size: 0.9rem;
}

.age-input-section {
    margin-bottom: 0;
}

.age-input {
    display: flex;
    flex-direction: column;
}

.age-input input::placeholder {
    color: var(--text-muted);
}

.button-group {
    margin-top: 26px;
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 12px;
}

.calculate-btn,
.random-btn {
    min-height: 54px;
    padding: 12px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 13px;
    font-size: 0.95rem;
    font-weight: 650;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.calculate-btn {
    border: 1px solid transparent;
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
}

.calculate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(15, 118, 110, 0.22);
}

.random-btn {
    border: 1px solid var(--border-strong);
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

.random-btn:hover {
    transform: translateY(-1px);
    border-color: var(--primary-color);
    background: var(--primary-soft);
    color: var(--primary-color);
}

.calculate-btn:active,
.random-btn:active {
    transform: translateY(0) scale(0.99);
}

.calculate-btn i,
.random-btn i {
    font-size: 0.95rem;
}

.result-section {
    position: relative;
    z-index: 1;
    width: min(100%, 760px);
    margin: 28px auto 0;
    padding-top: 26px;
    border-top: 1px solid var(--divider-color);
    text-align: center;
}

.pet-image-container,
.pet-image,
.pet-image::before {
    display: none;
}

.result-display {
    margin: 0;
}

.result-display h2 {
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    font-weight: 750;
    line-height: 1.18;
    letter-spacing: -0.035em;
}

.result-display p {
    max-width: 660px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.fun-fact {
    position: relative;
    margin-top: 20px;
    padding: 17px 18px 17px 48px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--text-secondary);
    box-shadow: none;
    font-size: 0.93rem;
    font-style: normal;
    line-height: 1.6;
    text-align: left;
}

.fun-fact::before {
    content: '💡';
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 0;
    background: transparent;
    font-size: 1.1rem;
}

/* =========================
   QUICK LINKS / CALLOUTS
   ========================= */
.jump-links {
    margin-top: 18px;
    padding: 18px 20px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
}

.jump-links p {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.jump-links ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    list-style: none;
}

.jump-links li {
    margin: 0;
}

.jump-links a {
    min-height: 36px;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.jump-links a:hover,
.jump-links a:focus-visible {
    border-color: rgba(15, 118, 110, 0.28);
    background: var(--primary-soft);
    color: var(--primary-color);
}

.snippet-answer {
    margin-top: 22px;
    padding: 18px 20px;
    border: 1px solid rgba(15, 118, 110, 0.20);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    background: var(--primary-soft);
}

.snippet-answer p,
.snippet-answer li {
    color: var(--text-secondary);
}

section .snippet-answer {
    width: 100%;
    margin: 18px 0 0;
}

/* =========================
   TABLES
   ========================= */
table {
    width: 100%;
    margin: 20px 0 6px;
    overflow: hidden;
    border: 1px solid var(--border-color) !important;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 14px;
    background: var(--surface-color);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
    font-size: 0.9rem;
    text-align: left !important;
}

thead,
tbody,
tr {
    border: 0;
}

th,
td {
    padding: 12px 14px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--divider-color) !important;
    border-right: 1px solid var(--divider-color) !important;
    vertical-align: middle;
}

th:last-child,
td:last-child {
    border-right: 0 !important;
}

tr:last-child td {
    border-bottom: 0 !important;
}

th {
    background: var(--surface-muted);
    color: var(--text-primary);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.35;
}

tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--surface-muted) 55%, transparent);
}

/* =========================
   FAQ REFINEMENT
   ========================= */
.faq-section > h3 {
    margin-top: 0;
    padding-top: 22px;
    border-top: 1px solid var(--divider-color);
}

.faq-section > h3:first-of-type {
    padding-top: 8px;
    border-top: 0;
}

.faq-section > p + h3,
.faq-section > br + h3 {
    margin-top: 18px;
}

/* =========================
   FOOTER
   ========================= */
.site-footer {
    width: 100vw;
    margin: 70px 0 0 calc(50% - 50vw);
    padding: 0;
    border: 0;
    background: #101a20;
    color: #d9e2e6;
    text-align: left;
}

.footer-inner {
    width: min(100% - 40px, var(--content-width));
    margin: 0 auto;
    padding: 48px 0 24px;
}

.footer-main {
    display: grid;
    grid-template-columns: minmax(250px, 1.1fr) minmax(0, 1.9fr);
    gap: 64px;
    align-items: start;
}

.footer-brand {
    max-width: 340px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.footer-logo:hover {
    color: #ffffff;
}

.footer-logo img {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    object-fit: cover;
}

.footer-brand p {
    margin-top: 15px;
    color: #9fb0b9;
    font-size: 0.9rem;
    line-height: 1.7;
}

.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.footer-column h2 {
    margin: 0 0 7px;
    color: #ffffff;
    font-size: 0.87rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.footer-column a {
    width: fit-content;
    color: #9fb0b9;
    text-decoration: none;
    font-size: 0.87rem;
    line-height: 1.55;
    transition: color var(--transition-fast);
}

.footer-column a:hover,
.footer-column a:focus-visible {
    color: #7be0d2;
}

.footer-bottom {
    margin-top: 38px;
    padding-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid #27363e;
}

.footer-bottom p {
    color: #82959f;
    font-size: 0.78rem;
    line-height: 1.55;
}

.footer-note {
    text-align: right;
}

/* =========================
   ACCESSIBILITY / STATES
   ========================= */
:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.32);
    outline-offset: 3px;
}

.calculate-btn:focus-visible,
.random-btn:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible,
.submenu-toggle:focus-visible {
    outline: 3px solid rgba(15, 118, 110, 0.32);
    outline-offset: 2px;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* =========================
   TABLET / MOBILE NAVIGATION
   ========================= */
@media (max-width: 900px) {
    :root {
        --nav-height: 70px;
    }

    /* Mobile header is an explicit two-column layout: brand on the left,
       controls pinned to the far right. This prevents the menu controls
       from crowding the site title on narrow screens. */
    .nav-container {
        width: calc(100% - 24px);
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 20px;
    }

    .nav-logo {
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .nav-controls {
        margin-left: 0;
        justify-self: end;
        flex: 0 0 auto;
        gap: 10px;
    }

    .nav-brand-text {
        font-size: 0.98rem;
    }

    .nav-logo-image {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        border-radius: 12px;
    }

    .nav-menu {
        position: fixed;
        top: var(--nav-height);
        right: 0;
        z-index: 2100;
        width: min(88vw, 380px);
        height: calc(100dvh - var(--nav-height));
        margin: 0;
        padding: 18px 16px 28px;
        display: block;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-left: 1px solid var(--border-color);
        background: var(--surface-elevated);
        box-shadow: -18px 22px 48px rgba(20, 34, 45, 0.16);
        transform: translateX(104%);
        transition: transform var(--transition-slow);
    }

    .nav-menu.is-open {
        transform: translateX(0);
    }

    .nav-item + .nav-item {
        margin-top: 4px;
    }

    .nav-link {
        width: 100%;
        min-height: 50px;
        padding: 0 13px;
        justify-content: flex-start;
        border-radius: 11px;
        font-size: 0.96rem;
    }

    .nav-parent-row {
        width: 100%;
    }

    .nav-parent-link {
        flex: 1 1 auto;
    }

    .submenu-toggle {
        width: 48px;
        height: 48px;
        margin: 0;
        flex: 0 0 48px;
    }

    .submenu {
        position: static;
        width: 100%;
        max-height: 0;
        padding: 0 0 0 14px;
        overflow: hidden;
        visibility: visible;
        opacity: 1;
        transform: none;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transition: max-height var(--transition-slow), padding var(--transition-normal);
    }

    .submenu::before {
        display: none;
    }

    .nav-item-has-submenu:hover > .submenu,
    .nav-item-has-submenu:focus-within > .submenu {
        max-height: 0;
    }

    .nav-item-has-submenu.is-submenu-open > .submenu {
        max-height: 330px;
        padding-top: 5px;
        padding-bottom: 8px;
    }

    .submenu a {
        min-height: 44px;
        padding: 8px 12px;
        border-left: 2px solid var(--divider-color);
        border-radius: 0 9px 9px 0;
        font-size: 0.9rem;
    }

    .submenu a:hover,
    .submenu a:focus-visible,
    .submenu a[aria-current="page"] {
        padding-left: 15px;
        border-left-color: var(--primary-color);
    }

    .nav-toggle {
        display: inline-grid;
    }

    /* Invisible click-catcher behind the drawer. No dimming and no blur.
       Keep it below the navbar stacking context so it never washes out
       or blocks the mobile menu itself. */
    .nav-backdrop {
        position: fixed;
        inset: var(--nav-height) 0 0 0;
        z-index: 1900;
        display: block;
        visibility: hidden;
        opacity: 0;
        background: transparent;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        transition: visibility var(--transition-fast);
    }

    .nav-backdrop.is-visible {
        visibility: visible;
        opacity: 0;
    }

    .container {
        width: min(100% - 30px, var(--content-width));
        padding-top: 24px;
    }

    .calculator-container {
        margin-top: 10px;
    }

    .footer-main {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .footer-brand {
        max-width: 520px;
    }
}

/* =========================
   PHONE
   ========================= */
@media (max-width: 640px) {
    .nav-container {
        width: calc(100% - 24px);
        column-gap: 18px;
    }

    .nav-logo {
        gap: 8px;
        min-width: 0;
    }

    .nav-logo-image {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 11px;
    }

    .nav-brand-text {
        min-width: 0;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.9rem;
    }

    .theme-toggle,
    .nav-toggle {
        width: 40px;
        height: 40px;
        border-radius: 11px;
    }

    .nav-controls {
        margin-left: 0;
        justify-self: end;
        gap: 10px;
    }

    .container {
        width: calc(100% - 24px);
        padding-top: 18px;
    }

    .calculator-container {
        padding: 24px 17px 22px;
        border-radius: 20px;
        box-shadow: var(--shadow-md);
    }

    .calculator-container::after {
        display: none;
    }

    .pet-selection,
    .breed-selection-wrapper {
        margin-bottom: 18px;
    }

    .pet-dropdown,
    .age-input input {
        min-height: 52px;
        padding-left: 14px;
        font-size: 16px; /* Prevents iOS form zoom. */
    }

    .button-group {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 22px;
    }

    .calculate-btn,
    .random-btn {
        min-height: 52px;
        width: 100%;
    }

    .result-section {
        margin-top: 22px;
        padding-top: 22px;
    }

    .fun-fact {
        padding: 15px 15px 15px 44px;
    }

    .fun-fact::before {
        top: 14px;
        left: 14px;
    }

    .container > h1 {
        margin-top: 38px;
        margin-bottom: 15px;
        font-size: clamp(1.8rem, 8vw, 2.35rem);
    }

    .container > section:not(.calculator-container) {
        margin-top: 18px;
        padding: 22px 17px;
        border-radius: 18px;
    }

    .container > section:not(.calculator-container) + section:not(.calculator-container) {
        margin-top: 16px;
    }

    h2 {
        font-size: 1.45rem;
    }

    h3 {
        margin-top: 24px;
        font-size: 1.1rem;
    }

    p,
    li {
        font-size: 0.94rem;
        line-height: 1.72;
    }

    .jump-links {
        margin-top: 14px;
        padding: 15px;
        border-radius: 14px;
    }

    .jump-links ul {
        gap: 7px;
    }

    .jump-links a {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .snippet-answer {
        padding: 15px 16px;
    }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        border-radius: 12px;
        font-size: 0.82rem;
    }

    th,
    td {
        min-width: 118px;
        padding: 10px 12px !important;
    }

    .footer-inner {
        width: calc(100% - 30px);
        padding-top: 38px;
    }

    .footer-links-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 22px;
    }

    .footer-bottom {
        margin-top: 30px;
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .footer-note {
        text-align: left;
    }
}

/* Extra-small phone header tuning. */
@media (max-width: 380px) {
    .nav-container {
        column-gap: 14px;
    }

    .nav-logo-image {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    .nav-brand-text {
        max-width: 132px;
        font-size: 0.84rem;
    }

    .theme-toggle,
    .nav-toggle {
        width: 38px;
        height: 38px;
    }
}


@media (max-width: 390px) {
    .nav-brand-text {
        max-width: 126px;
        font-size: 0.88rem;
    }

    .theme-toggle,
    .nav-toggle {
        width: 38px;
        height: 38px;
    }

    .footer-links-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   PREFERENCES
   ========================= */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --border-color: #737f86;
        --border-strong: #4c5960;
    }

    [data-theme="dark"] {
        --border-color: #a7b5bd;
        --border-strong: #d2dce1;
    }
}

/* =========================================================
   DOG HUB LAYOUT REFINEMENTS - 2026-08-18
   Breadcrumb alignment, intro card, and single CTA fit.
   ========================================================= */

/* Keep the breadcrumb on the same visual grid as the calculator/content cards. */
.breadcrumbs {
    width: min(100%, 930px);
    margin: 4px auto 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
    text-underline-offset: 3px;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text-muted);
    font-size: 1.05em;
}

/* The opening copy is a first-class content card, matching the sections below. */
.container > .dog-page-intro {
    width: min(100%, var(--reading-width));
    margin: 0 auto 26px;
    padding: clamp(28px, 4vw, 44px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

.dog-page-intro h1 {
    max-width: 800px;
    margin: 0 auto 16px;
    color: var(--text-primary);
    font-size: clamp(2rem, 4vw, 3.15rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -0.045em;
    text-align: center;
}

.dog-page-intro .intro-kicker {
    max-width: 720px;
    margin: 0 auto 24px;
    color: var(--text-muted);
    text-align: center;
}

.dog-page-intro > p:not(.intro-kicker):not(.last-updated) {
    max-width: 780px;
    margin: 0 auto;
}

.dog-page-intro > p:not(.intro-kicker):not(.last-updated) + p:not(.last-updated) {
    margin-top: 22px;
}

.dog-page-intro .last-updated {
    max-width: 780px;
    margin: 24px auto 0;
    padding-top: 18px;
    border-top: 1px solid var(--divider-color);
    color: var(--text-muted);
}

/* This hub has one CTA, so it should occupy the form width rather than a two-button grid column. */
.calculator-container .button-group {
    grid-template-columns: 1fr;
    width: 100%;
}

.calculator-container .button-group .calculate-btn:only-child {
    width: 100%;
    max-width: none;
    justify-self: stretch;
}

/* Reduce the gap between the calculator and breadcrumb while keeping visual separation. */
.calculator-container {
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .breadcrumbs {
        width: 100%;
        margin: 2px auto 14px;
        padding: 0 2px;
        font-size: 0.84rem;
    }

    .container > .dog-page-intro {
        margin-bottom: 16px;
        padding: 24px 18px;
        border-radius: 18px;
    }

    .dog-page-intro h1 {
        margin-bottom: 13px;
        font-size: clamp(1.75rem, 8vw, 2.3rem);
    }

    .dog-page-intro .intro-kicker {
        margin-bottom: 20px;
    }

    .dog-page-intro > p:not(.intro-kicker):not(.last-updated) + p:not(.last-updated) {
        margin-top: 18px;
    }

    .dog-page-intro .last-updated {
        margin-top: 20px;
        padding-top: 15px;
    }

    .calculator-container .button-group {
        margin-top: 18px;
    }
}

/* =========================================================
   INTERNAL DOG PAGES - BREED CALCULATORS + SIZE HUBS
   Shared UI layer for ../styles-breeds.css
   Keeps the global Pet Age Calculator visual system consistent.
   ========================================================= */

/* ---------- Internal page rhythm ---------- */
.container > #site-amazon-products {
    width: min(100%, 930px);
    margin: 0 auto;
}

.container > section:not(.calculator-container) > br {
    display: none;
}

.container > section:not(.calculator-container) > p + p {
    margin-top: 18px;
}

.container > section:not(.calculator-container) > p + ul,
.container > section:not(.calculator-container) > p + ol,
.container > section:not(.calculator-container) > p + table,
.container > section:not(.calculator-container) > p + .table-responsive,
.container > section:not(.calculator-container) > ul + p,
.container > section:not(.calculator-container) > ol + p,
.container > section:not(.calculator-container) > table + p,
.container > section:not(.calculator-container) > .table-responsive + p {
    margin-top: 18px;
}

.container > section:not(.calculator-container) > h2 + p,
.container > section:not(.calculator-container) > h3 + p {
    margin-top: 0;
}

/* ---------- Intro cards on breed and size pages ---------- */
.container > section[class*="intro"] {
    position: relative;
    overflow: hidden;
    padding: clamp(30px, 4.6vw, 48px);
}

.container > section[class*="intro"]::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--primary-gradient);
}

.container > section[class*="intro"] > h1 {
    max-width: 790px;
    margin: 0 auto 18px;
    color: var(--text-primary);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -0.045em;
    text-align: center;
}

.container > section[class*="intro"] > h1 + p,
.container > section[class*="intro"] > h1 + small,
.container > section[class*="intro"] > h1 + br + p {
    margin-top: 0;
}

.container > section[class*="intro"] > p {
    max-width: 790px;
    margin-left: auto;
    margin-right: auto;
}

.container > section[class*="intro"] > p > small,
.container > section[class*="intro"] > small {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ---------- Breadcrumbs shared across internal hubs ---------- */
.breadcrumbs {
    width: min(100%, 930px);
    margin: 4px auto 16px;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
    color: var(--primary-hover);
    text-decoration: underline;
}

.breadcrumbs span {
    color: var(--text-muted);
}

/* ---------- Breed-locked calculator ---------- */
.breed-selection-wrapper--fixed {
    display: block !important;
    margin-bottom: 22px;
}

.breed-fixed-card {
    min-height: 70px;
    padding: 15px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background: var(--surface-color);
    box-shadow: var(--shadow-xs);
}

.breed-fixed-card > div {
    min-width: 0;
}

.fixed-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.015em;
}

.fixed-badge {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 11px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(15, 118, 110, 0.16);
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

[data-theme="dark"] .fixed-badge {
    border-color: rgba(72, 201, 184, 0.20);
}

.breed-note {
    margin-top: 6px;
    color: var(--text-muted) !important;
    font-size: 0.84rem;
    line-height: 1.55;
}

/* Breed calculators always have a single primary action. */
.button-group--single,
.calculator-container .button-group--single {
    width: 100%;
    grid-template-columns: 1fr;
}

.button-group--single .calculate-btn,
.calculator-container .button-group--single .calculate-btn {
    width: 100%;
    max-width: none;
    justify-self: stretch;
}

/* ---------- Breed quick-answer callout ---------- */
.quick-answer-box {
    margin: 20px 0 0;
    padding: 18px 20px;
    border: 1px solid rgba(15, 118, 110, 0.20);
    border-left: 4px solid var(--primary-color);
    border-radius: 13px;
    background: var(--primary-soft);
}

.quick-answer-box p {
    color: var(--text-secondary);
}

.quick-answer-box strong {
    color: var(--text-primary);
}

/* Existing optional content-card markup uses the same system. */
.content-card {
    width: min(100%, var(--reading-width));
    margin: 26px auto 0;
    padding: clamp(24px, 4vw, 42px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

.content-card h2 {
    margin-bottom: 14px;
}

.content-card p + p {
    margin-top: 18px;
}

/* ---------- Responsive tables ---------- */
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.table-responsive table {
    margin-top: 0;
}

/* ---------- Size hub navigation cards ---------- */
.dog-size-navigation > ul,
[class*="featured-"][class*="-calculators"] > ul {
    margin-top: 6px;
    padding: 0 !important;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    list-style: none;
}

.dog-size-navigation > ul > li,
[class*="featured-"][class*="-calculators"] > ul > li {
    margin: 0 !important;
}

.dog-size-navigation > ul > li > a,
[class*="featured-"][class*="-calculators"] > ul > li > a,
.dog-size-navigation > ul > li > strong {
    min-height: 52px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 13px;
    background: var(--surface-muted);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.35;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.dog-size-navigation > ul > li > a:hover,
[class*="featured-"][class*="-calculators"] > ul > li > a:hover {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.30);
    background: var(--primary-soft);
    color: var(--primary-color);
}

.dog-size-navigation > ul > li > strong {
    border-color: rgba(15, 118, 110, 0.22);
    background: var(--primary-soft);
    color: var(--primary-color);
}

/* ---------- A-Z breed directory ---------- */
[class*="breeds-directory"] > h3 {
    width: 38px;
    height: 38px;
    margin: 28px 0 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 750;
}

[class*="breeds-directory"] > h3:first-of-type {
    margin-top: 18px;
}

[class*="breeds-directory"] > ul {
    padding: 0 !important;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    list-style: none;
}

[class*="breeds-directory"] > ul > li {
    margin: 0 !important;
}

[class*="breeds-directory"] > ul > li > a {
    min-height: 48px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-muted);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
    transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

[class*="breeds-directory"] > ul > li > a:hover,
[class*="breeds-directory"] > ul > li > a:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(15, 118, 110, 0.28);
    background: var(--primary-soft);
    color: var(--primary-color);
}

/* ---------- FAQ polish on breed and size pages ---------- */
section[class*="faq"] > h3,
section[id*="faq"] > h3 {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--divider-color);
}

section[class*="faq"] > h3:first-of-type,
section[id*="faq"] > h3:first-of-type {
    margin-top: 8px;
    padding-top: 0;
    border-top: 0;
}

/* ---------- End-of-page navigation callout ---------- */
.explore-dog-age-calculators {
    border-color: rgba(15, 118, 110, 0.18) !important;
    background: linear-gradient(135deg, var(--primary-soft), var(--surface-color)) !important;
}

/* ---------- Mobile internal pages ---------- */
@media (max-width: 640px) {
    .container > section[class*="intro"] {
        padding: 25px 18px;
    }

    .container > section[class*="intro"] > h1 {
        margin-bottom: 14px;
        font-size: clamp(1.75rem, 8vw, 2.3rem);
    }

    .breadcrumbs {
        width: 100%;
        margin: 2px auto 13px;
        padding-inline: 2px;
        font-size: 0.82rem;
    }

    .breed-fixed-card {
        min-height: 0;
        padding: 14px;
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .fixed-badge {
        min-height: 31px;
    }

    .quick-answer-box {
        padding: 15px 16px;
    }

    .content-card {
        padding: 22px 17px;
        border-radius: 18px;
    }

    .dog-size-navigation > ul,
    [class*="featured-"][class*="-calculators"] > ul,
    [class*="breeds-directory"] > ul {
        grid-template-columns: 1fr;
    }

    [class*="breeds-directory"] > h3 {
        margin-top: 24px;
    }

    .table-responsive {
        margin-inline: 0;
    }

    .table-responsive table {
        min-width: 620px;
    }
}

@media (max-width: 390px) {
    .container > section[class*="intro"] > h1 {
        font-size: 1.72rem;
    }

    .breed-note {
        font-size: 0.8rem;
    }
}

/* =========================================================
   UNIVERSAL BREED PAGE BREADCRUMB ALIGNMENT
   Shared fix for all breed-specific calculator pages.
   No HTML changes required.
   ========================================================= */
.container .breadcrumbs,
.container .breadcrumb,
.container nav[aria-label="Breadcrumb"],
.container nav[aria-label="breadcrumb"],
.container nav[aria-label*="breadcrumb" i],
.container [role="navigation"][aria-label*="breadcrumb" i] {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    float: none !important;
    transform: none !important;

    width: min(100%, 930px) !important;
    max-width: 930px !important;
    margin: 0 auto 18px !important;
    padding: 0 !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 7px !important;

    box-sizing: border-box !important;
    color: var(--text-muted) !important;
    font-size: 0.9rem !important;
    line-height: 1.45 !important;
    text-align: left !important;
}

.container .breadcrumbs a,
.container .breadcrumb a,
.container nav[aria-label*="breadcrumb" i] a,
.container [role="navigation"][aria-label*="breadcrumb" i] a {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    text-underline-offset: 3px;
}

.container .breadcrumbs a:hover,
.container .breadcrumbs a:focus-visible,
.container .breadcrumb a:hover,
.container .breadcrumb a:focus-visible,
.container nav[aria-label*="breadcrumb" i] a:hover,
.container nav[aria-label*="breadcrumb" i] a:focus-visible,
.container [role="navigation"][aria-label*="breadcrumb" i] a:hover,
.container [role="navigation"][aria-label*="breadcrumb" i] a:focus-visible {
    color: var(--primary-hover) !important;
    text-decoration: underline !important;
}

.container .breadcrumbs span,
.container .breadcrumb span,
.container .breadcrumb-separator,
.container nav[aria-label*="breadcrumb" i] span,
.container [role="navigation"][aria-label*="breadcrumb" i] span {
    color: var(--text-muted) !important;
}

@media (max-width: 640px) {
    .container .breadcrumbs,
    .container .breadcrumb,
    .container nav[aria-label="Breadcrumb"],
    .container nav[aria-label="breadcrumb"],
    .container nav[aria-label*="breadcrumb" i],
    .container [role="navigation"][aria-label*="breadcrumb" i] {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto 14px !important;
        padding: 0 2px !important;
        gap: 5px !important;
        font-size: 0.82rem !important;
    }
}

/* =========================================================
   BREED CALCULATOR CONTENT CARDS - 2026-08-18
   CSS-only upgrade for all breed-specific calculator pages.
   Scope is limited to pages containing .breed-fixed-card so
   size hubs keep their existing card layout unchanged.
   ========================================================= */

/* Keep breed-page reading content on the same 900px grid used by size hubs. */
.container:has(.breed-fixed-card) > h1,
.container:has(.breed-fixed-card) > h1 + p,
.container:has(.breed-fixed-card) > h1 + p + p,
.container:has(.breed-fixed-card) > h1 + p + p + p,
.container:has(.breed-fixed-card) > h2,
.container:has(.breed-fixed-card) > h2 + p,
.container:has(.breed-fixed-card) > h2 + p + p,
.container:has(.breed-fixed-card) > h2 + p + p + p,
.container:has(.breed-fixed-card) > h2 + ul,
.container:has(.breed-fixed-card) > h2 + ol,
.container:has(.breed-fixed-card) > h2 + ul + p,
.container:has(.breed-fixed-card) > h2 + ol + p,
.container:has(.breed-fixed-card) > h2 + p + ul,
.container:has(.breed-fixed-card) > h2 + p + ol,
.container:has(.breed-fixed-card) > h2 + p + ul + p,
.container:has(.breed-fixed-card) > h2 + p + ol + p {
    width: min(100%, var(--reading-width));
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* ---------- Breed intro card: H1 + opening copy ---------- */
.container:has(.breed-fixed-card) > h1 {
    position: relative;
    margin-top: 0;
    margin-bottom: 0;
    padding: clamp(36px, 5vw, 52px) clamp(24px, 5vw, 54px) 18px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: none;
    font-size: clamp(2rem, 4vw, 3.15rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -0.045em;
    text-align: center;
}

.container:has(.breed-fixed-card) > h1::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

/* Opening paragraphs visually continue the H1 card. */
.container:has(.breed-fixed-card) > h1 + p,
.container:has(.breed-fixed-card) > h1 + p + p,
.container:has(.breed-fixed-card) > h1 + p + p + p {
    margin-top: 0;
    margin-bottom: 0;
    padding: 0 clamp(24px, 5vw, 54px) 16px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.72;
}

/* Close the intro card on the final consecutive paragraph after H1. */
.container:has(.breed-fixed-card) > h1 + p:not(:has(+ p)),
.container:has(.breed-fixed-card) > h1 + p + p:not(:has(+ p)),
.container:has(.breed-fixed-card) > h1 + p + p + p {
    padding-bottom: clamp(30px, 4vw, 42px);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* Space from intro card to the next top-level section. */
.container:has(.breed-fixed-card) > h1 + p:not(:has(+ p)) + h2,
.container:has(.breed-fixed-card) > h1 + p + p:not(:has(+ p)) + h2,
.container:has(.breed-fixed-card) > h1 + p + p + p + h2 {
    margin-top: 26px;
}

/* ---------- Top-level breed content cards ---------- */
/* Direct H2s are section-card headers. Existing <section> cards are untouched. */
.container:has(.breed-fixed-card) > h2 {
    margin-top: 26px;
    margin-bottom: 0;
    padding: clamp(28px, 4vw, 38px) clamp(24px, 4vw, 42px) 14px;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: none;
    font-size: clamp(1.55rem, 2.7vw, 2.15rem);
    font-weight: 720;
    line-height: 1.22;
    letter-spacing: -0.035em;
}

/* Content immediately belonging to a direct H2 continues the same card. */
.container:has(.breed-fixed-card) > h2 + p,
.container:has(.breed-fixed-card) > h2 + p + p,
.container:has(.breed-fixed-card) > h2 + p + p + p,
.container:has(.breed-fixed-card) > h2 + ul,
.container:has(.breed-fixed-card) > h2 + ol,
.container:has(.breed-fixed-card) > h2 + ul + p,
.container:has(.breed-fixed-card) > h2 + ol + p,
.container:has(.breed-fixed-card) > h2 + p + ul,
.container:has(.breed-fixed-card) > h2 + p + ol,
.container:has(.breed-fixed-card) > h2 + p + ul + p,
.container:has(.breed-fixed-card) > h2 + p + ol + p {
    margin-top: 0;
    margin-bottom: 0;
    padding: 0 clamp(24px, 4vw, 42px) 16px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    line-height: 1.72;
}

.container:has(.breed-fixed-card) > h2 + ul,
.container:has(.breed-fixed-card) > h2 + ol,
.container:has(.breed-fixed-card) > h2 + p + ul,
.container:has(.breed-fixed-card) > h2 + p + ol {
    padding-left: calc(clamp(24px, 4vw, 42px) + 1.25rem);
}

/* Close common H2 card patterns. This covers the shared 121-page template
   without needing to edit the HTML of every calculator. */
.container:has(.breed-fixed-card) > h2 + p:not(:has(+ p, + ul, + ol)),
.container:has(.breed-fixed-card) > h2 + p + p:not(:has(+ p, + ul, + ol)),
.container:has(.breed-fixed-card) > h2 + p + p + p,
.container:has(.breed-fixed-card) > h2 + ul:not(:has(+ p)),
.container:has(.breed-fixed-card) > h2 + ol:not(:has(+ p)),
.container:has(.breed-fixed-card) > h2 + ul + p,
.container:has(.breed-fixed-card) > h2 + ol + p,
.container:has(.breed-fixed-card) > h2 + p + ul:not(:has(+ p)),
.container:has(.breed-fixed-card) > h2 + p + ol:not(:has(+ p)),
.container:has(.breed-fixed-card) > h2 + p + ul + p,
.container:has(.breed-fixed-card) > h2 + p + ol + p {
    padding-bottom: clamp(28px, 4vw, 36px);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* If a direct H2 has no simple paragraph/list body, make it a complete card
   rather than leaving an open-ended header block. */
.container:has(.breed-fixed-card) > h2:not(:has(+ p, + ul, + ol)) {
    padding-bottom: clamp(28px, 4vw, 36px);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* Direct standalone paragraphs that follow a completed list are often the
   final note in the shared "How to Use" template. Pull them into a clean,
   quiet note card rather than leaving floating copy. */
.container:has(.breed-fixed-card) > h2:first-of-type + ol + p,
.container:has(.breed-fixed-card) > h2:first-of-type + ul + p {
    color: var(--text-secondary);
}

/* Existing section wrappers already render as cards. Make their spacing and
   geometry match the size-hub screenshot more closely. */
.container:has(.breed-fixed-card) > section:not(.calculator-container),
.container:has(.breed-fixed-card) > .content-card {
    width: min(100%, var(--reading-width));
    margin-top: 26px;
    padding: clamp(28px, 4vw, 42px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

/* Breadcrumb should sit on the reading grid, just above the first content card. */
.container:has(.breed-fixed-card) .breadcrumbs,
.container:has(.breed-fixed-card) .breadcrumb,
.container:has(.breed-fixed-card) nav[aria-label*="breadcrumb" i] {
    width: min(100%, var(--reading-width)) !important;
    max-width: var(--reading-width) !important;
    margin: 0 auto 18px !important;
}

/* A slightly calmer gap between calculator and content hierarchy. */
.container:has(.breed-fixed-card) .calculator-container {
    margin-bottom: 26px;
}

/* ---------- Mobile breed content cards ---------- */
@media (max-width: 640px) {
    .container:has(.breed-fixed-card) > h1 {
        padding: 28px 18px 14px;
        border-radius: 18px 18px 0 0;
        font-size: clamp(1.72rem, 8vw, 2.25rem);
        text-align: left;
    }

    .container:has(.breed-fixed-card) > h1 + p,
    .container:has(.breed-fixed-card) > h1 + p + p,
    .container:has(.breed-fixed-card) > h1 + p + p + p {
        padding-left: 18px;
        padding-right: 18px;
        font-size: 0.95rem;
    }

    .container:has(.breed-fixed-card) > h1 + p:not(:has(+ p)),
    .container:has(.breed-fixed-card) > h1 + p + p:not(:has(+ p)),
    .container:has(.breed-fixed-card) > h1 + p + p + p {
        padding-bottom: 24px;
        border-radius: 0 0 18px 18px;
    }

    .container:has(.breed-fixed-card) > h2 {
        margin-top: 20px;
        padding: 24px 18px 12px;
        border-radius: 18px 18px 0 0;
        font-size: clamp(1.35rem, 6vw, 1.75rem);
    }

    .container:has(.breed-fixed-card) > h2 + p,
    .container:has(.breed-fixed-card) > h2 + p + p,
    .container:has(.breed-fixed-card) > h2 + p + p + p,
    .container:has(.breed-fixed-card) > h2 + ul,
    .container:has(.breed-fixed-card) > h2 + ol,
    .container:has(.breed-fixed-card) > h2 + ul + p,
    .container:has(.breed-fixed-card) > h2 + ol + p,
    .container:has(.breed-fixed-card) > h2 + p + ul,
    .container:has(.breed-fixed-card) > h2 + p + ol,
    .container:has(.breed-fixed-card) > h2 + p + ul + p,
    .container:has(.breed-fixed-card) > h2 + p + ol + p {
        padding-left: 18px;
        padding-right: 18px;
        font-size: 0.95rem;
    }

    .container:has(.breed-fixed-card) > h2 + ul,
    .container:has(.breed-fixed-card) > h2 + ol,
    .container:has(.breed-fixed-card) > h2 + p + ul,
    .container:has(.breed-fixed-card) > h2 + p + ol {
        padding-left: 36px;
    }

    .container:has(.breed-fixed-card) > h2 + p:not(:has(+ p, + ul, + ol)),
    .container:has(.breed-fixed-card) > h2 + p + p:not(:has(+ p, + ul, + ol)),
    .container:has(.breed-fixed-card) > h2 + p + p + p,
    .container:has(.breed-fixed-card) > h2 + ul:not(:has(+ p)),
    .container:has(.breed-fixed-card) > h2 + ol:not(:has(+ p)),
    .container:has(.breed-fixed-card) > h2 + ul + p,
    .container:has(.breed-fixed-card) > h2 + ol + p,
    .container:has(.breed-fixed-card) > h2 + p + ul:not(:has(+ p)),
    .container:has(.breed-fixed-card) > h2 + p + ol:not(:has(+ p)),
    .container:has(.breed-fixed-card) > h2 + p + ul + p,
    .container:has(.breed-fixed-card) > h2 + p + ol + p {
        padding-bottom: 24px;
        border-radius: 0 0 18px 18px;
    }

    .container:has(.breed-fixed-card) > section:not(.calculator-container),
    .container:has(.breed-fixed-card) > .content-card {
        margin-top: 20px;
        padding: 24px 18px;
        border-radius: 18px;
    }

    .container:has(.breed-fixed-card) .breadcrumbs,
    .container:has(.breed-fixed-card) .breadcrumb,
    .container:has(.breed-fixed-card) nav[aria-label*="breadcrumb" i] {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 14px !important;
    }
}

/* =========================================================
   BREED CALCULATOR FLAT-TEMPLATE COMPATIBILITY
   Some refreshed breed pages place H1/H2 content directly in .container
   rather than inside <section> wrappers. These rules reproduce the same
   boxed visual system without editing individual HTML files.
   ========================================================= */

/* Hide spacer BR elements used by the legacy/refreshed flat templates. */
.container > h1 + br,
.container > h1 + p + br,
.container > h1 + br + p + br,
.container > h1 + p + br + p + br,
.container > h1 + br + p + br + p + br,
.container > h2 + br,
.container > h2 + p + br,
.container > h2 + ol + br,
.container > h2 + ul + br,
.container > h2 + br + p + br,
.container > h2 + br + ol + br,
.container > h2 + br + ul + br {
    display: none;
}

/* Flat-template intro card. */
.container > h1 {
    position: relative;
    width: min(100%, var(--reading-width));
    margin: 26px auto 0;
    padding: clamp(34px, 4.5vw, 48px) clamp(26px, 4.6vw, 48px) 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: var(--surface-color);
    box-shadow: none;
    color: var(--text-primary);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -0.045em;
    text-align: center;
}

.container > h1::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--primary-gradient);
}

/* First, second and third opening paragraphs can follow H1 with or without BRs. */
.container > h1 + p,
.container > h1 + br + p,
.container > h1 + p + p,
.container > h1 + p + br + p,
.container > h1 + br + p + p,
.container > h1 + br + p + br + p,
.container > h1 + p + p + p,
.container > h1 + p + br + p + br + p,
.container > h1 + br + p + br + p + br + p {
    width: min(100%, var(--reading-width));
    margin: 0 auto;
    padding: 0 clamp(26px, 4.6vw, 48px) 16px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.72;
}

/* Close the intro card when the next meaningful node starts another section. */
.container > h1 + p:has(+ h2),
.container > h1 + p:has(+ br + h2),
.container > h1 + br + p:has(+ h2),
.container > h1 + br + p:has(+ br + h2),
.container > h1 + p + p:has(+ h2),
.container > h1 + p + p:has(+ br + h2),
.container > h1 + p + br + p:has(+ h2),
.container > h1 + p + br + p:has(+ br + h2),
.container > h1 + br + p + br + p:has(+ h2),
.container > h1 + br + p + br + p:has(+ br + h2),
.container > h1 + p + p + p:has(+ h2),
.container > h1 + p + p + p:has(+ br + h2),
.container > h1 + p + br + p + br + p:has(+ h2),
.container > h1 + p + br + p + br + p:has(+ br + h2),
.container > h1 + br + p + br + p + br + p:has(+ h2),
.container > h1 + br + p + br + p + br + p:has(+ br + h2) {
    padding-bottom: clamp(30px, 4vw, 40px);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* Flat-template H2 content cards. */
.container > h2 {
    width: min(100%, var(--reading-width));
    margin: 26px auto 0;
    padding: clamp(28px, 4vw, 38px) clamp(26px, 4vw, 42px) 14px;
    border: 1px solid var(--border-color);
    border-bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: none;
    font-size: clamp(1.55rem, 2.7vw, 2.15rem);
    font-weight: 720;
    line-height: 1.22;
    letter-spacing: -0.035em;
}

/* Common section bodies on the refreshed calculator template. */
.container > h2 + p,
.container > h2 + br + p,
.container > h2 + ol,
.container > h2 + br + ol,
.container > h2 + ul,
.container > h2 + br + ul,
.container > h2 + p + p,
.container > h2 + p + br + p,
.container > h2 + br + p + br + p,
.container > h2 + ol + p,
.container > h2 + ol + br + p,
.container > h2 + br + ol + br + p,
.container > h2 + ul + p,
.container > h2 + ul + br + p,
.container > h2 + br + ul + br + p {
    width: min(100%, var(--reading-width));
    margin: 0 auto;
    padding: 0 clamp(26px, 4vw, 42px) 16px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    line-height: 1.72;
}

.container > h2 + ol,
.container > h2 + br + ol,
.container > h2 + ul,
.container > h2 + br + ul {
    padding-left: calc(clamp(26px, 4vw, 42px) + 1.35rem);
}

/* Close common H2 card patterns before the next H2/section/footer. */
.container > h2 + p:has(+ h2, + section, + footer),
.container > h2 + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + br + p:has(+ h2, + section, + footer),
.container > h2 + br + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + p + p:has(+ h2, + section, + footer),
.container > h2 + p + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + p + br + p:has(+ h2, + section, + footer),
.container > h2 + p + br + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + br + p + br + p:has(+ h2, + section, + footer),
.container > h2 + br + p + br + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + ol:has(+ h2, + section, + footer),
.container > h2 + ol:has(+ br + h2, + br + section, + br + footer),
.container > h2 + br + ol:has(+ h2, + section, + footer),
.container > h2 + br + ol:has(+ br + h2, + br + section, + br + footer),
.container > h2 + ol + p:has(+ h2, + section, + footer),
.container > h2 + ol + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + ol + br + p:has(+ h2, + section, + footer),
.container > h2 + ol + br + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + br + ol + br + p:has(+ h2, + section, + footer),
.container > h2 + br + ol + br + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + ul:has(+ h2, + section, + footer),
.container > h2 + ul:has(+ br + h2, + br + section, + br + footer),
.container > h2 + br + ul:has(+ h2, + section, + footer),
.container > h2 + br + ul:has(+ br + h2, + br + section, + br + footer),
.container > h2 + ul + p:has(+ h2, + section, + footer),
.container > h2 + ul + p:has(+ br + h2, + br + section, + br + footer),
.container > h2 + ul + br + p:has(+ h2, + section, + footer),
.container > h2 + ul + br + p:has(+ br + h2, + br + section, + br + footer) {
    padding-bottom: clamp(28px, 4vw, 36px);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* If an H2 is followed by a wrapped section rather than direct copy, keep H2 whole. */
.container > h2:has(+ section),
.container > h2:has(+ br + section) {
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* Keep every actual section aligned and visually identical to the size-hub cards. */
.container > section:not(.calculator-container) {
    width: min(100%, var(--reading-width));
    margin-left: auto;
    margin-right: auto;
    padding: clamp(30px, 4vw, 42px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

.container > section:not(.calculator-container) > h1,
.container > section:not(.calculator-container) > h2 {
    margin-top: 0;
}

/* Match the desired hub-style card width on desktop. */
.container > .breadcrumbs,
.container > .breadcrumb,
.container > nav[aria-label*="breadcrumb" i] {
    width: min(100%, var(--reading-width)) !important;
    max-width: var(--reading-width) !important;
}

@media (max-width: 640px) {
    .container > h1 {
        margin-top: 20px;
        padding: 28px 18px 13px;
        border-radius: 18px 18px 0 0;
        font-size: clamp(1.72rem, 8vw, 2.25rem);
        text-align: left;
    }

    .container > h1 + p,
    .container > h1 + br + p,
    .container > h1 + p + p,
    .container > h1 + p + br + p,
    .container > h1 + br + p + br + p,
    .container > h1 + p + p + p,
    .container > h1 + p + br + p + br + p,
    .container > h1 + br + p + br + p + br + p {
        padding-left: 18px;
        padding-right: 18px;
        font-size: 0.95rem;
    }

    .container > h2 {
        margin-top: 20px;
        padding: 24px 18px 12px;
        border-radius: 18px 18px 0 0;
        font-size: clamp(1.35rem, 6vw, 1.75rem);
    }

    .container > h2 + p,
    .container > h2 + br + p,
    .container > h2 + ol,
    .container > h2 + br + ol,
    .container > h2 + ul,
    .container > h2 + br + ul,
    .container > h2 + p + p,
    .container > h2 + p + br + p,
    .container > h2 + br + p + br + p,
    .container > h2 + ol + p,
    .container > h2 + ol + br + p,
    .container > h2 + br + ol + br + p,
    .container > h2 + ul + p,
    .container > h2 + ul + br + p,
    .container > h2 + br + ul + br + p {
        padding-left: 18px;
        padding-right: 18px;
        font-size: 0.95rem;
    }

    .container > h2 + ol,
    .container > h2 + br + ol,
    .container > h2 + ul,
    .container > h2 + br + ul {
        padding-left: 36px;
    }

    .container > section:not(.calculator-container) {
        padding: 24px 18px;
        border-radius: 18px;
    }
}

/* =========================================================
   SHARED UI/UX HARDENING - 2026-08-23
   Safe CSS-only protections for responsive layout stability.
   ========================================================= */

/* Reserve the desktop scrollbar gutter so opening menus or changing page
   height does not nudge centered content horizontally. Keep this desktop-only
   so very narrow mobile viewports never lose usable content width. */
@media (min-width: 901px) {
    html {
        scrollbar-gutter: stable;
    }
}

/* Preserve intrinsic image proportions and prevent embedded/media elements
   from exceeding their containing card. More specific component rules can
   still set intentional fixed dimensions. */
img {
    height: auto;
}

svg,
video,
canvas,
iframe {
    max-width: 100%;
}

/* Flex/grid children must be allowed to shrink. This prevents long breed
   names, labels and result text from forcing page-level horizontal overflow. */
.nav-container,
.nav-logo,
.nav-controls,
.nav-parent-row,
.container,
.calculator-container,
.input-section,
.result-section,
.content-card {
    min-width: 0;
}

/* Long URLs or unusually long words may wrap inside content instead of being
   clipped by the viewport. Normal prose still wraps at spaces as usual. */
.container :where(h1, h2, h3, p, li, a, th, td),
.breadcrumbs,
.breadcrumbs a {
    overflow-wrap: anywhere;
}

/* Keep form controls constrained to their responsive parent. */
input,
select,
textarea,
button {
    max-width: 100%;
}

/* Tables remain contained by their card; existing mobile overflow rules still
   provide horizontal scrolling where a table genuinely needs more width. */
table {
    max-width: 100%;
}

/* Reduce accidental double-tap/gesture delays on interactive controls. */
button,
[role="button"],
.nav-link,
.submenu a,
.jump-links a {
    touch-action: manipulation;
}

/* Prefer clipping over creating an unintended horizontal scroll container in
   browsers that support it. Visible page content has been verified in-bounds. */
@supports (overflow: clip) {
    body {
        overflow-x: clip;
    }
}

@media (max-width: 900px) {
    /* 100vh fallback first, dynamic viewport height second. This keeps the
       mobile drawer usable when browser chrome expands/collapses. */
    .nav-menu {
        height: calc(100vh - var(--nav-height));
        height: calc(100dvh - var(--nav-height));
    }
}

@media (hover: none) {
    /* Avoid sticky hover movement on touch devices. */
    .calculate-btn:hover,
    .random-btn:hover,
    .dog-size-navigation > ul > li > a:hover,
    [class*="featured-"][class*="-calculators"] > ul > li > a:hover,
    [class*="breeds-directory"] > ul > li > a:hover {
        transform: none;
    }
}

