/*
 * Web pública de Lauko, versión B «Industrial oscuro» (fase 4). Ver specs/fase-4/README.md
 * Lo memorable: el nombre de cada servicio en condensada gigante sobre su foto. Todo lo demás, sobrio.
 */

@font-face {
    font-family: 'Barlow';
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/barlow-400.81419bf5abb5.woff2") format('woff2');
}
@font-face {
    font-family: 'Barlow';
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/barlow-600.a1e2a2d7d4c0.woff2") format('woff2');
}
@font-face {
    font-family: 'Barlow Condensed';
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/barlow-condensed-600.ba4513495282.woff2") format('woff2');
}
@font-face {
    font-family: 'Barlow Condensed';
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/barlow-condensed-700.e1180918b873.woff2") format('woff2');
}

:root {
    /* Grafito con el matiz azul del marino del logo */
    --graphite: #161a21;
    --graphite-raised: #202631;
    --line: #343c4a;
    --text: #e8ebef; /* 14,6:1 sobre grafito */
    --text-muted: #a3acb8; /* 7,6:1 */
    --red: #d0112b; /* solo filetes, botones y estados: como texto no llega a 4,5:1 sobre grafito */
    --red-dark: #a80d22;
    --paper: #f2f3f5;
    --ink: #1c222b;

    --font-text: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;

    --wrap: 80rem;
    --gutter: clamp(1.25rem, 5vw, 3rem);
    --space: clamp(4rem, 10vw, 8rem);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--graphite);
    color: var(--text);
    font-family: var(--font-text);
    font-size: 1.0625rem;
    line-height: 1.65;
}

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

h1,
h2,
h3 {
    margin: 0 0 0.5em;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 0.95;
}

h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
}

p {
    margin: 0 0 1em;
}

a {
    color: var(--text);
    text-decoration-color: var(--red);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.25em;
}

a:hover {
    color: #fff;
}

:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    top: -100%;
    left: var(--gutter);
    z-index: 100;
    padding: 0.75rem 1rem;
    background: var(--red);
    color: #fff;
    font-weight: 600;
}

.skip-link:focus {
    top: 0.5rem;
}

.button {
    display: inline-block;
    padding: 0.85rem 1.75rem;
    border: 0;
    background: var(--red);
    color: #fff;
    font: 600 1.125rem/1 var(--font-display);
    letter-spacing: 0.04em;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--red-dark);
    color: #fff;
}

/* Cabecera: sólida por defecto; transparente sobre la foto de cabecera hasta que se baja */
.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--graphite);
    border-bottom: 1px solid var(--line);
    transition: background-color 0.2s, border-color 0.2s;
}

.has-hero .masthead {
    position: fixed;
    inset: 0 0 auto;
    background: linear-gradient(to bottom, rgb(22 26 33 / 0.85), transparent);
    border-bottom-color: transparent;
}

.has-hero .masthead.is-solid {
    background: var(--graphite);
    border-bottom-color: var(--line);
}

.masthead__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 2rem;
    min-height: 4.5rem;
}

.brand {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    align-items: center;
    color: #fff;
    text-decoration: none;
}

.brand img {
    grid-row: span 2;
    width: 2.5rem;
    height: 2.5rem;
}

.brand__name {
    font: 700 1.75rem/0.9 var(--font-display);
    letter-spacing: 0.02em;
}

.brand__tag {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.2;
}

.menu-toggle {
    display: none;
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid var(--line);
    background: transparent;
    color: #fff;
    font: 600 1.125rem var(--font-display);
    cursor: pointer;
}

.site-menu {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.site-menu__links {
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-menu__links a {
    display: block;
    padding-block: 0.5rem;
    border-bottom: 2px solid transparent;
    color: #fff;
    font: 600 1.25rem var(--font-display);
    text-decoration: none;
}

.site-menu__links a:hover,
.site-menu__links a[aria-current='page'] {
    border-bottom-color: var(--red);
}

/* Desplegable de servicios (fase 10): botón con aria-expanded y lista de enlaces que flota bajo él */
.submenu {
    position: relative;
}

.submenu__toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #fff;
    font: 600 1.25rem var(--font-display);
    cursor: pointer;
}

.submenu__toggle:hover,
.submenu__toggle.is-current {
    border-bottom-color: var(--red);
}

.submenu__icon {
    transition: transform 0.2s;
}

.submenu__toggle[aria-expanded='true'] .submenu__icon {
    transform: rotate(180deg);
}

.submenu__list {
    position: absolute;
    top: 100%;
    left: -1rem;
    min-width: 15rem;
    margin: 0;
    padding: 0.5rem 0;
    border: 1px solid var(--line);
    background: var(--graphite-raised);
    list-style: none;
}

/* Cerrado: con JS, hasta que se abre; sin JS, se abre al pasar el ratón o con el foco */
.js .submenu:not(.is-open) .submenu__list,
html:not(.js) .submenu:not(:hover, :focus-within) .submenu__list {
    display: none;
}

.site-menu__links .submenu__list a {
    padding: 0.6rem 1rem;
    border-bottom: 0;
    border-left: 3px solid transparent;
    font-size: 1.125rem;
}

.site-menu__links .submenu__list a:hover,
.site-menu__links .submenu__list a[aria-current='page'] {
    border-left-color: var(--red);
    background: var(--graphite);
}

.languages {
    display: flex;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.languages a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    color: var(--text-muted);
    font: 600 1rem var(--font-display);
    text-decoration: none;
    text-transform: lowercase;
}

.languages a:hover {
    color: #fff;
}

.languages a[aria-current='true'] {
    box-shadow: inset 0 -2px var(--red);
    color: #fff;
}

@media (max-width: 52rem) {
    .js .menu-toggle {
        display: block;
    }

    .site-menu {
        flex-basis: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding-bottom: 1.5rem;
    }

    .js .site-menu:not(.is-open) {
        display: none;
    }

    .site-menu__links {
        flex-direction: column;
        gap: 0;
    }

    .site-menu__links a,
    .submenu__toggle {
        font-size: 1.75rem;
    }

    /* En el móvil, los servicios se abren debajo, dentro del menú */
    .submenu__list {
        position: static;
        min-width: 0;
        padding: 0 0 0.5rem;
        border: 0;
        background: transparent;
    }

    .site-menu__links .submenu__list a {
        font-size: 1.375rem;
    }

    .has-hero .masthead:has(.is-open) {
        background: var(--graphite);
    }
}

/* Cabecera de página con foto a pantalla completa, casi sin velo */
.hero {
    position: relative;
    display: grid;
    align-items: end;
    min-height: min(70vh, 38rem);
    padding-block: 8rem clamp(2.5rem, 6vw, 4.5rem);
    background: var(--graphite) var(--photo) center / cover no-repeat;
}

.hero::before {
    /* Solo oscurece la parte baja, donde va el texto */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgb(22 26 33 / 0.95), rgb(22 26 33 / 0.1) 60%);
}

.hero--home {
    min-height: min(100svh, 54rem);
}

.hero__inner {
    position: relative;
}

/*
 * Cabecera con texto largo encima (Empresa): velo de al menos el 85 % en toda la foto. Así, aunque la foto tenga
 * zonas blancas, el texto mantiene un contraste mínimo de 9,2:1 (AAA)
 */
.hero--text {
    align-items: center;
    min-height: min(100svh, 52rem);
}

.hero--text::before {
    background: linear-gradient(to right, rgb(22 26 33 / 0.94) 40%, rgb(22 26 33 / 0.85));
}

.hero__body {
    padding-left: 1.25rem;
    border-left: 4px solid var(--red);
}

.hero__body p:last-child {
    margin-bottom: 0;
}

.hero__title {
    font-size: clamp(3.5rem, 13vw, 11rem);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

/* Portada: «Lauko» enorme y «Máquinas Herramienta» debajo, más pequeño; el h1 dice el nombre completo (fase 7) */
.hero__title-tag {
    display: block;
    font-size: clamp(1.5rem, 4.5vw, 3.25rem);
    letter-spacing: 0.02em;
}

.hero__lead {
    max-width: 40rem;
    padding-left: 1.25rem;
    border-left: 4px solid var(--red);
    font-size: clamp(1.125rem, 2vw, 1.375rem);
}

/* Servicios de la portada: un bloque por servicio, con su foto de fondo y el nombre enorme */
.band {
    position: relative;
    display: grid;
    align-items: end;
    min-height: min(85vh, 42rem);
    padding-block: var(--space) clamp(2.5rem, 6vw, 4.5rem);
    background: var(--graphite) var(--photo) center / cover no-repeat;
    border-top: 1px solid var(--line);
}

.band::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgb(22 26 33 / 0.96) 15%, rgb(22 26 33 / 0.2) 75%);
}

.band__inner {
    position: relative;
    display: grid;
    gap: 1.5rem 3rem;
    align-items: end;
}

.band__title {
    margin: 0;
    font-size: clamp(3rem, 10vw, 9rem);
    line-height: 0.85;
    text-transform: uppercase;
}

.band__text {
    max-width: 30rem;
    padding-left: 1.25rem;
    border-left: 4px solid var(--red);
}

.band__text p {
    font-size: 1.125rem;
}

@media (min-width: 64rem) {
    /* El nombre ocupa toda la fila; el texto, a la derecha debajo */
    .band__text {
        justify-self: end;
    }
}

/* Cabecera de página sin foto */
.page-head {
    padding-block: clamp(4rem, 10vw, 7rem) clamp(2rem, 5vw, 3.5rem);
    border-bottom: 1px solid var(--line);
}

.page-head__title {
    font-size: clamp(3rem, 9vw, 7rem);
    text-transform: uppercase;
}

.page-head__lead {
    max-width: 44rem;
    color: var(--text-muted);
    font-size: clamp(1.125rem, 2vw, 1.375rem);
}

.page-head--full {
    display: grid;
    align-items: center;
    min-height: min(70vh, 36rem);
}

.page-head--full .button {
    margin-top: 1rem;
}

/* Secciones */
.section {
    padding-block: var(--space);
}

.section--raised {
    background: var(--graphite-raised);
}

/* Texto largo de CKEditor: sobre papel claro, porque puede traer colores en línea pensados para fondo blanco */
.section--paper {
    background: var(--paper);
    color: var(--ink);
}

.section--paper a {
    color: var(--ink);
}

.section--paper :focus-visible {
    outline-color: var(--ink);
}

.prose > * {
    max-width: 44rem;
}

.prose--large {
    font-size: clamp(1.125rem, 2vw, 1.375rem);
}

.rich-text h1,
.rich-text h2,
.rich-text h3,
.rich-text h4 {
    margin-top: 1.75em;
    font-size: 1.75rem;
    line-height: 1.1;
}

.rich-text > div > :first-child {
    margin-top: 0;
}

.rich-text table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.rich-text th,
.rich-text td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #c8ccd3;
    text-align: left;
    vertical-align: top;
}

/* Proyectos de un servicio: foto grande y texto, alternando */
.projects {
    display: grid;
    gap: clamp(3rem, 8vw, 6rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.project {
    display: grid;
    gap: 1.5rem 3rem;
    align-items: center;
}

.project img {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.project h2 {
    text-transform: uppercase;
}

.project__text {
    padding-left: 1.25rem;
    border-left: 4px solid var(--red);
    color: var(--text-muted);
}

.project__text h2 {
    color: var(--text);
}

@media (min-width: 52rem) {
    .project {
        grid-template-columns: 3fr 2fr;
    }

    .project:nth-child(even) img {
        order: 2;
    }

    .project:nth-child(even) {
        grid-template-columns: 2fr 3fr;
    }
}

/* Máquinas: fotos grandes, nombre debajo */
.machines {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: 2.5rem 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.machine a {
    display: block;
    text-decoration: none;
}

.machine img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: filter 0.2s;
}

.machine__name {
    margin: 0;
    padding-top: 1rem;
    border-top: 4px solid transparent;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    text-transform: uppercase;
}

.machine a:hover .machine__name {
    border-top-color: var(--red);
}

.machine a:hover img {
    filter: brightness(1.1);
}

/* Pie */
.site-footer {
    padding-block: var(--space) 2rem;
    border-top: 1px solid var(--line);
}

.site-footer__grid {
    display: grid;
    gap: 1.5rem 3rem;
}

.site-footer__title {
    margin: 0;
    font-size: clamp(3rem, 8vw, 6rem);
    text-transform: uppercase;
}

.site-footer__address {
    color: var(--text-muted);
    font-size: 1.125rem;
    font-style: normal;
}

.site-footer__direct {
    display: grid;
    gap: 0.25rem;
    margin: 0;
    font: 600 clamp(1.5rem, 3vw, 2rem) / 1.2 var(--font-display);
}

.site-footer__direct a {
    width: fit-content;
    text-decoration: none;
}

.site-footer__direct a:hover {
    text-decoration: underline;
    text-decoration-color: var(--red);
}

.site-footer__legal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    margin: 2rem 0 0;
    padding: 1.5rem 0 0;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.95rem;
    list-style: none;
}

.site-footer__legal a {
    color: var(--text-muted);
}

@media (min-width: 52rem) {
    .site-footer__grid {
        grid-template-columns: 1fr 1fr;
        align-items: end;
    }

    .site-footer__title {
        grid-column: 1 / -1;
    }

    .site-footer__legal {
        grid-column: 1 / -1;
    }
}

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