@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

:root{

    --btn-color: #fdfdfd;/* button color*/
    --btn-bg: #0d0d0d;/* button bg color*/

    --primary-text-color: #000;
    --header-link-hover: #dddcdccf;
    --footer-link-hover: #6dbb00;
    --input-focus-bd-color: #0d0d0d;
}


html {
    scroll-behavior: smooth;
    font-family: "Roboto", sans-serif;
    overflow-x: clip;
}

body {
    overflow-x: clip;
}

[id] {
    scroll-margin-top: 72px;
}

.outline-effect {
    color: black;
    -webkit-text-fill-color: transparent; /* Will override color (regardless of order) */
    -webkit-text-stroke: 2px black;
}

.animated-collapse{
    transition: width 0.3s ease;
}

.header-links {
    display: flex;
    align-items: center;
    min-width: fit-content;
    border-radius: 25px;
    padding: 5px 15px;
    transition: background-color 0.5s, color 0.5s;
}


.header-links:hover {
    background-color: var(--header-link-hover);
}

/* ============================================================
   Floating chrome: brand wordmark + "line & labels" section nav
   Monospace, B&W + single green accent (#6dbb00), light theme.
   ============================================================ */

:root {
    --accent: #6dbb00;
}

/* Content spans the full width (no side offset) */
.site-main {
    width: 100%;
    max-width: 100%;
}

/* Brand wordmark — pinned to the top-left corner, one line */
.brand-mark {
    position: fixed;
    top: 26px;
    left: 30px;
    z-index: 50;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1;
    white-space: nowrap;
    color: #000;
    transition: color 0.25s ease;
}
.brand-mark:hover {
    color: var(--accent);
}

/* Floating nav — a thin vertical rule on the right with small labels;
   each label ties to the rule with a short tick; active label = green. */
.floating-nav {
    position: fixed;
    top: 50%;
    right: 28px;
    transform: translateY(-50%);
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 20px;
    padding-right: 20px;
    border-right: 1px solid #e2e2e2;
    transition: gap 0.4s ease, padding-right 0.4s ease;
}

.fnav-link {
    position: relative;
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #a2a2a2;
    line-height: 1;
    transition: color 0.25s ease, font-size 0.4s ease,
        letter-spacing 0.4s ease;
}

/* Tick connecting the label to the vertical rule */
.fnav-link::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -20px;
    width: 10px;
    height: 1px;
    background: #cfcfcf;
    transform: translateY(-50%);
    transition: width 0.25s ease, background-color 0.25s ease,
        right 0.4s ease;
}

/* Enlarged state while the user is at the very top of the page */
.floating-nav.is-top {
    gap: 30px;
    padding-right: 26px;
}
.floating-nav.is-top .fnav-link {
    font-size: 1.02rem;
    letter-spacing: 0.2em;
}
.floating-nav.is-top .fnav-link::after {
    right: -26px;
    width: 14px;
}

.fnav-link:hover {
    color: #000;
}
.fnav-link:hover::after {
    width: 15px;
    background: #000;
}

.fnav-link.is-active {
    color: var(--accent);
}
.fnav-link.is-active::after {
    width: 18px;
    background: var(--accent);
}

/* Hide the floating rail on narrow screens (keep the brand mark) */
@media not all and (min-width: 1024px) {
    .floating-nav {
        display: none;
    }
    .brand-mark {
        top: 18px;
        left: 18px;
        font-size: 1.3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .brand-mark,
    .fnav-link,
    .fnav-link::after {
        transition: none !important;
    }
}

/* ============================================================
   Business-card modal (editorial style, wide "real card")
   Opens via any .js-open-card trigger, the ?card deep-link,
   or the #card hash. Closes back to the portfolio.
   ============================================================ */

.card-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.card-modal[hidden] {
    display: none;
}

.card-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 20, 22, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.28s ease;
}
.card-modal.is-open .card-modal-backdrop {
    opacity: 1;
}

/* The card itself — wide, landscape-leaning, opens large */
.card-modal-dialog {
    position: relative;
    width: min(620px, 94vw);
    box-sizing: border-box;
    background: #fff;
    border-radius: 14px;
    padding: 20px 44px 30px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    transform: translateY(14px) scale(0.98);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
        opacity 0.3s ease;
}
.card-modal.is-open .card-modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.card-modal-dialog:focus {
    outline: none;
}

/* Top-left toolbar holding the shared "portfolio website" back button */
.card-toolbar {
    display: flex;
    margin-bottom: 18px;
}

/* Two-column body: identity on the left, contacts on the right */
.card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 28px 40px;
    align-items: flex-start;
    margin-top: 4px;
}
.card-primary {
    flex: 1 1 240px;
    min-width: 0;
}
.card-accent {
    display: block;
    width: 46px;
    height: 4px;
    border-radius: 999px;
    background: var(--accent);
    margin-bottom: 18px;
}
.card-name {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #111;
}
.card-role {
    margin-top: 12px;
    font-size: 0.95rem;
    color: #333;
}
.card-location {
    margin-top: 6px;
    font-size: 0.82rem;
    color: #8a8a8a;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Contact list */
.card-contacts {
    flex: 1 1 240px;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.card-contacts li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.86rem;
    color: #1a1a1a;
}
.card-contacts i {
    flex-shrink: 0;
    width: 20px;
    font-size: 1.05rem;
    color: var(--accent);
    text-align: center;
}
.card-contact-text {
    min-width: 0;
    word-break: break-word;
}
/* Only the label portion (e.g. "linkedin.com") is the hyperlink */
.card-contacts a {
    color: #1a1a1a;
    transition: color 0.25s ease;
}
.card-contacts a:hover {
    color: var(--accent);
}
/* The full path is shown as plain, muted text — not a link */
.card-contact-path {
    color: #8a8a8a;
}

/* Action row */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid #ececec;
}
.card-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: #111;
    background: #fff;
    border: 1px solid #d4d4d4;
    border-radius: 9999px;
    cursor: pointer;
    transition: border-color 0.25s ease, background-color 0.25s ease,
        color 0.25s ease;
}
.card-btn i {
    font-size: 1rem;
}
.card-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.card-btn--solid {
    background: #000;
    border-color: #000;
    color: #fff;
}
.card-btn--solid:hover {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}
.card-btn.is-done {
    border-color: var(--accent);
    color: var(--accent);
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .card-modal-dialog {
        padding: 34px 24px 24px;
    }
    .card-name {
        font-size: 1.6rem;
    }
}

/* ============================================================
   Resume modal — a larger card that renders the GitHub README.
   Reuses the .card-modal overlay/backdrop; its own dialog +
   scroll region + typographic styles for the compiled markdown.
   ============================================================ */

/* Resume overlay hugs the viewport so the card can be nearly full-height */
.resume-modal {
    padding: 14px;
}
.resume-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(860px, 94vw);
    /* Almost as tall as the page allows, just under the top/bottom gap */
    height: calc(100dvh - 28px);
    max-height: calc(100dvh - 28px);
    box-sizing: border-box;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
    transform: translateY(14px) scale(0.985);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1),
        opacity 0.3s ease;
    overflow: hidden;
}
.card-modal.is-open .resume-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.resume-dialog:focus {
    outline: none;
}

/* Toolbar: back / download / copy-link, pinned at the top-left */
.resume-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid #ececec;
    background: #fafafa;
    flex-shrink: 0;
}
.modal-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #1a1a1a;
    background: #fff;
    border: 1px solid #d8d8d8;
    border-radius: 9999px;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}
.modal-tool i {
    font-size: 0.95rem;
}
.modal-tool:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.modal-tool.is-done {
    border-color: var(--accent);
    color: var(--accent);
}

/* Scroll region holding the rendered resume */
.resume-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 34px 42px 40px;
    -webkit-overflow-scrolling: touch;
}
.resume-status {
    color: #8a8a8a;
    font-size: 0.9rem;
}

/* --- Compiled-markdown typography (monospace theme, green accent) --- */
.resume-content {
    color: #1a1a1a;
    font-size: 0.9rem;
    line-height: 1.6;
}
.resume-content h1 {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.resume-content h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 1.7rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}
.resume-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.1rem;
}
.resume-content p {
    margin: 0.5rem 0;
}
.resume-content ul,
.resume-content ol {
    margin: 0.4rem 0 0.9rem;
    padding-left: 1.3rem;
}
.resume-content li {
    margin: 0.2rem 0;
}
.resume-content li::marker {
    color: var(--accent);
}
.resume-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.resume-content a:hover {
    color: #4f8a00;
}
.resume-content strong {
    font-weight: 700;
    color: #000;
}
.resume-content hr {
    border: none;
    border-top: 1px solid #e6e6e6;
    margin: 1.1rem 0;
}
.resume-content code {
    font-family: inherit;
    background: #f0f0f0;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
}
.resume-content img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 767px) {
    .card-modal-dialog {
        padding: 34px 24px 24px;
    }
    .resume-scroll {
        padding: 24px 20px 30px;
    }
    .resume-content h1 {
        font-size: 1.5rem;
    }
    /* Keep the back label; drop the others' labels to save room on mobile */
    #resume-download span,
    #resume-copy-link span {
        display: none;
    }
    .modal-tool {
        padding: 8px 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card-modal-backdrop,
    .card-modal-dialog,
    .resume-dialog {
        transition: none !important;
    }
}

/* ============================================================
   Ornate hand-drawn baroque frame around the hero avatar
   Black line-art (stroke #111), transparent, square opening.
   ============================================================ */

.avatar-frame {
    position: relative;
    width: clamp(300px, 40vw, 450px);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

/* The photo sits in the centered square opening.
   The opening is ~62% of the frame box; centered. */
.avatar-frame .avatar-opening {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 62%;
    height: 62%;
    transform: translate(-50%, -50%);
    overflow: hidden;
    border-radius: 2px;
    z-index: 1;
    background: #f0efe9;
}

.avatar-frame .avatar-opening img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* The ornate SVG sits above the photo, bordering the opening */
.avatar-frame .frame-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
}

@media not all and (min-width: 1024px) {
    .avatar-frame {
        width: clamp(275px, 72vw, 375px);
    }
}

.material-icons.md-40 {
    font-size: 40px;
}

.primary-text-color{
    color: var(--primary-text-color);
}

.opacity-0{
    opacity: 0 !important;
}

.opacity-100{
    opacity: 100 !important;
}

.btn{
    padding: 10px 15px;
    width: max-content;
    border-radius: 25px;
    color: var(--btn-color);
    background-color: var(--btn-bg);
    justify-content: center;
    align-items: center;
    display: flex;
    cursor: pointer;
}

.btn:hover{

}

.btn:disabled{
    cursor: default;
}

.input{
    padding: 10px;
    background-color: transparent;
    border-radius: 25px;
    /* outline: none; */
    min-width: 100px;
    border: 2px solid #818080;
    transition: border 0.3s;
}

.input:active, .input:focus, .input:focus-within{
    border: 2px solid var(--input-focus-bd-color);
}

.input-error{
    border-bottom: 3px solid #ff1e1e;
}

.input-error:focus-within{
    border-bottom: 3px solid #fd0101;
}


/* Navigation dots styling */
.dots-container {
    text-align: center;
    margin-top: 20px;
}

.footer-link{
    color: #0d0d0d;
    transition: color 0.3s;
}

.footer-link:hover{
    color: var(--footer-link-hover);
}


.review-container {
    position: relative;
    max-width: 600px;
    margin: auto;
}

.review-card{
    box-shadow: 0px 2px 4px #757474a0;
    border-radius: 15px;
    /* width: 200px; */
    /* height: 550px; */
    padding: 10px;
}

/* --------- collapsible div ---------- */
.collapsible {
    background-color: #f3f0f0;
    color: #2b2929;
    /* cursor: pointer; */
    padding: 5px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 16px;
    transition: 0.4s;
}

/* Style for the collapsible content */
.content {
    padding: 0 18px;
    /* display: none; */
    height: 0px;
    overflow: hidden;
    background-color: transparent;
    transition: height 0.5s;
    text-align: justify;
    margin-top: 10px;
}

.collapsible .active,
.collapsible:hover {
    /* background-color: #dedddd; */
}

/* ============================================================
   a-Fig additions — components with no template photos.
   Built on the template's tokens (accent #6dbb00, green-200).
   ============================================================ */

/* Accessibility: visible focus ring for keyboard users */
a:focus-visible,
button:focus-visible {
    outline: 3px solid #6dbb00;
    outline-offset: 3px;
    border-radius: 6px;
}

/* Hero avatar neutral fallback (when the GitHub avatar fails to load) */
.avatar-fallback {
    background: #1a1a1c;
}

/* ---- Projects: featured works (image + text) ---- */
.project-featured {
    align-items: stretch;
}

/* Healthy breathing room between stacked featured cards.
   (The template's tw-gap-12 utility isn't in the compiled build, so the
   gap is set explicitly here.) */
.project-featured + .project-featured {
    margin-top: 4rem;
}

/* Media slot — holds the <img>; degrades to a neutral placeholder tile */
.project-media {
    position: relative;
    flex-shrink: 0;
    width: 42%;
    min-height: 260px;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #111112;
    isolation: isolate;
}

.project-media img {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Clean neutral fallback shown when the <img> is missing/broken.
   It sits under the image; if the image loads it fully covers this. */
.project-media-fallback {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem;
    background: #1a1a1c;
    color: #fff;
}
.project-media-name {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.project-media-tag {
    align-self: flex-start;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.28);
    color: rgba(255,255,255,0.85);
}

@media not all and (min-width: 1024px) {
    .project-media {
        width: 100%;
        min-height: 220px;
        max-height: 280px;
    }
}

/* AfterCart — receipt-comparison graphic, recreated in CSS (no image asset).
   Fills the dark media slot; two overlapping monospace receipts + savings badge. */
.project-media--receipts {
    background: #141416;
}
.receipts {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    overflow: hidden;
}
.receipt {
    position: relative;
    box-sizing: border-box;
    width: 168px;
    padding: 14px 15px 16px;
    background: #f4eee1;
    color: #2b2622;
    border-radius: 3px;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.5);
    font-size: 10.5px;
    line-height: 1.75;
    letter-spacing: 0.02em;
}
.receipt--back {
    transform: rotate(-7deg) translate(-40px, -16px);
    z-index: 1;
}
.receipt--front {
    transform: rotate(3deg) translate(22px, 12px);
    z-index: 2;
}
.receipt-store {
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 2px;
}
.receipt-rule {
    border-top: 1px dashed #c1b498;
    margin: 6px 0;
}
.receipt-items {
    list-style: none;
    margin: 0;
    padding: 0;
}
.receipt-items li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.receipt-total {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.rp {
    color: #2b2622;
}
.ri-1 { color: #b8860b; } /* CHKN THIGHS */
.ri-2 { color: #b5651d; } /* GROUND BEEF */
.ri-3 { color: #2b6cb0; } /* WHOLE MILK */
.ri-4 { color: #2f855a; } /* GREEK YOGURT */
.ri-5 { color: #c0392b; } /* CHEDDAR */
.receipt-badge {
    position: absolute;
    top: -11px;
    right: -12px;
    z-index: 3;
    padding: 4px 11px;
    background: #2f9e44;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 9999px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
}
@media not all and (min-width: 1024px) {
    .receipt {
        width: 158px;
        font-size: 10px;
    }
    .receipt--back {
        transform: rotate(-7deg) translate(-32px, -12px);
    }
    .receipt--front {
        transform: rotate(3deg) translate(18px, 10px);
    }
}

/* Neutral meta tag (language / star count) — no color */
.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid #d4d4d4;
    color: #595959;
    background: #fafafa;
    white-space: nowrap;
}

/* Secondary works — uniform clean text cards */
.text-card {
    display: flex;
    flex-direction: column;
    background: #f7f7f7;
    border: 1px solid #ececec;
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: border-color 0.25s ease;
}
.text-card:hover {
    border-color: #6dbb00;
}

/* Project links row */
.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #0d0d0d;
    transition: color 0.3s;
}
.project-link:hover { color: #6dbb00; }

/* Muted "More on GitHub" link */
.more-link {
    color: #595959;
    font-weight: 500;
    transition: color 0.3s;
}
.more-link:hover { color: #6dbb00; }

/* Highlights — Awards & Contests / Experience split */
.hl-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    width: 100%;
    max-width: 1120px;
}
.hl-subhead {
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6dbb00;
    border-bottom: 2px solid #6dbb00;
    display: inline-block;
    padding-bottom: 7px;
    margin-bottom: 1.6rem;
}

/* Awards & Contests — trophy rows */
.hl-award {
    display: flex;
    gap: 1.1rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.hl-award i {
    flex-shrink: 0;
    color: #6dbb00;
    font-size: 1.55rem;
    margin-top: 2px;
}
.hl-award-title {
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.3;
}
.hl-award-meta {
    margin-top: 5px;
    font-size: 0.9rem;
    color: #8a8a8a;
    line-height: 1.45;
}

/* Experience — dated roles */
.hl-exp {
    padding: 1.35rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.hl-exp-role {
    font-weight: 600;
    font-size: 1.25rem;
}
.hl-exp-meta {
    margin-top: 5px;
    font-size: 0.85rem;
    color: #8a8a8a;
    letter-spacing: 0.02em;
}
.hl-exp p {
    margin-top: 0.7rem;
    font-size: 1rem;
    color: #595959;
    line-height: 1.55;
}

@media (max-width: 767px) {
    .hl-split {
        grid-template-columns: 1fr;
        gap: 2.75rem;
    }
    .hl-award-title,
    .hl-exp-role {
        font-size: 1.1rem;
    }
}

/* Reading — single consistent green spine accent */
/* Reading — book cards with real cover images (article-card style) */
.book-shelf {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 900px;
    justify-content: center;
}
.book-card {
    position: relative;
    display: block;
    background: #f5f5f5;
    border-radius: 0.5rem;
    padding: 0.55rem;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
    perspective: 1000px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.book-card:hover,
.book-card:focus-within {
    transform: scale(1.04);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.1);
    z-index: 5;
}
/* Front face reproduces the original vertical card layout */
.book-card-front {
    display: flex;
    flex-direction: column;
}
.book-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 0.4rem;
    overflow: hidden;
    background: #e7e3d9;
    margin-bottom: 0.6rem;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}
.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.book-title {
    font-weight: 600;
    font-size: 0.82rem;
    line-height: 1.25;
}
.book-author {
    margin-top: 0.1rem;
    font-size: 0.68rem;
    color: #6b7280;
}
.book-note {
    margin-top: 0.4rem;
    font-size: 0.7rem;
    color: #595959;
    line-height: 1.45;
}

/* Currently reading — horizontal featured strip: small cover + text */
.book-featured-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
}
.book-featured {
    position: relative;
    display: block;
    width: 430px;
    max-width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 0.6rem;
    padding: 1rem;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.05);
    perspective: 1000px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.book-featured:hover,
.book-featured:focus-within {
    transform: scale(1.04);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.1);
    z-index: 5;
}
/* Front face reproduces the original horizontal featured layout */
.book-featured-front {
    display: flex;
    gap: 1.1rem;
    align-items: center;
}
.book-featured-text {
    flex: 1;
    min-width: 0;
}
.book-featured-cover {
    flex-shrink: 0;
    width: 92px;
    aspect-ratio: 2 / 3;
    border-radius: 0.35rem;
    overflow: hidden;
    background: #e7e3d9;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.book-featured-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Wider-than-2:3 covers: show the full artwork (matted) instead of cropping the sides. */
.book-cover--contain img {
    object-fit: contain;
}

/* --- Hover-flip: grid-stack technique so faces auto-size at any width --- */
.flip-inner {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.flip-face {
    grid-area: 1 / 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background: transparent;
}
.flip-back {
    transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.book-card:hover .flip-inner,
.book-card:focus-within .flip-inner,
.book-featured:hover .flip-inner,
.book-featured:focus-within .flip-inner {
    transform: rotateY(180deg);
}

/* Progress bar on the currently-reading featured cards */
.book-progress {
    margin-top: 0.55rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.book-progress-track {
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: #e6e6e6;
    overflow: hidden;
}
.book-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: #6dbb00;
}
.book-progress-label {
    flex-shrink: 0;
    font-size: 0.62rem;
    color: #6b7280;
    letter-spacing: 0.02em;
}

/* Back face: the one-line opinion */
.book-opinion {
    position: relative;
    margin: 0;
    padding: 0.6rem 0.5rem 0.2rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: #333;
    text-align: center;
}
.book-featured .book-opinion {
    font-size: 0.9rem;
    padding: 0.4rem 0.6rem;
}
.book-opinion::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 2px;
    border-radius: 999px;
    background: #6dbb00;
}
@media (max-width: 767px) {
    body {
        padding-bottom: calc(66px + env(safe-area-inset-bottom));
    }

    .brand-mark {
        top: 12px;
        left: 12px;
        padding: 8px 10px;
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        font-size: 1.05rem;
    }

    .floating-nav,
    .floating-nav.is-top {
        top: auto;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        left: 10px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0;
        padding: 6px;
        border: 1px solid rgba(0, 0, 0, 0.11);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        transform: none;
    }

    .fnav-link,
    .floating-nav.is-top .fnav-link {
        display: flex;
        flex: 1 1 0;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 38px;
        padding: 0 2px;
        border-radius: 999px;
        font-size: 0.55rem;
        letter-spacing: 0.02em;
    }

    .fnav-link::after,
    .floating-nav.is-top .fnav-link::after {
        display: none;
    }

    .fnav-link.is-active {
        background: #e3f7c5;
        color: #315600;
    }

    #top {
        min-height: auto !important;
        margin-top: 0 !important;
        padding: 0 1rem 2rem !important;
    }

    .hero-layout {
        min-height: auto !important;
        align-items: stretch !important;
        gap: 1.25rem !important;
        padding: 5.25rem 0 0.5rem !important;
    }

    #about {
        width: 100%;
    }

    .hero-kicker {
        margin-bottom: 0.7rem !important;
        font-size: 0.7rem !important;
        letter-spacing: 0.12em !important;
    }

    .hero-name {
        flex-wrap: nowrap !important;
        align-items: center;
        font-size: clamp(2rem, 10.5vw, 2.55rem) !important;
        line-height: 1 !important;
    }

    .hero-name br {
        display: none;
    }

    .hero-name > span:first-of-type {
        padding: 0.2rem 0.55rem !important;
    }

    .hero-name > span:last-of-type {
        margin-left: 0.3rem;
    }

    .hero-role {
        margin-top: 1rem !important;
        font-size: 0.9rem !important;
        line-height: 1.55;
    }

    .hero-summary {
        margin-top: 0.55rem !important;
        padding: 0 !important;
        font-size: 0.9rem;
        line-height: 1.7 !important;
        text-align: left !important;
    }

    .hero-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem !important;
        margin-top: 1rem !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .hero-actions > a {
        width: 100%;
        height: 44px !important;
        min-height: 44px;
        justify-content: space-between;
        padding-left: 0.9rem !important;
        font-size: 0.76rem;
        white-space: nowrap;
    }

    .hero-actions > a:first-child {
        grid-column: 1 / -1;
    }

    .hero-portrait {
        max-width: 100% !important;
    }

    .avatar-frame {
        width: min(70vw, 270px);
    }

    #work,
    .highlights-section,
    .reading-section,
    .skills-section {
        min-height: auto !important;
        margin-top: 0 !important;
        padding: 4rem 1.25rem !important;
    }

    #work,
    #highlights,
    #skills,
    #reading {
        scroll-margin-top: 0;
    }

    .section-title {
        font-size: 2rem !important;
        line-height: 1.15 !important;
    }

    .section-rule {
        width: 100% !important;
        margin: 1rem 0 0 !important;
        background: #d8d8d8 !important;
    }

    .projects-list,
    .hl-split {
        margin-top: 1.75rem !important;
    }

    .project-featured + .project-featured {
        margin-top: 3rem;
    }

    .project-media {
        min-height: 200px;
    }

    .text-card {
        padding: 1.1rem;
        border-radius: 0.75rem;
    }

    .highlights-section {
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    .highlights-section > .section-title {
        text-align: center;
    }

    .hl-split {
        gap: 2.25rem;
    }

    .hl-subhead {
        margin-bottom: 0.7rem;
    }

    .hl-award,
    .hl-exp {
        padding: 1rem 0;
    }

    .hl-award {
        gap: 0.8rem;
    }

    .hl-exp p {
        font-size: 0.92rem;
    }

    .skills-inner,
    .skills-grid {
        width: 100%;
        max-width: 100% !important;
        margin: 0 !important;
    }

    .skills-inner {
        gap: 1.5rem !important;
    }

    .skills-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .skill-card {
        width: 100% !important;
        height: auto !important;
        min-height: 0;
        padding: 1rem !important;
        border: 1px solid #e8e8e8;
        border-radius: 0.75rem;
        background: #fafafa;
    }

    .reading-section {
        align-items: stretch !important;
    }

    .reading-title,
    .shelf-title {
        text-align: center;
    }

    .book-featured-row {
        gap: 0.85rem;
        margin-top: 1.5rem !important;
    }

    .book-featured {
        width: 100%;
        max-width: 100%;
        padding: 0.75rem;
        border-radius: 0.75rem;
    }

    .book-featured-front {
        align-items: flex-start;
        gap: 0.75rem;
    }

    .book-featured-cover {
        width: 74px;
    }

    .book-featured .book-title {
        font-size: 1rem !important;
    }

    .book-featured .book-note {
        font-size: 0.68rem;
    }

    .book-featured .book-progress {
        gap: 0.35rem;
    }

    .book-featured .book-progress-label {
        font-size: 0.55rem;
    }

    .shelf-title {
        margin-top: 2.75rem !important;
    }

    .book-shelf {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        margin-top: 1.5rem !important;
    }

    #contact {
        padding: 3rem 1.25rem calc(5rem + env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 359px) {
    .fnav-link,
    .floating-nav.is-top .fnav-link {
        font-size: 0.49rem;
    }

    .hero-actions > a {
        padding-left: 0.7rem !important;
        font-size: 0.7rem;
    }
}

@media (hover: none) {
    .book-card:hover,
    .book-featured:hover {
        transform: none;
    }

    .book-card:hover .flip-inner,
    .book-featured:hover .flip-inner {
        transform: none;
    }
}

/* Reduced motion: neutralize GSAP reveal end-states + smooth scroll */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal-up,
    .reveal-hero-text,
    .reveal-hero-img {
        opacity: 1 !important;
        transform: none !important;
    }
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
    /* No flip and no scale on hover/focus — keep the front face static. */
    .book-card:hover,
    .book-card:focus-within,
    .book-featured:hover,
    .book-featured:focus-within {
        transform: none !important;
    }
    .book-card:hover .flip-inner,
    .book-card:focus-within .flip-inner,
    .book-featured:hover .flip-inner,
    .book-featured:focus-within .flip-inner {
        transform: none !important;
    }
}
