/* ============================================================
   Tyler MacInnis — portfolio
   Design system: dark-first, terminal-meets-glassmorphism
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
    --font-sans: "Inter", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

    --bg: #0a0e14;
    --bg-alt: #0e1420;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-strong: rgba(255, 255, 255, 0.07);
    --border: rgba(140, 255, 210, 0.12);
    --text: #d6dde8;
    --text-dim: #8a94a6;
    --heading: #f2f6fc;

    --accent: #2ee6a8;
    /* terminal green */
    --accent-2: #38c8f0;
    /* cyan */
    --accent-glow: rgba(46, 230, 168, 0.35);

    --radius: 14px;
    --nav-h: 64px;
    --max-w: 1080px;

    --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
    --bg: #f3f6fa;
    --bg-alt: #e8edf4;
    --surface: rgba(255, 255, 255, 0.65);
    --surface-strong: rgba(255, 255, 255, 0.85);
    --border: rgba(10, 120, 90, 0.18);
    --text: #2a3242;
    --text-dim: #5d6878;
    --heading: #101724;
    --accent: #0a9e6e;
    --accent-2: #0a7ec2;
    --accent-glow: rgba(10, 158, 110, 0.25);
    --shadow: 0 10px 40px rgba(30, 45, 70, 0.15);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body::before {
    /* subtle grid backdrop */
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 64px 64px;
    opacity: 0.25;
    pointer-events: none;
    z-index: -2;
}

.mono {
    font-family: var(--font-mono);
}

h1,
h2,
h3 {
    color: var(--heading);
    line-height: 1.2;
    margin: 0 0 0.6em;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--font-mono);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.1em 0.4em;
    font-size: 0.9em;
}

img {
    max-width: 100%;
    display: block;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

/* ---------- Glass utility ---------- */
.glass {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

/* ---------- Boot overlay ---------- */
#boot-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #05080c;
    color: var(--accent);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8vh 8vw;
    font-family: var(--font-mono);
    transition: opacity 0.5s ease;
}

#boot-overlay.done {
    opacity: 0;
    pointer-events: none;
}

#boot-overlay.hidden {
    display: none;
}

#boot-log {
    margin: 0;
    font-size: clamp(0.7rem, 1.6vw, 0.95rem);
    white-space: pre-wrap;
    text-shadow: 0 0 8px var(--accent-glow);
}

.boot-skip {
    position: absolute;
    bottom: 24px;
    right: 32px;
    color: var(--text-dim);
    font-size: 0.75rem;
    animation: blink-soft 1.6s infinite;
}

@keyframes blink-soft {
    50% {
        opacity: 0.3;
    }
}

/* ---------- Navigation ---------- */
.nav-wrap {
    position: fixed;
    top: 12px;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    padding: 0 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
}

.nav {
    position: relative;
    width: 100%;
    max-width: var(--max-w);
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.nav-logo {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--heading);
    font-size: 0.95rem;
}

.nav-logo:hover {
    text-decoration: none;
    color: var(--accent);
}

.prompt-char {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text);
}

.nav-links a:hover {
    color: var(--accent);
    text-decoration: none;
}

#theme-toggle {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

#theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

html[data-theme="dark"] .icon-moon {
    display: none;
}

html[data-theme="light"] .icon-sun {
    display: none;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 100svh;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 0 20px;
}

#hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hero-content {
    width: 100%;
    max-width: 760px;
}

.hero-pre {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 8px;
}

.hero-name {
    font-size: clamp(2.6rem, 8vw, 5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
    background: linear-gradient(120deg, var(--heading) 55%, var(--accent) 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-sub {
    font-size: clamp(1rem, 3vw, 1.35rem);
    color: var(--text);
    min-height: 1.6em;
    margin-bottom: 30px;
}

.cursor {
    color: var(--accent);
    animation: blink 1.05s steps(1) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.hero-cta {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 26px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-ghost {
    color: var(--accent);
    background: transparent;
}

.btn-ghost:hover {
    background: var(--surface-strong);
}

.hero-socials {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 34px;
}

.hero-socials a {
    color: var(--text-dim);
    transition: color 0.18s, transform 0.18s;
}

.hero-socials a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.scroll-hint {
    position: absolute;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-dim);
    animation: bob 2.2s ease-in-out infinite;
}

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

@keyframes bob {
    50% {
        transform: translate(-50%, 8px);
    }
}

/* ---------- Sections ---------- */
.section {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 110px 20px 30px;
}

.section-title {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    margin-bottom: 36px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
    margin-left: 8px;
}

.section-num {
    color: var(--accent);
    font-size: 0.8em;
    font-weight: 400;
}

.section-lead {
    color: var(--text-dim);
    margin: -22px 0 26px;
}

/* ---------- Reveal animation ---------- */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: none;
}

/* ---------- About ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 44px;
    align-items: center;
}

.about-photo-wrap {
    position: relative;
    justify-self: center;
    /* symmetric breathing room so the offset frame doesn't skew the layout */
    margin: 14px 14px 14px 0;
}

.about-photo {
    width: 280px;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center;
    border-radius: var(--radius);
    filter: saturate(0.92);
    position: relative;
    z-index: 1;
}

.photo-frame {
    position: absolute;
    inset: 14px -14px -14px 14px;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    opacity: 0.55;
}

.about-text {
    padding: 28px 32px;
}

.about-text p:first-child {
    margin-top: 0;
}

.about-facts {
    list-style: none;
    margin: 22px 0 0;
    padding: 16px 18px;
    border-left: 2px solid var(--accent);
    background: var(--surface);
    border-radius: 0 10px 10px 0;
    font-size: 0.85rem;
}

.about-facts li {
    margin: 4px 0;
}

.fact-key {
    color: var(--accent-2);
    margin-right: 6px;
}

/* ---------- Terminal ---------- */
.term {
    overflow: hidden;
}

.term-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface-strong);
    border-bottom: 1px solid var(--border);
}

.term-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.term-dot.red {
    background: #ff5f57;
}

.term-dot.yellow {
    background: #febc2e;
}

.term-dot.green {
    background: #28c840;
}

.term-title {
    margin-left: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.term-screen {
    position: relative;
    height: 420px;
    overflow-y: auto;
    padding: 18px 20px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    background:
        repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.07) 2px 4px),
        transparent;
    cursor: text;
}

.term-screen:focus {
    outline: 1px solid var(--accent);
    outline-offset: -1px;
}

#term-output {
    white-space: pre-wrap;
    word-break: break-word;
}

#term-output .t-line {
    margin: 0;
}

#term-output .t-cmd {
    color: var(--heading);
}

#term-output .t-accent {
    color: var(--accent);
}

#term-output .t-dim {
    color: var(--text-dim);
}

#term-output .t-err {
    color: #ff6b6b;
}

#term-output a {
    color: var(--accent-2);
}

.term-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.term-prompt {
    color: var(--accent);
    white-space: nowrap;
}

#term-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--heading);
    font-size: 0.88rem;
    caret-color: var(--accent);
}

/* ---------- Timeline ---------- */
.timeline {
    position: relative;
    padding-left: 34px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(var(--accent), var(--accent-2));
    opacity: 0.4;
}

.tl-item {
    position: relative;
    margin-bottom: 28px;
}

.tl-marker {
    position: absolute;
    left: -34px;
    top: 26px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg);
    border: 3px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    margin-left: 3px;
}

.tl-card {
    padding: 24px 28px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.tl-card:hover {
    transform: translateX(4px);
    border-color: var(--accent);
}

.tl-head h3 {
    margin-bottom: 2px;
    font-size: 1.15rem;
}

.tl-org {
    margin: 0;
    color: var(--accent-2);
    font-weight: 600;
}

.tl-date {
    margin: 2px 0 0;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.tl-card ul {
    margin: 14px 0 0;
    padding-left: 20px;
}

.tl-card li {
    margin: 5px 0;
}

/* ---------- Projects ---------- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.project-card {
    padding: 26px 28px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.project-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

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

.project-tags {
    color: var(--text-dim);
    font-size: 0.75rem;
}

.project-card h3 {
    font-size: 1.2rem;
}

.project-card p {
    flex: 1;
    margin: 0 0 14px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
}

/* ---------- Live GitHub ---------- */
.gh-live {
    margin-top: 48px;
}

.gh-heading {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 6px;
}

.gh-status {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 400;
    animation: blink-soft 2s infinite;
}

.gh-lead {
    margin: 0 0 22px;
}

.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.repo-card {
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
    color: var(--text);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.repo-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    text-decoration: none;
}

.repo-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.repo-name {
    color: var(--accent-2);
    font-weight: 600;
    font-size: 0.9rem;
    word-break: break-all;
}

.repo-stars {
    color: var(--text-dim);
    font-size: 0.78rem;
    white-space: nowrap;
}

.repo-desc {
    flex: 1;
    margin: 10px 0 14px;
    font-size: 0.86rem;
    color: var(--text-dim);
}

.repo-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.72rem;
    color: var(--text-dim);
}

.repo-lang {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lang-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.gh-activity {
    padding: 22px 26px;
}

.gh-activity h3 {
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 14px;
}

.gh-activity ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gh-activity li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.88rem;
}

.gh-activity li:last-child {
    border-bottom: none;
}

.act-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    flex-shrink: 0;
    align-self: center;
}

.gh-activity a {
    color: var(--text);
    flex: 1;
}

.gh-activity a:hover {
    color: var(--accent);
    text-decoration: none;
}

.act-time {
    color: var(--text-dim);
    font-size: 0.72rem;
    white-space: nowrap;
}

.gh-error {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* ---------- Skills ---------- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.skill-group {
    padding: 24px 28px;
}

.skill-group h3 {
    color: var(--accent);
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.chips li {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: border-color 0.18s, color 0.18s, transform 0.18s;
}

.chips li:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* ---------- Education / Awards ---------- */
.edu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.edu-card {
    padding: 26px 28px;
}

.edu-card ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.edu-card li {
    margin: 6px 0;
}

.more-about {
    padding: 26px 28px;
}

.more-about h3 {
    color: var(--accent);
    font-size: 0.95rem;
}

/* ---------- Contact ---------- */
.section-contact {
    text-align: center;
    padding-bottom: 80px;
}

.section-contact .section-title {
    justify-content: center;
}

.section-contact .section-title::after {
    display: none;
}

.contact-card {
    max-width: 620px;
    margin: 0 auto;
    padding: 44px 36px;
}

.contact-line {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0;
}

.contact-socials {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 28px;
    flex-wrap: wrap;
}

.contact-socials a {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-dim);
}

.contact-socials a:hover {
    color: var(--accent);
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: 28px 20px 36px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.78rem;
}

#boot-replay {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--accent);
    cursor: pointer;
}

#boot-replay:hover {
    text-decoration: underline;
}

/* ---------- Responsive: tablets & small laptops ---------- */
@media (max-width: 820px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        /* Full-width dropdown panel anchored to the nav bar itself. */
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 10px;
        /* Solid, opaque background — no transparency artifacts over content. */
        background: var(--bg-alt);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        max-height: calc(100dvh - var(--nav-h) - 40px);
        overflow-y: auto;
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        /* Visibility flips instantly (delayed only while fading out) so the
           menu opens immediately even if transitions are throttled. */
        transition: transform 0.25s ease,
            opacity 0.25s ease,
            visibility 0s 0.25s;
    }

    .nav-links a {
        display: block;
        padding: 13px 16px;
        border-radius: 10px;
        font-size: 1rem;
        text-align: center;
    }

    .nav-links a:active,
    .nav-links a:hover {
        background: var(--surface-strong);
        color: var(--accent);
    }

    .nav-links li:last-child {
        display: flex;
        justify-content: center;
        padding: 10px 0 6px;
        border-top: 1px solid var(--border);
        margin-top: 6px;
    }

    #theme-toggle {
        width: 42px;
        height: 42px;
    }

    .nav.open .nav-links {
        transform: none;
        opacity: 1;
        visibility: visible;
        transition: transform 0.25s ease,
            opacity 0.25s ease,
            visibility 0s;
    }

    .nav.open .nav-toggle span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

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

    .nav.open .nav-toggle span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

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

    .about-photo-wrap {
        margin: 0 auto 14px;
    }

    .about-photo {
        width: min(260px, 70vw);
    }

    .section {
        padding-top: 80px;
    }

    .term-screen {
        height: 360px;
        font-size: 0.8rem;
    }
}

/* ---------- Responsive: phones ---------- */
@media (max-width: 520px) {
    .section {
        padding: 64px 14px 20px;
    }

    .nav {
        padding: 0 16px;
    }

    .hero-content {
        padding: 0 4px;
    }

    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        text-align: center;
    }

    .about-text {
        padding: 20px 18px;
    }

    .about-facts {
        font-size: 0.74rem;
    }

    .timeline {
        padding-left: 26px;
    }

    .tl-marker {
        left: -26px;
    }

    .tl-card,
    .project-card,
    .skill-group,
    .edu-card,
    .more-about {
        padding: 18px 18px;
    }

    .term-screen {
        height: 320px;
    }

    .gh-activity {
        padding: 18px 16px;
    }

    .gh-activity li {
        flex-wrap: wrap;
    }

    .contact-card {
        padding: 28px 18px;
    }

    .boot-skip {
        left: 0;
        right: 0;
        text-align: center;
    }
}

/* ---------- Touch devices ---------- */
@media (pointer: coarse) {

    /* 16px input prevents iOS Safari from zooming the page on focus. */
    #term-input,
    .term-prompt {
        font-size: 16px;
    }

    .nav-links a {
        padding: 8px 6px;
    }

    .chips li {
        padding: 8px 16px;
    }
}

a,
button {
    touch-action: manipulation;
}

/* ---------- Reduced motion ---------- */
/* Decorative effects stay on (owner preference); only large page-level
   motion is calmed: smooth scrolling and scroll-reveal slides. */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .scroll-hint {
        animation: none;
    }
}
