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

:root {
    --bg: #f6f6f3;
    --surface: #ffffff;
    --surface-soft: #fbfbf9;
    --text: #000000;
    --text-soft: #2f2f2f;
    --text-muted: #4f4f4f;
    --border: #e5e5e5;
    --border-soft: #e1e1e1;
    --hover: #f4f4ef;
    --hover-border: #cfcfcf;
    --line: #d9d9d9;
    --toggle-hover: #eeeeee;
}

html[data-theme='dark'] {
    --bg: #000000;
    --surface: #1a1d21;
    --surface-soft: #20252a;
    --text: #f4f6f8;
    --text-soft: #d5dae0;
    --text-muted: #b2bac4;
    --border: #2d353f;
    --border-soft: #35404b;
    --hover: #26303a;
    --hover-border: #475767;
    --line: #35404b;
    --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);
}

.recom-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}

.recom-subtitle {
    margin-top: 0.28rem;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.recom-list {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
}

@media (max-width: 768px) {
    .recom-list {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    .recommendation-card:last-child:nth-child(odd) {
        grid-column: span 2;
    }
}

.recommendation-card {
    position: relative;
    border: 1px solid var(--border-soft);
    background: var(--surface-soft);
    border-radius: 0.6rem;
    padding: 1.25rem 1.5rem;
    transition: border-color 220ms ease, background-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.recommendation-card:hover {
    border-color: var(--hover-border);
    background: var(--hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.02);
}

.recommendation-quote-bg {
    position: absolute;
    top: -1rem;
    left: -0.25rem;
    font-size: 7rem;
    font-family: 'Georgia', serif;
    color: var(--text);
    opacity: 0.045;
    pointer-events: none;
    line-height: 1;
    font-weight: 900;
    user-select: none;
}

.recommendation-quote {
    position: relative;
    z-index: 1;
    margin: 0 0 0.9rem 0;
    font-size: 0.94rem;
    font-weight: 500;
    font-style: italic;
    color: var(--text-soft);
    line-height: 1.6;
}

.recommendation-author-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.author-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    font-size: 0.76rem;
    font-weight: 700;
    background: var(--hover);
    color: var(--text);
    border: 1.5px solid var(--border-soft);
    user-select: none;
    flex-shrink: 0;
    transition: background-color 200ms ease, color 200ms ease;
}

.recommendation-author {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.author-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text);
}

.author-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.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.5s ease, transform 0.5s 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.5s ease, transform 0.5s ease;
}

.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);
}

.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);
}

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

    .recom-title {
        font-size: 1.28rem;
    }

    .recom-subtitle {
        margin-top: 0.4rem;
        font-size: 0.88rem;
        line-height: 1.6;
    }
}

/* Disable transitions during theme change to prevent blinking */
html.theme-transition-to-dark,
html.theme-transition-to-dark *,
html.theme-transition-to-light,
html.theme-transition-to-light * {
    transition: none !important;
}

/* View Transition Base Styles */
::view-transition-group(root),
::view-transition-image-pair(root) {
    animation: none;
    isolation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
    display: block;
}

html.theme-transition-to-dark::view-transition-old(root) {
    z-index: 1;
}

html.theme-transition-to-dark::view-transition-new(root) {
    z-index: 9999;
    animation: ripple-expand 600ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

html.theme-transition-to-light::view-transition-old(root) {
    z-index: 9999;
    animation: ripple-shrink 600ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

html.theme-transition-to-light::view-transition-new(root) {
    z-index: 1;
}

@keyframes ripple-expand {
    from {
        clip-path: circle(0px at var(--clip-x) var(--clip-y));
    }
    to {
        clip-path: circle(var(--clip-radius) at var(--clip-x) var(--clip-y));
    }
}

@keyframes ripple-shrink {
    from {
        clip-path: circle(var(--clip-radius) at var(--clip-x) var(--clip-y));
    }
    to {
        clip-path: circle(0px at var(--clip-x) var(--clip-y));
    }
}
