*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 55% 45% at 15% 10%,
            rgba(122, 158, 126, 0.07) 0%,
            transparent 65%
        ),
        radial-gradient(
            ellipse 45% 55% at 85% 90%,
            rgba(201, 141, 58, 0.05) 0%,
            transparent 60%
        );
}

a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #ffffff;
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 1rem;
    min-height: 100vh;
}

.card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 2rem 1.25rem;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3 {
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        sans-serif;
    font-weight: 600;
    color: #ffffff;
}

h1 {
    font-size: clamp(3rem, 5vw, 5rem);
    line-height: 1.1;
    font-weight: 600;
}

h2 {
    display: block;
    font-size: clamp(2.4rem, 3.4vw, 3.2rem);
    background: none;
    color: rgba(255, 255, 255, 0.75);
    padding: 0;
    border: none;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

h2::after {
    content: "";
    display: block;
    width: clamp(3rem, 8vw, 7rem);
    max-width: calc(100% - 2rem);
    height: 1px;
    margin: 0.25rem auto 0;
    background: #7a9e7e;
}

h3 {
    display: inline-block;
    font-size: clamp(1.4rem, 1.8vw, 1.7rem);
    padding: 0.05em 0.5em;
    color: #ffffff;
    transform: skewX(-10deg);
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
}

h3 span {
    display: inline-block;
    transform: skewX(10deg);
}

/* ── Card 1: Who ── */
.card-who {
    gap: 0;
    justify-content: center;
}

.hero-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.hero-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
}

.hero-text {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: center;
}

.photo-wrapper {
    width: 240px;
    height: 360px;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.photo-fallback {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    background: rgba(122, 158, 126, 0.15);
    align-items: center;
    justify-content: center;
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        sans-serif;
    font-size: 2.1rem;
    font-weight: 600;
    color: #ffffff;
}

.identity {
    font-size: 1.3rem;
    color: #ffffff;
    line-height: 1.6;
}

.role-list {
    list-style: none;
    font-size: 1.3rem;
    color: #ffffff;
    line-height: 1.6;
    text-align: center;
}

.hero-avail {
    font-size: 1rem;
    color: #ffffff;
    line-height: 1.5;
    padding: 0.35rem 0.85rem;
    background: rgba(122, 158, 126, 0.12);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    text-align: center;
    width: fit-content;
    margin: 0 auto;
}

.links-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    font-size: 1.3rem;
    width: fit-content;
    margin: 0 auto;
}

.links-row a {
    color: rgba(255, 255, 255, 0.75);
}

.links-row a:hover {
    color: #ffffff;
}

.link-separator {
    color: #e8e4dc;
    margin: 0 0.2rem;
    user-select: none;
}

.links-row .github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: transform 0.2s;
}

.links-row .icon-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: transform 0.2s;
}

.links-row .github-link:hover,
.links-row .icon-link:hover {
    transform: translateY(-2px);
}

.github-link svg,
.icon-link svg {
    width: 1.3em;
    height: 1.3em;
    fill: currentColor;
    flex: none;
}

/* ── Card 3: Skills ── */
.card-stack {
    gap: 0.35rem;
    text-align: left;
    padding-top: 2rem;
    padding-bottom: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stack-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stack-grid h2 {
    grid-column: 1 / -1;
    text-align: center;
}

.stack-label {
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.3rem;
    text-align: center;
}

.stack-items {
    font-size: 1.3rem;
    color: #ffffff;
    line-height: 1.5;
    text-align: center;
}

/* ── Card 2: Projects ── */
.card-projects {
    gap: 0;
    justify-content: center;
}

.projects-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.card-projects h2 {
    text-align: center;
}

.project-item {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.85rem 2rem 0.85rem 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.project-item:hover {
    transform: translateX(-3px);
}

.project-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.project-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.project-chevron {
    font-size: 1.1rem;
    color: #ffffff;
    transition: transform 0.2s;
    display: inline-block;
}

.project-item[data-open="true"] .project-chevron {
    transform: rotate(90deg);
}

.project-indicator {
    display: inline-block;
    transform: skewX(10deg);
    transition: transform 0.2s;
    margin-right: 0.3em;
}

.project-item[data-open="true"] .project-indicator {
    transform: skewX(10deg) rotate(90deg);
}

.project-detail {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding-left: 2rem;
    transition:
        max-height 0.35s ease,
        opacity 0.35s ease;
}

.project-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-item[data-open="true"] .project-detail {
    opacity: 1;
}

.project-tech-details {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.project-tech-details li {
    font-size: 1.3rem;
    color: #ffffff;
    line-height: 1.5;
    padding-left: 0.8rem;
    position: relative;
}

.project-tech-details li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: #ffffff;
}

.project-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-name {
    color: #ffffff;
    margin-right: 0.25rem;
}

.project-divider {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.1rem;
    font-size: 1em;
    font-weight: 900;
    line-height: 1;
    color: #ffffff;
    vertical-align: middle;
}

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

.project-item h3,
.pill-link,
.code-link {
    transition: color 0.2s;
}

.pill-link {
    font-size: 0.85rem;
    display: inline-block;
    transform: skewX(-10deg);
    border-radius: 0;
    border: none;
    padding: 0.05em 0.5em;
    color: #ffffff;
    line-height: 1.4;
}

.pill-link span {
    display: inline-block;
    transform: skewX(10deg);
}

.pill-link:hover {
    color: #ffffff;
}

.code-link {
    font-size: 0.85rem;
    display: inline-block;
    transform: skewX(-10deg);
    border-radius: 0;
    padding: 0.05em 0.5em;
    color: #ffffff;
}

.code-link span,
.code-link svg {
    display: inline-block;
    transform: skewX(10deg);
}

.code-link svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    flex: none;
    margin-right: 0.35rem;
}

.code-link:hover {
    color: #ffffff;
}

.project-item .pill-link:hover,
.project-item .code-link:hover {
    color: var(--project-accent);
}

.project-what {
    font-size: 1.3rem;
    color: #ffffff;
    line-height: 1.5;
    margin-bottom: 0;
}

.project-stack {
    font-size: 1.3rem;
    color: #ffffff;
    line-height: 1.5;
    margin-bottom: 0;
}

.project-why {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
    line-height: 1.5;
}

/* ── Terminal Overlay ── */
.terminal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.terminal-overlay.open {
    display: flex;
}

.terminal-window {
    width: 90%;
    max-width: 600px;
    max-height: 70vh;
    background: #2d353b;
    border: 1px solid #3a4248;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid #3a4248;
    background: #272e33;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot.red {
    background: #e67e80;
}

.terminal-dot.yellow {
    background: #dbbc7f;
}

.terminal-dot.green {
    background: #a7c080;
}

.terminal-title {
    font-size: 0.7rem;
    color: #7a8478;
    margin-left: 0.4rem;
}

.terminal-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #7a8478;
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem 0.45rem;
}

.terminal-close:hover {
    color: #d3c6aa;
}

.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 1rem;
    font-family: "Courier New", Courier, monospace;
    font-size: 1rem;
    line-height: 1.55;
    color: #d3c6aa;
    background: #2d353b;
    display: flex;
    flex-direction: column;
}

.terminal-body::-webkit-scrollbar {
    width: 4px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #3a4248;
    border-radius: 2px;
}

.terminal-body {
    scrollbar-width: thin;
    scrollbar-color: #3a4248 transparent;
}

.terminal-output {
    flex: 1;
}

.terminal-output .line {
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-output .line.cmd {
    color: #d3c6aa;
}

.terminal-output .line.cmd::before {
    content: "visitor@portfolio:~$ ";
    color: #a7c080;
}

.terminal-output .line.out {
    color: #d3c6aa;
}

.terminal-output .line.err {
    color: #e67e80;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    margin-top: 0.3rem;
}

.terminal-prompt {
    color: #a7c080;
    white-space: nowrap;
    font-family: inherit;
    font-size: 1rem;
}

.terminal-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #d3c6aa;
    font-family: inherit;
    font-size: 1rem;
    caret-color: #e69875;
    padding: 0;
}

.terminal-kw {
    color: #e69875;
}

.term-hint {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 32px;
    height: 32px;
    padding: 8px;
    background: none;
    border: 1px solid #3a4248;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a8478;
    transition: color 0.2s, border-color 0.2s;
    z-index: 50;
}

.term-hint svg {
    width: 16px;
    height: 16px;
}

.term-hint:hover {
    color: #d3c6aa;
    border-color: #4a555b;
}

/* ── Responsive ── */
@media (min-width: 1024px) {
    body {
        height: 100vh;
        overflow: hidden;
    }

    .grid {
        grid-template-columns: minmax(0, 1.8fr) minmax(0, 3.8fr);
        grid-template-rows: auto 1fr;
        height: 100vh;
        overflow: hidden;
        gap: 0;
        max-width: 1400px;
        margin: 0 auto;
        padding: 3rem 3rem 3rem 0.75rem;
    }

    .card {
        min-height: 0;
        padding: clamp(0.75rem, 1.4vmin, 1.5rem) clamp(1rem, 2vw, 2.5rem);
        overflow: visible;
    }

    h1 {
        font-size: clamp(2.5rem, 4.5vmin, 4.5rem);
    }

    h2 {
        font-size: clamp(1.8rem, 2.8vmin, 2.6rem);
        margin-bottom: 0;
    }

    h3 {
        font-size: clamp(1.2rem, 1.6vmin, 1.5rem);
    }

    .card-who {
        gap: clamp(0.35rem, 0.7vmin, 0.75rem);
        padding-right: clamp(2rem, 4vw, 4rem);
    }

    .hero-content {
        position: relative;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .hero-content::before,
    .hero-content::after {
        content: '';
        position: absolute;
        left: -2rem;
        right: 0;
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
    }

    .hero-content::before {
        top: 0;
    }

    .hero-content::after {
        bottom: 0;
    }

    .photo-wrapper {
        width: clamp(120px, 20vh, 213px);
        height: clamp(180px, 30vh, 320px);
    }

    .identity {
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.4;
    }

    .role-list {
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.4;
    }

    .hero-avail {
        font-size: clamp(0.72rem, 1.1vmin, 0.88rem);
        padding: clamp(0.2rem, 0.45vmin, 0.35rem) clamp(0.5rem, 1vmin, 0.85rem);
    }

    .links-row {
        font-size: clamp(0.9rem, 1.3vmin, 1.1rem);
        margin-top: 0.5rem;
    }

    .stack-label {
        font-size: clamp(0.8rem, 1.2vmin, 0.95rem);
    }

    .stack-items {
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.4;
    }

    .card-projects {
        justify-content: flex-start;
        gap: clamp(0.25rem, 0.65vmin, 0.6rem);
    }

    .project-item {
        padding: clamp(0.35rem, 0.7vmin, 0.7rem) clamp(0.75rem, 1.5vw, 1.5rem)
            clamp(0.35rem, 0.7vmin, 0.7rem) 0;
    }

    .project-name {
        font-size: clamp(1.25rem, 2vmin, 1.7rem);
    }

    .project-indicator {
        display: none;
    }

    .project-what {
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.4;
    }

    .project-stack {
        font-size: 1.1rem;
        line-height: 1.35;
    }

    .project-why {
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.35;
    }

    .project-tech-details {
        gap: clamp(0.2rem, 0.4vmin, 0.4rem);
        margin-top: clamp(0.25rem, 0.5vmin, 0.6rem);
        padding-top: clamp(0.25rem, 0.5vmin, 0.6rem);
    }

    .project-tech-details li {
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.35;
    }

    .card-who {
        grid-column: 1;
        grid-row: 1 / -1;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }

    .right-col {
        grid-column: 2;
        grid-row: 1 / -1;
        display: flex;
        flex-direction: column;
        justify-content: safe center;
        overflow-y: auto;
        padding-left: clamp(2rem, 4vw, 4rem);
    }

    .right-col .card {
        flex-shrink: 0;
    }
}

@media (max-width: 1023px) {
    .right-col {
        display: contents;
    }

    .card {
        padding: 1.15rem;
    }

    .card-who {
        padding: 1.15rem;
        text-align: center;
        order: 1;
    }

    .hero-grid {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .photo-wrapper {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
    }

    h1 {
        font-size: clamp(1.65rem, 6vw, 1.85rem);
        line-height: 1.1;
    }

    h2 {
        font-size: clamp(1.15rem, 3.6vw, 1.3rem);
        margin-bottom: 0;
    }

    h3 {
        font-size: clamp(1rem, 3.2vw, 1.3rem);
    }

    .identity {
        font-size: 1.1rem;
    }

    .role-list {
        font-size: 1.1rem;
    }

    .hero-avail {
        font-size: 0.72rem;
        line-height: 1.25;
        padding: 0.35rem 0.6rem;
    }

    .links-row {
        font-size: 0.76rem;
        gap: 0.25rem 0.75rem;
    }

    .links-row svg {
        width: 1.3em;
        height: 1.3em;
    }

    .links-row .link-text {
        display: none;
    }

    .links-row .link-separator {
        display: inline;
        color: #ffffff;
    }

    .links-row .github-link,
    .links-row .icon-link {
        gap: 0;
        padding: 0.4rem 0.25rem;
    }

    .project-item {
        padding: 0.65rem 1rem 0.65rem 0;
    }

    .project-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        column-gap: 0.45rem;
        row-gap: 0.22rem;
        align-items: start;
    }

    .project-toggle {
        display: none;
    }

    .project-name {
        grid-column: 1 / -1;
        grid-row: 1;
        text-align: center;
    }

    .project-divider {
        display: none;
    }

    .pill-link {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
        color: rgba(255, 255, 255, 0.75);
    }

    .code-link {
        grid-column: 1;
        grid-row: 2;
        justify-self: start;
        color: rgba(255, 255, 255, 0.75);
    }

    .project-detail {
        padding-left: 0.9rem;
    }

    .project-stack {
        width: auto;
        max-width: 100%;
        font-size: clamp(0.95rem, 1.5vmin, 1.15rem);
        line-height: 1.3;
    }

    .project-what,
    .project-why {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .project-tech-details li {
        font-size: 1.1rem;
        line-height: 1.35;
    }

    .card-stack {
        order: 2;
        padding-bottom: 1.5rem;
    }

    .card-projects {
        order: 3;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .stack-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .stack-group {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
    }

    .stack-label {
        margin-bottom: 0;
    }

    .stack-items {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .card,
    .card-who {
        padding: 1rem;
    }

    .hero-grid {
        gap: 0.6rem;
    }

    .photo-wrapper {
        width: 105.6px;
        height: 105.6px;
    }

    h1 {
        font-size: clamp(1.4rem, 5.5vw, 1.6rem);
    }

    h2 {
        font-size: clamp(1rem, 3.8vw, 1.2rem);
    }

    h3 {
        font-size: clamp(0.9rem, 3.2vw, 1.1rem);
    }

    .hero-avail {
        font-size: 0.72rem;
        line-height: 1.2;
        padding: 0.3rem 0.5rem;
    }

    .links-row {
        font-size: 0.69rem;
        gap: 0.2rem 0.6rem;
    }

    .stack-label {
        font-size: 0.65rem;
    }

    .stack-items {
        font-size: 0.75rem;
        line-height: 1.35;
    }

    .project-item {
        padding: 0.55rem 0.85rem 0.55rem 0;
    }

    .project-detail {
        padding-left: 0.75rem;
    }

    .project-stack {
        font-size: 0.85rem;
    }

    .project-what,
    .project-why {
        font-size: 0.85rem;
    }

    .project-tech-details li {
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }

    .project-item:hover,
    .links-row .github-link:hover,
    .links-row .icon-link:hover {
        transform: none;
    }
}
