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

:root {
    color-scheme: light;
    --page-background: #f7f4ef;
    --text-color: #171717;
    --muted-text-color: #5f5a53;
    --header-background: rgba(247, 244, 239, 0.94);
    --accent-color: #7b2cbf;
    --footer-background: #171717;
    --footer-text-color: #ffffff;
    --birthday-carousel-background: #51266b;
    --birthday-carousel-text: #ffffff;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --page-background: #000000;
    --text-color: #f7f4ef;
    --muted-text-color: #c9c1b8;
    --header-background: rgba(23, 23, 23, 0.94);
    --accent-color: #d7a5ff;
    --footer-background: #080808;
    --footer-text-color: #f7f4ef;
    --birthday-carousel-background: #392148;
    --birthday-carousel-text: #fffaff;
}

body {
    margin: 0;
    font-family: 'Oswald', sans-serif;
    background-color: var(--page-background);
    color: var(--text-color);
    isolation: isolate;
    transition: background-color 0.25s ease, color 0.25s ease;
}

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

ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

svg {
    height: 36px;
}

.shell {
    width: 100%;
}

.site-chrome {
    position: sticky;
    top: 0;
    z-index: 3;
}

.header-shell {
    position: relative;
    background-color: var(--header-background);
    backdrop-filter: blur(8px);
}

.header-limit {
    max-width: 1200px;
    margin-inline: auto;
    padding: 2rem 1.25rem;

    display: flex;
    align-items: center;
    justify-content: space-between;

    font-size: 1.05rem;
}

.birthday-carousel {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    width: 100%;
    height: 2.4rem;
    overflow: hidden;
    background: var(--birthday-carousel-background);
    color: var(--birthday-carousel-text);
}

html:not([data-birthday-active="true"]) .birthday-carousel,
html:not([data-birthday-active="true"]) .fireworks-canvas,
html:not([data-birthday-active="true"]) .fireworks-status {
    display: none;
}

.birthday-carousel-track {
    display: flex;
    width: 100%;
    justify-content: center;
}

.birthday-carousel-track.is-moving {
    width: max-content;
    justify-content: flex-start;
    animation: birthday-carousel-scroll 30s linear infinite;
    will-change: transform;
}

.birthday-carousel-message {
    position: relative;
    flex: none;
    padding-inline: 1.6rem;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
}

.birthday-carousel-message::after {
    position: absolute;
    top: 50%;
    right: 0;
    width: 0.3rem;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--accent-color);
    content: '';
    transform: translate(50%, -50%);
}

@keyframes birthday-carousel-scroll {
    to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .birthday-carousel-track.is-moving {
        width: 100%;
        justify-content: center;
        animation: none;
    }

    .birthday-carousel-track.is-moving .birthday-carousel-message:not(:first-child) {
        display: none;
    }
}

.menu-toggle {
    display: none;
}

.site-title {
    white-space: nowrap;
    font-size: 1.5rem;
}

.nav-list {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1.5rem;
    margin-inline: auto;
}

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 6.75rem;
    height: 2.25rem;
    border: 0;
    border-radius: 2rem;
    background: #d9d9d9;
    color: #4a4a4a;
    outline: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    transition: background-color 0.3s ease, color 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    inset: 2px auto 2px 2px;
    width: calc(50% - 2px);
    border-radius: 1rem;
    background: #f5f5f5;
    transition: transform 0.25s ease;
}

.theme-option {
    position: relative;
    z-index: 1;
    flex: 1;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: 1rem;
}

.theme-option-light {
    color: #4a4a4a;
}

.theme-option-dark {
    color: #4a4a4a;
}

:root[data-theme="dark"] .theme-toggle::before {
    transform: translateX(100%);
}

:root[data-theme="dark"] .theme-option-light {
    color: #4a4a4a;
}

:root[data-theme="dark"] .theme-option-dark {
    color: #4a4a4a;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    background-color: #d9d9d9;
    color: #4a4a4a;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.nav-link {
    padding-block: 0.5rem;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 1.5rem;
    height: 3px;
    background-color: var(--accent-color);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-link[aria-current="page"]::after {
  opacity: 1;
  transform: scaleX(1);
}

.main-limit {
    max-width: 1200px;
    margin-inline: auto;
    padding: 0;
}

.contact-limit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: max(245px, calc(100svh - 100px - 418px));
    text-align: center;
}

.contact-limit .social-media_links {
    justify-content: center;
}

.project-limit {
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - 100px - 418px);
    padding: 3rem clamp(1rem, 4vw, 2.5rem) 5rem;
}

.projects-page > h1,
.project-detail > h1 {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    font-weight: 500;
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: 1.5rem;
}

.projects-list a {
    display: flex;
    min-height: 10rem;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    border: 1px solid color-mix(in srgb, var(--text-color) 14%, transparent);
    border-radius: 4px;
    background: var(--header-background);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.projects-list a:hover,
.projects-list a:focus-visible {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.projects-list h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
}

.projects-list span {
    font-family: 'Barlow', sans-serif;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.project-detail {
    font-family: 'Barlow', sans-serif;
    line-height: 1.6;
}

.project-detail > h1 {
    font-family: 'Oswald', sans-serif;
}

.project-detail > p {
    color: var(--muted-text-color);
}

.project-back-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.project-back-link:hover,
.project-back-link:focus-visible {
    color: var(--accent-color);
}

.article-limit {
    min-height: calc(100svh - 100px);
}

.articles-section {
    padding: 2rem clamp(1rem, 4vw, 2.5rem) 5rem;
}

.articles-section > h1,
.articles-section > h2 {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    font-weight: 500;
}

.home-articles-section {
    padding-bottom: 3rem;
}

.home-articles-section > h2 {
    text-align: center;
}

.home-articles-section .articles-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 22rem));
    justify-content: center;
}

.home-articles-section .articles-more {
    text-align: center;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: 1.5rem;
    align-items: start;
}

.article-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--text-color) 14%, transparent);
    border-radius: 4px;
    background: var(--header-background);
}

.article-card-image-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 3 / 2;
    background: #e9e6df;
}

.article-card-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-card-details {
    padding: 1.1rem 1.2rem 1.3rem;
}

.article-card-date {
    color: var(--muted-text-color);
    font-family: 'Barlow', sans-serif;
    font-size: 0.9rem;
}

.article-card h2 {
    margin: 0.55rem 0;
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.25;
}

.article-card h2 a:hover {
    color: var(--accent-color);
}

.article-card-excerpt,
.articles-message {
    color: var(--muted-text-color);
    font-family: 'Barlow', sans-serif;
    line-height: 1.55;
}

.article-card-excerpt {
    margin: 0;
}

.articles-message {
    grid-column: 1 / -1;
    margin: 0;
}

.articles-more {
    margin: 2.5rem 0 0;
    color: var(--muted-text-color);
    font-family: 'Barlow', sans-serif;
    line-height: 1.55;
}

.articles-more a {
    color: var(--text-color);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.articles-more a:hover {
    color: var(--accent-color);
}

.home-about {
    height: 100%;
    padding: 3rem;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    font-family: 'Barlow', sans-serif;
}

.home-about img {
    height: 700px;
    width: auto;
}

.book-section {
    margin-block: 5rem;
}

.book-section div, .book-section h1 {
    display: flex;
    justify-content: center;
    font-weight: 400;
}

.books-layout img {
    height: 456px;
    width: 275px;
}

.books-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-inline: clamp(1rem, 4vw, 2.5rem);
}

.fireworks-canvas {
    position: fixed;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.fireworks-status {
    position: fixed;
    z-index: 2;
    bottom: 2rem;
    left: 2rem;
    max-width: calc(100vw - 11rem);
    margin: 0;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--accent-color);
    background: var(--header-background);
    color: var(--text-color);
    font-family: 'Barlow', sans-serif;
    font-size: 0.95rem;
}

footer {
    background-color: var(--footer-background);
    color: var(--footer-text-color);
    height: 418px;
    display: flex;
    align-items: center;
    justify-content: center;
}

footer .limit {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.social-media_links {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.img a {
    display: flex;
    flex-direction: column;
    align-items: center;
}

@media (max-width: 1024px) {
    .header-limit {
        display: grid;
        grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
        align-content: center;
        min-height: 100px;
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .menu-toggle {
        grid-column: 1;
        grid-row: 1;
        width: 2rem;
        height: 2rem;
        padding: 0.35rem;
        border: 0;
        background: transparent;
        color: var(--text-color);
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.25rem;
        cursor: pointer;
        z-index: 1;
    }

    .menu-toggle span {
        display: block;
        width: 1.1rem;
        height: 1px;
        background: currentColor;
        transition: transform 280ms ease, opacity 180ms ease;
    }

    .menu-toggle[aria-expanded="true"] span:first-child {
        transform: translateY(0.32rem) rotate(45deg);
    }

    .menu-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle[aria-expanded="true"] span:last-child {
        transform: translateY(-0.32rem) rotate(-45deg);
    }

    .site-title {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: center;
        font-size: 1.5rem;
        text-align: center;
    }

    .nav-list {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
        max-height: 0;
        margin: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(-0.5rem);
        visibility: hidden;
        transition: max-height 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms ease, transform 420ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 420ms;
    }

    .header-limit.menu-open .nav-list {
        max-height: 26rem;
        margin-top: 0.75rem;
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
        transition-delay: 0s;
    }

    .nav-list li {
        border-bottom: 1px solid color-mix(in srgb, var(--text-color) 12%, transparent);
    }

    .nav-link {
        display: block;
        padding: 0.75rem 0;
    }
}

@media (max-width: 720px) {
    .fireworks-status {
        bottom: 1rem;
        left: 1rem;
        max-width: calc(100vw - 9rem);
        padding: 0.65rem 0.75rem;
        font-size: 0.85rem;
    }

    .home-about {
        min-height: auto;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        justify-items: center;
        padding: 1.25rem clamp(0.5rem, 4vw, 3rem);
    }

    .contact-limit {
        min-height: max(245px, calc(100svh - 100px - 50svh));
    }

    .home-about img,
    .home-about article {
        width: min(100%, clamp(280px, 55vw, 384px));
    }

    .home-about img {
        justify-self: center;
        align-self: center;
        height: auto;
        aspect-ratio: 4 / 5;
        max-height: none;
        object-fit: cover;
    }

    .home-about article {
        grid-row: 2;
        margin-top: 0;
    }

    .books-layout .img {
        flex-basis: 100%;
        max-width: none;
    }

    footer {
        min-height: 50svh;
        height: auto;
        padding: 2rem 1rem;
        text-align: center;
    }
}

@media (min-width: 721px) and (max-width: 1024px) {
    .site-title {
        font-size: 1.75rem;
    }

    .home-about {
        display: grid;
        min-height: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
        align-items: start;
        padding: clamp(1.5rem, 4vw, 3rem);
        gap: 2rem;
    }

    .home-about img,
    .home-about article {
        width: min(100%, 24rem);
    }

    .home-about img {
        justify-self: center;
        height: auto;
        aspect-ratio: 4 / 5;
        max-height: none;
        object-fit: contain;
    }

    .home-about article {
        grid-row: auto;
        justify-self: center;
        margin-top: 0;
    }
}