/* igorrighini.ch - TYPO3 13 sitepackage - v2 (responsive) */
:root {
    --ink: #1a1a1a;
    --muted: #595959;
    --soft: #8a8a8a;
    --line: #e6e6e6;
    --bg: #fff;
    --font: 'Lato', 'Helvetica Neue', Arial, sans-serif;
    --sidebar-w: clamp(13rem, 15vw, 18rem);
    --gutter: clamp(1.1rem, 3vw, 3.5rem);
    --text-w: 68ch;
    --wide-w: 1760px;
}

*, *::before, *::after { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    /* fluid type: 15px on phones -> 19px on large monitors */
    font-size: clamp(15px, 0.55vw + 10.5px, 19px);
}
body {
    margin: 0;
    font-family: var(--font);
    font-weight: 300;
    line-height: 1.65;
    color: var(--ink);
    background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--muted); }
strong, b { font-weight: 400; }
h1, h2, h3, h4 { font-weight: 300; line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1vw, 2.1rem); letter-spacing: .01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; font-weight: 400; margin-top: 1.5em; }
p { margin: 0 0 1em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    padding: 2rem var(--gutter) 2rem clamp(1.1rem, 2vw, 2.5rem);
    background: var(--bg);
    z-index: 20;
}
.brand { display: block; font-size: 1.3rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); line-height: 1.2; }
.tagline { margin: .2rem 0 2.4rem; color: var(--muted); font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; }
.mainnav ul { list-style: none; margin: 0; padding: 0; }
.mainnav li { margin: 0 0 .35rem; }
.mainnav a { display: inline-block; padding: .1rem 0; color: var(--muted); transition: color .2s; }
.mainnav a:hover, .mainnav .is-active > a { color: var(--ink); }
.mainnav .is-active > a { box-shadow: inset 0 -1px 0 currentColor; }
.social { display: inline-block; margin-top: 1.8rem; color: var(--muted); }
.social:hover { color: #1877f2; }
.nav-toggle { display: none; }

/* ---------- Main ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.content { width: 100%; padding: 2.2rem var(--gutter) 3rem; flex: 1; }
.content--wide { max-width: var(--wide-w); }
.content .frame { margin-bottom: 2.4rem; }
.content .frame > * { max-width: var(--text-w); }
.content ul { padding-left: 1.1em; }
.content li { margin-bottom: .2em; }
.content table { border-collapse: collapse; }
.content td { padding: .2rem 1.4rem .2rem 0; vertical-align: top; }
.content td:first-child { color: var(--muted); }

/* Text pages: two columns on wide screens */
.content--text { max-width: calc(var(--text-w) * 2 + 8rem); }
@media (min-width: 1300px) {
    .content--text {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: clamp(3rem, 5vw, 7rem);
        align-items: start;
    }
}

.footer {
    display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; flex-wrap: wrap;
    margin: 0 var(--gutter); padding: 1.3rem 0 1.8rem;
    max-width: calc(var(--wide-w) - 2 * var(--gutter));
    border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem;
}
.footer p { margin: 0; }
.footer__logo { height: 2.8rem; width: auto; }
.footer__link { text-decoration: underline; text-underline-offset: .2em; }

/* ---------- Informativa cookie ---------- */
.cookie-notice {
    position: fixed; z-index: 90; left: 1rem; right: 1rem; bottom: 1rem;
    max-width: 34rem; margin-left: auto;
    display: flex; align-items: center; gap: 1rem 1.4rem; flex-wrap: wrap;
    padding: 1rem 1.2rem; background: #fff; color: var(--ink);
    border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.12);
    font-size: .88rem; line-height: 1.5;
}
.cookie-notice[hidden] { display: none; }
.cookie-notice p { margin: 0; flex: 1 1 16rem; }
.cookie-notice a { text-decoration: underline; text-underline-offset: .2em; }
.cookie-notice__ok {
    font: inherit; letter-spacing: .06em; text-transform: uppercase;
    padding: .55rem 1.1rem; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer;
}
.cookie-notice__ok:hover, .cookie-notice__ok:focus-visible { background: #fff; color: var(--ink); }

/* ---------- Content elements (fluid_styled_content) ---------- */
.ce-textpic { display: flex; flex-direction: column; gap: 1.4rem; }
.ce-textpic.ce-left.ce-intext, .ce-textpic.ce-left.ce-nowrap { flex-direction: row; align-items: flex-start; }
.ce-textpic.ce-right.ce-intext, .ce-textpic.ce-right.ce-nowrap { flex-direction: row-reverse; align-items: flex-start; }
.ce-textpic .ce-bodytext { flex: 1; min-width: 0; }
.ce-textpic .ce-gallery img { width: clamp(110px, 9vw, 160px); }
.ce-gallery { margin: 0; }
.ce-gallery .ce-row { display: flex; gap: 12px; margin-bottom: 12px; }
.ce-gallery .ce-column { flex: 1; }
.ce-gallery figure { margin: 0; }
.ce-gallery figcaption { color: var(--muted); font-size: .85rem; padding-top: .3rem; }
.ce-gallery a.lightbox { display: block; cursor: zoom-in; overflow: hidden; }
.ce-gallery a.lightbox img { transition: transform .5s ease, opacity .3s; }
.ce-gallery a.lightbox:hover img { transform: scale(1.02); }

.ce-uploads { list-style: none; padding: 0 !important; margin: 0; }
.ce-uploads li { margin: 0 0 .55rem; }
.ce-uploads a { display: inline-flex; align-items: center; gap: .55rem; box-shadow: inset 0 -1px 0 var(--line); }
.ce-uploads a::before { content: 'PDF'; font-size: .62rem; font-weight: 400; letter-spacing: .05em; padding: 2px 5px; border: 1px solid currentColor; }
.ce-uploads img { display: none; }
.ce-uploads span { display: inline; }
.ce-uploads-filesize { color: var(--soft); font-size: .8rem; margin-left: .4rem; }

/* ---------- Opere: card grid ---------- */
.intro { margin-bottom: 2rem; }
.works {
    list-style: none; padding: 0 !important; margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(2rem, 3vw, 3rem) clamp(1.1rem, 2vw, 2rem);
}
.work__link { display: block; }
.work__media { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #f2f2f2; margin-bottom: .8rem; }
.work__img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.work__link:hover .work__img { transform: scale(1.04); }
.work__title { display: block; font-size: 1.05rem; color: var(--ink); line-height: 1.3; }
.work__years { display: block; color: var(--muted); font-size: .85rem; margin-top: .15rem; letter-spacing: .04em; }
.work__link:hover .work__title { color: var(--muted); }

/* ---------- Opera (dettaglio) ---------- */
.opera__header h1 { margin-bottom: .2rem; }
.opera__years { color: var(--muted); font-size: 1.1rem; margin-bottom: 1.6rem; letter-spacing: .04em; }
.opera__aside .ce-bodytext p { text-transform: uppercase; letter-spacing: .05em; font-size: .82rem; line-height: 1.8; }
.opera__aside .frame-type-uploads header h3 { margin-top: 0; }
.backlink { margin-top: 2rem; font-size: .9rem; }
.backlink a { color: var(--muted); }
.backlink a:hover { color: var(--ink); }

.opera__gallery .ce-gallery { columns: 1; column-gap: 14px; }
.opera__gallery .ce-row { display: contents; }
.opera__gallery .ce-column { break-inside: avoid; margin-bottom: 14px; }
.opera__gallery .frame { margin-bottom: 0; }
.opera__gallery .frame > * { max-width: none; }

@media (min-width: 1000px) {
    .opera {
        display: grid;
        grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
        gap: clamp(2rem, 4vw, 4.5rem);
        align-items: start;
    }
    .opera__aside { position: sticky; top: 2.2rem; }
}
@media (min-width: 1500px) {
    .opera__gallery .ce-gallery { columns: 2; }
    .opera__gallery .ce-row:first-child .ce-column { column-span: all; }
}

/* ---------- Home slideshow ---------- */
.site--Home .sidebar {
    background: none; color: #fff; bottom: auto;
    text-shadow: 0 1px 12px rgba(0, 0, 0, .45);
}
.site--Home .sidebar::before {
    content: ''; position: absolute; inset: 0 -40% -60% 0; z-index: -1; pointer-events: none;
    background: radial-gradient(ellipse at top left, rgba(0, 0, 0, .42), transparent 70%);
}
.site--Home .brand, .site--Home .mainnav a, .site--Home .social { color: #fff; }
.site--Home .tagline { color: rgba(255, 255, 255, .85); }
.site--Home .mainnav a:hover { color: rgba(255, 255, 255, .75); }
.site--Home .main { margin-left: 0; }
.slideshow { position: fixed; inset: 0; background: #222; overflow: hidden; }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity 1.4s ease; }
.slide.is-active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slideshow__nav {
    position: absolute; top: 50%; width: 3rem; height: 3rem; margin-top: -1.5rem;
    border: 0; border-radius: 50%; background: rgba(255, 255, 255, .55); cursor: pointer; z-index: 5;
    opacity: 0; transition: opacity .3s, background .2s;
}
.slideshow:hover .slideshow__nav, .slideshow__nav:focus-visible { opacity: 1; }
.slideshow__nav:hover { background: rgba(255, 255, 255, .9); }
.slideshow__nav::before { content: ''; position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; border: solid var(--ink); border-width: 0 0 2px 2px; }
.slideshow__nav--prev { left: 1.2rem; }
.slideshow__nav--prev::before { transform: translate(-30%, -50%) rotate(45deg); }
.slideshow__nav--next { right: 1.2rem; }
.slideshow__nav--next::before { transform: translate(-70%, -50%) rotate(-135deg); }
.slideshow__dots { position: absolute; left: 0; right: 0; bottom: 1.6rem; display: flex; justify-content: center; gap: .6rem; z-index: 5; }
.slideshow__dots span {
    width: 2rem; height: 2px; background: rgba(255, 255, 255, .45); cursor: pointer; transition: background .3s;
    box-shadow: 0 0 6px rgba(0, 0, 0, .3);
}
.slideshow__dots span.is-active { background: #fff; }
.home-content { position: fixed; right: 1.5rem; bottom: 4rem; max-width: 26rem; background: rgba(255, 255, 255, .92); padding: 1.1rem 1.4rem; z-index: 6; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .97); }
.lb[hidden] { display: none; }
.lb__img { max-width: calc(100vw - 140px); max-height: calc(100vh - 80px); width: auto; object-fit: contain; box-shadow: 0 4px 30px rgba(0, 0, 0, .12); }
.lb__btn { position: absolute; border: 0; background: none; cursor: pointer; color: var(--ink); font: 300 2.4rem/1 var(--font); padding: 14px 18px; }
.lb__btn:hover { color: var(--muted); }
.lb__close { top: 8px; right: 12px; }
.lb__prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb__next { right: 8px; top: 50%; transform: translateY(-50%); }
.lb__count { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: .85rem; }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 860px) {
    .sidebar {
        position: sticky; top: 0; width: auto; bottom: auto;
        display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px;
        padding: .8rem var(--gutter); border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, .96);
        -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    }
    .brand { font-size: 1.1rem; }
    .tagline { margin: 0; flex: 1; font-size: .7rem; }
    .nav-toggle {
        display: block; position: relative; width: 36px; height: 30px; border: 0; background: none; cursor: pointer; color: inherit;
    }
    .nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after {
        position: absolute; left: 7px; width: 22px; height: 1.5px; background: currentColor; content: ''; transition: transform .2s, opacity .2s;
    }
    .nav-toggle__bar { top: 14px; }
    .nav-toggle__bar::before { top: -7px; left: 0; }
    .nav-toggle__bar::after { top: 7px; left: 0; }
    .nav-toggle[aria-expanded="true"] .nav-toggle__bar { background: transparent; }
    .nav-toggle[aria-expanded="true"] .nav-toggle__bar::before { transform: translateY(7px) rotate(45deg); }
    .nav-toggle[aria-expanded="true"] .nav-toggle__bar::after { transform: translateY(-7px) rotate(-45deg); }
    .mainnav { display: none; width: 100%; padding: .8rem 0 .4rem; }
    .mainnav.is-open { display: block; }
    .mainnav a { font-size: 1.15rem; padding: .35rem 0; }
    .social { margin-top: .8rem; }

    .site--Home .sidebar { position: fixed; left: 0; right: 0; border-bottom: 0; background: linear-gradient(rgba(0, 0, 0, .5), transparent); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .site--Home .sidebar::before { display: none; }
    .site--Home .sidebar:has(.mainnav.is-open) { background: rgba(0, 0, 0, .72); }

    .main { margin-left: 0; }
    .content { padding-top: 1.6rem; }
    .ce-textpic.ce-left.ce-intext, .ce-textpic.ce-left.ce-nowrap { flex-direction: column; }
    .lb__img { max-width: 100vw; max-height: calc(100vh - 120px); }
    .lb__prev, .lb__next { top: auto; bottom: 0; transform: none; }
    .slideshow__nav { opacity: 1; width: 2.6rem; height: 2.6rem; }
}
@media (max-width: 560px) {
    .works { grid-template-columns: 1fr; }
    .content td { display: block; padding: 0; }
    .content td:first-child { padding-top: .5rem; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}
