* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f6f6f3;
    --surface: #ffffff;
    --surface-soft: #f0f0ee;
    --text: #000000;
    --text-soft: #2f2f2f;
    --text-muted: #4a4a4a;
    --border: #d8d8d8;
    --border-soft: #e1e1e1;
    --capsule-bg: #ffffff;
    --toggle-hover: #eeeeee;
}

html[data-theme='dark'] {
    --bg: #000000;
    --surface: #1a1d21;
    --surface-soft: #22272e;
    --text: #f4f6f8;
    --text-soft: #d5dae0;
    --text-muted: #b2bac4;
    --border: #35404b;
    --border-soft: #35404b;
    --capsule-bg: #20252a;
    --toggle-hover: #2a2a2a;
}

body {
    font-family: 'Geist', sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 1.1rem 1.1rem 2rem;
    line-height: 1.5;
    transition: background-color 200ms ease, color 200ms ease;
}

.page-wrap {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    text-decoration: none;
    color: var(--text-soft);
    font-size: 0.88rem;
    line-height: 1;
    margin-top: 0.25rem;
    margin-bottom: 1rem;
    transition: color 180ms ease, transform 180ms ease;
}

.back-home-arrow {
    display: inline-block;
    transition: transform 180ms ease;
}

.back-home-arrow svg {
    width: 0.98rem;
    height: 0.98rem;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.back-home:hover {
    color: var(--text);
    transform: translateX(-2px);
}

.back-home:hover .back-home-arrow {
    transform: translateX(-3px);
}

.stack-header-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.28rem;
    margin-top: 1.8rem;
    margin-bottom: 1.5rem;
}

.stack-subtitle {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-weight: 400;
}

.stack-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.5px;
}

.tech-stack-groups {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

.tech-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tech-group h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.45;
}

.tech-capsules-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.4rem;
}

.tech-card {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.52rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    user-select: none;
}

.tech-card:hover {
    background: var(--surface-soft);
    border-color: var(--border);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

html[data-theme='dark'] .tech-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.tech-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.tech-icon-wrap svg {
    width: 100%;
    height: 100%;
    display: block;
}

.tech-icon-dark {
    display: none;
    width: 100%;
    height: 100%;
}

.tech-icon-light {
    display: block;
    width: 100%;
    height: 100%;
}

html[data-theme='dark'] .tech-icon-dark {
    display: block;
}

html[data-theme='dark'] .tech-icon-light {
    display: none;
}

.tech-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--surface);
    color: var(--text);
    border-radius: 50%;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    touch-action: manipulation;
}

@media (hover: hover) {
    .theme-toggle:hover {
        background: var(--toggle-hover);
        transform: translateY(-1px);
    }
}

.theme-toggle-icon {
    width: 1rem;
    height: 1rem;
    display: inline-block;
    position: relative;
}

.theme-toggle-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-icon-moon {
    opacity: 0;
    transform: rotate(-90deg);
}

html[data-theme='dark'] .theme-icon-sun {
    opacity: 0;
    transform: rotate(90deg);
}

html[data-theme='dark'] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

@media (max-width: 820px) {
    body {
        padding: 1rem 0.95rem 1.4rem;
    }

    .page-wrap {
        max-width: 100%;
    }

    .stack-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 700px) {
    .back-home {
        font-size: 0.83rem;
    }

    .theme-toggle {
        width: 2rem;
        height: 2rem;
    }

    .stack-title {
        font-size: 1.3rem;
    }

    .tech-capsules-grid {
        gap: 0.55rem;
    }

    .tech-card {
        font-size: 0.82rem;
        padding: 0.45rem 0.78rem;
        gap: 6px;
        border-radius: 6px;
    }

    .tech-icon-wrap { width: 18px; height: 18px; }
}

@media (max-width: 520px) {
    body {
        padding: 0.9rem 0.78rem 1.2rem;
    }

    .page-head {
        gap: 0.55rem;
    }

    .stack-title {
        font-size: 1.15rem;
    }

    .tech-card {
        font-size: 0.78rem;
        padding: 0.4rem 0.68rem;
    }
}


/* Freeze transitions while theme overlay is active */
html.theme-no-transition,
html.theme-no-transition * {
    transition: none !important;
    animation: none !important;
}
/* Theme sweep — mirrors toffdarell.dev pattern */

/* Kill default cross-fade */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

/* Suppress all element transitions during the sweep so nothing bleeds */
html[data-theme-sweep="on"] *,
html[data-theme-sweep="on"] *::before,
html[data-theme-sweep="on"] *::after {
    transition: none !important;
    animation: none !important;
}

/* New theme expands in as a circle from the toggle button */
html[data-theme-sweep="on"]::view-transition-new(root) {
    clip-path: circle(0px at var(--sweep-x, 50%) var(--sweep-y, 50%));
    animation: theme-sweep 800ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 9999;
}

html[data-theme-sweep="on"]::view-transition-old(root) {
    z-index: 1;
    animation: none;
}

@keyframes theme-sweep {
    to {
        clip-path: circle(var(--sweep-r, 100vmax) at var(--sweep-x, 50%) var(--sweep-y, 50%));
    }
}

.site-footer {
    width: 100%;
    max-width: 820px;
    margin: 1.5rem auto 0;
    padding: 0.75rem 0 0.9rem;
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}