/* ==========================================================================
   Ahmed Hugais — Portfolio
   Berkeley Blue (#003262) / Berkeley Gold (#FDB515), light + dark themes.

   Fonts are self-hosted (fonts/inter.woff2, fonts/space-grotesk.woff2)
   instead of pulled from Google Fonts. That's one less external connection
   (DNS + TLS handshake) the browser has to make before it can render text —
   on a high-latency or unreliable connection, every extra external origin
   adds real, sometimes multi-second, delay. Both are variable fonts, so one
   file each covers every weight used on the site.
   ========================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    /* optional (not swap): fonts are self-hosted and tiny, so they're ready
       almost immediately — this avoids the visible text reflow/flash that
       "swap" causes when the fallback font gets replaced mid-render. */
    font-display: optional;
    src: url('fonts/inter.woff2') format('woff2');
}
@font-face {
    font-family: 'Space Grotesk';
    font-style: normal;
    font-weight: 500 700;
    font-display: optional;
    src: url('fonts/space-grotesk.woff2') format('woff2');
}

/* ---------- Design tokens ---------- */
:root {
    --cal-blue: #003262;
    --cal-blue-light: #3b6ea5;
    --cal-gold: #FDB515;

    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.18);

    --nav-height: 68px;
    /* Big, one-time motions (content revealing on scroll, the hero entrance) —
       a long decelerating tail that reads as deliberate at ~0.5s+, but feels
       sluggish on anything short, which is why it was wrong for hover/press. */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    /* Quick interactive feedback (hover/press on cards, buttons, tags) — a
       snappier, more linear-out curve so short durations actually read as
       instant instead of dragging through a long tail. */
    --ease-snap: cubic-bezier(0.3, 0, 0.2, 1);

    /* Timing: fast for UI feedback (buttons, cards, tags); theme for the
       light/dark switch (icon, body colors, hero crossfade move together);
       reveal for content fading in on scroll. */
    --t-fast: 0.15s;
    --t-theme: 0.4s;
    --t-reveal: 0.8s;
}

html[data-theme="light"] {
    --bg: #f5f6f8;
    --bg-elevated: #ffffff;
    --bg-soft: #ececef;
    --text: #14181f;
    --text-muted: #52586a;
    --border: rgba(0, 50, 98, 0.14);
    --accent: var(--cal-blue);
    --accent-contrast: var(--cal-gold);
    --nav-bg: rgba(245, 246, 248, 0.75);
    --icon-color: var(--cal-blue);
    --card-bg: #ffffff;
    --todo-bg: rgba(253, 181, 21, 0.14);
    --todo-border: #b8860b;
}

html[data-theme="dark"] {
    --bg: #14171c;
    --bg-elevated: #1c2029;
    --bg-soft: #20242e;
    --text: #f2f3f5;
    --text-muted: #a7acba;
    --border: rgba(253, 181, 21, 0.16);
    --accent: var(--cal-gold);
    --accent-contrast: var(--cal-blue);
    --nav-bg: rgba(20, 23, 28, 0.75);
    --icon-color: var(--cal-gold);
    --card-bg: #1c2029;
    --todo-bg: rgba(253, 181, 21, 0.1);
    --todo-border: var(--cal-gold);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    background: var(--bg);
    color: var(--text);
    margin: 0;
    font-family: var(--font-body);
    overflow-x: hidden;
    transition: background-color var(--t-theme) var(--ease), color var(--t-theme) var(--ease);
}

h1, h2, h3 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

a { color: inherit; }

.inline-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--cal-gold);
    text-underline-offset: 3px;
    transition: color 0.2s var(--ease-snap);
}
.inline-link:hover { color: var(--cal-gold); }

section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 110px 24px;
}

.section-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 10px;
}
.section-label::before {
    content: '';
    width: 28px;
    height: 3px;
    background: linear-gradient(to right, var(--cal-blue), var(--cal-gold));
    border-radius: 2px;
}

.section-title {
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    font-weight: 700;
    margin: 0 0 46px;
}

/* ---------- Scroll reveal ----------
   Duration/easing for the reveal transition is set inline by JS (see
   style.js), not here — cards like .project-item declare their own
   `transition` shorthand for hover/press feedback, and a second `transition`
   shorthand from a class like .reveal would silently replace it rather than
   merge with it (that's how the CSS cascade treats shorthands). Setting it
   inline at reveal-time, then clearing it once the animation finishes, lets
   the reveal run at its own slower speed without touching each card's fast
   hover speed afterwards. */
.reveal {
    opacity: 0;
    transform: translateY(38px);
}
.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}
.reveal-stagger.in-view > * {
    /* Capped so a big grid (row 3+) doesn't end up waiting noticeably longer
       than row 1 — still a ripple across the first few items, then the rest
       settle together instead of the delay growing without limit. */
    transition-delay: calc(min(var(--stagger-i, 0), 4) * 40ms);
}

/* ---------- TODO / placeholder highlight ----------
   Wrap anything you haven't filled in yet with class="todo-fill"
   (inline) or "todo-card" (block). Once you replace the content,
   just delete the wrapper / remove the class — that's the "unhighlight". */
.todo-fill {
    background: var(--todo-bg);
    border-bottom: 2px dashed var(--todo-border);
    padding: 0 3px;
    border-radius: 3px;
}

.todo-card {
    position: relative;
    border: 2px dashed var(--todo-border) !important;
    background: var(--todo-bg) !important;
}
.todo-card::after {
    content: 'FILL ME IN';
    position: absolute;
    top: -11px;
    right: 14px;
    background: var(--todo-border);
    color: #14171c;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 9px;
    border-radius: 20px;
}

/* ---------- Navigation ---------- */
.navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: linear-gradient(to right, rgba(0, 50, 98, 0.16), rgba(253, 181, 21, 0.16)), var(--nav-bg);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    z-index: 1000;
    box-sizing: border-box;
}
/* Scroll progress — draggable, like a YouTube scrubber. .scroll-progress-track
   is a taller invisible hit area (mouse + touch, via Pointer Events) than the
   visible bar, so it's easy to grab without needing pixel-precision. Its
   ::before is the dim track; .scroll-progress is the filled portion, sized
   with `transform: scaleX` (not `width`) so it stays on the compositor and
   tracks scroll position with zero lag. */
.scroll-progress-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;
    height: 26px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.scroll-progress-track::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 7px;
    background: var(--border);
    border-radius: 4px;
    transition: height 0.15s var(--ease-snap);
}
.scroll-progress {
    position: relative;
    width: 100%;
    height: 7px;
    background: linear-gradient(to right, var(--cal-blue), var(--cal-gold));
    transform: scaleX(0);
    transform-origin: left;
    border-radius: 4px;
    pointer-events: none;
    transition: height 0.15s var(--ease-snap);
}
/* The thumb only appears on hover/drag — keeps the bar slim the rest of the time. */
.scroll-progress::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    width: 13px;
    height: 13px;
    background: var(--cal-gold);
    border: 2px solid var(--bg);
    border-radius: 50%;
    transform: translateY(-50%) scale(0);
    transition: transform 0.15s var(--ease-snap);
}
.scroll-progress-track:hover::before,
.scroll-progress-track:hover .scroll-progress,
.scroll-progress-track.dragging::before,
.scroll-progress-track.dragging .scroll-progress {
    height: 10px;
}
.scroll-progress-track:hover .scroll-progress::after,
.scroll-progress-track.dragging .scroll-progress::after {
    transform: translateY(-50%) scale(1);
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
/* Desktop only — spreading the links across the bar via flex/margin here
   was previously unscoped, which leaked `margin-left: 48px` into the mobile
   dropdown (a fixed-position, full-width panel) and shifted/narrowed it
   enough to look broken. The mobile rules below never touch these. */
@media screen and (min-width: 861px) {
    .nav-links {
        flex: 1;
        justify-content: space-between;
        margin-left: 48px;
    }
}

.nav-links a:not(.theme-toggle) {
    position: relative;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: color 0.2s var(--ease-snap), background-color 0.2s var(--ease-snap);
}
.nav-links a:not(.theme-toggle):hover {
    color: var(--text);
    background: var(--bg-soft);
}

.theme-toggle {
    cursor: pointer;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    color: var(--icon-color);
    transition: transform var(--t-theme) var(--ease), background-color var(--t-fast);
}
.theme-toggle:hover { background: var(--border); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* Self-contained icons (replaced Font Awesome — one less external CDN that
   can stall the page if it's slow or blocked on someone's network) */
.icon-inline {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}
.theme-toggle.flip { transform: rotate(360deg); }

.hamburger-toggle { display: none; }
.hamburger-icon { display: none; }

/* ---------- Hero ---------- */
#Home {
    position: relative;
    height: 100vh;
    min-height: 560px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
}

.theme-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--t-theme) var(--ease);
    animation: heroZoomIn 2.2s cubic-bezier(0.19, 1, 0.22, 1) both;
    will-change: transform;
}
@keyframes heroZoomIn {
    from { transform: scale(1.12); }
    to { transform: scale(1); }
}
#lightImage { opacity: 1; }
#darkImage { opacity: 0; }
html[data-theme="dark"] #lightImage { opacity: 0; }
html[data-theme="dark"] #darkImage { opacity: 1; }

.hero-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.55) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 760px;
    padding: 0 24px;
    color: #fff;
    animation: heroFadeUp 1s var(--ease) both;
    animation-delay: 0.2s;
}
@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-kicker {
    font-family: var(--font-display);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--cal-gold);
    margin-bottom: 18px;
    font-weight: 600;
}

.hero-name {
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800;
    margin: 0 0 14px;
    line-height: 1.05;
}

#typewriter {
    font-size: clamp(1.1rem, 2.4vw, 1.5rem);
    min-height: 2.6em;
    color: #e9e9ef;
    font-weight: 500;
}
.cursor {
    display: inline-block;
    width: 0.09em;
    margin-left: 0.12em;
    background-color: var(--cal-gold);
    animation: blink 1s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.hero-actions {
    margin-top: 34px;
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 13px 26px;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: transform 0.2s var(--ease-snap), box-shadow 0.2s var(--ease-snap), background-color 0.2s, color 0.2s;
}
@media (hover: hover) and (pointer: fine) {
    .btn:hover { transform: translateY(-3px); }
}

.btn-primary {
    background: var(--cal-gold);
    color: #14171c;
    box-shadow: 0 8px 24px rgba(253, 181, 21, 0.35);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(253, 181, 21, 0.45); }

.btn-outline {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
    backdrop-filter: blur(6px);
}
.btn-outline:hover { background: rgba(255,255,255,0.18); }

.scroll-cue {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: rgba(255,255,255,0.75);
    font-size: 1.3rem;
    animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 8px); }
}

/* ---------- About ---------- */
#About {
    display: flex;
    align-items: center;
    gap: 60px;
}

.about-image-wrap {
    flex-shrink: 0;
    position: relative;
}
.about-image {
    width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s var(--ease-snap), box-shadow 0.2s var(--ease-snap);
}
@media (hover: hover) and (pointer: fine) {
    .about-image:hover {
        transform: translateY(-6px) scale(1.02);
        box-shadow: var(--shadow-lg), 0 0 0 4px var(--card-bg), 0 0 0 7px var(--cal-blue), 0 0 0 10px var(--cal-gold);
    }
}

.about-text { flex: 1; min-width: 0; }
.about-text p {
    font-size: 1.08rem;
    line-height: 1.75;
    color: var(--text-muted);
    margin: 0 0 18px;
}
.about-text p:first-of-type {
    font-size: 1.2rem;
    color: var(--text);
    font-weight: 500;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 22px;
}
.status-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #33c46a;
    box-shadow: 0 0 0 3px rgba(51, 196, 106, 0.25);
}

.resume-view-button {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--cal-gold);
    color: #14171c;
    border: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.98rem;
    padding: 14px 28px;
    border-radius: 999px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(253, 181, 21, 0.35);
    transition: transform 0.2s var(--ease-snap), box-shadow 0.2s var(--ease-snap);
}
@media (hover: hover) and (pointer: fine) {
    .resume-view-button:hover {
        transform: translateY(-3px);
        box-shadow: 0 14px 32px rgba(253, 181, 21, 0.45);
    }
}
.resume-view-button svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- Skills ---------- */
.skills-groups {
    display: grid;
    gap: 30px;
}
.skills-group-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.skills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.skill-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.92rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease-snap), border-color 0.2s;
}
@media (hover: hover) and (pointer: fine) {
    .skill-tag:hover {
        transform: translateY(-3px);
        border-color: var(--accent);
    }
}

/* ---------- Experience ---------- */
.timeline {
    position: relative;
    padding-left: 34px;
    border-left: 2px solid var(--border);
}
.timeline-item {
    position: relative;
    margin-bottom: 42px;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -41px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--border);
}
.timeline-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px 28px;
    box-shadow: var(--shadow-sm);
}
.timeline-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}
.timeline-role {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
}
.timeline-dates {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.timeline-company {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 12px;
}
.timeline-card ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
    line-height: 1.7;
}

/* ---------- Projects ---------- */
#Projects { text-align: center; }

.filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 44px;
}
.filter-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 9px 20px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s var(--ease-snap);
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.project-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.project-item {
    width: calc(33.33% - 24px);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--card-bg);
    border: 2px solid var(--cal-blue);
    box-shadow: var(--shadow-sm);
    position: relative;
    text-align: left;
    /* transform only — box-shadow's soft blur reads as gradual/slow to the
       eye even at an identical duration to a crisp transform, which is what
       was making the card feel laggier than the image scaling inside it. */
    transition: transform 0.1s var(--ease-snap);
    perspective: 800px;
}
html[data-theme="dark"] .project-item { border-color: var(--cal-gold); }
.project-item.filtered-out {
    display: none;
}
@media (hover: hover) and (pointer: fine) {
    .project-item:hover {
        transform: translateY(-5px) scale(1.015);
        box-shadow: var(--shadow-md);
    }
}
.project-item a { text-decoration: none; color: inherit; display: block; }

.project-thumb {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 10;
}
.project-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.1s var(--ease-snap);
}
@media (hover: hover) and (pointer: fine) {
    .project-item:hover img { transform: scale(1.07); }
}

.project-info { padding: 18px 20px 22px; }
.project-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0 0 6px;
}
.project-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.project-tag {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--bg-soft);
    padding: 3px 9px;
    border-radius: 6px;
}

@media (max-width: 900px) {
    .project-item { width: calc(50% - 24px); }
}
@media (max-width: 600px) {
    .project-item { width: 100%; }
}

/* ---------- Education ---------- */
#Education { text-align: center; }

.course-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 22px;
}

.course-item {
    width: 270px;
    padding: 26px 20px;
    background: var(--card-bg);
    border: 2px solid var(--cal-blue);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s var(--ease-snap);
}
html[data-theme="dark"] .course-item { border-color: var(--cal-gold); }
@media (hover: hover) and (pointer: fine) {
    .course-item:hover {
        transform: translateY(-4px) scale(1.015);
        box-shadow: var(--shadow-md);
    }
}
.course-item a { text-decoration: none; color: inherit; }

.course-image-container {
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid transparent;
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(135deg, var(--cal-blue), var(--cal-gold)) border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--todo-border);
}
.course-item img {
    width: 100%;
    height: 100%;
    /* Padding keeps a square logo's corners inside the circular frame:
       a square inscribed in a circle without clipping needs side <= diameter / sqrt(2),
       so at a 96px circle, padding must be at least ~14px per side. */
    object-fit: contain;
    padding: 15px;
    box-sizing: border-box;
}

/* CS169A's logo is a solid navy square with no transparent margin, so it can
   fill the full circle (cropped to round) instead of shrinking with padding. */
.course-item img[alt="CS 169A"] {
    object-fit: cover;
    padding: 0;
}

.course-code {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 4px 0;
}
.course-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.course-desc {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-muted);
    opacity: 0.85;
    margin: 10px 0 0;
}

/* ---------- Contact ---------- */
#Contact { text-align: center; padding-bottom: 140px; }

/* The barely visible dot at the very bottom: my way into the Sabora console. */
.console-dot {
    display: block;
    width: 32px;
    height: 32px;
    margin: 0 auto 20px;
    line-height: 32px;
    text-align: center;
    font-size: 24px;
    color: var(--text-muted);
    text-decoration: none;
    opacity: 0.15;
    transition: opacity 0.2s;
}
.console-dot:hover, .console-dot:focus-visible { opacity: 0.7; }

.contact-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 26px;
    margin-top: 24px;
}
.contact-icon {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    font-size: 1.4rem;
    color: var(--icon-color);
    transition: transform 0.2s var(--ease-snap), background-color 0.2s, color 0.2s;
}
@media (hover: hover) and (pointer: fine) {
    .contact-icon:hover {
        transform: translateY(-5px);
        background: var(--accent);
        color: var(--bg);
    }
}

/* ---------- Divider ---------- */
.section-divider {
    border: none;
    height: 2px;
    max-width: 1160px;
    margin: 0 auto;
    background: linear-gradient(to right, var(--cal-blue), var(--cal-gold));
    opacity: 0.5;
}

/* ---------- Project detail pages (hog.html, cats.html, etc.) ---------- */
.project-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 150px 24px 110px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 28px;
    transition: gap 0.2s var(--ease-snap);
}
.back-link:hover { gap: 12px; }

.project-page-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.project-page h1 {
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    margin: 0 0 28px;
}
.project-page img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin: 0 auto 40px;
    display: block;
    transition: transform 0.12s var(--ease-snap);
}
@media (hover: hover) and (pointer: fine) {
    .project-page img:hover { transform: scale(1.015); }
}
.project-page p.project-body {
    font-size: 1.08rem;
    line-height: 1.85;
    color: var(--text-muted);
    white-space: pre-line;
}

@media screen and (max-width: 860px) {
    .project-page { padding: 120px 20px 80px; }
}

/* ---------- Touch feedback (:active) ----------
   Mirrors the :hover interactions above so taps feel responsive on phones —
   touch devices never trigger :hover, so without this nothing animates on tap. */
.btn:active { transform: translateY(-1px) scale(0.97); }
.project-item:active { transform: scale(0.98); }
.project-item:active img { transform: scale(1.05); }
.course-item:active { transform: scale(0.96); }
.skill-tag:active { transform: scale(0.94); }
.filter-btn:active { transform: scale(0.95); }
.contact-icon:active { transform: scale(0.9); }
.resume-view-button:active { transform: scale(0.96); }
.about-image:active {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--card-bg), 0 0 0 7px var(--cal-blue), 0 0 0 10px var(--cal-gold);
}
.project-page img:active { transform: scale(1.02); }

/* ---------- Back to top ---------- */
#back-to-top {
    position: fixed;
    bottom: 26px;
    right: 26px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-md);
    z-index: 999;
    transition: transform 0.2s var(--ease-snap), opacity 0.2s;
}
@media (hover: hover) and (pointer: fine) {
    #back-to-top:hover { transform: translateY(-4px); }
}
#back-to-top:active { transform: translateY(-1px) scale(0.94); }
#back-to-top.visible { display: flex; }

/* ==========================================================================
   Mobile
   ========================================================================== */
@media screen and (max-width: 860px) {
    section { padding: 80px 20px; }

    /* Nudge the hero photo so the face clears the edge crop on narrow screens */
    .theme-image { object-position: 30% center; }

    #About {
        flex-direction: column;
        text-align: center;
        gap: 34px;
    }
    .about-image { width: 220px; height: 220px; }

    .hamburger-icon {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 26px;
        height: 20px;
        cursor: pointer;
        z-index: 10;
    }
    .hamburger-icon span {
        display: block;
        height: 2.5px;
        width: 100%;
        background-color: var(--text);
        border-radius: 2px;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.2s var(--ease);
    }
    .nav-links a:not(.theme-toggle) {
        padding: 16px 28px;
        border-radius: 0;
        border-bottom: 1px solid var(--border);
        text-align: center;
    }
    .theme-toggle { margin: 16px 0; align-self: center; }

    #hamburger-toggle:checked ~ .nav-links { max-height: 480px; }

    #hamburger-toggle:checked ~ .hamburger-icon span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
    #hamburger-toggle:checked ~ .hamburger-icon span:nth-child(2) { opacity: 0; }
    #hamburger-toggle:checked ~ .hamburger-icon span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

    #typewriter { padding: 0 10px; }

    .project-container, .course-container { gap: 18px; }
}
