/* ==========================================================================
   ISH Hutter GmbH – static site
   Layout follows the former TYPO3 template (960 px grid); responsive below.
   Font sizes: exactly four steps (--fs-s / -m / -l / -xl), see :root.
   ========================================================================== */

:root {
    --teal: #009ab2;
    --text: #414141;
    --muted: #777;
    --line: #ccc;
    --page-bg: #eee;
    --subnav-bg: #d9d9d9;
    --subnav-text: #585857;

    --font: Helvetica, Arial, sans-serif;   /* = the browser default "sans-serif" the original used */
    --fs-s: 13px;
    --fs-m: 16px;
    --fs-l: 20px;
    --fs-xl: 24px;

    --container: 960px;
    --gutter: 20px;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

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

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--fs-m);
    line-height: 1.4;
    color: var(--text);
    background-color: var(--page-bg);
}

img { max-width: 100%; height: auto; vertical-align: middle; border: 0; }

a { color: var(--teal); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

hr { height: 1px; margin: 1em 0; padding: 0; border: 0; border-top: 1px solid var(--line); }

figure { margin: 0; }

sup { font-size: var(--fs-s); line-height: 0; position: relative; vertical-align: baseline; top: -0.5em; }

::selection { background: #b3d4fc; }

.skip-link {
    position: absolute; left: 8px; top: -100px; z-index: 1000;
    padding: 8px 12px; background: #fff; color: var(--text); font-weight: bold;
}
.skip-link:focus { top: 8px; }

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

/* --------------------------------------------------------------------------
   Header image(s) – 2000 × 620 artwork, centred like the original
   -------------------------------------------------------------------------- */

.hero {
    position: relative;
    height: 602px;
    overflow: hidden;
    background-color: #fff;
}

.hero__slide {
    position: absolute;
    inset: 0;
    background-repeat: no-repeat;
    background-position: center top;
    background-size: auto;            /* natural size, like the original */
    opacity: 0;
    transition: opacity 1.5s ease;
}
.hero__slide.is-active { opacity: 1; }

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */

.wrapper {
    overflow: hidden;
    background: url("../img/layout/bodybg.jpg") no-repeat center top;
}

.mainnav,
.main,
.footer {
    width: 100%;
    max-width: var(--container);
    margin-left: auto;
    margin-right: auto;
}

/* Main navigation */
.mainnav {
    margin-bottom: 20px;
    background-color: #fff;
}

.mainnav__list {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mainnav__list li { margin-right: 10px; padding: 5px 10px; }

.mainnav__list a {
    font-weight: bold;
    color: var(--text);
    text-decoration: none;
}
.mainnav__list a:hover,
.mainnav__list .is-active > a { color: var(--teal); }

.mainnav__toggle { display: none; }

/* Two-column content area: 220 px sidebar + 700 px content (former grid_3 / grid_9) */
.main {
    display: grid;
    grid-template-columns: 220px 700px;
    column-gap: var(--gutter);
    align-items: start;
    margin-bottom: 20px;
}

.main--home { display: flow-root; }
.main--home .content { max-width: 940px; }

.content { min-width: 0; overflow-wrap: break-word; }

/* Sidebar */
.subnav {
    margin-bottom: 10px;
    padding: 10px;
    background-color: var(--subnav-bg);
}
.subnav ul { margin: 0; padding: 0; list-style: none; }
.subnav a { font-size: var(--fs-s); color: var(--subnav-text); }
.subnav .is-active > a { font-weight: bold; }

.contact { background-color: #fff; }

.vcard { padding: 15px 10px; }
.vcard .org { font-size: var(--fs-l); font-weight: bold; }
.vcard .adr,
.vcard .numbers { margin-bottom: 10px; }

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px 20px;
    margin-bottom: 80px;
    border-top: 1px solid var(--line);
}

.langmenu { display: flex; gap: 4px; padding-top: 4px; }
.langmenu a { display: block; line-height: 0; }
.langmenu img { display: block; }

.footnav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
    list-style: none;
}
.footnav li { margin-left: 15px; }
.footnav a { font-size: var(--fs-s); color: var(--text); }

/* --------------------------------------------------------------------------
   Content typography
   -------------------------------------------------------------------------- */

.content p { margin: 0 0 1.3em; }

.content h1,
.content h2 { font-size: var(--fs-xl); margin: 0.83em 0; }
.content h3 { font-size: var(--fs-l); margin: 1em 0; }
.content h4 { font-size: var(--fs-m); margin: 1.33em 0; }
.content h5 { font-size: var(--fs-s); margin: 1.67em 0; }

.content ul,
.content ol { margin: 1em 0; padding-left: 40px; }

/* content element spacing (from the old TYPO3 "space before/after" settings) */
.ce--mt10 { margin-top: 10px; }
.ce--mb10 { margin-bottom: 10px; }
.ce--mb30 { margin-bottom: 30px; }
.ce--mb50 { margin-bottom: 50px; }

/* --------------------------------------------------------------------------
   Text with images (former csc-textpic)
   -------------------------------------------------------------------------- */

.textpic { display: flow-root; }

.textpic__media {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}
.textpic__row { display: flex; flex-wrap: wrap; gap: 10px; flex-basis: 100%; }
.textpic__media img { display: block; }
/* several images: the last row has no bottom margin (as in TYPO3 css_styled_content) */
.textpic > .textpic__media:last-child:has(> figure + figure, > .textpic__row) { margin-bottom: 0; }
.page-galerie-montage .textpic > .textpic__media:last-child { margin-bottom: 10px; }   /* "column" mode kept it */
.textpic__media figcaption { text-align: center; }

/* image floated in the text */
.textpic--right > .textpic__media { float: right; margin-left: 10px; }
.textpic--left > .textpic__media { float: left; margin-right: 10px; }

/* image beside the text, no wrapping */
.textpic--right-nowrap,
.textpic--left-nowrap { display: flex; gap: 10px; align-items: flex-start; }
.textpic--right-nowrap { flex-direction: row-reverse; }
.textpic--right-nowrap > .textpic__media,
.textpic--left-nowrap > .textpic__media { flex: none; }
.textpic--right-nowrap > .textpic__text,
.textpic--left-nowrap > .textpic__text { flex: 1; min-width: 0; }

/* images above the text */
.textpic--above-center > .textpic__media,
.textpic--above-center .textpic__row { justify-content: center; }
.textpic--above-right > .textpic__media,
.textpic--above-right .textpic__row { justify-content: flex-end; }

/* --------------------------------------------------------------------------
   Columns (former 960 grid: 60 px columns, 20 px gutter)
   -------------------------------------------------------------------------- */

.cols {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gutter);
    margin: 0 0 20px;
    padding-top: 5px;   /* not a margin: the old floated columns did not collapse with the heading above */
}
.cols--9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }

.col--2 { grid-column: span 2; }
.col--3 { grid-column: span 3; }
.col--4 { grid-column: span 4; }
.col--5 { grid-column: span 5; }
.col--6 { grid-column: span 6; }
.col--pre1 { padding-left: 80px; }
.col:empty { display: none; }   /* the old template's empty spacer column took no room either */

/* --------------------------------------------------------------------------
   Components
   -------------------------------------------------------------------------- */

/* list with teal squares (home page) */
.iconlist ul { margin: 0; padding-left: 40px; list-style: none; }
.iconlist li {
    margin: 7px 0;
    padding: 10px 0 10px 50px;
    font-size: var(--fs-l);
    line-height: 1.35;   /* 47 px per item, as in the original (19.2 px × 1.4) */
    background: url("../img/layout/list-icon.png") no-repeat left center;
}
.iconlist a { color: var(--text); }

/* file downloads */
.content .uploads { padding: 0; list-style: none; }
.uploads li { margin: 1em 0; }
.uploads a { text-decoration: underline; }

/* sitemap */
.content .sitemap,
.content .sitemap ul { list-style-type: circle; }

/* reference album teaser + gallery (CNC pages) */
.content .album__crumb {
    margin: 0;
    padding: 5px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.album__item { display: flex; gap: 10px; align-items: flex-start; margin-top: 7px; }
.album__item .album__count { margin: 0; }
.album__thumb img { display: block; }
.content .album__pager { margin-top: 47px; color: var(--muted); }

.gallery {
    display: grid;
    grid-template-columns: repeat(3, 200px);
    gap: 15px;
    margin: 23px 0 0;
    padding-left: 40px;
}
.gallery a { display: block; }
.gallery img { display: block; }
.content .gallery + .album__pager { margin-top: 15px; margin-bottom: 39px; padding-left: 40px; }

/* directions map */
.map img { display: block; }
.map figcaption { margin-top: 4px; font-size: var(--fs-s); color: var(--muted); text-align: right; }
.map__links { margin-top: 10px; }

/* --------------------------------------------------------------------------
   Lightbox (js/main.js)
   -------------------------------------------------------------------------- */

.lightbox-open { overflow: hidden; }

.lb {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 50px 60px;
    background: rgba(11, 11, 11, 0.85);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.lb[hidden] { display: none; }
.lb.is-visible { opacity: 1; }

.lb__figure { margin: 0; text-align: center; }
.lb__img {
    display: block;
    max-width: calc(100vw - 120px);
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    margin: 0 auto;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
    background: #fff;
}
.lb__caption { margin-top: 8px; font-size: var(--fs-s); color: #f3f3f3; }

.lb__btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    opacity: 0.75;
}
.lb__btn:hover, .lb__btn:focus-visible { opacity: 1; }
.lb__btn svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; }
.lb__close { top: 6px; right: 6px; }
.lb__prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lb__next { right: 6px; top: 50%; transform: translateY(-50%); }
.lb__btn[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Tablet & small desktop: fluid frame */
@media (max-width: 999px) {
    .mainnav, .main, .footer { max-width: none; width: auto; margin-left: 16px; margin-right: 16px; }

    .hero { height: 62.7vw; }
    .hero__slide { background-size: auto 103%; background-position: var(--focus-x, 50%) top; }

    .main { grid-template-columns: 220px minmax(0, 1fr); }
    .main--home .content { max-width: none; }

    .gallery { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); padding-left: 0; }
    .gallery img { width: 100%; }
    .content .gallery + .album__pager { padding-left: 0; }

    .col--pre1 { padding-left: 0; }
}

@media (min-width: 768px) and (max-width: 999px) {
    .mainnav__list { justify-content: space-between; }
    .mainnav__list li { margin-right: 0; padding: 5px 6px; }
    .page-home .cols > .col--3:first-child { grid-column: span 5; }
}

/* Large phones / tablets: floated images must leave room for the text */
@media (min-width: 480px) and (max-width: 999px) {
    .textpic--right > .textpic__media,
    .textpic--left > .textpic__media { max-width: 45%; }
    .textpic--right > .textpic__media > figure,
    .textpic--left > .textpic__media > figure { min-width: 0; }
}

/* Phone */
@media (max-width: 767px) {
    .mainnav { position: relative; }
    .js .mainnav__toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 10px;
        border: 0;
        background: #fff;
        color: var(--text);
        font: bold var(--fs-m)/1.4 var(--font);
        text-align: left;
        cursor: pointer;
    }
    .mainnav__burger,
    .mainnav__burger::before,
    .mainnav__burger::after {
        display: block;
        width: 20px;
        height: 2px;
        background: currentColor;
        transition: transform 0.2s ease;
    }
    .mainnav__burger { position: relative; }
    .mainnav__burger::before,
    .mainnav__burger::after { content: ""; position: absolute; left: 0; }
    .mainnav__burger::before { top: -6px; }
    .mainnav__burger::after { top: 6px; }
    .mainnav__toggle[aria-expanded="true"] .mainnav__burger { background: transparent; }
    .mainnav__toggle[aria-expanded="true"] .mainnav__burger::before { transform: translateY(6px) rotate(45deg); }
    .mainnav__toggle[aria-expanded="true"] .mainnav__burger::after { transform: translateY(-6px) rotate(-45deg); }

    .mainnav__list { flex-direction: column; }
    .js .mainnav__list { display: none; border-top: 1px solid var(--line); }
    .js .mainnav.is-open .mainnav__list { display: flex; }
    .mainnav__list li { margin: 0; padding: 0; border-bottom: 1px solid var(--page-bg); }
    .mainnav__list li:last-child { border-bottom: 0; }
    .mainnav__list a { display: block; padding: 10px; }

    /* sidebar: submenu above the content, contact box below it */
    .main { display: flex; flex-direction: column; }
    .sidebar { display: contents; }
    .subnav { order: 1; width: 100%; margin-bottom: 0; }
    .content { order: 2; width: 100%; }
    .contact { order: 3; width: 100%; margin-top: 20px; }
    .subnav ul { display: flex; flex-wrap: wrap; gap: 4px 16px; }
    .subnav a { display: inline-block; padding: 4px 0; }

    .cols, .cols--9 { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
    .cols > .col { grid-column: auto; }

    .footer { flex-direction: column; align-items: center; padding-top: 6px; margin-bottom: 40px; }
    .langmenu { gap: 0; }
    .langmenu a { padding: 6px; }   /* 33 × 25 px tap targets */
    .footnav ul { justify-content: center; gap: 4px 15px; }
    .footnav li { margin-left: 0; }
    .footnav a { display: inline-block; padding: 4px 0; }

    .iconlist ul { padding-left: 0; }

    .lb { padding: 50px 8px; }
    .lb__img { max-width: calc(100vw - 16px); }
    .lb__prev, .lb__next { top: auto; bottom: 4px; transform: none; }
}

/* Small phones: images in text go above the text */
@media (max-width: 479px) {
    .textpic--right > .textpic__media,
    .textpic--left > .textpic__media { float: none; margin: 0 0 10px; justify-content: center; }
    .textpic--right-nowrap,
    .textpic--left-nowrap { flex-direction: column; }
    .textpic--right-nowrap > .textpic__media,
    .textpic--left-nowrap > .textpic__media { margin-bottom: 10px; align-self: center; }
    .page-kompetenzen .textpic--above-center > .textpic__media { flex-wrap: nowrap; }
    .page-kompetenzen .textpic--above-center > .textpic__media > figure { flex: 0 1 auto; min-width: 0; }
}

/* --------------------------------------------------------------------------
   Page specifics
   -------------------------------------------------------------------------- */

/* home: address + certificates row, three teaser buttons */
@media (max-width: 767px) {
    .page-home .cols { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 10px; }
    .page-home .cols > .col:first-child { grid-column: 1 / -1; }
    .page-home .cols > .col--4 { grid-column: 1 / -1; }
    .page-home .cols > .col--4 .textpic__media { justify-content: center; }
    .page-home .cols > .col--6 { grid-column: 1 / -1; }
}

/* reference gallery overview: two columns of tiles; the label moves below the
   thumbnail as soon as its longest word would not fit beside it */
@media (max-width: 999px) {
    .page-galerie .cols--9 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gutter); }
    .page-galerie .cols--9 > .col { grid-column: auto; }
    .page-galerie .textpic--left-nowrap { flex-direction: row; flex-wrap: wrap; row-gap: 0; }
    .page-galerie .textpic--left-nowrap > .textpic__media { flex: 0 1 auto; align-self: flex-start; margin-bottom: 10px; min-width: 0; }
    .page-galerie .textpic--left-nowrap > .textpic__text { flex: 1 0 130px; }
}

/* small phones: keep two thumbnails per row in the galleries */
@media (max-width: 479px) {
    [class*="page-galerie-"] .textpic__media > figure { max-width: calc(50% - 5px); }
    .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* home: certificate caption on one line */
.page-home figcaption { white-space: nowrap; }

@media print {
    .hero, .mainnav, .subnav, .footer, .skip-link { display: none; }
    .wrapper { background: none; }
    .main { display: block; }
}
