
/* ==========================================
   1. Theme Variables
========================================== */

:root {
    --bg: #ffffff;
    --ink: #17171c;
    --sub: #55565f;
    --line: #dcdce2;
    --soft: #f3f3f6;
    --acc: #b8301c;
    --on: #ffffff;
    --mark: #ffd9d2;
}

:root[data-theme="dark"] {
    --bg: #131318;
    --ink: #f2f2f5;
    --sub: #a9aab5;
    --line: #2e2f38;
    --soft: #1e1f26;
    --acc: #ff8a73;
    --on: #131318;
    --mark: #6e2f27;
    color-scheme: dark;
}


/* ==========================================
   2. Global Styles
========================================== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
}

img {
    max-width: 100%;
}

h1,
h2,
h3,
p,
a,
span,
div {
    overflow-wrap: anywhere;
}

h1 {
    word-break: auto-phrase;
}

a {
    color: var(--ink);
    text-underline-offset: 4px;
}

a:hover {
    color: var(--acc);
}

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


/* ==========================================
   3. Components
========================================== */

/* Highlight links */

.mark {
    text-decoration: none;
    box-shadow: inset 0 -0.38em 0 var(--mark);
    transition: box-shadow 0.2s ease;
}

.mark:hover {
    box-shadow: inset 0 -1.2em 0 var(--mark);
}

/* Cards */

.card {
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
}

/* Rows */
/* Rows */

.row {
    position: relative;
}

/* accent line drawn over the row's top border */
.row::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--acc);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
    pointer-events: none;
}

.row:hover::before {
    transform: scaleX(1);
}

/* big number: color + small nudge, no layout change */
.row > div:first-child {
    transition: transform 0.3s ease;
}

.row:hover > div:first-child {
    transform: translateX(6px);
}

/* Project tags */

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: 'JetBrains Mono', 'Noto Sans JP', 'Noto Sans Myanmar', monospace;
    font-size: 11px;
    line-height: 1.7;
    color: var(--sub);
}

.tag-freelance {
    border-color: var(--acc);
    color: var(--acc);
}

.tag-inhouse {
    background: var(--soft);
}

/* Language selector */

.lang {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    text-decoration: none;
}

.lang[aria-current] {
    background: var(--ink);
    color: var(--on);
}

/* Avatar */

.avatar {
    position: relative;
    overflow: hidden;
}

.avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================
   3b. Hero (fits first screen)
========================================== */

.first-view {
    position: relative;
    height: 100vh;
    height: 100svh;
    min-height: 560px;          /* safety for very short windows */
    display: flex;
    flex-direction: column;
}

.hero {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;    /* centers content in the space under the header */
    padding: 0 0 72px;          /* reserves room for the scroll cue */
    padding-top: 52px;
}

.hero-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(10px, 3.2vw, 14px);
    color: var(--acc);
    white-space: nowrap;
}

.hero-title {
    margin: clamp(6px, 1.5vh, 12px) 0 clamp(8px, 2vh, 18px);
    font-family: 'Archivo', 'Noto Sans JP', 'Noto Sans Myanmar', sans-serif;
    font-weight: 800;
    font-size: clamp(36px, min(7vw, 7.5vh), 80px);
    line-height: 1.2;
    white-space: pre-line;
}

.hero-lead {
    margin: 0 0 clamp(12px, 2.5vh, 24px);
    max-width: 900px;           /* wider = fewer lines */
    font-size: clamp(14px, 2.1vh, 18px);
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}

.btn-primary {
    background: var(--ink);
    color: var(--on);
    text-decoration: none;
    font-weight: 700;
    padding: clamp(10px, 1.8vh, 14px) 28px;
    border-radius: 999px;
}

.btn-primary:hover {
    color: var(--on);
    background: var(--acc);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-top: clamp(16px, 3.5vh, 40px);
}

.stat {
    padding: clamp(8px, 1.4vh, 14px) 16px;
    background: var(--soft);
    border-radius: 8px;
}

.stat-label { font-size: 13px; color: var(--sub); }
.stat-value { font-weight: 700; }


/* backToTop */

#backToTop {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ink);
    color: var(--on);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.9);
    transition:
        opacity 0.3s ease,
        transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
        visibility 0.3s,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

#backToTop:hover {
    background: var(--acc);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

#backToTop:active {
    transform: translateY(0) scale(0.94);
}

#backToTop:focus-visible {
    outline: 2px solid var(--acc);
    outline-offset: 4px;
}

/* Progress ring */
.btt-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.btt-ring circle {
    fill: none;
    stroke-width: 2;
}

.btt-track {
    stroke: color-mix(in srgb, var(--on) 22%, transparent);
}

.btt-bar {
    stroke: var(--acc);
    stroke-linecap: round;
    stroke-dasharray: 138.23;                                  /* 2 * π * 22 */
    stroke-dashoffset: calc(138.23 * (1 - var(--progress, 0)));
}

#backToTop:hover .btt-bar {
    stroke: var(--on);
}

/* Arrow icon */
.btt-arrow {
    position: relative;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.25s ease;
}

#backToTop:hover .btt-arrow {
    transform: translateY(-2px);
}
/* Scroll cue */

.scroll-cue {
    position: absolute;         /* no longer adds to the height */
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.24em;
    color: var(--sub);
    text-decoration: none;
    white-space: nowrap;
}

.scroll-cue { transition: opacity 0.3s ease, color 0.2s ease; }


.scroll-cue > span:first-child { margin-right: -0.24em; } /* optical centering */

.scroll-cue:focus:not(:focus-visible) { outline: none; }
.scroll-cue:focus-visible { outline: 2px solid var(--acc); outline-offset: 6px; border-radius: 4px; }

.scroll-cue:hover { color: var(--acc); }

.scroll-line {
    position: relative;
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--line));
    overflow: hidden;
}

.scroll-line::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(to bottom, transparent, var(--acc) 70%, var(--acc));
    border-radius: 1px;
    transform: translateY(-100%);
    animation: scroll-line 2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    will-change: transform;
}

/* ==========================================
   3c. Language Overrides
========================================== */

/* Myanmar: taller glyphs need more line-height, and the title has 3 lines */
html[lang="my"] .hero-title {
    font-size: clamp(32px, min(6vw, 6.5vh), 68px);
    line-height: 1.45;
}

html[lang="my"] .hero-lead {
    line-height: 2;
    font-size: clamp(14px, 2vh, 17px);
    max-width: 920px;
}

html[lang="my"] .hero-eyebrow {
    white-space: normal;
}

@keyframes scroll-line {
    0%   { transform: translateY(-100%); }
    70%  { transform: translateY(170%); }
    100% { transform: translateY(170%); }  /* short pause before the next loop */
}

/* Short laptop screens: tighten the header too */
@media (min-width: 701px) {
    header#top { padding: 12px 0 !important; gap: 8px 16px !important; }
}

@media (max-width: 900px) {
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
}


/* ==========================================
   5. Mobile Navigation
========================================== */

.burger {
    display: none;
}

@media (max-width: 700px) {
    html.js header {
        flex-wrap: nowrap !important;
    }

    html.js .burger {
        position: fixed;
        top: 24px;
        right: 16px;
        z-index: 102;
        display: block;
        width: 48px;
        height: 48px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 50%;
        background: var(--bg);
        color: var(--ink);
        cursor: pointer;
    }

    .burger span {
        position: absolute;
        left: 10px;
        width: 26px;
        height: 3px;
        border-radius: 2px;
        background: currentColor;
        transition:
            top 0.25s ease,
            transform 0.25s ease,
            opacity 0.2s ease;
    }

    .burger span:nth-child(1) {
        top: 14px;
    }

    .burger span:nth-child(2) {
        top: 22px;
    }

    .burger span:nth-child(3) {
        top: 30px;
    }

    .menu-open .burger span:nth-child(1) {
        top: 22px;
        transform: rotate(45deg);
    }

    .menu-open .burger span:nth-child(2) {
        opacity: 0;
    }

    .menu-open .burger span:nth-child(3) {
        top: 22px;
        transform: rotate(-45deg);
    }

    html.js header > a:first-child {
        margin-right: 56px;
    }

    html.js header nav {
        position: fixed;
        inset: 0;
        z-index: 100;
        display: flex !important;
        flex-direction: column;
        flex-wrap: nowrap !important;
        align-items: flex-start;
        gap: 4px !important;
        padding: 96px 28px 112px;
        overflow-y: auto;
        background: var(--bg);
        visibility: hidden;
        opacity: 0;
        transition:
            opacity 0.25s ease,
            visibility 0.25s;
    }

    html.js header nav a {
        flex: none;
        margin: auto 0 0;
        padding: 6px 0 !important;
        border-top: 0 !important;
        min-width: 0 !important;
        font-size: 32px;
        font-weight: 800;
        line-height: 1.5;
    }

    html.js header nav a ~ a {
        margin-top: 0;
    }

    html.js header nav a > span {
        float: left;
        width: 100%;
    }

    html.js header nav a:last-child {
        margin-bottom: auto;
    }

    html.js header nav a[aria-current] {
        text-decoration: underline var(--acc) 8px !important;
        text-underline-offset: 8px !important;
        text-decoration-skip-ink: none;
    }

    html.js header > div {
        position: fixed;
        right: 16px;
        bottom: 24px;
        left: 28px;
        z-index: 101;
        visibility: hidden;
        opacity: 0;
        transition:
            opacity 0.25s ease,
            visibility 0.25s;
    }

    html.js.menu-open header nav,
    html.js.menu-open header > div {
        visibility: visible;
        opacity: 1;
    }

    html.menu-open,
    html.menu-open body {
        overflow: hidden;
    }

    #backToTop {
        right: 16px;
        bottom: 20px;
        width: 46px;
        height: 46px;
    }
}


/* ==========================================
   6. Tablet Layout
========================================== */

@media (max-width: 900px) {


    section[data-reveal] {
        padding: 56px 0 !important;
    }
}


/* ==========================================
   7. Mobile Layout
========================================== */

@media (max-width: 600px) {

    h1 {
        font-size: clamp(32px, 10vw, 44px) !important;
    }

    section[data-reveal] {
        padding: 40px 0 !important;
    }

    article.row > div:first-child {
        flex-basis: 100% !important;
        font-size: 44px !important;
    }

    article.row > div {
        flex-basis: 100% !important;
    }

    /* article.row:hover {
        padding-left: 0;
    } */

    #contact {
        padding: 32px 20px !important;
    }
}


/* ==========================================
   8. Desktop Navigation
========================================== */

@media (min-width: 701px) {
    header nav a.home {
        display: none;
    }

    header nav a[aria-current] {
        border-top-color: var(--acc) !important;
    }
}

@media (max-width: 700px) {
    html:not(.js) header {
        flex-wrap: wrap;
    }
}

/* Project screenshot */

.project-shot {
    flex: 1 1 240px;
    margin: 0;
    align-self: flex-start;
    border-radius: 12px;
    overflow: hidden;
    background: var(--soft);
    border: 1px solid var(--line);
}

.project-shot a {
    display: block;
}

.project-shot img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: top;          /* keeps the top of the page visible */
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.row:hover .project-shot img {
    transform: scale(1.04);        /* GPU-friendly, no layout change */
}

/* hide caption when the image loads; show it as fallback text when it doesn't */
.project-shot figcaption {
    display: none;
}

.project-shot.no-img {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--sub);
}

.project-shot.no-img figcaption {
    display: block;
    padding: 16px;
    text-align: center;
}


/* ==========================================
   9. Reduced Motion Accessibility
========================================== */

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

    .row,
    .card,
    .mark,
    .burger span,
    header nav,
    header > div {
        transition: none !important;
    }

    .row:hover,
    .card:hover {
        transform: none;
    }

    .scroll-line::after { animation: none; transform: translateY(0); }

    .row::before,
    .row > div:first-child { transition: none !important; }
    .row:hover > div:first-child { transform: none; }

    .project-shot img { transition: none !important; }  
    .row:hover .project-shot img { transform: none; }
}



