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

:root {
    --bg-color: #e8e8e8;
    --text-color: #1a1a1a;
    --accent-color: #666666;
    --hover-opacity: 0.7;
    --transition-speed: 0.3s;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    letter-spacing: -0.01em;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

body.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #e8e8e8;
    --accent-color: #999999;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

h1 {
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 10px;
}

h2 {
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 20px;
}

h3 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
}

.divider {
    margin: 40px 0;
    color: var(--accent-color);
}

/* Apple Notes-style Hero Quote */
.hero-quote {
    font-size: 14px;
    line-height: 1.6;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--text-color);
    margin: 40px 0;
    padding: 16px 20px;
    font-style: normal;
    background-color: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    text-align: left;
}

body.dark-mode .hero-quote {
    background-color: rgba(255, 255, 255, 0.05);
}

.intro {
    margin-bottom: 20px;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.contact-links a {
    color: var(--text-color);
    text-decoration: underline;
    transition: opacity var(--transition-speed) ease;
}

.contact-links a:hover {
    opacity: var(--hover-opacity);
}

.separator {
    color: var(--accent-color);
}

.expandable-section {
    margin: 20px 0;
}

.section-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    padding: 10px 0;
    width: 100%;
    text-align: left;
    transition: opacity var(--transition-speed) ease;
    letter-spacing: -0.01em;
}

.section-toggle:hover {
    opacity: var(--hover-opacity);
}

.section-toggle:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.arrow {
    display: inline-block;
    transition: transform var(--transition-speed) ease;
}

.section-content {
    max-height: 2000px;
    overflow: visible;
    transition: max-height 0.5s ease, opacity var(--transition-speed) ease;
    margin-top: 20px;
}

.section-content.hidden {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    overflow: hidden;
}

/* Philosophy Section - Simple Style */
#philosophy-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-color);
    letter-spacing: -0.01em;
}

.philosophy-text {
    font-size: 15px;
    line-height: 1.8;
    letter-spacing: -0.01em;
    color: var(--text-color);
}

.philosophy-text p {
    margin-bottom: 20px;
    opacity: 0.92;
}

.philosophy-text p:last-child {
    margin-top: 28px;
    margin-bottom: 0;
}

.philosophy-text strong {
    font-weight: 600;
    opacity: 1;
    font-size: 15px;
}

/* Think Different Section - Enhanced Apple-inspired styling */
.think-different {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-style: italic;
    line-height: 1.8;
    text-align: left;
    padding: 40px 30px;
    background: linear-gradient(145deg, rgba(0, 0, 0, 0.03) 0%, rgba(0, 0, 0, 0.01) 100%);
    border-radius: 0;
    margin: 20px 0;
    color: var(--text-color);
    font-size: 13px;
    letter-spacing: 0.02em;
    border-left: 5px solid var(--accent-color);
    position: relative;
    overflow: hidden;
    font-weight: 400;
}

/* Subtle gradient overlay for depth */
.think-different::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(0, 0, 0, 0.02), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.think-different > * {
    position: relative;
    z-index: 1;
}

body.dark-mode .think-different {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
}

body.dark-mode .think-different::before {
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.03), transparent 60%);
}

.think-different p {
    margin-bottom: 12px;
    opacity: 0.85;
    transition: opacity 0.4s ease, transform 0.3s ease;
}

.think-line {
    margin-bottom: 6px;
    transition: opacity 0.4s ease, transform 0.3s ease, padding-left 0.3s ease;
}

.think-line:hover {
    opacity: 1 !important;
    transform: translateX(2px);
}

/* First line - "Here's to the crazy ones" - Hero emphasis */
.think-line:nth-child(1) {
    padding-left: 0;
    font-size: 14px;
    font-weight: 600;
    opacity: 1;
    letter-spacing: 0.03em;
    margin-bottom: 10px;
    text-transform: none;
}

/* Short impactful lines with cascading indents */
.think-line:nth-child(2) {
    padding-left: 15px;
    opacity: 0.82;
}
.think-line:nth-child(3) {
    padding-left: 40px;
    opacity: 0.80;
}
.think-line:nth-child(4) {
    padding-left: 65px;
    opacity: 0.78;
}
.think-line:nth-child(5) {
    padding-left: 90px;
    opacity: 0.76;
    margin-bottom: 10px;
}

/* Return to flush left with spacing */
.think-line:nth-child(6) {
    padding-left: 0;
    margin-top: 8px;
    opacity: 0.84;
}
.think-line:nth-child(7) {
    padding-left: 0;
    opacity: 0.82;
}
.think-line:nth-child(8) {
    padding-left: 0;
    opacity: 0.80;
    margin-bottom: 10px;
}

/* Action lines with rhythm */
.think-line:nth-child(12) {
    padding-left: 0;
    margin-top: 8px;
    opacity: 0.86;
}
.think-line:nth-child(13) {
    padding-left: 0;
    opacity: 0.84;
}
.think-line:nth-child(14) {
    padding-left: 0;
    opacity: 0.82;
}

.think-paragraph {
    margin-top: 12px;
    margin-bottom: 8px;
    font-style: normal;
    padding-left: 0;
    opacity: 0.88;
    line-height: 1.7;
    transition: opacity 0.4s ease;
}

.think-paragraph:hover {
    opacity: 0.98;
}

/* Final powerful statement */
.think-final {
    margin-top: 20px;
    font-weight: 600;
    font-style: normal;
    padding-left: 0;
    font-size: 13px;
    opacity: 1;
    color: var(--text-color);
    border-top: 2px solid rgba(0, 0, 0, 0.12);
    padding-top: 16px;
    letter-spacing: 0.015em;
    line-height: 1.6;
}

body.dark-mode .think-final {
    border-top: 2px solid rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
    .think-different {
        padding: 25px 20px;
        font-size: 12px;
        line-height: 1.7;
    }

    .think-line:nth-child(1) {
        font-size: 13px;
    }

    .think-line:nth-child(2) { padding-left: 12px; }
    .think-line:nth-child(3) { padding-left: 30px; }
    .think-line:nth-child(4) { padding-left: 48px; }
    .think-line:nth-child(5) { padding-left: 66px; }

    .think-final {
        font-size: 12px;
    }
}

.emphasis-word {
    position: relative;
    transition: font-weight 0.3s ease, opacity 0.3s ease;
}

.emphasis-word.highlighted {
    font-weight: 600;
    opacity: 1;
}

.now-entry {
    margin-bottom: 24px;
}

.now-entry time {
    display: block;
    color: var(--accent-color);
    font-size: 12px;
    margin-bottom: 8px;
}

/* Now Section - Primary Entry Emphasis */
.now-primary p {
    font-size: 15px;
    line-height: 1.8;
    letter-spacing: -0.01em;
}

/* Work History Section */
.work-entry {
    margin-bottom: 28px;
}

.work-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.work-company {
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    color: var(--text-color);
}

.work-role-separator {
    color: var(--accent-color);
    font-weight: 400;
}

.work-role {
    font-size: 14px;
    font-weight: 400;
    color: var(--accent-color);
}

.work-date {
    display: block;
    font-size: 12px;
    color: var(--accent-color);
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.work-description {
    font-size: 14px;
    line-height: 1.7;
    letter-spacing: -0.01em;
    opacity: 0.92;
    margin: 0;
}

.work-divider {
    margin: 24px 0;
    color: var(--accent-color);
    text-align: left;
}

.project {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--accent-color);
}

.project:last-child {
    border-bottom: none;
}

.project p {
    margin-bottom: 8px;
}

.tech-stack {
    color: var(--accent-color);
    font-size: 12px;
    margin-bottom: 12px;
}

.project-link {
    color: var(--text-color);
    text-decoration: underline;
    transition: opacity var(--transition-speed) ease;
}

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

footer {
    margin-top: 60px;
    text-align: right;
}

.footer-signature {
    background: none;
    border: none;
    color: var(--accent-color);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: opacity var(--transition-speed) ease;
}

.footer-signature:hover {
    opacity: var(--hover-opacity);
}

.footer-signature:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.easter-egg-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 20px 40px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.easter-egg-message.show {
    opacity: 1;
}

.easter-egg-message.hidden {
    display: none;
}

/* Cursor Trail Image Animation - Optimized with Sprite Sheet */
.cursor-trail-image {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.9;
    /* Use transform for better performance (GPU-accelerated) */
    transition: opacity 1.8s cubic-bezier(0.4, 0, 0.6, 1),
                transform 1.8s cubic-bezier(0.4, 0, 0.6, 1);
    /* Prevent blurry images during animation */
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    /* Sprite sheet background */
    background-repeat: no-repeat;
}

.cursor-trail-image.fade {
    opacity: 0;
    transform: scale(0.3) rotate(10deg);
}

/* Disable on mobile */
@media (max-width: 768px), (hover: none) {
    .cursor-trail-image {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .contact-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .separator {
        display: none;
    }

    .divider {
        margin: 20px 0;
    }

    .now-primary p {
        font-size: 14px;
    }

    /* Work History Mobile */
    .work-header {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }

    .work-role-separator {
        display: none;
    }

    .work-divider {
        margin: 20px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Wikipedia-style Tooltip */
.term {
    position: relative;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--text-color);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    cursor: help;
    color: inherit;
    transition: text-decoration-color 0.2s ease;
}

.term:hover {
    text-decoration-color: var(--accent-color);
}

/* HTML Tooltip (via JavaScript) */
.term-tooltip {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    
    background-color: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    min-width: 350px;
    max-width: 550px;
    text-align: left;
    white-space: normal;
    text-decoration: none;
    
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.term-tooltip strong {
    font-weight: 700;
    color: white;
}

.term-tooltip-arrow {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
}

.term:hover .term-tooltip,
.term:hover .term-tooltip-arrow {
    opacity: 1;
    visibility: visible;
}

/* Tooltip below variant */
.term.tooltip-below .term-tooltip {
    bottom: auto;
    top: calc(100% + 12px);
}

.term.tooltip-below .term-tooltip-arrow {
    bottom: auto;
    top: calc(100% + 4px);
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.95);
}

body.dark-mode .term-tooltip {
    background-color: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
}

body.dark-mode .term-tooltip strong {
    color: #1a1a1a;
}

body.dark-mode .term-tooltip-arrow {
    border-top-color: rgba(255, 255, 255, 0.95);
}

body.dark-mode .term.tooltip-below .term-tooltip-arrow {
    border-top-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.95);
}

/* Only show CSS-based tooltips for terms without HTML tooltips */
.term:not([data-definition-html])::after {
    content: attr(data-definition);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 12px);
    transform: translateX(-50%);
    
    background-color: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    min-width: 350px;
    max-width: 550px;
    text-align: left;
    white-space: normal;
    text-decoration: none;
    
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.term:not([data-definition-html])::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%);
    
    border: 8px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.95);
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
}

/* Show tooltip below when it would overflow top */
.term.tooltip-below:not([data-definition-html])::after {
    bottom: auto;
    top: calc(100% + 12px);
}

.term.tooltip-below:not([data-definition-html])::before {
    bottom: auto;
    top: calc(100% + 4px);
    border-top-color: transparent;
    border-bottom-color: rgba(0, 0, 0, 0.95);
}

.term:not([data-definition-html]):hover::after,
.term:not([data-definition-html]):hover::before {
    opacity: 1;
    visibility: visible;
}

body.dark-mode .term:not([data-definition-html])::after {
    background-color: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
}

body.dark-mode .term:not([data-definition-html])::before {
    border-top-color: rgba(255, 255, 255, 0.95);
}

body.dark-mode .term.tooltip-below:not([data-definition-html])::before {
    border-top-color: transparent;
    border-bottom-color: rgba(255, 255, 255, 0.95);
}

@media (max-width: 768px) {
    .term:not([data-definition-html])::after {
        left: 10px;
        transform: translateX(0);
        max-width: calc(100vw - 40px);
    }
    
    .term:not([data-definition-html])::before {
        left: 30px;
        transform: translateX(0);
    }

    .term-tooltip {
        left: 10px;
        transform: translateX(0);
        max-width: calc(100vw - 40px);
        min-width: unset;
    }
    
    .term-tooltip-arrow {
        left: 30px;
        transform: translateX(0);
    }
}
