@import url("https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700|Montserrat:600,700,800&display=swap");

:root {
    --scacchi-ink: #20252d;
    --scacchi-navy: #2f3c48;
    --scacchi-navy-deep: #17212b;
    --scacchi-gold: #e7c900;
    --scacchi-gold-soft: #fff6ad;
    --scacchi-paper: #f5f4ef;
    --scacchi-white: #ffffff;
    --scacchi-muted: #68717a;
    --scacchi-line: #dddcd5;
    --scacchi-success: #2d8a57;
    --scacchi-danger: #bb3e3e;
    --scacchi-shadow: 0 18px 50px rgba(23, 33, 43, 0.1);
}

.scacchi-skip-link {
    position: fixed;
    z-index: 10000;
    top: 10px;
    left: 10px;
    padding: 10px 16px;
    color: var(--scacchi-ink);
    background: var(--scacchi-gold);
    font: 600 14px/1.2 "Poppins", sans-serif;
    text-decoration: none;
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.scacchi-skip-link:focus {
    transform: translateY(0);
}

.scacchi-sitebar,
.scacchi-sitebar * {
    box-sizing: border-box;
}

.scacchi-sitebar {
    position: relative;
    z-index: 1000;
    width: 100%;
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: "Poppins", sans-serif;
}

.scacchi-sitebar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    width: min(1160px, calc(100% - 40px));
    min-height: 80px;
    margin: 0 auto;
}

.scacchi-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    color: var(--scacchi-white) !important;
    text-decoration: none !important;
}

.scacchi-brand__mark {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    color: var(--scacchi-gold);
    border: 1px solid rgba(231, 201, 0, 0.72);
    border-radius: 50%;
    font: 400 25px/1 Georgia, serif;
}

.scacchi-brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.scacchi-brand__text strong {
    color: var(--scacchi-white);
    font: 700 14px/1.25 "Montserrat", sans-serif;
}

.scacchi-brand__text small {
    margin-top: 3px;
    color: var(--scacchi-gold);
    font: 600 9px/1.2 "Montserrat", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.scacchi-sitebar__nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.scacchi-sitebar__nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 13px;
    color: var(--scacchi-white) !important;
    border-radius: 24px;
    font: 600 13px/1 "Poppins", sans-serif;
    text-decoration: none !important;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.scacchi-sitebar__nav a:hover,
.scacchi-sitebar__nav a:focus-visible,
.scacchi-sitebar__nav a.is-current {
    color: var(--scacchi-ink) !important;
    background: var(--scacchi-gold);
    outline: none;
}

.scacchi-sitebar__nav a:last-child:not(.is-current) {
    border: 2px solid var(--scacchi-gold);
}

.scacchi-site-footer,
.scacchi-site-footer * {
    box-sizing: border-box;
}

.scacchi-site-footer {
    clear: both;
    margin-top: 64px;
    color: rgba(255, 255, 255, 0.82);
    background: var(--scacchi-navy-deep);
    border-top: 4px solid var(--scacchi-gold);
    font: 400 14px/1.7 "Poppins", sans-serif;
}

.scacchi-site-footer__inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 40px;
    width: min(1080px, calc(100% - 40px));
    margin: 0 auto;
    padding: 44px 0;
}

.scacchi-site-footer strong {
    color: var(--scacchi-gold);
    font-family: "Montserrat", sans-serif;
}

.scacchi-site-footer p {
    margin: 9px 0 0;
}

.scacchi-site-footer__links {
    display: grid;
    gap: 7px;
    text-align: right;
}

.scacchi-site-footer a {
    color: var(--scacchi-white) !important;
    text-decoration-color: rgba(231, 201, 0, 0.5);
    text-underline-offset: 3px;
}

.scacchi-site-footer a:hover,
.scacchi-site-footer a:focus-visible {
    color: var(--scacchi-gold) !important;
}

/* ELO overview and calculators */
body.scacchi-shell-page {
    --primary-color: var(--scacchi-navy);
    --secondary-color: var(--scacchi-gold);
    --accent-color: var(--scacchi-danger);
    --light-color: var(--scacchi-paper);
    --dark-color: var(--scacchi-ink);
    --success-color: var(--scacchi-success);
    --warning-color: #c78800;
    margin: 0;
    padding: 0;
    color: var(--scacchi-ink);
    background: var(--scacchi-paper);
    font-family: "Poppins", sans-serif;
}

.scacchi-shell-page > .container {
    width: min(1040px, calc(100% - 40px));
    max-width: none;
    margin: 48px auto 0;
    padding: 44px 48px 50px;
    background: var(--scacchi-white);
    border: 0;
    border-top: 5px solid var(--scacchi-gold);
    border-radius: 0 0 8px 8px;
    box-shadow: var(--scacchi-shadow);
}

.scacchi-shell-page h1,
.scacchi-shell-page h2,
.scacchi-shell-page h3 {
    color: var(--scacchi-ink);
    font-family: "Montserrat", sans-serif;
    letter-spacing: -0.025em;
}

.scacchi-shell-page h1 {
    margin-bottom: 8px;
    font-size: clamp(2rem, 4vw, 3.3rem);
    line-height: 1.08;
    text-align: left;
}

.scacchi-shell-page h1 a {
    color: inherit !important;
}

.scacchi-shell-page h2 {
    margin-top: 42px;
    border-bottom-color: var(--scacchi-gold);
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    line-height: 1.25;
}

.scacchi-shell-page h3 {
    color: var(--scacchi-navy);
}

.scacchi-shell-page p,
.scacchi-shell-page li {
    font-size: 15px;
    line-height: 1.75;
}

.scacchi-shell-page a {
    color: #394b59;
    text-underline-offset: 3px;
}

.scacchi-shell-page .chess-border {
    margin: 10px 0 42px;
    border-bottom-color: var(--scacchi-gold);
}

.scacchi-shell-page .chess-border::after {
    color: var(--scacchi-navy);
    background: var(--scacchi-white);
}

.scacchi-shell-page .calculator-card,
.scacchi-shell-page .input-section,
.scacchi-shell-page .result-section {
    border: 1px solid var(--scacchi-line);
    border-radius: 4px;
    box-shadow: none;
}

.scacchi-shell-page .calculator-card {
    position: relative;
    overflow: hidden;
    padding: 26px;
}

.scacchi-shell-page .calculator-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--scacchi-gold);
    content: "";
}

.scacchi-shell-page .calculator-card:hover {
    box-shadow: 0 12px 28px rgba(32, 37, 45, 0.12);
}

.scacchi-shell-page .btn,
.scacchi-shell-page button {
    color: var(--scacchi-ink);
    background: var(--scacchi-gold);
    border: 2px solid var(--scacchi-gold);
    border-radius: 24px;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
}

.scacchi-shell-page .btn:hover,
.scacchi-shell-page .btn:focus-visible,
.scacchi-shell-page button:hover,
.scacchi-shell-page button:focus-visible {
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
    border-color: var(--scacchi-navy);
    outline: none;
}

.scacchi-shell-page .btn-secondary {
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
    border-color: var(--scacchi-navy);
}

.scacchi-shell-page .btn-secondary:hover,
.scacchi-shell-page .btn-secondary:focus-visible {
    color: var(--scacchi-ink);
    background: var(--scacchi-gold);
    border-color: var(--scacchi-gold);
}

.scacchi-shell-page input,
.scacchi-shell-page select {
    min-height: 46px;
    border: 1px solid #c9cac5;
    border-radius: 3px;
    background: var(--scacchi-white);
    font-family: "Poppins", sans-serif;
}

.scacchi-shell-page input:focus,
.scacchi-shell-page select:focus {
    border-color: var(--scacchi-gold);
    box-shadow: 0 0 0 3px rgba(231, 201, 0, 0.22);
}

.scacchi-shell-page .results,
.scacchi-shell-page th {
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
}

.scacchi-shell-page .highlight-box {
    background: #fffbea;
    border-left-color: var(--scacchi-gold);
}

.scacchi-shell-page .footer {
    margin-bottom: -16px;
    color: var(--scacchi-muted);
    border-top-color: var(--scacchi-line);
}

/* Training hub and guide */
body.tools-hub,
body.guide-page {
    color: var(--scacchi-ink);
    background: var(--scacchi-paper);
    font-family: "Poppins", sans-serif;
}

body.tools-hub > header,
body.guide-page > header {
    position: relative;
    margin: 0 0 42px;
    padding: 66px 20px 70px;
    color: var(--scacchi-white);
    background:
        linear-gradient(90deg, rgba(23, 33, 43, 0.97), rgba(47, 60, 72, 0.9)),
        url("/images/slide01.jpg") center 42% / cover;
    border-radius: 0;
    box-shadow: none;
}

body.tools-hub > header::after,
body.guide-page > header::after {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 92px;
    height: 5px;
    background: var(--scacchi-gold);
    content: "";
    transform: translateX(-50%);
}

body.tools-hub > header h1,
body.guide-page > header h1 {
    color: var(--scacchi-white);
    font-family: "Montserrat", sans-serif;
    font-size: clamp(2rem, 4.6vw, 3.7rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
    text-shadow: none;
}

body.tools-hub > header .subtitle,
body.guide-page > header .subtitle {
    max-width: 760px;
    margin-right: auto;
    margin-left: auto;
    color: rgba(255, 255, 255, 0.84);
}

.tools-hub .breadcrumb-nav,
.guide-page .breadcrumb-nav {
    background: var(--scacchi-white);
    border-bottom: 1px solid var(--scacchi-line);
}

.tools-hub .breadcrumb-item a,
.guide-page .breadcrumb-item a,
.tools-hub .intro h2,
.tools-hub .faq-item h3,
.tools-hub .benefit-card h3,
.tools-hub .method-step h4,
.tools-hub .tip-card h3,
.guide-page .content-section h2,
.guide-page .content-section h3 {
    color: var(--scacchi-navy);
}

.guide-page .intro h2,
.guide-page .technique-card h4,
.guide-page .quote-box cite,
.guide-page .toc a:hover {
    color: var(--scacchi-navy);
}

.guide-page .content-section h2::after {
    background: var(--scacchi-gold);
}

.guide-page .highlight-box {
    background: #fffbea;
    border-left-color: var(--scacchi-gold);
}

.guide-page .toc li::before {
    color: var(--scacchi-gold);
}

.guide-page .cta-section {
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
    border-top: 4px solid var(--scacchi-gold);
}

.tools-hub .section-title,
.tools-hub .features h2,
.tools-hub .faq h2,
.tools-hub .benefits-section h2,
.tools-hub .methodology-section h2,
.tools-hub .tips-section h2,
.tools-hub .keywords-section h2 {
    color: var(--scacchi-ink);
    font-family: "Montserrat", sans-serif;
    letter-spacing: -0.03em;
}

.tools-hub .section-divider {
    background: var(--scacchi-gold);
}

.tools-hub .intro,
.tools-hub .tool-card,
.tools-hub .benefit-card,
.tools-hub .methodology-section,
.tools-hub .tip-card,
.tools-hub .keywords-section,
.tools-hub .faq,
.guide-page .content-section,
.guide-page .toc,
.guide-page .cta-section {
    border-radius: 4px;
    box-shadow: 0 12px 32px rgba(23, 33, 43, 0.07);
}

.tools-hub .tool-card {
    border: 1px solid var(--scacchi-line);
    border-top: 4px solid var(--scacchi-gold);
}

.tools-hub .tool-card.calculator {
    background: var(--scacchi-white);
    border: 1px solid var(--scacchi-line);
    border-top: 4px solid var(--scacchi-gold);
}

.tools-hub .tool-icon,
.tools-hub .feature-icon,
.tools-hub .tool-card.calculator .tool-icon {
    color: var(--scacchi-gold);
    filter: grayscale(1);
}

.tools-hub .tool-link,
.guide-page .cta-button {
    color: var(--scacchi-ink);
    background: var(--scacchi-gold);
    border-radius: 24px;
    font-weight: 700;
}

.tools-hub .tool-link:hover,
.tools-hub .tool-link:focus-visible,
.guide-page .cta-button:hover,
.guide-page .cta-button:focus-visible {
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
}

.tools-hub .benefit-card {
    border-left-color: var(--scacchi-gold);
}

.tools-hub .tip-card {
    background: #fffbea;
    border-color: rgba(231, 201, 0, 0.38);
}

.tools-hub > footer,
.guide-page > footer {
    margin-top: 64px;
    color: rgba(255, 255, 255, 0.8);
    background: var(--scacchi-navy-deep);
    border-top: 4px solid var(--scacchi-gold);
}

.tools-hub > footer h4,
.guide-page > footer h4 {
    color: var(--scacchi-gold);
    font-family: "Montserrat", sans-serif;
}

.tools-hub > footer a:hover,
.guide-page > footer a:hover {
    color: var(--scacchi-gold);
}

/* Interactive training exercises */
body.training-app {
    --primary-color: var(--scacchi-gold);
    --secondary-color: var(--scacchi-navy);
    --success-color: var(--scacchi-success);
    --danger-color: var(--scacchi-danger);
    --warning-color: #c78800;
    --text-primary: var(--scacchi-ink);
    --text-secondary: var(--scacchi-muted);
    --bg-primary: var(--scacchi-paper);
    --bg-secondary: var(--scacchi-white);
    --shadow: 0 14px 38px rgba(23, 33, 43, 0.09);
    background: var(--scacchi-paper);
    font-family: "Poppins", sans-serif;
}

.training-app .screen {
    min-height: calc(100vh - 80px);
    padding-top: 38px;
}

.training-app .screen header h1,
.training-app .results-box h1 {
    color: var(--scacchi-ink);
    font-family: "Montserrat", sans-serif;
    letter-spacing: -0.035em;
}

.training-app .screen header::after {
    display: block;
    width: 64px;
    height: 4px;
    margin: 18px auto 0;
    background: var(--scacchi-gold);
    content: "";
}

.training-app .subtitle a {
    color: var(--scacchi-navy);
    font-weight: 600;
    text-underline-offset: 4px;
}

.training-app .start-form,
.training-app .quiz-header,
.training-app .question-container,
.training-app .results-box,
.training-app .modal-content,
.training-app .collision-question-container,
.training-app .diagonal-question-container,
.training-app .coordinate-display {
    border: 1px solid var(--scacchi-line);
    border-top: 4px solid var(--scacchi-gold);
    border-radius: 4px;
    box-shadow: var(--scacchi-shadow);
}

.training-app .button.primary,
.training-app .progress-fill {
    color: var(--scacchi-ink);
    background: var(--scacchi-gold);
}

.training-app .button.primary {
    border-radius: 24px;
}

.training-app .button.primary:hover,
.training-app .button.primary:focus-visible {
    color: var(--scacchi-white);
    background: var(--scacchi-navy);
}

.training-app .button.secondary {
    background: var(--scacchi-navy);
    border-radius: 24px;
}

.training-app .form-group input:focus {
    border-color: var(--scacchi-gold);
    box-shadow: 0 0 0 3px rgba(231, 201, 0, 0.22);
}

.training-app .instructions {
    background: #f8f7f2;
}

.training-app .tip,
.training-app .coordinates-reminder {
    color: var(--scacchi-ink);
    background: #fffbea;
    border-left-color: var(--scacchi-gold);
}

@media (max-width: 980px) {
    .scacchi-sitebar__inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
        padding: 16px 0 13px;
    }

    .scacchi-sitebar__nav {
        justify-content: flex-start;
        width: 100%;
        padding-bottom: 3px;
        overflow-x: auto;
        scrollbar-width: thin;
    }

    .training-app .screen {
        min-height: calc(100vh - 137px);
    }
}

@media (max-width: 680px) {
    .scacchi-sitebar__inner {
        width: min(100% - 28px, 1160px);
    }

    .scacchi-brand {
        min-width: 0;
    }

    .scacchi-brand__mark {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .scacchi-sitebar__nav {
        justify-content: space-between;
        gap: 0;
        overflow: visible;
    }

    .scacchi-sitebar__nav a {
        min-height: 38px;
        padding: 8px 6px;
        font-size: 10.5px;
    }

    .scacchi-shell-page > .container {
        width: min(100% - 24px, 1040px);
        margin-top: 24px;
        padding: 30px 20px 34px;
    }

    .scacchi-shell-page h1 {
        font-size: 2rem;
    }

    .scacchi-shell-page .calculator-box,
    .scacchi-shell-page .form-container {
        display: block;
    }

    .scacchi-shell-page .calculator-card,
    .scacchi-shell-page .input-section,
    .scacchi-shell-page .result-section {
        min-width: 0;
        margin-bottom: 18px;
    }

    .scacchi-shell-page .highlight-box > div[style] {
        flex-direction: column;
    }

    .elo-page table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    body.tools-hub > header,
    body.guide-page > header {
        padding: 48px 18px 54px;
    }

    .scacchi-site-footer__inner {
        flex-direction: column;
        gap: 24px;
        width: min(100% - 28px, 1080px);
    }

    .scacchi-site-footer__links {
        text-align: left;
    }

    .training-app .screen {
        min-height: calc(100vh - 134px);
        padding: 24px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scacchi-sitebar *,
    .scacchi-shell-page *,
    .tools-hub *,
    .guide-page *,
    .training-app * {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
