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

:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --border-color: #e0e0e0;
    --hover-color: #f5f5f5;
}

body {
    font-family: Georgia, 'Times New Roman', Times, serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Global link styles - keep all links black, visited or not */
a:link,
a:visited {
    color: var(--text-color);
}

/* Skip to content link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--text-color);
    color: var(--bg-color);
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* External link indicator */
a[target="_blank"]::after {
    content: " ↗";
    font-size: 0.8em;
}

header {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.9);
    font-style: italic;
}

nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: opacity 0.2s;
}

.logo img {
    height: 2rem;
    width: auto;
    display: block;
}

.logo:hover {
    opacity: 0.7;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    text-transform: lowercase;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.7;
}

.nav-links a.active {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
}

/* Mobile menu toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 101;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-color);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -4px);
}

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    grid-auto-rows: 8px;
    gap: 1rem;
    padding: 2rem 0;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--hover-color);
    border-radius: 4px;
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.4s ease,
                opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.portfolio-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
    pointer-events: none;
}

.portfolio-item:hover::before {
    opacity: 1;
}

.portfolio-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    filter: brightness(1.05);
    z-index: 10;
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item:hover img {
    transform: scale(1.1);
}

/* Varying sizes for visual interest - more horizontal layout */
.portfolio-item.size-small {
    grid-row-end: span 15;
    grid-column: span 1;
}

.portfolio-item.size-medium {
    grid-row-end: span 18;
    grid-column: span 1;
}

.portfolio-item.size-large {
    grid-row-end: span 22;
    grid-column: span 2;
}

.portfolio-item.size-wide {
    grid-row-end: span 16;
    grid-column: span 3;
}

@media (max-width: 768px) {
    .portfolio-item.size-wide {
        grid-column: span 1;
    }
}

/* Page Content (About, Now) */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

.about-container h1,
.now-container h1,
.consulting-container h1,
.blubot-container h1 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 2rem;
    font-style: italic;
}

/* Widen about page content on desktop */
.page-content:has(.about-container) {
    max-width: 1000px;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3rem;
    margin-top: 2rem;
    align-items: start;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

.about-text p {
    margin-bottom: 1.5rem;
}

.about-text a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.about-text a:hover {
    opacity: 0.7;
}

.about-image {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--hover-color);
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.now-container p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.now-list {
    list-style: none;
    font-size: 1.1rem;
    line-height: 1.8;
}

.now-list li {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    position: relative;
}

.now-list li::before {
    content: '•';
    position: absolute;
    left: 0;
}

.now-list a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.now-list a:hover {
    opacity: 0.7;
}

/* Consulting Page */
.consulting-container {
    max-width: 800px;
}

.consulting-logo {
    margin-bottom: 2rem;
    max-width: 100%;
}

.consulting-logo img {
    width: 100%;
    height: auto;
    display: block;
}

.consulting-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 2rem;
    color: #666;
    font-style: italic;
}

.consulting-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.consulting-content p {
    margin-bottom: 1.5rem;
}

.consulting-section {
    margin: 3rem 0;
}

.consulting-section h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1rem;
    font-style: italic;
}

.consulting-list {
    list-style: none;
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 1.5rem 0;
}

.consulting-list li {
    margin-bottom: 0.75rem;
    padding-left: 0;
}

.consulting-note {
    font-style: italic;
    color: #666;
    font-size: 0.95rem;
}

.consulting-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 3rem 0;
}

.consulting-bio {
    margin-top: 3rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.consulting-bio-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3rem;
    align-items: start;
}

.consulting-bio-text {
    flex: 1;
}

.consulting-bio h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.consulting-bio p {
    margin-bottom: 1.5rem;
}

.consulting-bio strong {
    font-weight: 600;
}

.consulting-bio-image {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--hover-color);
}

.consulting-bio-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Blu-bot and Bloon Page */
main:has(#blubot-grid) .page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Consulting Page */
main:has(#consulting-grid) .page-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.blubot-container {
    max-width: 800px;
}

.blubot-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 2rem;
    line-height: 1.8;
    font-style: italic;
}

.blubot-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.blubot-content p {
    margin-bottom: 1.5rem;
}

.blubot-content a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.blubot-content a:hover {
    opacity: 0.7;
}

/* Lightbox Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.98);
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.3s ease;
}

@keyframes modalContentFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: var(--text-color);
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.modal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 1002;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.05);
    border: none;
    transition: background-color 0.2s, opacity 0.2s;
    user-select: none;
    line-height: 1;
}

.modal-arrow:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.modal-arrow-left {
    left: 2rem;
}

.modal-arrow-right {
    right: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        padding: 1rem 1.5rem;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background-color: var(--bg-color);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2rem;
        transition: right 0.3s ease;
        z-index: 100;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links a {
        font-size: 1.5rem;
    }

    main {
        padding: 1rem;
    }

    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
        padding: 1rem 0;
    }
    
    .portfolio-item.size-small {
        grid-row-end: span 12;
    }
    
    .portfolio-item.size-medium {
        grid-row-end: span 14;
    }
    
    .portfolio-item.size-large {
        grid-row-end: span 16;
        grid-column: span 1;
    }
    
    .portfolio-item.size-wide {
        grid-column: span 1;
    }

    .page-content {
        padding: 2rem 1rem;
    }

    .about-content {
        grid-template-columns: 1fr;
    }

    .about-container h1,
    .now-container h1,
    .consulting-container h1,
    .blubot-container h1 {
        font-size: 2rem;
    }
    
    .consulting-subtitle,
    .blubot-subtitle {
        font-size: 1.1rem;
    }
    
    .consulting-section h2,
    .consulting-bio h2 {
        font-size: 1.3rem;
        font-style: italic;
    }

    .consulting-bio-content {
        grid-template-columns: 1fr;
    }

    .modal-close {
        top: 1rem;
        right: 1rem;
    }

    .modal-arrow {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }

    .modal-arrow-left {
        left: 1rem;
    }

    .modal-arrow-right {
        right: 1rem;
    }
}

/* Footer */
footer {
    border-top: 1px solid var(--border-color);
    padding: 3rem 2rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.contact-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    text-transform: lowercase;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
}

.contact-button:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

.copyright {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    text-align: center;
}

/* 404 Error Page */
.error-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 4rem 2rem;
}

.error-container h1 {
    font-size: 6rem;
    font-weight: 400;
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1;
}

.error-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    color: #666;
    text-transform: lowercase;
}

.error-message {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 3rem;
    color: #666;
}

.error-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
    text-transform: lowercase;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
}

.error-button:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
}

@media (max-width: 768px) {
    .error-container {
        padding: 2rem 1rem;
    }

    .error-container h1 {
        font-size: 4rem;
    }

    .error-subtitle {
        font-size: 1.3rem;
    }

    .error-message {
        font-size: 1rem;
    }

    .error-button {
        padding: 0.625rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    footer {
        padding: 2rem 1rem;
        margin-top: 2rem;
    }

    .contact-button {
        padding: 0.625rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Blog Styles */
.blog-container {
    max-width: 800px;
}

.blog-container h1 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 3rem;
    font-style: italic;
}

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.blog-post {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 3rem;
}

.blog-post:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.blog-post-header {
    margin-bottom: 1.5rem;
}

.blog-post-title {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 1rem;
    font-style: italic;
    line-height: 1.3;
}

.blog-post-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.blog-post-date {
    font-style: italic;
}

.blog-post-author {
    font-style: italic;
}

.blog-post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.blog-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    background-color: var(--hover-color);
    border-radius: 3px;
    color: var(--text-color);
    font-style: italic;
}

.blog-post-excerpt {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #666;
    font-style: italic;
    margin-bottom: 1.5rem;
}

/* Blog Post Preview Cards (List View) */
.blog-post-preview {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
}

.blog-post-preview:hover {
    border-color: var(--text-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.blog-post-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 2rem;
    transition: opacity 0.2s;
}

.blog-post-link:hover {
    opacity: 1;
}

.blog-post-preview-header {
    margin-bottom: 1rem;
}

.blog-post-preview-title {
    font-size: 1.75rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
    font-style: italic;
    line-height: 1.3;
    color: var(--text-color);
}

.blog-post-preview-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.blog-post-preview-date {
    font-style: italic;
}

.blog-post-preview-author {
    font-style: italic;
}

.blog-post-preview-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.blog-post-preview-excerpt {
    font-size: 1rem;
    line-height: 1.7;
    color: #666;
    font-style: italic;
    margin-top: 1rem;
}

/* Back link for single post view */
.blog-back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-style: italic;
    transition: opacity 0.2s;
}

.blog-back-link:hover {
    opacity: 0.7;
}

.blog-post-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4,
.blog-post-content h5,
.blog-post-content h6 {
    font-weight: 400;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.blog-post-content h1 {
    font-size: 2rem;
}

.blog-post-content h2 {
    font-size: 1.75rem;
}

.blog-post-content h3 {
    font-size: 1.5rem;
}

.blog-post-content h4 {
    font-size: 1.25rem;
}

.blog-post-content p {
    margin-bottom: 1.5rem;
}

.blog-post-content ul,
.blog-post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.blog-post-content li {
    margin-bottom: 0.5rem;
}

.blog-post-content blockquote {
    border-left: 3px solid var(--border-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #666;
}

.blog-post-content code {
    background-color: var(--hover-color);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.blog-post-content pre {
    background-color: var(--hover-color);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.blog-post-content pre code {
    background-color: transparent;
    padding: 0;
}

.blog-post-content a {
    color: var(--text-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}

.blog-post-content a:hover {
    opacity: 0.7;
}

.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5rem 0;
}

.blog-post-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

.blog-loading,
.blog-empty,
.blog-error {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
    font-size: 1.1rem;
    font-style: italic;
}

@media (max-width: 768px) {
    .blog-container h1 {
        font-size: 2rem;
    }

    .blog-post-title,
    .blog-post-preview-title {
        font-size: 1.5rem;
    }

    .blog-posts {
        gap: 2rem;
    }

    .blog-post {
        padding-bottom: 2rem;
    }

    .blog-post-link {
        padding: 1.5rem;
    }

    .blog-post-content h1 {
        font-size: 1.75rem;
    }

    .blog-post-content h2 {
        font-size: 1.5rem;
    }

    .blog-post-content h3 {
        font-size: 1.25rem;
    }
}
