/* ==========================================================================
   Forma Mentis — styles.css
   Industrial components & consulting — one-page site
   ========================================================================== */

/* ---------- Fonts ---------- */
@font-face {
    font-family: "ITC Officina Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src:
        url("../fonts/ITCOfficinaSansBook.woff2") format("woff2"),
        url("../fonts/ITCOfficinaSansBook.woff") format("woff"),
        url("../fonts/ITCOfficinaSansBook.ttf") format("truetype");
}
@font-face {
    font-family: "ITC Officina Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src:
        url("../fonts/ITCOfficinaSansBold.woff2") format("woff2"),
        url("../fonts/ITCOfficinaSansBold.woff") format("woff"),
        url("../fonts/ITCOfficinaSansBold.ttf") format("truetype");
}

/* ---------- Design tokens ---------- */
:root {
    /* Brand palette */
    --color-primary: #bd3c00;
    --color-primary-dark: #9a3100;
    --color-on-primary: #ffffff;

    /* Neutrals */
    --color-ink: #1c1612;
    --color-muted: #6b625b;
    --color-bg: #ffffff;
    --color-bg-alt: #f6f1ee;
    --color-surface: #ffffff;
    --color-border: #e7ded8;
    --color-footer: #281107;
    --color-footer-text: #f3e7e0;

    /* Typography */
    --font-base:
        "ITC Officina Sans", "Segoe UI", system-ui, -apple-system, Roboto,
        Helvetica, Arial, sans-serif;

    /* Spacing & shape */
    --container: 1160px;
    --gap: 1.5rem;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(40, 17, 7, 0.08);
    --shadow-lg: 0 18px 45px rgba(40, 17, 7, 0.14);
    --header-h: 72px;

    --transition: 0.25s ease;
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-h);
    -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    font-family: var(--font-base);
    color: var(--color-ink);
    background: var(--color-bg);
    line-height: 1.6;
    font-size: 1.0625rem;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--color-primary-dark);
}

h1,
h2,
h3 {
    line-height: 1.15;
    margin: 0 0 0.5em;
    font-weight: 700;
}

p {
    margin: 0 0 1em;
}

/* ---------- Layout helpers ---------- */
.container {
    width: min(100% - 2.5rem, var(--container));
    margin-inline: auto;
}

.section {
    padding: clamp(3.5rem, 7vw, 6rem) 0;
}
.section--alt {
    background: var(--color-bg-alt);
}

.section__head {
    text-align: center;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section__title {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
    letter-spacing: 0.01em;
}
.section__rule {
    display: block;
    width: 56px;
    height: 4px;
    border-radius: 2px;
    background: var(--color-primary);
    margin: 0.75rem auto 0;
}

/* ---------- Accessibility helpers ---------- */
.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    z-index: 1000;
    background: var(--color-primary);
    color: var(--color-on-primary);
    padding: 0.6rem 1rem;
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
    left: 0;
    color: var(--color-on-primary);
}

:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.6rem;
    transition:
        background var(--transition),
        color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}
.btn--primary {
    background: var(--color-primary);
    color: var(--color-on-primary);
}
.btn--primary:hover {
    background: var(--color-primary-dark);
    color: var(--color-on-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.btn--block {
    width: 100%;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-ink);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition:
        box-shadow var(--transition),
        border-color var(--transition);
}
.site-header.is-scrolled {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: #ffffff;
    font-weight: 700;
}
.brand:hover {
    color: #ffffff;
}
.brand__logo {
    height: 38px;
    width: auto;
}
.brand__name {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

.primary-nav ul {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.primary-nav a {
    display: block;
    padding: 0.5rem 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 700;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
}
.primary-nav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}
.primary-nav a.is-active {
    color: var(--color-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
}
.nav-toggle__bar {
    display: block;
    width: 24px;
    height: 2px;
    margin-inline: auto;
    background: #ffffff;
    transition:
        transform var(--transition),
        opacity var(--transition);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: min(88vh, 760px);
    display: flex;
    align-items: center;
    color: #fff;
    overflow: hidden;
}
.hero__bg {
    position: absolute;
    inset: 0;
    background: url("../img/hero.jpg") center / cover no-repeat;
    z-index: -2;
}
.hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        rgba(28, 11, 4, 0.78) 0%,
        rgba(28, 11, 4, 0.45) 55%,
        rgba(28, 11, 4, 0.25) 100%
    );
    z-index: -1;
}
.hero__content {
    max-width: 720px;
    padding-block: 4rem;
}
.hero__title {
    font-size: clamp(2.2rem, 5.5vw, 3.6rem);
    margin-bottom: 1rem;
}
.hero__subtitle {
    font-size: clamp(1.05rem, 2.2vw, 1.4rem);
    margin-bottom: 1.8rem;
    max-width: 38ch;
    opacity: 0.95;
}

/* ---------- About ---------- */
.about__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}
.about__media img {
    width: 100%;
    height: 100%;
    max-height: 460px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.about__body p {
    color: var(--color-muted);
    font-size: 1.1rem;
}

/* ---------- Card grid (Services / Products) ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(1.25rem, 3vw, 2rem);
    align-items: stretch;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition);
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

/* A wide card spans the full row (used for the spec-table product) */
.card--wide {
    grid-column: 1 / -1;
    flex-direction: row;
}
.card--wide .card__media {
    flex: 0 0 42%;
    aspect-ratio: auto;
}
.card--wide .card__body {
    flex: 1;
}

.card__media {
    aspect-ratio: 16 / 10;
    background: var(--color-bg-alt);
    overflow: hidden;
}
.card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.card:hover .card__media img {
    transform: scale(1.04);
}
.card__media--contain {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.card__media--contain img {
    object-fit: contain;
}

.card__body {
    padding: 1.5rem;
}
.card__title {
    font-size: 1.25rem;
    margin-bottom: 0.6rem;
}
.card__body p {
    color: var(--color-muted);
    margin-bottom: 0;
}

/* ---------- Spec table ---------- */
.spec {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.1rem;
    font-size: 0.85rem;
}
.spec caption {
    text-align: left;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}
.spec th,
.spec td {
    border: 1px solid var(--color-border);
    padding: 0.35rem 0.6rem;
    text-align: left;
    vertical-align: top;
}
.spec thead th {
    background: var(--color-primary);
    color: var(--color-on-primary);
    text-align: center;
    letter-spacing: 0.04em;
}
.spec tbody th {
    background: var(--color-bg-alt);
    font-weight: 700;
    white-space: nowrap;
}
.spec tbody tr:nth-child(even) td {
    background: #fbf8f6;
}

/* ---------- Contact ---------- */
.contact__wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--color-surface);
}
.contact__photo {
    height: clamp(240px, 38vw, 380px);
    background: url("../img/contact-map.jpg") center / cover no-repeat;
}
.contact__card {
    position: relative;
    z-index: 1;
    margin-top: -64px;
    background: var(--color-surface);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: clamp(1.5rem, 4vw, 2.75rem);
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: clamp(1.5rem, 4vw, 3rem);
}

.contact__details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.contact__group h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin-bottom: 0.25rem;
}
.contact__group p {
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}
.contact__hours {
    color: var(--color-muted);
    font-size: 0.95rem !important;
}

/* Form */
.contact__form .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.field {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}
.field label {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--color-ink);
}
.field input,
.field textarea {
    font: inherit;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-ink);
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}
.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(189, 60, 0, 0.15);
}
.field textarea {
    resize: vertical;
    min-height: 110px;
}
.form-status {
    margin: 0.75rem 0 0;
    font-weight: 700;
    min-height: 1.2em;
}
.form-status.is-ok {
    color: #2e7d32;
}
.form-status.is-error {
    color: var(--color-primary);
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--color-footer);
    color: var(--color-footer-text);
    padding: 2.5rem 0;
}
.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.site-footer__name {
    font-weight: 700;
    font-size: 1.1rem;
}
.site-footer__copy {
    margin: 0.25rem 0 0;
    opacity: 0.7;
    font-size: 0.9rem;
}
.site-footer nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-footer nav a {
    color: var(--color-footer-text);
    font-weight: 700;
    opacity: 0.85;
}
.site-footer nav a:hover {
    color: #fff;
    opacity: 1;
}

/* ---------- Back to top ---------- */
.to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 90;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 1.3rem;
    box-shadow: var(--shadow);
    transition:
        opacity var(--transition),
        transform var(--transition),
        background var(--transition);
}
.to-top[hidden] {
    display: none;
}
.to-top:hover {
    background: var(--color-primary-dark);
    color: #fff;
    transform: translateY(-3px);
}

/* ---------- Scroll reveal ---------- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 0.6s ease,
        transform 0.6s ease;
}
.reveal.is-visible {
    opacity: 1;
    transform: none;
}
@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .card--wide {
        flex-direction: column;
    }
    .card--wide .card__media {
        flex-basis: auto;
        aspect-ratio: 16 / 10;
    }
}

@media (max-width: 768px) {
    /* Mobile nav */
    .nav-toggle {
        display: flex;
    }
    .primary-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        background: #fff;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow);
        transform: translateY(-150%);
        transition: transform 0.3s ease;
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
    }
    .primary-nav.is-open {
        transform: translateY(0);
    }
    .primary-nav ul {
        flex-direction: column;
        gap: 0;
        padding: 0.5rem;
    }
    .primary-nav a {
        padding: 0.9rem 1rem;
    }

    .about__grid {
        grid-template-columns: 1fr;
    }
    .about__media {
        order: -1;
    }

    .contact__card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .contact__form .field-row {
        grid-template-columns: 1fr;
    }
    .brand__name {
        display: none;
    }
    /* spec table scrolls horizontally on tiny screens */
    .card--wide .card__body {
        overflow-x: auto;
    }
}
