/* ---- Homepage redesign: "Field Log" - profile card + paged project grid ---- */

:root {
    --hp-bg: #ffffff;
    --hp-panel: #f7f7f5;
    --hp-panel-border: #e2e2de;
    --hp-ink: #1a1a1a;
    --hp-ink-soft: #63645f;
    --hp-accent: #2d71c4;
    --hp-accent-dark: #1f5391;
    --hp-accent-tint: #eaf1fa;
    --hp-mono: "JetBrains Mono", "Courier New", monospace;
    --hp-sans: "Source Sans Pro", sans-serif;
}

html, body.home-page {
    height: 100%;
}

body.home-page {
    background: var(--hp-bg);
    overflow: hidden;
}

.home-layout {
    display: flex;
    align-items: stretch;
    gap: 2em;
    max-width: 1500px;
    height: 100vh;
    margin: 0 auto;
    padding: 2em;
    box-sizing: border-box;
}

/* ---- Profile card (left, ~1/3) ---- */
.profile-card {
    flex: 0 0 33%;
    max-width: 33%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--hp-panel);
    box-shadow: inset 0 0 0 1px var(--hp-panel-border), 0 20px 48px rgba(0, 0, 0, 0.24);
    padding: 1.75em;
    box-sizing: border-box;
}

.profile-photo {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
    border-radius: 5px;
    background: var(--hp-accent-tint);
}

.profile-photo::before,
.profile-photo::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--hp-accent);
    z-index: 2;
}

.profile-photo::before {
    top: 8px;
    left: 8px;
    border-right: none;
    border-bottom: none;
}

.profile-photo::after {
    bottom: 8px;
    right: 8px;
    border-left: none;
    border-top: none;
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    display: block;
}

.photo-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1s ease;
    z-index: 0;
}

.photo-slide.active {
    opacity: 1;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .photo-slide {
        transition: none;
    }
}

.profile-body {
    flex: 0 0 auto;
    margin-top: 1.25em;
}

.profile-body h1 {
    font-family: var(--hp-mono);
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: -0.01em;
    text-align: left;
    color: var(--hp-ink);
    margin: 0 0 0.35em 0;
}

.profile-title,
.profile-facts li {
    font-family: var(--hp-mono);
    font-size: 0.85rem;
    color: var(--hp-ink-soft);
    margin: 0 0 0.5em 0;
}

.profile-facts li {
    margin: 0;
}

/* ---- typewriter lines: a hidden "ghost" reserves the final layout
   space so the animated overlay never reflows the elements below it ---- */
.tw-wrap {
    position: relative;
    display: block;
}

.tw-ghost {
    visibility: hidden;
}

.tw-live {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.tw-accent {
    color: var(--hp-accent);
}

.typewriter.typing::after {
    content: "";
    display: inline-block;
    width: 0.5em;
    margin-left: 1px;
    border-right: 2px solid var(--hp-accent);
    animation: hp-caret-blink 0.9s steps(1) infinite;
}

@keyframes hp-caret-blink {
    0%, 49% { border-color: var(--hp-accent); }
    50%, 100% { border-color: transparent; }
}

.profile-facts {
    list-style: none;
    margin: 0 0 0.5em 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.profile-blurb {
    font-family: var(--hp-sans);
    font-weight: 300;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--hp-ink-soft);
    margin: 0;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.profile-blurb.visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .profile-blurb {
        transition: none;
    }
}

.profile-actions {
    flex: 0 0 auto;
    margin-top: 1.25em;
    display: flex;
    flex-direction: row;
    gap: 0.6em;
}

.profile-btn {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    font-family: var(--hp-mono);
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    color: var(--hp-ink) !important;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px var(--hp-panel-border);
    border-radius: 2px;
    padding: 0.6em 0.85em;
    text-decoration: none;
    transition: box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.profile-btn i {
    font-size: 0.95rem;
}

.profile-btn:hover {
    box-shadow: inset 0 0 0 1px var(--hp-accent);
    color: var(--hp-accent) !important;
}

.profile-btn-primary {
    background: var(--hp-accent);
    box-shadow: none;
    color: #ffffff !important;
}

.profile-btn-primary:hover {
    background: var(--hp-accent-dark);
    color: #ffffff !important;
}

/* ---- Projects panel (right, ~2/3) ---- */
.projects-panel {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--hp-panel);
    box-shadow: inset 0 0 0 1px var(--hp-panel-border), 0 20px 48px rgba(0, 0, 0, 0.24);
    padding: 1.75em;
    box-sizing: border-box;
    overflow: hidden;
}

.projects-header {
    flex: 0 0 auto;
    margin-bottom: 1.1em;
    display: flex;
    align-items: baseline;
    gap: 0.6em;
}

.projects-header h2 {
    font-family: var(--hp-mono);
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--hp-ink);
    margin: 0;
}

.projects-header .count {
    font-family: var(--hp-mono);
    font-size: 0.75rem;
    color: var(--hp-ink-soft);
}

.projects-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1.25em;
}

.project-tile {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px var(--hp-panel-border);
    background: #ffffff;
}

.project-tile[hidden] {
    display: none;
}

.project-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.project-tile:hover img {
    transform: scale(1.06);
}

.tile-index {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--hp-accent);
    color: #ffffff;
    font-family: var(--hp-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.3em 0.55em;
    z-index: 2;
}

.tile-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding: 0.55em 0.7em;
    background: rgba(15, 17, 15, 0.78);
    color: #ffffff;
    font-family: var(--hp-mono);
    transition: background 0.2s ease;
}

.tile-caption-title {
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.3;
}

.tile-caption-detail {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    font-size: 0.68rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.01em;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}

.project-tile:hover .tile-caption {
    background: rgba(15, 17, 15, 0.88);
}

.project-tile:hover .tile-caption-detail {
    max-height: 6em;
    opacity: 1;
    margin-top: 0.4em;
}

.projects-nav {
    flex: 0 0 auto;
    margin-top: 1.1em;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.nav-arrow {
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 2px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px var(--hp-panel-border);
    color: var(--hp-ink);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-appearance: none;
    appearance: none;
    transition: box-shadow 0.2s ease, color 0.2s ease;
}

#prevPage {
    justify-self: end;
    margin-right: 0.9em;
}

#nextPage {
    justify-self: start;
    margin-left: 0.9em;
}

.nav-arrow:hover {
    box-shadow: inset 0 0 0 1px var(--hp-accent);
    color: var(--hp-accent);
}

.nav-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.nav-arrow:disabled:hover {
    box-shadow: inset 0 0 0 1px var(--hp-panel-border);
    color: var(--hp-ink);
}

.page-dots {
    grid-column: 2;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4em;
}

.page-dots .dot {
    width: 9px;
    height: 4px;
    border-radius: 1px;
    background: rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease;
}

.page-dots .dot.active {
    background: var(--hp-accent);
}

@media screen and (max-width: 900px) {
    body.home-page {
        overflow: visible;
    }
    .home-layout {
        flex-direction: column;
        height: auto;
        padding: 1.5em;
    }
    /* Profile renders as its own full-height screen first; the project
       list follows below it as an ordinary scrolling page, matching the
       simple "scroll through the posts" feel of the original site. */
    .profile-card {
        flex: 0 0 auto;
        max-width: 100%;
        min-height: calc(100vh - 3em);
    }
    .profile-photo {
        flex: 1 1 auto;
        min-height: 0;
    }
    .projects-panel {
        flex: 0 0 auto;
        margin-top: 1.5em;
    }
    /* Pagination is a desktop-only interaction here; on mobile every
       project is shown in one scrolling column instead. */
    .projects-nav {
        display: none;
    }
    .projects-grid {
        grid-template-columns: 1fr;
        grid-template-rows: none;
        gap: 1.25em;
    }
    .project-tile {
        aspect-ratio: 4 / 3;
        height: auto;
    }
}
