/* ==========================================================================
   New design (Carrot, Oct 2026): photo tiles and the entrance animation
   Shared by Home, the season pages, Portfolio, Green Responsibility...
   Values from the delivered prototype (app.css: .brand-tile, .portfolio-square, the
   21 Oct "one entrance animation for every page" and the "square system").
   Loaded only for Preview users.
   ========================================================================== */

/* ---------- Photo tile with a white logo in the middle ---------- */
.s2-tile {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--s2-indigo);
    -webkit-tap-highlight-color: transparent;
}
.s2-tile-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}
.s2-tile-logo-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.s2-tile-logo {
    display: block;
    height: auto;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25));
}

/* ---------- Photo square with a white title in the middle ---------- */
.s2-square {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--s2-indigo);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.s2-square > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}
.s2-square-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0 10px;
    font-family: var(--s2-font);
    /* Same title size in every square: 20.4px on a 411px wide phone */
    font-size: calc((min(50vw, 197px) - 26px) / 8.4);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* Squares that carry a short white line under the title (portfolios): it draws in after the entrance */
.s2-square-underline .s2-square-label {
    flex-direction: column;
}
.s2-square-underline .s2-square-label::after {
    content: '';
    display: block;
    width: 44px;
    height: 2px;
    background: #fff;
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
    transform: scaleX(0);
    transition: transform 0.6s var(--s2-ease-out) calc(var(--fx-d, 0s) + 0.55s);
}
.s2-square-underline.fx-in .s2-square-label::after,
html:not(.s2-js) .s2-square-underline .s2-square-label::after {
    transform: scaleX(1);
}

/* Tap: the photo zooms a little inside its frame */
.s2-tile-img,
.s2-square > img {
    transition: transform 0.45s var(--s2-ease-out), opacity 0.45s ease;
}
.s2-tile:active .s2-tile-img,
.s2-square:active > img {
    transform: scale(1.07);
    transition-duration: 0.2s;
}

/* Photos fade in once loaded; the indigo tile shows meanwhile (fx.js adds .is-loaded) */
.s2-js .s2-tile-img:not(.is-loaded),
.s2-js .s2-square > img:not(.is-loaded) {
    opacity: 0;
}

/* ---------- Entrance: wipe from the top, photo settles, logo/title rises ----------
   fx.js gives every [data-s2-fx] block .fx-in (with a small delay) when it comes into view.
   Before the script runs nothing is hidden, so the page never stays blank. */
.s2-js [data-s2-fx]:not(.fx-in) {
    clip-path: inset(0 0 100% 0);
}
[data-s2-fx].fx-in {
    animation: s2TileWipe 0.75s var(--s2-ease-in-out) var(--fx-d, 0s) both;
}
[data-s2-fx].fx-in .s2-tile-img,
[data-s2-fx].fx-in .s2-card-img,
[data-s2-fx].fx-in > img {
    animation: s2ImgSettle 1.1s var(--s2-ease-out) var(--fx-d, 0s) both;
}
[data-s2-fx].fx-in .s2-tile-logo,
[data-s2-fx].fx-in .s2-square-label,
[data-s2-fx].fx-in .s2-line-logo,
[data-s2-fx].fx-in .s2-line-name {
    animation: s2LogoRise 0.6s var(--s2-ease-out) calc(var(--fx-d, 0s) + 0.4s) both;
}

/* Text (titles, intros) joins the same sequence: it fades in and rises a little */
.s2-js [data-s2-fxt]:not(.fx-in) {
    opacity: 0;
}
[data-s2-fxt].fx-in {
    animation: s2TextIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) calc(var(--fx-d, 0s) + 0.15s) both;
}
/* Pressing a tile after the entrance still zooms the photo */
[data-s2-fx].fx-in:active .s2-tile-img,
[data-s2-fx].fx-in .s2-card-link:active .s2-card-img,
.s2-card:has(.s2-card-name:active) [data-s2-fx].fx-in .s2-card-img,
[data-s2-fx].fx-in:active > img {
    animation: none;
}

@keyframes s2TileWipe {
    from { clip-path: inset(0 0 100% 0); }
    to   { clip-path: inset(0 0 0 0); }
}
@keyframes s2ImgSettle {
    from { transform: scale(1.18); }
    to   { transform: scale(1); }
}
@keyframes s2LogoRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes s2TextIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .s2-js [data-s2-fx]:not(.fx-in) { clip-path: none; }
    .s2-js [data-s2-fxt]:not(.fx-in) { opacity: 1; }
    [data-s2-fx].fx-in, [data-s2-fx].fx-in *, [data-s2-fxt].fx-in { animation: none; }
}
