@import url("https://fonts.cdnfonts.com/css/thegoodmonolith");

:root {
    --ink: #112747;
    --blue: #0a5ea8;
    --cyan: #08a8c8;
    --paper: #f4f7fb;
    --paper-solid: #fff;
    --muted: #687a92;
    --line: rgba(17, 39, 71, .14);
    --shadow: 0 24px 60px rgba(24, 50, 85, .16);
    --mono: "TheGoodMonolith", ui-monospace, monospace;
    --font: "Vazirmatn", Tahoma, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
}

body {
    overflow: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 15%, rgba(8, 168, 200, .08), transparent 28rem),
        var(--paper);
    font-family: var(--font);
    cursor: grab;
}

body.dragging {
    cursor: grabbing;
}

body.project-open {
    cursor: default;
}

body.project-open .header {
    opacity: 0 !important;
    pointer-events: none;
}

body.project-open .header-email {
    visibility: hidden;
}

button,
a {
    color: inherit;
    font: inherit;
}

a {
    text-decoration: none;
}

button {
    border: 0;
}

ul {
    list-style: none;
}

#preloader-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(30px, 6vw, 84px);
    padding: clamp(24px, 5vw, 72px);
    overflow: auto;
    background:
        radial-gradient(circle at 78% 22%, rgba(8, 168, 200, .1), transparent 30rem),
        radial-gradient(circle at 18% 82%, rgba(10, 94, 168, .07), transparent 24rem),
        var(--paper);
}

.intro-visual {
    position: relative;
    display: grid;
    place-items: center;
    justify-self: center;
}

#preloader-canvas {
    width: min(360px, 40vw);
    height: min(360px, 40vw);
    opacity: .55;
}

.intro-logo {
    position: absolute;
    width: min(150px, 17vw);
    height: auto;
    object-fit: contain;
}

.intro-panel {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 540px;
}

.intro-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.intro-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0bbf90;
    box-shadow: 0 0 0 0 rgba(11, 191, 144, .55);
    animation: introPulse 2s infinite;
}

.intro-panel h1 {
    font-size: clamp(28px, 4vw, 52px);
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -.04em;
}

.intro-lead {
    max-width: 40ch;
    margin-top: 18px;
    color: var(--muted);
    font-size: clamp(14px, 1.3vw, 17px);
    line-height: 2;
}

.intro-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: clamp(28px, 3.5vw, 40px);
}

.intro-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px 28px;
    border-radius: 999px;
    color: #fff;
    background: var(--ink);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .3s ease, box-shadow .3s ease;
}

.intro-button:hover {
    background: var(--blue);
    box-shadow: 0 16px 34px rgba(10, 94, 168, .28);
}

.intro-button svg {
    width: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .3s ease;
}

.intro-button:hover svg {
    transform: translateX(-4px);
}

.intro-count {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.4;
}

@keyframes introPulse {
    70% { box-shadow: 0 0 0 9px rgba(11, 191, 144, 0); }
    100% { box-shadow: 0 0 0 0 rgba(11, 191, 144, 0); }
}

.header,
.footer {
    position: fixed;
    right: 0;
    z-index: 100;
    width: 100%;
    padding: 24px clamp(18px, 2.2vw, 36px);
    pointer-events: none;
    opacity: 0;
}

.header {
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer {
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 16px;
    align-items: end;
}

.header > *,
.footer > * {
    pointer-events: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-symbol {
    position: relative;
    display: block;
    width: 44px;
    height: 28px;
}

.brand-symbol i {
    position: absolute;
    top: 50%;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ink);
    transform: translateY(-50%);
    transition: transform .5s cubic-bezier(.16, 1, .3, 1);
}

.brand-symbol i:first-child {
    left: 0;
}

.brand-symbol i:last-child {
    left: 15px;
    background: var(--cyan);
    mix-blend-mode: multiply;
}

.brand:hover .brand-symbol i:first-child {
    transform: translate(-6px, -50%);
}

.brand:hover .brand-symbol i:last-child {
    transform: translate(6px, -50%);
}

.brand-copy {
    line-height: 1;
}

.brand-copy b {
    display: block;
    font-size: 21px;
    font-weight: 900;
}

.brand-copy small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: .26em;
}

.header-email {
    position: relative;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    direction: ltr;
}

.header-email::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width .35s ease;
}

.header-email:hover::after {
    width: 100%;
}

.viewport {
    position: fixed;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    opacity: 0;
    touch-action: none;
}

.canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    isolation: isolate;
}

.grid-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.grid-item {
    position: absolute;
    width: 320px;
    height: 320px;
    overflow: hidden;
    background: #dce5ef;
    cursor: pointer;
    opacity: 0;
    will-change: left, top, opacity, transform;
}

.grid-item::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, .36);
    box-shadow: inset 0 0 0 1px rgba(17, 39, 71, .04);
    pointer-events: none;
}

.grid-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    transition: filter .5s ease;
}

.grid-item:hover img {
    filter: saturate(1.08) contrast(1.03);
}

.grid-item.out-of-view {
    opacity: .13 !important;
}

.project-view {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1fr;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.project-view.is-active {
    visibility: visible;
    pointer-events: auto;
}

.project-visual,
.project-content {
    position: relative;
    width: 100%;
    height: 100%;
}

.project-visual {
    z-index: 1;
    background: rgba(231, 238, 246, .96);
}

.zoom-target {
    position: absolute;
    inset: 0;
}

.project-content {
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(36px, 6vw, 110px);
    background: rgba(255, 255, 255, .96);
    border-right: 1px solid var(--line);
}

.project-counter {
    position: absolute;
    top: clamp(26px, 4vw, 54px);
    right: clamp(28px, 5vw, 80px);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    direction: ltr;
}

.project-counter i {
    width: 44px;
    height: 1px;
    background: var(--line);
}

.project-kicker {
    margin-bottom: 18px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.project-kicker::before {
    content: "";
    display: inline-block;
    width: 26px;
    height: 1px;
    margin-left: 9px;
    vertical-align: middle;
    background: currentColor;
}

.project-content h1 {
    max-width: 620px;
    font-size: clamp(38px, 5.4vw, 80px);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.055em;
}

.project-description {
    max-width: 550px;
    margin-top: 25px;
    color: var(--muted);
    font-size: clamp(14px, 1.2vw, 17px);
    line-height: 2;
}

.project-meta {
    display: flex;
    gap: clamp(38px, 6vw, 80px);
    margin-top: clamp(34px, 5vw, 70px);
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.project-meta span {
    display: grid;
    gap: 5px;
}

.project-meta small {
    color: var(--muted);
    font-size: 10px;
}

.project-meta b {
    font-size: 12px;
}

.scaling-image-overlay {
    position: fixed;
    z-index: 30;
    overflow: hidden;
    pointer-events: none;
    will-change: transform, width, height;
}

.scaling-image-overlay img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.close-button {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 120;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    color: #fff;
    background: rgba(17, 39, 71, .82);
    backdrop-filter: blur(10px);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: scale(.75) rotate(-45deg);
}

.close-button.is-active {
    pointer-events: auto;
}

.close-button svg {
    width: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.controls-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    z-index: 110;
    display: flex;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%);
    opacity: 0;
    transition: left 1s cubic-bezier(.87, 0, .13, 1);
}

.controls-container.is-hidden {
    pointer-events: none;
}

.percentage-indicator,
.sound-toggle {
    display: grid;
    place-items: center;
    min-width: 62px;
    color: var(--ink);
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 11px;
    box-shadow: 0 8px 25px rgba(17, 39, 71, .08);
}

.percentage-indicator {
    border-radius: 0 6px 6px 0;
    direction: ltr;
}

.switch {
    display: flex;
    gap: 7px;
    padding: 8px 12px;
    color: rgba(255, 255, 255, .48);
    background: var(--ink);
}

.switch-button {
    position: relative;
    padding: 5px 9px;
    color: inherit;
    background: none;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: color .25s ease;
}

.switch-button:hover,
.switch-button.is-current {
    color: #fff;
}

.switch-button span {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-left: 5px;
    border-radius: 50%;
    background: var(--cyan);
    opacity: 0;
    transition: opacity .25s ease;
}

.switch-button.is-current span {
    opacity: 1;
}

.sound-toggle {
    min-width: 54px;
    border-radius: 6px 0 0 6px;
    cursor: pointer;
}

.sound-toggle canvas {
    width: 32px;
    height: 16px;
}

.gallery-hint {
    grid-column: 1 / span 4;
    display: flex;
    align-items: center;
    justify-self: start;
    gap: 10px;
}

.drag-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
    font-size: 13px;
}

.footer p {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.7;
    direction: ltr;
}

.info-section {
    grid-column: 9 / span 4;
    text-align: left;
}

.page-vignette {
    position: fixed;
    inset: 0;
    z-index: 90;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(244, 247, 251, .96), transparent 20%),
        linear-gradient(to top, rgba(244, 247, 251, .94), transparent 17%);
}

@media (max-width: 900px) {
    #preloader-overlay {
        grid-template-columns: 1fr;
        align-content: center;
        justify-items: center;
        gap: 18px;
        padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
        text-align: center;
    }

    #preloader-canvas {
        width: min(230px, 58vw);
        height: min(230px, 58vw);
    }

    .intro-logo {
        width: min(104px, 26vw);
    }

    .intro-panel {
        align-items: center;
    }

    .intro-panel h1 {
        font-size: clamp(26px, 8vw, 36px);
    }

    .intro-actions {
        flex-direction: column;
        gap: 14px;
        width: 100%;
    }

    .intro-button {
        width: min(100%, 280px);
    }

    .header,
    .footer {
        padding: 18px;
    }

    .project-view {
        grid-template-columns: 1fr;
        grid-template-rows: 54vh 46vh;
        overflow-y: auto;
        background: var(--paper-solid);
    }

    .project-content {
        min-height: 46vh;
        padding: 38px 22px calc(38px + env(safe-area-inset-bottom));
        border: 0;
        border-top: 1px solid var(--line);
    }

    .project-counter {
        top: 22px;
        right: 22px;
    }

    .project-kicker {
        margin-top: 25px;
        margin-bottom: 10px;
    }

    .project-content h1 {
        font-size: clamp(34px, 11vw, 56px);
    }

    .project-description {
        margin-top: 14px;
        font-size: 13px;
        line-height: 1.9;
    }

    .project-meta {
        margin-top: 24px;
    }

    .close-button {
        top: 18px;
        left: 18px;
        width: 46px;
        height: 46px;
    }

    .footer {
        display: flex;
        justify-content: space-between;
    }

    .info-section {
        text-align: left;
    }

    .desktop-only {
        display: none;
    }

    .page-vignette {
        background:
            linear-gradient(to bottom, rgba(244, 247, 251, .96), transparent 14%),
            linear-gradient(to top, rgba(244, 247, 251, .94), transparent 13%);
    }
}

@media (max-width: 640px) {
    .brand-copy b {
        font-size: 19px;
    }

    .brand-symbol {
        width: 38px;
    }

    .brand-symbol i {
        width: 23px;
        height: 23px;
    }

    .brand-symbol i:last-child {
        left: 13px;
    }

    .controls-container {
        bottom: max(14px, env(safe-area-inset-bottom));
        width: calc(100vw - 24px);
    }

    .percentage-indicator {
        min-width: 51px;
        padding-inline: 7px;
    }

    .sound-toggle {
        min-width: 48px;
    }

    .switch {
        flex: 1;
        justify-content: space-evenly;
        gap: 0;
        padding-inline: 4px;
    }

    .switch-button {
        padding-inline: 5px;
        font-size: 9px;
    }

    .switch-button span {
        display: none;
    }

    .gallery-hint {
        display: none;
    }

    .footer {
        bottom: 54px;
        justify-content: flex-start;
        pointer-events: none;
    }

    .info-section {
        margin-right: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
