/* ==========================================================================
   Colton Francis — portfolio
   Theming runs entirely on custom properties, so the light/dark toggle only
   has to add or remove [data-theme="light"] on <html>.
   ========================================================================== */

/* ===== CSS Variables (theming) ===== */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2333;
    --bg-elevated: #2d3748;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent: #58a6ff;
    --accent-contrast: #04121f;
    --accent-glow: rgba(88, 166, 255, 0.15);
    --border-subtle: #30363d;
    --shadow-card: 0 8px 24px rgba(0,0,0,0.6);
    --shadow-card-hover: 0 12px 32px rgba(0,0,0,0.45);
    --radius: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="light"] {
    --bg-primary: #f6f8fa;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-elevated: #e1e4e8;
    --text-primary: #1f2328;
    --text-secondary: #424a53;
    --text-muted: #656d76;
    --border-subtle: #d0d7de;
    --shadow-card: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-card-hover: 0 12px 32px rgba(0,0,0,0.12);
    --accent: #0969da;
    --accent-contrast: #ffffff;
    --accent-glow: rgba(9, 105, 218, 0.12);
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
    -webkit-text-size-adjust: 100%;
}
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.8; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform var(--transition);
}
.skip-link:focus-visible { transform: translateY(0); opacity: 1; }

/* ===== Scroll Reveal =====
   Only hide sections when JS is present to reveal them again, so the page is
   fully readable if the script fails to load. */
.js .section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.js .section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Navigation ===== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition), border-color var(--transition);
}
.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    height: 64px;
}
.nav-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}
.nav-logo:hover { opacity: 1; color: var(--accent); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.8rem;
    margin-left: auto;
}
.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition);
}
.nav-links a:hover { color: var(--text-primary); opacity: 1; }
.nav-links a:hover::after { width: 100%; }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 1.8rem;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    color: var(--text-secondary);
}
.theme-toggle:hover { background: var(--bg-elevated); color: var(--text-primary); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 6px;
}
.hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}
.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Hero ===== */
.hero-section {
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 0 2rem;
    position: relative;
}
.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.hero-greeting { font-size: 1rem; color: var(--accent); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.hero-name { font-size: 3.8rem; font-weight: 800; line-height: 1.1; letter-spacing: -1px; margin: 0.25rem 0; }
.hero-tagline { font-size: 1.4rem; color: var(--text-secondary); font-weight: 400; margin-bottom: 0.75rem; }
.hero-description { max-width: 500px; color: var(--text-secondary); font-size: 1.1rem; margin-bottom: 2rem; }

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.6rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-primary);
    transition: var(--transition);
    cursor: pointer;
}
.btn:hover { opacity: 1; }
.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
}
.btn-primary:hover { opacity: 0.85; color: var(--accent-contrast); }
.btn-secondary {
    border-color: var(--border-subtle);
    background: var(--bg-secondary);
}
.btn-secondary:hover { background: var(--bg-elevated); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--bg-elevated); border-color: var(--border-subtle); }
.btn-small { padding: 0.4rem 1rem; font-size: 0.85rem; }

.hero-code-block {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.8rem 2rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 2;
    box-shadow: var(--shadow-card);
    overflow-x: auto;
}
.code-line { display: block; white-space: pre; }
.code-keyword { color: #ff7b72; }
.code-type    { color: #ffa657; }
.code-this    { color: #d2a8ff; }
.code-prop    { color: #79c0ff; }
.code-string  { color: #a5d6ff; }

/* Syntax colours tuned for the light background. */
[data-theme="light"] .code-keyword { color: #cf222e; }
[data-theme="light"] .code-type    { color: #953800; }
[data-theme="light"] .code-this    { color: #8250df; }
[data-theme="light"] .code-prop    { color: #0550ae; }
[data-theme="light"] .code-string  { color: #0a3069; }

.hero-scroll-indicator {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 1.6rem;
    animation: bounce 2s infinite;
}
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* ===== Section titles ===== */
.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.5px;
    position: relative;
    display: inline-block;
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--accent);
    border-radius: 4px;
}

/* ===== About ===== */
.about-section { padding: 4rem 0; }
.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2.5rem;
    align-items: start;
}
.about-text p { margin-bottom: 1rem; color: var(--text-secondary); }
.about-text strong { color: var(--text-primary); }

.about-highlights {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: var(--bg-secondary);
    padding: 1.8rem 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
}
.highlight-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.highlight-icon { font-size: 1.5rem; }

/* ===== Projects ===== */
.projects-section { padding: 4rem 0; }
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}
.project-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.8rem;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}
.project-card:hover,
.project-card:focus-within {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: var(--shadow-card-hover);
}
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.6rem;
}
.project-name { font-size: 1.3rem; font-weight: 700; }
.project-tag {
    background: var(--bg-elevated);
    padding: 0.2rem 0.8rem;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.project-description { color: var(--text-secondary); font-size: 0.95rem; flex: 1; margin-bottom: 1.2rem; }
.project-links {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: auto;
}
.project-demo-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}

/* ===== Education ===== */
.education-section { padding: 4rem 0; }
.education-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.edu-item {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-secondary);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    /* Accent stripe: set after the shorthand so it isn't overwritten. */
    border-left: 4px solid var(--accent);
}
.edu-school { font-size: 1.3rem; font-weight: 700; }
.edu-location { color: var(--text-secondary); font-size: 0.95rem; }
.edu-degree { font-weight: 500; margin: 0.2rem 0; }
.edu-date { color: var(--text-muted); font-size: 0.9rem; }

/* ===== Skills ===== */
.skills-section { padding: 4rem 0; }
.skills-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}
.skill-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.skill-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.skill-pills li {
    background: var(--bg-elevated);
    padding: 0.3rem 1rem;
    border-radius: 40px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}
/* In-progress skill, visually de-emphasised. */
.skill-pills li.skill-pending {
    background: transparent;
    color: var(--text-secondary);
    border-style: dashed;
}

/* ===== Contact ===== */
.contact-section { padding: 4rem 0 3rem; }
.contact-content {
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
}
.contact-text { margin-bottom: 1.8rem; color: var(--text-secondary); font-size: 1.05rem; }
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2.5rem;
}
.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-weight: 500;
}
.contact-icon { font-size: 1.2rem; }
.contact-location { color: var(--text-secondary); cursor: default; }

.contact-resume {
    margin-top: 2rem;
    padding-top: 1.8rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem 1.2rem;
}
.contact-resume-note { color: var(--text-muted); font-size: 0.9rem; }

/* ===== Footer ===== */
.site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: 2rem;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.footer-copy { color: var(--text-muted); font-size: 0.9rem; }
.footer-heart { color: #e34c4c; }
.footer-small { font-size: 0.85rem; color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 850px) {
    .hero-container { grid-template-columns: 1fr; text-align: center; }
    .hero-description { margin-left: auto; margin-right: auto; }
    .hero-cta { justify-content: center; }
    .about-grid { grid-template-columns: 1fr; }
    .hero-name { font-size: 2.8rem; }
    .nav-links { gap: 1.2rem; }
    .nav-actions { margin-left: 1.2rem; }
}

@media (max-width: 650px) {
    .nav-toggle { display: flex; }
    .nav-links {
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem 2rem;
        gap: 1.2rem;
        margin-left: 0;
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: var(--shadow-card);
        display: none;
    }
    .nav-links.open { display: flex; }
    .nav-actions { margin-left: 0; }
    .hero-section { min-height: auto; }
    .hero-name { font-size: 2.2rem; }
    .hero-code-block { font-size: 0.75rem; padding: 1rem; }
    .projects-grid { grid-template-columns: 1fr; }
    .contact-content { padding: 1.75rem 1.5rem; }
    .contact-links { flex-direction: column; gap: 0.8rem; }
}

/* ===== Motion preferences ===== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .js .section { opacity: 1; transform: none; }
    .project-card:hover { transform: none; }
}

@media print {
    .site-nav, .skip-link, .hero-scroll-indicator { display: none; }
    .js .section { opacity: 1; transform: none; }
    body { background: #fff; color: #000; }
}
