:root {
    --bg: #FOEADD;
    --fg: #1A1A1A;
    --muted: #6B6B6B;
    --accent: #C4A47C;
    --accent-hover: #B08D5B;
    --border: #d0d0d0;
    --card-bg: white;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1d23;
        --fg: #e5e7eb;
        --muted: #9ca3af;
        --accent: #d4b896;
        --accent-hover: #e5c9a8;
        --border: #374151;
        --card-bg: #252a33;
    }
}

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

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Index Page Syles */
.container {
    max-width: 600px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
    margin: 0 auto;
}


.home-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.name {
    font-family: 'Merriweather', serif;
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    gap: 0.5rem;
}

.title-icon {
    height: 1.2em;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    margin-left: 0.3rem;
}

.title-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    isolation: isolate;
    transform: translateY(0.17em);
}

.title-icon-wrap .title-icon {
    position: relative;
    z-index: 2;
}

.title-icon-greeting {
    position: absolute;
    top: -0.2em;
    right: -0.45em;
    z-index: 1;
    font-family: 'Caveat', cursive;
    font-size: 0.48em;
    font-weight: 700;
    line-height: 1;
    color: #d97706;
    opacity: 0;
    transform: translate(-0.5em, 0.35em) scale(0.85) rotate(8deg);
    transform-origin: bottom left;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
}

.title-icon-wrap:hover .title-icon-greeting {
    opacity: 1;
    transform: translate(0.05em, -0.35em) scale(1) rotate(8deg);
}

.tilt-right {
    transform: rotate(4deg);
}

.tilt-right:hover {
    transform: rotate(8deg) scale(1.1);
}

.tilt-left {
    transform: rotate(-4deg);
}

.tilt-left:hover {
    transform: rotate(-8deg) scale(1.1);
}

.intro {
    margin-top: 2.5rem;
    font-size: 1.05rem;
    color: var(--fg);
    font-weight: 400;
    line-height: 1.7;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

nav {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

nav a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--fg);
    text-decoration: none;
    position: relative;
    padding-bottom: 2px;
    transition: color 0.2s ease;
}

nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

nav a:hover {
    color: var(--accent-hover);
}

nav a:hover::after {
    width: 100%;
}

/* Projects Page Styles */
.page {
    max-width: 600px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    animation: fadeIn 0.8s ease-out;
}

.back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
    text-decoration: none;
    margin-bottom: 3rem;
    transition: color 0.2s ease;
}

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

.back svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

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

header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-family: 'Merriweather', serif;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.lead {
    font-size: 1.05rem;
    color: var(--muted);
    max-width: 380px;
    margin: 0 auto;
}

/* Projects grid */
.projects-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.project-card {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card-bg);
}

.project-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0;
}

.project-app-icon {
    width: 56px;
    height: 56px;
    max-width: 56px;
    max-height: 56px;
    border-radius: 22%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.08);
}

.project-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
    gap: 0.25rem;
}

.project-meta h3 {
    font-size: 1.18rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.15;
}

.project-meta p {
    font-size: 0.95rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.35;
}

.project-bullets {
    margin-top: 1.1rem;
    padding-left: 0;
    list-style: none;
}

.project-bullets li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 0.4rem;
}

.project-bullets li:last-child {
    margin-bottom: 0;
}

.project-bullet-icon {
    width: 0.95rem;
    height: 0.95rem;
    margin-top: 0.18rem;
    flex-shrink: 0;
    opacity: 0.92;
}

.project-link {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.project-link:hover {
    color: var(--accent-hover);
}

.project-link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.project-link:hover svg {
    transform: translateX(3px);
}

.project-chip {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-hover);
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.project-chip:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}

/* Coming soon state */
.coming-soon {
    text-align: center;
    padding: 1.5rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.coming-soon-text {
    font-size: 1rem;
    color: var(--muted);
    font-weight: 400;
}

.coming-soon-sub {
    font-size: 0.9rem;
    color: var(--muted);
    opacity: 0.7;
    margin-bottom: 1rem;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 0 auto 3rem;
    max-width: 120px;
}

/* Subscribe section */
.subscribe {
    text-align: center;
}

.subscribe h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subscribe .subtitle {
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.substack-embed {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
    width: 100%;
    max-width: 480px;
}

.substack-embed iframe {
    display: block;
    width: 100%;
    height: 150px;
    border: 0;
    background: var(--card-bg);
}

.dark-mode-apology {
    display: none;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.75rem;
    font-style: italic;
}

@media (prefers-color-scheme: dark) {
    .dark-mode-apology {
        display: block;
    }
}

/* Media Queries */
@media (prefers-reduced-motion: reduce) {

    .container,
    .page {
        animation: none;
    }

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

@media (max-width: 480px) {

    /* Index specific mobile styles */
    .home-body {
        padding: 1.5rem;
    }

    .container {
        padding: 0 0.5rem;
    }

    .name {
        flex-direction: column;
        white-space: normal;
        gap: 0;
        line-height: 1.1;
        font-size: 2rem;
    }

    .intro {
        margin-top: 2rem;
        font-size: 1rem;
        padding: 0 1rem;
    }

    nav {
        margin-top: 2.5rem;
        gap: 1.5rem;
    }

    .title-icon {
        height: 1.1em;
    }

    /* Projects specific mobile styles */
    .page {
        padding: 3rem 1.5rem 4rem;
    }
}

/* About Page Styles */
.content {
    margin-bottom: 3rem;
}

.content p {
    font-size: 1.05rem;
    color: var(--fg);
    line-height: 1.75;
    margin-bottom: 1.25rem;
}

.content p:last-child {
    margin-bottom: 0;
}

.content a {
    color: var(--fg);
    text-decoration: none;
    font-weight: 600;
}

.content a:hover {
    text-decoration: underline;
}

.signature {
    font-family: 'Caveat', cursive;
    font-size: 12rem;
    color: var(--fg);
    margin-top: 2.5rem;
}

/* Easter Egg Slot Animation */
.my-prefix {
    display: inline;
    transition: opacity 0.3s ease;
}

.my-prefix.hidden {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.easter-egg-slot {
    display: inline-flex;
    position: relative;
    vertical-align: baseline;
    overflow: hidden;
    padding-right: 0.5em;
}

.slot-container {
    display: inline-flex;
    position: relative;
    align-items: baseline;
    transition: width 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.slot-item {
    display: inline-flex;
    align-items: baseline;
    white-space: nowrap;
}

.slot-item .title-icon {
    align-self: center;
    margin-left: 0.4rem;
}

.slot-item.entering {
    position: absolute;
    left: 0;
    top: 0;
    transform: translateY(100%);
    opacity: 0;
}

.slot-item.active {
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.5s ease;
}

.slot-item.active.bouncing {
    animation: slotSlide 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.slot-item.exiting {
    position: absolute;
    left: 0;
    top: 0;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1), opacity 0.5s ease;
}

@keyframes slotSlide {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .slot-item,
    .slot-item.active,
    .slot-item.exiting,
    .slot-item.entering,
    .slot-container,
    .my-prefix {
        animation: none !important;
        transition: none !important;
    }
}
