:root {
    color-scheme: light;
    --paper: #FFF3E0;
    --ink: #110D00;
    --muted: #735f2a;
    --line: #110D00;
    --line-soft: rgba(17, 13, 0, 0.24);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #110D00;
    --ink: #FFF3E0;
    --muted: #d6c596;
    --line: #FFF3E0;
    --line-soft: rgba(255, 243, 224, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Tahoma, Verdana, sans-serif;
    transition: background 0.18s ease, color 0.18s ease;
}

a {
    color: var(--ink);
    text-decoration: none;
}

a:hover,
button:hover {
    color: var(--muted);
}

button {
    color: var(--ink);
    font: inherit;
}

.theme-toggle {
    display: inline-flex;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 20;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.16s ease;
}

.theme-toggle:hover {
    background: var(--ink);
    color: var(--paper);
    transform: scale(1.06);
}

.theme-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.theme-icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
    display: block;
}

.pageheader {
    width: min(100% - 28px, 1180px);
    margin: 0 auto;
    border-bottom: 2px solid var(--line);
    padding: 24px 0 16px;
}

.pageheadertext {
    margin: 0;
    color: var(--ink);
    font-size: clamp(34px, 6vw, 64px);
    font-weight: 900;
    letter-spacing: 0;
    line-height: 0.95;
}

.home-page .pageheader {
    display: flex;
    position: relative;
    min-height: 100vh;
    width: min(100% - 28px, 1180px);
    margin: 0 auto;
    align-items: center;
    border-bottom: 0;
    padding: 0;
    justify-content: center;
}

.home-page .hero-title-group {
    display: grid;
    width: max-content;
    max-width: 100%;
    gap: 4px;
    text-align: center;
}

.home-page .hero-name {
    display: flex;
    justify-content: space-between;
    margin: 0;
    color: var(--ink);
    font-size: 54px;
    font-weight: 900;
    line-height: 0.8;
}

.hero-name-accessible {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.home-page .pageheadertext {
    max-width: 1100px;
    font-size: clamp(64px, 14vw, 168px);
    line-height: 0.75;
}

.container {
    display: flex;
    flex-direction: column;
    gap: 46px;
    width: min(100% - 28px, 1180px);
    margin: 24px auto 40px;
}

.home-page .container {
    margin-bottom: 60vh;
}

.intro-panel {
    max-width: 920px;
}

.title {
    margin: 0;
    color: var(--ink);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1.15;
}

p.para {
    max-width: 920px;
    margin: 10px 0 0;
    color: var(--ink);
    font-size: 17px;
    line-height: 1.58;
    text-align: left;
}

.links {
    align-self: start;
}

.home-page .links,
.blog-return {
    width: 100%;
    align-self: center;
    text-align: center;
}

.links .title,
.blogdisplay > .title {
    margin-bottom: 16px;
}

.links:not(#links-section) a:not(.link-icon) {
    display: block;
    width: fit-content;
    padding: 0;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.3;
}

.links:not(#links-section) a:not(.link-icon):hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

#links-section {
    scroll-margin-top: 0;
}

#main-content {
    scroll-margin-top: 24px;
}

.links-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 42px 28px;
    perspective: 900px;
}

.link-icon {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    display: inline-flex;
    position: relative;
    width: 96px;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--line);
    border-radius: 18px;
    background: transparent;
    color: var(--ink);
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1);
    transform-style: preserve-3d;
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease;
    will-change: transform;
}

.link-icon:hover,
.link-icon.is-hovered,
.link-icon:focus-visible {
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1.08);
}

.link-icon::after {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    width: max-content;
    max-width: 220px;
    content: attr(data-label);
    color: var(--ink);
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 900;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.link-icon:hover::after,
.link-icon.is-hovered::after,
.link-icon:focus-visible::after {
    opacity: 1;
    transform: translate(-50%, 0);
}

.link-icon svg {
    width: 52px;
    height: 52px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.link-logo {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: contain;
    transition: filter 0.16s ease;
}

:root[data-theme="dark"] .link-logo {
    filter: invert(1);
}

.link-icon:hover .link-logo,
.link-icon.is-hovered .link-logo,
.link-icon:focus-visible .link-logo {
    filter: invert(1);
}

:root[data-theme="dark"] .link-icon:hover .link-logo,
:root[data-theme="dark"] .link-icon.is-hovered .link-logo,
:root[data-theme="dark"] .link-icon:focus-visible .link-logo {
    filter: invert(0);
}

.logo-filters {
    position: absolute;
    pointer-events: none;
}

.link-icon .link-logo-youtube {
    filter: url("#youtube-ink");
    transition: none;
}

:root[data-theme="dark"] .link-icon .link-logo-youtube,
.link-icon:hover .link-logo-youtube,
.link-icon.is-hovered .link-logo-youtube,
.link-icon:focus-visible .link-logo-youtube {
    filter: url("#youtube-paper");
}

:root[data-theme="dark"] .link-icon:hover .link-logo-youtube,
:root[data-theme="dark"] .link-icon.is-hovered .link-logo-youtube,
:root[data-theme="dark"] .link-icon:focus-visible .link-logo-youtube {
    filter: url("#youtube-ink");
}

.link-icon-text span {
    font-size: 44px;
    font-weight: 900;
    line-height: 1;
}

.home-projects {
    width: min(100%, 920px);
    align-self: center;
}

.home-projects > .title {
    margin-bottom: 16px;
}

.project-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.project-card {
    display: block;
    padding: 18px 0 20px;
    color: var(--ink);
    border-top: 1px solid var(--line);
}

.project-card:last-child {
    border-bottom: 1px solid var(--line);
}

.project-card:hover {
    color: var(--ink);
    text-decoration: none;
}

.project-card:hover .project-title {
    text-decoration: underline;
    text-underline-offset: 5px;
}

.project-title,
.project-note {
    display: block;
}

.project-title {
    color: var(--ink);
    overflow-wrap: anywhere;
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 900;
    line-height: 1.04;
}

.project-note {
    max-width: 680px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.45;
}

.blogs-container {
    gap: 54px;
}

.blog-return {
    align-self: center;
}

.blog-return .links-grid {
    gap: 42px 28px;
}

.blogdisplay {
    width: min(100%, 920px);
    min-width: 0;
    align-self: center;
}

.blog {
    width: 100%;
    margin: 0;
    border-top: 1px solid var(--line);
    text-align: left;
}

.blog:last-child {
    border-bottom: 1px solid var(--line);
}

.collapsible {
    width: 100%;
    min-height: 0;
    margin: 0;
    border: 0;
    outline: none;
    background: transparent;
    cursor: pointer;
    padding: 18px 0;
    text-align: left;
}

.collapsible:hover .blogtitle {
    text-decoration: underline;
    text-underline-offset: 5px;
}

.titledisplay {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: baseline;
}

.blogtitle {
    margin: 0 0 6px;
    color: var(--ink);
    font-size: clamp(22px, 2.8vw, 34px);
    font-weight: 900;
    line-height: 1.08;
    text-align: left;
}

.blogsubject,
.blogdate,
.blogwordcount {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-align: left;
}

.blogbody {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

.blogbodytext {
    max-width: 860px;
    margin: 0 0 14px;
    color: var(--ink);
    font-size: 16px;
    line-height: 1.6;
    text-align: left;
}

.blogimage {
    display: block;
    width: min(95%, 860px);
    margin: 12px 0 18px;
    border: 1px solid var(--line);
}

.blog iframe {
    display: block;
    max-width: 100%;
    margin: 12px 0 18px;
    border: 1px solid var(--line);
    background: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .link-icon,
    .link-icon::after {
        transition: none;
    }
}

@media (max-width: 820px) {
    .container,
    .blogs-container {
        gap: 26px;
    }

    .intro-panel {
        max-width: none;
    }
}

@media (max-width: 540px) {
    .pageheader,
    .container {
        width: min(100% - 20px, 1180px);
    }

    .pageheader {
        padding: 18px 0 12px;
    }

    .home-page .pageheader {
        min-height: 100vh;
        padding: 0;
    }

    .home-page .pageheadertext {
        font-size: 52px;
    }

    .home-page .hero-name { font-size: 32px; }

    .theme-toggle {
        top: 14px;
        right: 14px;
        width: 44px;
        height: 44px;
    }

    .links-grid {
        gap: 44px 18px;
    }

    .link-icon {
        width: min(42vw, 132px);
        border-radius: 16px;
    }

    p.para,
    .project-note,
    .blogbodytext {
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .home-page .pageheadertext {
        font-size: 44px;
    }
}
/* Shared Home shortcut; reference markup is commented beside the homepage theme switch. */
.home-shortcut {
    position: fixed;
    top: 24px;
    right: 84px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);
}
.home-shortcut:hover, .home-shortcut:focus-visible {
    color: var(--paper);
    background: var(--ink);
}
@media (max-width: 540px) {
    .home-shortcut { top: 14px; right: 70px; width: 44px; height: 44px; }
}
