/* ==========================================================================
   CSS Reset & Base Styles
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Variables
   ========================================================================== */
:root {
    /* Color palette */
    --primary-color: #1d7c42; /* Basecamp-inspired green */
    --primary-color-hover: #165b31;
    --secondary-color: #333333;
    --background-color: #ffffff;
    --background-alt: #f5f5f5;
    --text-color: #333333;
    --light-gray: #f5f5f5;
    --medium-gray: #e0e0e0;
    --link-color: #1d7c42;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --font-size-base: 18px;
    --font-line-height: 1.6;

    /* Dark mode colors */
    --dark-primary-color: #25a155; /* Brighter green for contrast */
    --dark-primary-color-hover: #1c7e42;
    --dark-secondary-color: #f5f5f5;
    --dark-background-color: #121212;
    --dark-text-color: #f0f0f0;
    --dark-light-gray: #1e1e1e;
    --dark-medium-gray: #2a2a2a;
    --dark-link-color: #3dd775;
    --dark-gray: #666666;
    
    /* Gradients */
    --section-gradient: linear-gradient(to right, transparent 0%, var(--background-alt) 50%, transparent 100%);
    --dark-section-gradient: linear-gradient(to right, transparent 0%, var(--dark-light-gray) 50%, transparent 100%);
}

/* ==========================================================================
   Theme Modes
   ========================================================================== */
/* Dark mode styles applied when .dark-mode class is added to html element */
html.dark-mode {
    --primary-color: var(--dark-primary-color);
    --primary-color-hover: var(--dark-primary-color-hover);
    --secondary-color: var(--dark-secondary-color);
    --background-color: var(--dark-background-color);
    --background-alt: var(--dark-light-gray);
    --text-color: var(--dark-text-color);
    --light-gray: var(--dark-light-gray);
    --medium-gray: var(--dark-medium-gray);
    --link-color: var(--dark-link-color);
}

html.dark-mode section:nth-child(even) {
    background: var(--dark-section-gradient);
    border: none;
}

html.dark-mode a::after {
    background-color: var(--dark-link-color);
}

/* ==========================================================================
   Typography
   ========================================================================== */
html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: var(--font-line-height);
    color: var(--text-color);
    background-color: var(--background-color);
    /* background-image: url('img/background.svg'); */
    background-size: cover;
    background-repeat: repeat-y;
    background-attachment: fixed;
    padding: 0;
}

h1, h2, h3 {
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 0.75em;
    line-height: 1.2em;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1em;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75em;
}

p, ul, ol {
    margin-top: 0;
    margin-bottom: 1.5em;
}

/* Last child in containers should have no bottom margin */
main section > div > *:last-child,
section p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Links
   ========================================================================== */
a {
    color: var(--link-color);
    text-decoration: none;
    position: relative;
    transition: color 0.3s;
    display: inline-block;
    line-height: 1.4;
}

a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--link-color);
    transition: width 0.3s ease-in-out;
}

a:hover::after, 
a:focus::after {
    width: 100%;
}

a:hover, 
a:focus {
    color: var(--primary-color-hover);
}

/* Skip styling the underline animation for certain elements */
footer a::after,
.skip-nav::after,
.theme-toggle::after {
    display: none;
}

/* Link variations */
.external-link {
    display: inline-block;
    margin-top: 0; /* Removing top margin since it will be inside a dd */
    font-weight: 500;
}

.project .external-link {
    margin-left: 0;
}

@media (max-width: 767px) {
    .project .external-link {
        margin-left: 0;
    }
}

.email-link {
    font-size: 1.5rem;
    font-weight: 500;
}

.email-link::after {
    height: 3px;
}

.header-email {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--link-color);
}

.header-email::after {
    height: 2px;
}

.social-link {
    display: inline-block;
    margin: 0 5px;
    color: var(--link-color);
}

/* Enhanced focus styles for keyboard users */
a:focus-visible,
button:focus-visible {
    outline: 3px solid #1d7c42;
    outline-offset: 3px;
    border-radius: 2px;
}
a:focus-visible:after {
    display: none;
}

html.dark-mode a:focus-visible,
html.dark-mode button:focus-visible {
    outline-color: #3db66b;
}

/* ==========================================================================
   Layout & Structure
   ========================================================================== */
#layout {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 3.7rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 3.7rem;
    background-color: var(--background-color);
}

/* Aside (left column) */
aside {
    grid-column: 1;
    padding: 0;
    height: 100%;
}

aside > div {
    position: sticky;
    top: 0;
    padding-top: 72px;
}

aside h2 {
    font-size: 1.4rem;
    line-height: 1.6em;
    color: #777;
    margin-bottom: 1em;
    font-weight: normal;
}

/* Main content area */
main {
    grid-column: 2;
    padding: 0;
    position: relative;
}

/* ==========================================================================
   Section Styling
   ========================================================================== */
section {
    padding: 5.2rem 4rem;
}

section:nth-child(even) {
    /* background: var(--section-gradient); */
    border-top: 1px solid var(--medium-gray);
    border-bottom: 1px solid var(--medium-gray);
}

/* ==========================================================================
   Lists
   ========================================================================== */
ul, ol {
    padding-left: 1.5em;
}

li {
    margin-bottom: 0.5em;
}

/* Highlights list */
.highlights {
    list-style: none;
    padding-left: 0;
    margin: 0 0 1.5em 0;
}

.highlights li {
    position: relative;
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.highlights li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* ==========================================================================
   Images
   ========================================================================== */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

figure {
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    font-size: 0;
}

figure img {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Projects
   ========================================================================== */
.project {
    margin-bottom: 3rem;
}

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

.project > div {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
}

.project-details {
    flex: 1;
}

.project-details h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
    color: var(--secondary-color);
    line-height: 1.2;
}

/* Definition list styling - inline format */
dl {
    margin-top: 0.5rem;
}

dt {
    font-weight: 700;
    display: inline;
    margin-right: 0.25em;
}

dt::after {
    content: ":";
}

dd {
    display: inline;
    margin-left: 0;
}

dd::after {
    content: "";
    display: block;
    margin-bottom: 1em;
}

dd:last-child::after {
    display: none;
}

/* ==========================================================================
   Job Entries
   ========================================================================== */
.job-entry {
    display: flex;
    margin-bottom: 2.5rem;
    align-items: flex-start;
}

.job-entry figure {
    flex: 0 0 80px;
    margin-right: 1.5rem;
    margin-bottom: 0;
    font-size: 0;
}

.job-entry img {
    width: 80px;
    height: 80px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.job-entry div {
    flex: 1;
}

.job-entry p {
    margin: 0 0 0.5em 0;
}

.job-entry h3 {
    margin-top: 0;
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 40px 0;
    font-size: 0.9rem;
    color: #333;
    text-align: center;
}

.copyright {
    margin-top: 10px;
    font-size: 0.8rem;
}

.social-links {
    margin-top: 15px;
    font-size: 0.9rem;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
/* Skip navigation */
.skip-nav {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.2s ease;
    overflow: hidden;
    height: 1px;
    width: 1px;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

.skip-nav:focus {
    top: 0;
    height: auto;
    width: auto;
    clip: auto;
    clip-path: none;
    outline: 2px solid white;
    outline-offset: -2px;
}

/* Screen reader only */
.sr-only, 
.hide {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 1.1rem;
    right: 1.1rem;
    background: var(--background-color);
    border: 1px solid var(--medium-gray);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: background 0.3s, box-shadow 0.3s;
}

.theme-toggle:hover {
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: var(--text-color);
    transition: opacity 0.3s, transform 0.3s;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.sun-icon circle {
    fill: var(--text-color);
}

.sun-icon line {
    stroke: var(--text-color);
}

/* Theme toggle icon display */
html:not(.dark-mode) .theme-toggle .moon-icon {
    display: block;
}

html:not(.dark-mode) .theme-toggle .sun-icon {
    display: none;
}

html.dark-mode .theme-toggle .moon-icon {
    display: none;
}

html.dark-mode .theme-toggle .sun-icon {
    display: block;
}

/* Respect user preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   404 Page
   ========================================================================== */
header {
    padding: 4rem 0 1rem;
    text-align: center;
}

header div {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

header h2 {
    font-size: 1.4rem;
    color: #555;
    margin-bottom: 1em;
    font-weight: normal;
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
/* Desktop and tablet */
@media (min-width: 768px) {
    .project > div {
        flex-direction: row;
        align-items: flex-start;
    }
    
    figure {
        flex: 0 0 150px;
        margin-right: 2rem;
        margin-bottom: 0;
    }
    
    figure img {
        width: 150px;
        height: 150px;
        border-radius: 16px;
    }
    
    dl {
        margin-top: 0;
    }
}

/* Mobile */
@media (max-width: 1023px) {
    #layout {
        display: block;
        padding: 0 2rem;
    }
    
    aside {
        position: static;
        width: 100%;
        height: auto;
        padding: 2rem 0;
    }
    
    aside > div {
        position: static;
    }
    
    main {
        width: 100%;
        padding: 0;
    }

    section {
        padding: 2rem 0;
    }
    
    section:nth-child(even) {
        background: none;
    }
    
    html.dark-mode section:nth-child(even) {
        background: none;
    }
}

@media (max-width: 767px) {
    .job-entry {
        flex-direction: column;
    }
    
    .job-entry figure {
        margin-bottom: 1rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    #layout {
        display: block;
    }
    
    aside {
        position: static;
        width: 100%;
        height: auto;
        margin-bottom: 2cm;
        padding: 0;
        text-align: center;
        background-color: #ffffff !important;
    }
    
    main {
        margin-left: 0;
    }
    
    .theme-toggle,
    .skip-nav,
    .sr-only {
        display: none !important;
    }
    
    section:nth-child(even) {
        background: none;
    }
    
    /* Print optimization */
    @page {
        size: auto;
        margin: 2cm;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.3;
        background: #fff !important;
        color: #000 !important;
    }
    
    h1, h2, h3, dt {
        page-break-after: avoid;
    }
    
    figure, dd {
        page-break-inside: avoid;
    }
    
    a {
        color: #000 !important;
        font-weight: bold;
    }
    
    /* Print URLs after links */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        font-weight: normal;
    }
    
    /* Don't print URLs for images and internal links */
    a[href^="#"]:after,
    a[href*="mailto:"]:after,
    .external-link:after {
        content: "";
    }
    
    /* QR code for digital version */
    footer:after {
        content: "Access the digital version at https://37.noahkuhn.com";
        display: block;
        text-align: center;
        margin-top: 2cm;
        font-size: 10pt;
        border-top: 1px solid #ccc;
        padding-top: 0.5cm;
    }
}

/* Konami Code Easter Egg Styles */
.konami-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.konami-content {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 2rem;
    border-radius: 8px;
    max-width: 90%;
    width: 30rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    animation: scaleIn 0.5s forwards;
    border: 1px solid var(--medium-gray);
}

.konami-content h3 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.konami-content p {
    margin: 1rem 0;
    line-height: 1.5;
}

.konami-close {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-size: 1rem;
    margin-top: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.konami-close:hover {
    background-color: var(--primary-color-hover);
}

.konami-close:focus {
    outline: 2px solid var(--primary-color-hover);
    outline-offset: 2px;
}

/* Adjust overlay for light mode */
html:not(.dark-mode) .konami-message {
    background-color: rgba(0, 0, 0, 0.7);
}

/* Adjust overlay for dark mode */
html.dark-mode .konami-message {
    background-color: rgba(0, 0, 0, 0.85);
}

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

@keyframes scaleIn {
    from { transform: scale(0.8); }
    to { transform: scale(1); }
}

/* Optional: Add a subtle background effect when Konami code is active */
.konami-active {
    overflow: hidden; /* Prevent scrolling when modal is open */
}

.konami-active::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
} 