/* ==========================================================================
   Mohammed Ali Zeggaf — portfolio
   Visual design based on "Portfolio" by Elias (Figma Community, CC BY 4.0).

   1. Tokens & fonts      5. Cards              9. Forms
   2. Base                6. Sections          10. Footer
   3. Layout & utilities  7. Inner pages       11. Motion
   4. Header              8. Gallery           12. Additions, 13. Admin
   ========================================================================== */

/* 1. Tokens & fonts ------------------------------------------------------- */

@font-face {
    font-family: "Fira Code";
    src: url("../fonts/fira-code-400.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "Fira Code";
    src: url("../fonts/fira-code-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: "Fira Code";
    src: url("../fonts/fira-code-600.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: "Fira Code";
    src: url("../fonts/fira-code-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #282c33;
    --bg-raised: #2c3036;
    --bg-sunken: #23262c;
    --gray: #abb2bf;
    --white: #ffffff;
    --primary: #c778dd;
    --primary-soft: rgba(199, 120, 221, 0.2);
    --danger: #e06c75;
    --success: #98c379;

    --font: "Fira Code", ui-monospace, "Cascadia Code", Consolas, monospace;
    --container: 1024px;
    --gutter: 16px;
    --header-height: 64px;
    --section-gap: 112px;
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* 2. Base ----------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--gray);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
    margin: 0;
    padding: 0;
}

ul,
ol {
    list-style: none;
}

h1,
h2,
h3 {
    color: var(--white);
    line-height: 1.3;
    text-wrap: balance;
}

img,
svg {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea {
    font: inherit;
    color: inherit;
}

strong {
    color: var(--white);
    font-weight: 600;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

::selection {
    background: var(--primary);
    color: var(--bg);
}

/* 3. Layout & utilities --------------------------------------------------- */

.container {
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section {
    margin-top: var(--section-gap);
}

.section--tight {
    margin-top: 48px;
}

.hash,
.accent {
    color: var(--primary);
}

.muted {
    color: var(--gray);
    opacity: 0.75;
}

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

.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 100;
    padding: 8px 16px;
    background: var(--primary);
    color: var(--bg);
    font-weight: 600;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

.icon {
    flex: none;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--white);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn:hover {
    background: var(--primary-soft);
}

.btn--muted {
    border-color: var(--gray);
    color: var(--gray);
}

.btn--muted:hover {
    background: rgba(171, 178, 191, 0.15);
    color: var(--white);
}

/* Decorations from the original design: dot grids and outlined squares. */

.deco {
    position: absolute;
    pointer-events: none;
}

.deco--dots {
    width: 84px;
    height: 84px;
    background-image: radial-gradient(circle, var(--gray) 2px, transparent 2.5px);
    background-size: 20px 20px;
    background-position: -8px -8px;
}

.deco--frame {
    border: 1px solid var(--gray);
}

/* Section and page titles */

.section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 48px;
}

.section-title__text {
    font-size: 32px;
    font-weight: 500;
}

.section-title__line {
    flex: 0 1 512px;
    height: 1px;
    background: var(--primary);
}

.section-title__link {
    margin-left: auto;
    color: var(--white);
    font-weight: 500;
    white-space: nowrap;
}

.section-title__link:hover {
    color: var(--primary);
}

.page-title {
    margin-top: 56px;
}

.page-title__text {
    font-size: 32px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.page-title__subtitle {
    margin-top: 12px;
    max-width: 640px;
    color: var(--white);
}

.back-link {
    display: inline-block;
    margin-bottom: 24px;
}

.back-link:hover {
    color: var(--white);
}

.cta {
    margin-top: 48px;
}

/* 4. Header --------------------------------------------------------------- */

.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s var(--ease);
}

.header.is-scrolled {
    border-bottom-color: rgba(171, 178, 191, 0.25);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    color: var(--white);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav__list {
    display: flex;
    gap: 24px;
}

.nav__link {
    transition: color 0.2s var(--ease);
}

.nav__link:hover,
.nav__link.is-active {
    color: var(--white);
}

.nav__link.is-active {
    font-weight: 500;
}

.nav__socials,
.header__toggle {
    display: none;
}

.media-rail {
    position: fixed;
    top: 0;
    left: 17px;
    z-index: 60;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.media-rail__line {
    width: 1px;
    height: 180px;
    background: var(--gray);
}

.media-rail a {
    padding: 4px;
    transition: color 0.2s var(--ease);
}

.media-rail a:hover {
    color: var(--white);
}

@media (min-width: 1200px) {
    .media-rail {
        display: flex;
    }
}

@media (max-width: 960px) {
    .header__toggle {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        margin-right: -10px;
        border: 0;
        background: none;
        color: var(--gray);
        cursor: pointer;
    }

    .header__toggle-close,
    .nav-open .header__toggle-open {
        display: none;
    }

    .nav-open .header__toggle-close {
        display: block;
    }

    .nav {
        position: fixed;
        inset: var(--header-height) 0 0 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 40px var(--gutter) 32px;
        background: var(--bg);
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
    }

    .nav-open .nav {
        visibility: visible;
        opacity: 1;
        transform: none;
    }

    .nav-open body {
        overflow: hidden;
    }

    .nav__list {
        flex-direction: column;
        gap: 28px;
        font-size: 32px;
    }

    .nav__socials {
        display: flex;
        justify-content: center;
        gap: 16px;
        margin-top: 40px;
    }

    .nav__socials a {
        display: block;
        padding: 8px;
    }
}

/* 5. Cards ---------------------------------------------------------------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    gap: 16px;
}

.card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--gray);
    background: var(--bg);
    transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
}

.card[hidden] {
    display: none;
}

.card__media {
    position: relative;
    display: block;
    border-bottom: 1px solid var(--gray);
    background: var(--bg-sunken);
    overflow: hidden;
}

.card__media img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}

.card--video .card__media img {
    aspect-ratio: 16 / 9;
}

.card:hover .card__media img {
    transform: scale(1.03);
}

.card__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: auto;
    width: 56px;
    height: 56px;
    border: 1px solid var(--primary);
    background: rgba(40, 44, 51, 0.85);
    color: var(--white);
    transition: background-color 0.2s var(--ease);
}

.card__play .icon {
    margin-left: 3px;
}

.card:hover .card__play {
    background: var(--primary);
    color: var(--bg);
}

.card__tech {
    padding: 8px;
    border-bottom: 1px solid var(--gray);
    word-spacing: 4px;
}

.card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.card__title {
    font-size: 24px;
    font-weight: 500;
}

.card__title--small {
    font-size: 16px;
    line-height: 1.5;
}

.card__title a:hover {
    color: var(--primary);
}

.card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: auto;
}

/* 6. Sections ------------------------------------------------------------- */

/* Hero */

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 24px;
    margin-top: 48px;
}

.hero__title {
    font-size: 32px;
    font-weight: 600;
    line-height: 1.35;
}

.hero__tagline {
    margin-top: 32px;
    max-width: 463px;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
}

.hero__figure {
    position: relative;
    justify-self: end;
    width: min(100%, 420px);
}

.hero__photo,
.about__photo {
    position: relative;
    overflow: hidden;
}

.hero__photo {
    border: 1px solid var(--gray);
    transition: transform 0.3s var(--ease);
}

.hero__photo img,
.about__photo img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Soft fade into the page colour, so the photo sits in the dark layout. */
.hero__photo::after,
.about__photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 55%, rgba(40, 44, 51, 0.6));
    pointer-events: none;
}

.hero__frame {
    top: 22%;
    left: -32px;
    width: 155px;
    height: 155px;
    border-color: var(--primary);
}

.hero__dots {
    right: -16px;
    bottom: 76px;
    z-index: 1;
}

.hero__status {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 20px;
    padding: 8px;
    border: 1px solid var(--gray);
    border-top: 0;
}

.hero__status-dot {
    width: 16px;
    height: 16px;
    background: var(--primary);
}

/* Quote */

.quote {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 760px;
    margin-top: var(--section-gap);
}

.quote__text {
    position: relative;
    align-self: stretch;
    padding: 32px;
    border: 1px solid var(--gray);
    color: var(--white);
    font-size: 24px;
    font-weight: 500;
    text-align: center;
}

.quote__text::before,
.quote__text::after {
    content: "“";
    position: absolute;
    padding: 0 8px;
    background: var(--bg);
    color: var(--gray);
    font-size: 56px;
    line-height: 0.7;
    height: 28px;
}

.quote__text::before {
    top: -12px;
    left: 12px;
}

.quote__text::after {
    right: 12px;
    bottom: -18px;
}

.quote__author {
    padding: 16px;
    border: 1px solid var(--gray);
    border-top: 0;
    color: var(--white);
    font-size: 24px;
}

/* Skills */

.skills-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    align-items: start;
    gap: 32px;
}

.skills-layout__art {
    position: relative;
    height: 282px;
}

.art__dots-a {
    top: 16px;
    left: 16px;
}

.art__dots-b {
    top: 140px;
    left: 170px;
}

.art__frame-a {
    top: 0;
    left: 224px;
    width: 86px;
    height: 86px;
}

.art__frame-b {
    top: 210px;
    left: 260px;
    width: 52px;
    height: 52px;
}

.art__logo {
    position: absolute;
    top: 128px;
    left: 24px;
    color: var(--white);
}

.skills {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    align-items: start;
    gap: 16px;
}

.skill-block {
    border: 1px solid var(--gray);
}

.skill-block__title {
    padding: 8px;
    border-bottom: 1px solid var(--gray);
    font-size: 16px;
    font-weight: 600;
}

.skill-block__list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 8px;
}

/* About */

.about {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: 48px;
}

.about--page {
    margin-top: 48px;
}

.about__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
}

.about__figure {
    position: relative;
    justify-self: end;
    width: min(100%, 400px);
    border-bottom: 1px solid var(--primary);
}

.about__dots-a {
    top: 40px;
    left: -24px;
    z-index: 1;
}

.about__dots-b {
    right: -20px;
    bottom: 80px;
    z-index: 1;
}

/* Contacts */

.contacts {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 32px;
}

.contacts--page {
    margin-top: 48px;
}

.contacts__text {
    max-width: 520px;
}

.contacts__side {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.contact-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--gray);
}

.contact-box__title {
    font-size: 16px;
    font-weight: 600;
}

.contact-box__item {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-wrap: anywhere;
}

a.contact-box__item:hover {
    color: var(--white);
}

.media-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    gap: 16px;
}

.media-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--gray);
    color: var(--white);
    overflow-wrap: anywhere;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.media-list a:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

/* 7. Inner pages ---------------------------------------------------------- */

/* Lists with a purple marker */

.check-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.check-list li {
    position: relative;
    padding-left: 24px;
}

.check-list li::before {
    content: "";
    position: absolute;
    top: 0.55em;
    left: 2px;
    width: 8px;
    height: 8px;
    background: var(--primary);
}

/* Project filters */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px;
}

.filters[hidden] {
    display: none;
}

.filters__btn {
    padding: 4px 12px;
    border: 1px solid var(--gray);
    background: none;
    cursor: pointer;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.filters__btn:hover {
    color: var(--white);
}

.filters__btn.is-active {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--white);
}

.filters__empty {
    margin-top: 48px;
}

/* Project detail */

.project__layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    align-items: start;
    gap: 48px;
    margin-top: 48px;
}

.project__main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.project__heading {
    margin-top: 12px;
    font-size: 24px;
    font-weight: 500;
}

.project__meta {
    position: sticky;
    top: calc(var(--header-height) + 24px);
    border: 1px solid var(--gray);
}

.meta-list > div {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--gray);
}

.meta-list dt {
    flex: none;
    width: 76px;
    color: var(--white);
    font-weight: 600;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid var(--gray);
}

.tags li {
    padding: 2px 8px;
    border: 1px solid var(--gray);
    font-size: 14px;
}

.project__links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
}

.project__next {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: var(--section-gap);
    padding-top: 24px;
    border-top: 1px solid var(--gray);
}

.project__next a {
    color: var(--white);
    font-size: 24px;
    font-weight: 500;
}

.project__next a:hover {
    color: var(--primary);
}

/* Timeline (experience) */

.timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline__item {
    display: grid;
    grid-template-columns: 240px 1fr;
    border: 1px solid var(--gray);
}

.timeline__period {
    padding: 16px;
    border-right: 1px solid var(--gray);
    color: var(--white);
    font-weight: 500;
}

.timeline__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
}

.timeline__title {
    font-size: 20px;
    font-weight: 500;
}

.timeline__place {
    margin-top: -8px;
}

.timeline__tech {
    align-self: stretch;
    padding-top: 12px;
    border-top: 1px solid rgba(171, 178, 191, 0.35);
    font-size: 14px;
    word-spacing: 6px;
}

.timeline__link {
    color: var(--white);
    font-weight: 500;
}

.timeline__link:hover {
    color: var(--primary);
}

/* Education, certifications, languages */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    align-items: start;
    gap: 16px;
}

.info-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--gray);
}

.info-card--wide {
    grid-column: 1 / -1;
}

.info-card__label {
    font-size: 14px;
}

.info-card__title {
    font-size: 20px;
    font-weight: 500;
}

.info-card__sub {
    margin-top: -8px;
    color: var(--primary);
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 760px;
}

.facts li {
    padding: 8px;
    border: 1px solid var(--gray);
}

/* Error pages */

.error-page {
    padding-block: 96px 32px;
}

.error-page__code {
    color: var(--white);
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
}

.error-page__title {
    margin-top: 24px;
    font-size: 32px;
    font-weight: 600;
}

.error-page__text {
    margin-top: 12px;
    max-width: 560px;
}

/* 8. Gallery -------------------------------------------------------------- */

.gallery {
    display: grid;
    gap: 16px;
}

.gallery--phone {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.gallery--desktop {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.gallery__item {
    display: block;
    border: 1px solid var(--gray);
    background: var(--bg-sunken);
    overflow: hidden;
    cursor: zoom-in;
    transition: border-color 0.2s var(--ease);
}

.gallery__item:hover {
    border-color: var(--primary);
}

.gallery__item img {
    width: 100%;
    transition: transform 0.4s var(--ease);
}

.gallery__item:hover img {
    transform: scale(1.03);
}

.lightbox {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 56px 64px;
    border: 0;
    background: rgba(26, 28, 33, 0.96);
    color: var(--white);
}

.lightbox[open] {
    display: grid;
    place-items: center;
}

.lightbox::backdrop {
    background: transparent;
}

.lightbox__image {
    max-width: 100%;
    max-height: calc(100dvh - 112px);
    width: auto;
    object-fit: contain;
    border: 1px solid var(--gray);
}

.lightbox__btn {
    position: absolute;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--gray);
    background: var(--bg);
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.lightbox__btn:hover {
    border-color: var(--primary);
    background: var(--bg-raised);
}

.lightbox__close {
    top: 8px;
    right: 8px;
}

.lightbox__prev {
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
}

.lightbox__next {
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
}

/* 9. Forms ---------------------------------------------------------------- */

.form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
    max-width: 760px;
}

.form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.form__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form__field--full {
    grid-column: 1 / -1;
}

.form__field label {
    color: var(--white);
    font-weight: 500;
}

.form__field input,
.form__field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray);
    border-radius: 0;
    background: transparent;
    color: var(--white);
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.form__field textarea {
    min-height: 160px;
    resize: vertical;
}

.form__field input:focus,
.form__field textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(199, 120, 221, 0.06);
}

.form__field [aria-invalid="true"] {
    border-color: var(--danger);
}

.form__error {
    color: var(--danger);
    font-size: 14px;
}

.form__trap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.alert {
    max-width: 760px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border: 1px solid;
    color: var(--white);
}

.alert--success {
    border-color: var(--success);
    background: rgba(152, 195, 121, 0.12);
}

.alert--error {
    border-color: var(--danger);
    background: rgba(224, 108, 117, 0.12);
}

/* 10. Footer -------------------------------------------------------------- */

.footer {
    margin-top: var(--section-gap);
    padding-block: 32px;
    border-top: 1px solid var(--gray);
}

.footer__top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 32px;
}

.footer__identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
}

.footer__email:hover {
    color: var(--white);
}

.footer__role {
    margin-top: 16px;
    color: var(--white);
}

.footer__heading {
    font-size: 24px;
    font-weight: 500;
}

.footer__socials {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.footer__socials a {
    display: block;
    padding: 4px;
    transition: color 0.2s var(--ease);
}

.footer__socials a:hover {
    color: var(--white);
}

.footer__copy {
    margin-top: 48px;
    font-size: 14px;
    text-align: center;
}

.footer__copy a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer__copy a:hover {
    color: var(--white);
}

/* 11. Motion -------------------------------------------------------------- */

/* Elements fade in as they enter the viewport. Without JavaScript they stay visible. */

.js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), border-color 0.2s var(--ease);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

.js .card.reveal.is-visible:hover {
    transform: translateY(-4px);
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }
}

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

@media (max-width: 900px) {
    :root {
        --section-gap: 80px;
    }

    .skills-layout {
        grid-template-columns: 1fr;
    }

    .skills-layout__art {
        display: none;
    }

    .project__layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .project__meta {
        position: static;
    }

    .timeline__item {
        grid-template-columns: 1fr;
    }

    .timeline__period {
        border-right: 0;
        border-bottom: 1px solid var(--gray);
    }
}

@media (max-width: 760px) {
    .hero,
    .about,
    .contacts {
        grid-template-columns: 1fr;
    }

    .hero {
        gap: 40px;
        margin-top: 32px;
    }

    .hero__figure,
    .about__figure {
        justify-self: center;
    }

    .hero__frame {
        left: -12px;
    }

    .hero__dots {
        right: -8px;
    }

    .about__dots-a {
        left: -8px;
    }

    .about__dots-b {
        right: -8px;
    }

    .section-title {
        margin-bottom: 32px;
    }

    .section-title__text {
        font-size: 26px;
    }

    .quote__text,
    .quote__author {
        font-size: 18px;
    }

    .quote__text {
        padding: 24px 20px;
    }

    .form__row {
        grid-template-columns: 1fr;
    }

    .lightbox {
        padding: 60px 8px;
    }

    .lightbox__prev,
    .lightbox__next {
        top: auto;
        bottom: 8px;
        transform: none;
    }
}

/* 12. Additions ----------------------------------------------------------- */

.btn--small {
    padding: 4px 12px;
    font-size: 14px;
}

.section-intro {
    max-width: 640px;
    margin: -24px 0 32px;
}

.section-intro--flush {
    margin-top: 0;
}

/* Services */

.services {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    gap: 16px;
}

.service {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--gray);
}

.service:hover {
    border-color: var(--primary);
}

.service__number {
    color: var(--primary);
    font-size: 14px;
}

.service__title {
    margin-top: -8px;
    font-size: 20px;
    font-weight: 500;
}

.service__tech {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(171, 178, 191, 0.35);
    font-size: 14px;
    word-spacing: 6px;
}

.cta--close {
    margin-top: 24px;
}

/* Large outlined word behind a section. It slides sideways while scrolling (see app.js). */

.has-ghost {
    position: relative;
    isolation: isolate;
}

.ghost-text {
    position: absolute;
    top: -0.45em;
    left: 0;
    z-index: -1;
    color: transparent;
    font-size: clamp(72px, 15vw, 190px);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    -webkit-text-stroke: 1px rgba(171, 178, 191, 0.13);
    pointer-events: none;
    user-select: none;
    will-change: transform;
}

.ghost-text--hero {
    top: auto;
    bottom: -0.3em;
    left: -6%;
}

/* Hero: blinking cursor after the headline. */

.hero__cursor {
    display: inline-block;
    width: 0.55em;
    height: 0.12em;
    margin-left: 6px;
    background: var(--primary);
    animation: blink 1.1s steps(1) infinite;
}

/* Horizontal row of cards (videos). */

.scroller__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 32px) / 3);
    gap: 16px;
    padding: 6px 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none; /* No scrollbar: the arrows, a swipe or the keyboard move the row. */
}

.scroller__track > .card {
    scroll-snap-align: start;
}

.scroller__track::-webkit-scrollbar {
    display: none;
}

.scroller__controls {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.scroller__controls[hidden] {
    display: none;
}

.scroller__btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--gray);
    background: none;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), opacity 0.2s var(--ease);
}

.scroller__btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--white);
}

.scroller__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Certificates */

.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px 16px;
}

.cert {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 20px 16px 16px;
    border: 1px solid var(--gray);
    background: var(--bg);
}

.cert:hover {
    border-color: var(--primary);
}

.cert__topic {
    position: absolute;
    top: -13px;
    left: 12px;
    padding: 0 8px;
    background: var(--bg);
    color: var(--primary);
    font-size: 14px;
}

.cert__title {
    font-size: 18px;
    font-weight: 500;
}

.cert__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-bottom: auto;
    padding-bottom: 8px;
    font-size: 14px;
}

.cert__meta div {
    display: flex;
    gap: 6px;
}

.cert__meta dt {
    color: var(--white);
}

/* Decorations in motion. Dot grids drift slowly, each with its own rhythm,
   so they never move in step. */

.deco--dots {
    animation: drift 9s ease-in-out infinite alternate;
}

.hero__dots,
.art__dots-b,
.about__dots-b {
    animation-duration: 12s;
    animation-direction: alternate-reverse;
}

.deco--frame {
    animation: drift 14s ease-in-out infinite alternate-reverse;
}

.art__logo {
    animation: drift 10s ease-in-out infinite alternate;
}

/* The portrait zooms very slowly, and is revealed with a wipe on first load. */

.hero__photo img {
    animation: ken-burns 18s ease-in-out infinite alternate;
}

.js .hero__photo {
    animation: wipe-in 0.9s var(--ease) 0.1s both;
}

.about__photo img {
    transition: transform 0.8s var(--ease);
}

.about__figure:hover .about__photo img {
    transform: scale(1.05);
}

@keyframes drift {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(8px, -10px);
    }
}

@keyframes ken-burns {
    from {
        transform: scale(1.01);
    }

    to {
        transform: scale(1.08) translate(-1%, 1%);
    }
}

@keyframes wipe-in {
    from {
        clip-path: inset(0 100% 0 0);
    }

    to {
        clip-path: inset(0 0 0 0);
    }
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@media (max-width: 900px) {
    .scroller__track {
        grid-auto-columns: calc((100% - 16px) / 2);
    }
}

@media (max-width: 560px) {
    .scroller__track {
        grid-auto-columns: 84%;
    }
}

/* 13. Admin --------------------------------------------------------------- */

.admin__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 24px;
}

.admin__main {
    padding-block: 48px 96px;
}

.admin__gap {
    margin-top: 32px;
}

.admin code {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    background: var(--bg-sunken);
    color: var(--white);
}

.form--narrow {
    max-width: 360px;
}

.form__field .form__textarea--short {
    min-height: 84px;
}

.form__field ::placeholder {
    color: var(--gray);
    opacity: 0.55;
}

.inbox {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 860px;
}

.inbox__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--gray);
}

.inbox__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    align-self: stretch;
}

.inbox__subject {
    font-size: 18px;
    font-weight: 500;
}

.inbox__body {
    color: var(--white);
    overflow-wrap: anywhere;
}
