/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

img, video { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; transition: opacity .15s; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; transition: opacity .15s; }

/* ── Tokens ── */
:root {
    --color-dark:  #101113;
    --color-light: #ffffff;
    --font: system-ui, Helvetica, Arial, sans-serif;
}

/* ── Base ── */
html { font-family: var(--font); line-height: 1.5; -webkit-text-size-adjust: 100%; }

body {
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--color-light);
    color: var(--color-dark);
    transition: background-color .15s, color .15s;
}

body::selection, body *::selection {
    background-color: var(--color-dark);
    color: var(--color-light);
}

html.dark body {
    background-color: var(--color-dark);
    color: var(--color-light);
}

html.dark body::selection, html.dark body *::selection {
    background-color: var(--color-light);
    color: var(--color-dark);
}

/* ── Layout ── */
.page {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.layout {
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
    .layout {
        grid-template-columns: 5fr 7fr;
        gap: 4rem;
    }
}

@media (min-width: 1280px) { .layout { gap: 5rem; } }
@media (min-width: 1536px) { .layout { gap: 6rem; } }

/* ── Sidebar (left column) ── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    position: relative;
}

@media (min-width: 768px)  { .sidebar { padding: 3rem; gap: 2rem; } }
@media (min-width: 1024px) { .sidebar { position: sticky; top: 0; align-self: start; padding: 4rem 0 4rem 4rem; gap: 2.5rem; } }
@media (min-width: 1280px) { .sidebar { padding: 5rem 0 5rem 5rem; gap: 3rem; } }
@media (min-width: 1536px) { .sidebar { padding: 6rem 0 6rem 6rem; gap: 3.5rem; } }

/* ── Profile header ── */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .profile-header { flex-direction: row; gap: 0; }
}

.profile-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding-top: 1.25rem;
    text-align: center;
}

@media (min-width: 768px) {
    .profile-link { flex-direction: row; gap: 1.25rem; padding-top: 0; text-align: left; align-items: center; justify-content: flex-start; }
}
@media (min-width: 1024px) { .profile-link { gap: 1rem; } }
@media (min-width: 1280px) { .profile-link { gap: 1.5rem; } }

.profile-link:hover { opacity: .8; }

.avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
}

@media (min-width: 768px) { .avatar { width: 4rem; height: 4rem; } }

.profile-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.25rem;
}

@media (min-width: 768px) { .profile-name { align-items: flex-start; } }

.profile-name strong { font-weight: 800; }
.profile-name span   { font-weight: 500; opacity: .6; }

/* ── Header actions (dark toggle + follow) ── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    justify-content: space-between;
}

@media (min-width: 768px) {
    .header-actions { position: relative; top: auto; right: auto; margin-left: auto; gap: 1.25rem; }
}
@media (min-width: 1280px) { .header-actions { gap: 1.5rem; } }

.dark-toggle {
    opacity: .4;
}
.dark-toggle:hover { opacity: 1; }

.follow-btn {
    font-size: 1.125rem;
    font-weight: 700;
    border-radius: 9999px;
    padding: .5em 1em;
    background-color: var(--color-dark);
    color: var(--color-light);
}
.follow-btn:hover { opacity: .8; }

html.dark .follow-btn {
    background-color: var(--color-light);
    color: var(--color-dark);
}

/* ── Bio ── */
.bio {
    font-size: 1rem;
    text-align: center;
    padding: 0 1.25rem;
}

@media (min-width: 768px) { .bio { text-align: left; padding: 0; font-size: 1.5rem; } }
@media (min-width: 1024px) { .bio { font-size: 1.5rem; } }

.bio p + p { margin-top: 1em; }
.bio a { text-decoration: underline; }
.bio a:hover { opacity: .7; }

/* ── Bio toggle button ── */
.bio-toggle-wrap {
    display: flex;
    justify-content: center;
}

@media (min-width: 768px) { .bio-toggle-wrap { justify-content: flex-start; } }

.bio-toggle {
    font-size: .95rem;
    font-weight: 600;
    padding: .55em 1.4em;
    border-radius: 9999px;
    border: 2px solid currentColor;
    opacity: .5;
}
.bio-toggle:hover { opacity: 1; }

/* ── Bio panel ── */
.bio-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .35s ease;
    overflow: hidden;
}

.bio-panel.open {
    grid-template-rows: 1fr;
}

.bio-panel-inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1em;
    font-size: 1rem;
    line-height: 1.7;
    opacity: .8;
    padding-bottom: .25rem;
}

/* ── Recently watched ── */
.rw-section {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    align-items: center;
}

@media (min-width: 768px) { .rw-section { align-items: flex-start; } }

.rw-heading {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    opacity: .4;
}

.recently-watched {
    display: none;
    align-items: center;
    gap: .9rem;
    padding: .75rem;
    border-radius: 14px;
    background-color: rgba(16,17,19,.05);
    transition: background-color .15s;
    width: 100%;
}

.recently-watched:hover { background-color: rgba(16,17,19,.10); }

html.dark .recently-watched { background-color: rgba(255,255,255,.05); }
html.dark .recently-watched:hover { background-color: rgba(255,255,255,.10); }

.rw-poster {
    width: 48px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.rw-text {
    display: flex;
    flex-direction: column;
    gap: .15em;
    min-width: 0;
}

.rw-title {
    font-size: .95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rw-rating {
    font-size: .85rem;
    opacity: .6;
}

/* skeleton */
.rw-skeleton {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .75rem;
    border-radius: 14px;
    background-color: rgba(16,17,19,.05);
    width: 100%;
}

html.dark .rw-skeleton { background-color: rgba(255,255,255,.05); }

.rw-skeleton-poster {
    width: 48px;
    height: 72px;
    border-radius: 6px;
    flex-shrink: 0;
    background: rgba(16,17,19,.1);
    animation: shimmer 1.4s infinite;
}

html.dark .rw-skeleton-poster { background: rgba(255,255,255,.1); }

.rw-skeleton-text {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    flex: 1;
}

.rw-skeleton-line {
    height: .75rem;
    border-radius: 4px;
    width: 100%;
    background: rgba(16,17,19,.1);
    animation: shimmer 1.4s infinite;
}

html.dark .rw-skeleton-line { background: rgba(255,255,255,.1); }

.rw-skeleton-line--short { width: 45%; }
.rw-skeleton-line--mid   { width: 30%; }

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}

/* ── Social icons ── */
.social-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 1.5rem 0;
    margin-top: auto;
}

@media (min-width: 768px) { .social-links { justify-content: flex-start; padding: 0; } }
@media (min-width: 1024px) { .social-links { padding: 0; } }

.social-links a { padding: .5rem; margin: -.5rem; }

.social-icon-img { width: 1em; height: 1em; display: inline-block; vertical-align: middle; border-radius: 4px; }
.social-icon-img--lg { width: 2em; height: 2em; border-radius: 6px; }
.social-links a:hover { opacity: .6; }

/* ── Main content (right column) ── */
.main {
    padding: 1.5rem;
    margin-top: -1.5rem;
}

@media (min-width: 768px)  { .main { padding: 3rem; margin-top: -3rem; } }
@media (min-width: 1024px) { .main { padding: 4rem 4rem 4rem 0; margin-top: 0; } }
@media (min-width: 1280px) { .main { padding: 5rem 5rem 5rem 0; } }
@media (min-width: 1536px) { .main { padding: 6rem 6rem 6rem 0; } }

.links-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    font-size: 1rem;
}

@media (min-width: 768px) { .links-list { font-size: 1.25rem; gap: 1.5rem; } }
@media (min-width: 1024px) { .links-list { gap: 1.75rem; } }
@media (min-width: 1280px) { .links-list { gap: 2rem; } }

/* ── Link card ── */
.link-card {
    display: flex;
    align-items: center;
    gap: 1.5em;
    padding: 1.25rem;
    border-radius: 20px;
    background-color: rgba(16, 17, 19, 0.05);
    transition: background-color .15s;
}

.link-card:hover { background-color: rgba(16, 17, 19, 0.10); }

html.dark .link-card { background-color: rgba(255, 255, 255, 0.05); }
html.dark .link-card:hover { background-color: rgba(255, 255, 255, 0.10); }

@media (min-width: 768px) { .link-card { padding: 1.5rem; border-radius: 25px; } }

.link-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 15px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-light);
    padding: 10px;
}

html.dark .link-card-icon { background-color: var(--color-dark); }

@media (min-width: 768px) { .link-card-icon { width: 90px; height: 90px; border-radius: 18px; padding: 12px; } }

.link-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.link-card-text h2 { font-weight: 700; }
.link-card-text p  { font-weight: 500; opacity: .5; margin-top: .1em; }

/* ── Follow dropdown ── */
.follow-wrap {
    position: relative;
}

.follow-menu {
    display: none;
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 160px;
    list-style: none;
    background: var(--color-light);
    color: var(--color-dark);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,.14);
    padding: .4rem;
    z-index: 100;
}

.follow-menu.open { display: flex; flex-direction: column; }

html.dark .follow-menu {
    background: #1c1d1f;
    color: var(--color-light);
    box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

.follow-menu a {
    display: flex;
    align-items: center;
    gap: .6em;
    font-size: 1rem;
    font-weight: 600;
    padding: .55em .85em;
    border-radius: 9px;
    white-space: nowrap;
}

.follow-menu a:hover {
    background-color: rgba(16,17,19,.07);
}

html.dark .follow-menu a:hover {
    background-color: rgba(255,255,255,.08);
}

/* ── Avatar lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.lightbox.open { display: flex; }

.lightbox-img {
    width: min(480px, 90vw);
    height: min(480px, 90vw);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 12px 60px rgba(0,0,0,.5);
}

/* ── Footer quote ── */
.quote {
    opacity: .5;
    text-align: center;
    padding: 1.5rem 2rem;
    font-weight: 500;
}
