/*
    style.css
    ---------
    - Developer portfolio for Vishnu Nandan.
    - Matches clean, refined minimal aesthetic of amithv.xyz.
    - Strictly TWO font sizes across the whole site: Main and Sub (Sub is strictly 80% of Main).
    - Strictly TWO icon sizes across the whole site: Main and Sub (Sub is strictly 80% of Main).
    - Fluid responsive scaling for both desktop and mobile displays.
    - Symmetrical padding and centered bottom social icons with safe area support.
    - Dynamic project cutoff that adapts smoothly to viewport height with zero scrolling.
*/

:root {
    --font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* STRICT 2 FONT SIZES (Main & Sub = 80% of Main, smoothly scales for mobile & desktop) */
    --text-main: clamp(14px, calc(13px + 0.35vw), 16.5px);
    --text-sub: calc(var(--text-main) * 0.8);

    /* STRICT 2 ICON SIZES (Main & Sub = 80% of Main) */
    --icon-main: clamp(18px, calc(17px + 0.35vw), 21px);
    --icon-sub: calc(var(--icon-main) * 0.8);
    --icon-footer: clamp(20px, calc(19px + 0.35vw), 23px);

    /* Light theme */
    --bg-color: #ffffff;
    --text-color: #111111;
    --text-muted: #666666;
    --border-color: #e5e5e5;
    --hover-bg: #f5f5f5;
    --icon-bg: #f5f5f5;
    --accent-blue: #2563eb;
    --card-bg: #ffffff;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
}

[data-theme="dark"] {
    --bg-color: #000000;
    --text-color: #ffffff;
    --text-muted: #a3a3a3;
    --border-color: #262626;
    --hover-bg: #141414;
    --icon-bg: #141414;
    --accent-blue: #60a5fa;
    --card-bg: #0a0a0a;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.60);
}

* {
    box-sizing: border-box;
}

/* Strict reset: prevent browser default heading/button font-size discrepancies */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
a,
button,
input {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

html {
    height: 100%;
}

body {
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: var(--text-main);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    align-items: stretch;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----------------------------------------
    Layout container
    - Responsive 9:16 portrait canvas on desktop (up to 520px wide)
    - Full natural width on mobile (100dvh height, zero scrolling)
    - Symmetrical padding with mobile safe area support
    ---------------------------------------- */
.container {
    width: 100%;
    max-width: min(520px, calc(100dvh * 9 / 16));
    height: 100%;
    min-height: 100dvh;
    max-height: 100dvh;
    margin: 0 auto;
    padding: clamp(1.25rem, 2.5vh, 2rem) clamp(1.25rem, 2.5vw, 2rem);
    padding-bottom: max(clamp(1.25rem, 2.5vh, 2rem), calc(env(safe-area-inset-bottom) + 0.75rem));
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

/* ----------------------------------------
    Main content column
    - Stacks tightly from the top with natural clean gaps
    ---------------------------------------- */
main {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1;
    min-height: 0;
}

/* ----------------------------------------
    Profile section
    - Avatar & Name on left, Clock & Theme toggle on right (integrated on same row)
    ---------------------------------------- */
.profile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: clamp(1rem, 2vh, 1.5rem);
    width: 100%;
    flex-shrink: 0;
}

.profile-left {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    min-width: 0;
}

.avatar {
    width: clamp(48px, calc(44px + 0.5vw), 54px);
    height: clamp(48px, calc(44px + 0.5vw), 54px);
    min-width: 48px;
    min-height: 48px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-text {
    min-width: 0;
}

.profile-text h1 {
    margin: 0;
    font-size: var(--text-main);
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
}

.profile-text .subtitle {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: var(--text-sub);
    font-weight: 400;
}

.profile-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.clock,
.time {
    font-size: var(--text-sub);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

#theme-toggle {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background-color: var(--icon-bg);
    color: var(--text-color);
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
}

#theme-toggle:hover {
    background-color: var(--hover-bg);
}

#theme-toggle svg {
    width: 15px;
    height: 15px;
}

/* Section titles like CURRENTLY / ABOUT / PROJECTS */
h2 {
    margin: 0 0 0.5rem;
    font-size: var(--text-sub);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ----------------------------------------
    CURRENTLY section
    ---------------------------------------- */
.currently {
    margin-bottom: clamp(0.9rem, 1.8vh, 1.25rem);
    flex-shrink: 0;
}

.role-header h3 {
    margin: 0;
    font-size: var(--text-main);
    font-weight: 500;
    color: var(--text-color);
}

.date {
    margin: 0.15rem 0 0;
    font-size: var(--text-sub);
    font-weight: 400;
    color: var(--text-muted);
}

.prev-roles-section {
    margin-top: 0.35rem;
}

/* History toggle button with SVG chevron icon */
.prev-roles-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    color: var(--text-muted);
    font-size: var(--text-sub);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

.prev-roles-toggle .toggle-icon {
    width: var(--icon-sub);
    height: var(--icon-sub);
}

.prev-roles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding-left: 0.75rem;
    margin: 0.4rem 0 0;
    border-left: 1px solid var(--border-color);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.prev-roles-grid.expanded {
    max-height: 60px;
    opacity: 1;
}

.role-col h4 {
    margin: 0;
    font-size: var(--text-main);
    font-weight: 500;
    color: var(--text-color);
}

.text-right {
    text-align: left;
}

/* ----------------------------------------
    ABOUT section
    ---------------------------------------- */
.about {
    margin-bottom: clamp(0.9rem, 1.8vh, 1.25rem);
    flex-shrink: 0;
}

.about p {
    margin: 0;
    color: var(--text-color);
    font-size: var(--text-main);
    font-weight: 400;
    line-height: 1.5;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.6rem;
    margin-top: 0.45rem;
}

.tag {
    font-size: var(--text-main);
    font-weight: 400;
    color: var(--accent-blue);
    letter-spacing: -0.01em;
}

/* ----------------------------------------
    PROJECTS list & resizable container
    ---------------------------------------- */
.projects {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.projects-header {
    flex-shrink: 0;
}

.project-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.project-list::-webkit-scrollbar {
    width: 4px;
}

.project-list::-webkit-scrollbar-track {
    background: transparent;
}

.project-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.project-list li {
    flex-shrink: 0;
    height: clamp(36px, calc(34px + 0.4vw), 42px);
    min-height: clamp(36px, calc(34px + 0.4vw), 42px);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.project-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.35rem 0.45rem;
    margin: 0 -0.45rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
}

.project-list li a:hover {
    background-color: var(--hover-bg);
}

.project-left {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-color);
}

.project-left span {
    font-size: var(--text-main);
    font-weight: 400;
    color: var(--text-color);
}

.project-left .project-title {
    font-size: var(--text-main);
    font-weight: 400;
}

.icon-box {
    width: clamp(24px, calc(22px + 0.3vw), 28px);
    height: clamp(24px, calc(22px + 0.3vw), 28px);
    min-width: clamp(24px, calc(22px + 0.3vw), 28px);
    min-height: clamp(24px, calc(22px + 0.3vw), 28px);
    display: grid;
    place-items: center;
    border-radius: 4px;
    background-color: var(--icon-bg);
    border: 1px solid var(--border-color);
    font-size: var(--text-main);
    flex-shrink: 0;
}

.arrow-box {
    width: clamp(20px, calc(18px + 0.3vw), 23px);
    height: clamp(20px, calc(18px + 0.3vw), 23px);
    min-width: clamp(20px, calc(18px + 0.3vw), 23px);
    min-height: clamp(20px, calc(18px + 0.3vw), 23px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: var(--border-color);
    color: var(--text-color);
    flex-shrink: 0;
}

.arrow-box svg {
    display: block;
    width: var(--icon-sub);
    height: var(--icon-sub);
}

.project-list li a:hover .arrow-box {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* ----------------------------------------
    Bottom bar
    - Contains More works link and Centered social icons
    - Anchored permanently at the bottom, never clipped
    ---------------------------------------- */
.bottom-bar {
    display: flex;
    flex-direction: column;
    margin-top: auto;
    padding-top: 0.75rem;
    flex-shrink: 0;
    width: 100%;
}

.more-works {
    margin-bottom: clamp(0.9rem, 1.8vh, 1.25rem);
    padding-left: 0.1rem;
}

.more-works a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-sub);
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: none;
}

.more-works a svg {
    width: var(--icon-sub);
    height: var(--icon-sub);
}

/* ----------------------------------------
    Social links row (strictly centered with symmetrical padding)
    ---------------------------------------- */
.socials {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    margin: 0 auto;
}

.socials a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.socials a svg {
    width: var(--icon-footer);
    height: var(--icon-footer);
}

.socials a:hover {
    color: var(--text-color);
}

/* Tooltip: exact same font-size as var(--text-sub) */
.socials a::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 3px 6px;
    border-radius: 4px;
    font-size: var(--text-sub);
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.socials a:hover::after {
    opacity: 1;
}

/* ----------------------------------------
    Hover card (project preview for desktop)
    ---------------------------------------- */
#hover-card {
    position: fixed;
    display: none;
    opacity: 0;
    width: clamp(240px, 300px, 340px);
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    pointer-events: none;
    z-index: 9999;
    transform: translateY(-50%) scale(0.95);
}

#hover-card-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--border-color);
}

.hover-card-content {
    padding: 0.75rem 1rem;
}

.hover-card-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: var(--text-color);
    font-size: var(--text-main);
}

#hover-card-desc {
    margin: 0;
    font-size: var(--text-sub);
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
}
