/* 
   Demfati Top 100  Apple-inspired Design System
    */

:root {
    /* -- Colors -- */
    --c-bg:           #ffffff;
    --c-bg-secondary: #f5f5f7;
    --c-text:         #1d1d1f;
    --c-text-secondary: #485b5e;
    --c-accent:       #0071e3;
    --c-accent-hover: #0077ed;
    --c-border:       #f5f5f7;
    --c-up:           #12805c;
    --c-up-bg:        #e1f6ee;
    --c-down:         #e0446b;
    --c-down-bg:      #ffe9ef;
    --c-flat:         #86868b;
    --c-flat-bg:      #f5f5f7;
    --c-new:          #ec893c;
    --c-new-bg:       #fef3e8;

    /* -- Typography -- */
    --ff: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;

    /* -- Spacing (7px base) -- */
    --sp-1: 7px;
    --sp-2: 14px;
    --sp-3: 21px;
    --sp-4: 28px;
    --sp-5: 35px;
    --sp-6: 49px;
    --sp-7: 70px;

    /* -- Radius -- */
    --r-subtle: 5px;
    --r-btn: 8px;
    --r-btn-lg: 11px;
    --r-card: 18px;
    --r-pill: 980px;

    /* -- Shadows -- */
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-deep: rgba(0, 0, 0, 0.22) 3px 5px 30px 0px;
}

/* -- Reset -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    font-family: var(--ff);
    font-weight: 400;
    background: linear-gradient(160deg, #ffffff 0%, #f0f4ff 30%, #ffffff 55%, #f5f0ff 80%, #ffffff 100%);
    color: var(--c-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.47059;
    font-size: 17px;
    letter-spacing: -0.022em;
    position: relative;
    overflow-x: hidden;
}

/* Noise overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* Floating particles container */
.tp100-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.tp100-particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: tp100-float linear infinite;
    will-change: transform, opacity;
}

.tp100-particle--blue   { background: rgba(0, 113, 227, 0.12); }
.tp100-particle--purple { background: rgba(116, 36, 181, 0.10); }
.tp100-particle--orange { background: rgba(236, 137, 60,  0.10); }
.tp100-particle--gray   { background: rgba(134, 134, 139, 0.08); }
.tp100-particle--light  { background: rgba(0, 113, 227, 0.06); }

@keyframes tp100-float {
    0% {
        transform: translateY(100vh) translateX(0) scale(0.4);
        opacity: 0;
    }
    8% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) translateX(var(--drift)) scale(1);
        opacity: 0;
    }
}

/* Ensure content sits above background layers */
.tp100-header,
.tp100-main,
.tp100-footer {
    position: relative;
    z-index: 1;
}

a { color: var(--c-accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--c-accent-hover); }

:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: var(--r-subtle); }

.tp100-main { flex: 1 0 auto; width: 100%; }

.tp100-shell {
    max-width: 760px;
    margin: 0 auto;
    padding-left: var(--sp-2);
    padding-right: var(--sp-2);
}

/* 
   Header
    */

.tp100-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--c-border);
}

.tp100-header-inner {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    height: 52px;
}

.tp100-logo {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    fill: url(#tp100LogoGrad) var(--c-accent);
    display: block;
    transition: transform 0.3s ease;
}

.tp100-brand:hover .tp100-logo { transform: rotate(-8deg) scale(1.06); }

.tp100-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--c-text);
    font-family: var(--ff);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.022em;
    text-decoration: none;
    white-space: nowrap;
}

.tp100-brand:hover { text-decoration: none; color: var(--c-text); }

.tp100-brand-text { font-size: 17px; line-height: 1; }
.tp100-brand-text strong { font-weight: 700; color: var(--c-text); }

.tp100-nav { margin-left: auto; }

.tp100-nav ul {
    display: flex;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tp100-nav-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--r-pill);
    color: var(--c-text-secondary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: background 0.2s ease, color 0.2s ease;
}

.tp100-nav-link:hover { color: var(--c-text); background: var(--c-bg-secondary); text-decoration: none; }
.tp100-nav-link.is-active { color: var(--c-bg); background: var(--c-text); }

.tp100-header-actions { display: flex; align-items: center; gap: var(--sp-1); }

.tp100-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 17px;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: #fff;
    font-family: var(--ff);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border: 0;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease, transform 0.15s ease;
}

.tp100-cta:hover { background: var(--c-accent-hover); color: #fff; text-decoration: none; }
.tp100-cta:active { transform: scale(0.98); }
.tp100-cta--block { display: flex; width: 100%; margin-top: var(--sp-1); }

.tp100-burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--c-border);
    border-radius: var(--r-btn);
    background: var(--c-bg);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.tp100-burger span { display: block; width: 16px; height: 1.5px; border-radius: 1px; background: var(--c-text); transition: transform 0.2s ease, opacity 0.2s ease; }

.tp100-burger.is-open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.tp100-burger.is-open span:nth-child(2) { opacity: 0; }
.tp100-burger.is-open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
.tp100-burger:hover { border-color: var(--c-text); }

/* Mobile drawer */

.tp100-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.tp100-mobile-overlay.is-open { opacity: 1; visibility: visible; }

.tp100-mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 90;
    width: min(300px, 82vw);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: var(--sp-3) var(--sp-3) var(--sp-4);
    background: var(--c-bg);
    box-shadow: var(--shadow-deep);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
    overflow-y: auto;
}

.tp100-mobile-nav.is-open { transform: translateX(0); visibility: visible; }

.tp100-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-1);
    margin-bottom: var(--sp-3);
}

.tp100-mobile-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-btn);
    background: var(--c-bg-secondary);
    color: var(--c-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.tp100-mobile-close:hover { background: var(--c-border); }

.tp100-mobile-nav ul {
    list-style: none;
    margin: 0 0 var(--sp-2);
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tp100-mobile-link {
    display: block;
    padding: 10px 14px;
    border-radius: var(--r-btn);
    color: var(--c-text);
    font-size: 16px;
    font-weight: 500;
}

.tp100-mobile-link:hover { text-decoration: none; background: var(--c-bg-secondary); }
.tp100-mobile-link.is-active { color: var(--c-bg); background: var(--c-text); }

/* 
   Hero
    */

.tp100-hero {
    padding: var(--sp-5) 0 var(--sp-3);
}

.tp100-hero-subpage { padding: var(--sp-4) 0 var(--sp-3); }

.tp100-eyebrow {
    display: inline-block;
    margin: 0 0 var(--sp-2);
    padding: 5px 14px;
    border-radius: var(--r-pill);
    background: var(--c-bg-secondary);
    color: var(--c-text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tp100-hero h1 {
    margin: 0;
    font-family: var(--ff);
    font-weight: 600;
    font-size: clamp(34px, 8vw, 56px);
    line-height: 1.07;
    letter-spacing: -0.0374em;
    color: var(--c-text);
}

.tp100-hero-sub {
    margin: var(--sp-2) 0 0;
    color: var(--c-text-secondary);
    font-size: 18px;
    font-weight: 400;
    max-width: 560px;
    line-height: 1.47;
}

/* 
   Segmented period tabs
    */

.tp100-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0;
    margin-top: var(--sp-2);
    padding: 3px;
    background: var(--c-bg-secondary);
    border-radius: var(--r-pill);
}

.tp100-tab {
    padding: 8px 18px;
    border-radius: var(--r-pill);
    border: 0;
    background: transparent;
    color: var(--c-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.tp100-tab:hover { color: var(--c-text); text-decoration: none; }
.tp100-tab.is-active { background: var(--c-bg); color: var(--c-text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.tp100-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-1); margin-top: var(--sp-2); }

.tp100-filters label { display: inline-flex; flex-direction: column; gap: 4px; }

.tp100-filter-label { font-size: 12px; font-weight: 600; color: var(--c-text-secondary); letter-spacing: 0.01em; }

.tp100-select {
    padding: 8px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-btn);
    background: var(--c-bg);
    font-family: var(--ff);
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
    min-width: 180px;
    transition: border-color 0.2s ease;
    appearance: auto;
}

.tp100-select:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15); }

/* 
   Chart (Rows)
    */

.tp100-chart { padding: var(--sp-3) 0 var(--sp-6);padding-top:0; }

.tp100-rows { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 2px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-card);
    padding: 14px 18px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease; }

.tp100-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 0;
    padding: 12px 0;
    align-items: center;
    border-bottom: 1px solid var(--c-border);
}
.tp100-row:last-child { border-bottom: none;padding-bottom: 0; }
.tp100-rank-cell { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.tp100-rank {
    font-family: var(--ff);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.03em;
    color: var(--c-text);
    text-align: center;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tp100-row-main { display: flex; align-items: center; gap: 14px; min-width: 0; color: inherit; text-decoration: none; }
.tp100-row-main:hover { text-decoration: none; color: inherit; }

.tp100-row-logo, .tp100-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex: 0 0 48px;
    object-fit: cover;
    background: var(--c-bg-secondary);
    border: 1px solid var(--c-border);
}

.tp100-avatar { display: inline-flex; align-items: center; justify-content: center; color: var(--c-accent); font-weight: 600; font-size: 18px; }

.tp100-row-id { display: flex; flex-direction: column; min-width: 0; }

.tp100-name { font-weight: 600; font-size: 16px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-text); }

.tp100-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--c-flat); margin-top: 2px; font-weight: 500; }

.tp100-handle { color: var(--c-accent); }

.tp100-right { display: flex; align-items: center; gap: 10px; }

.tp100-movement { text-align: center; }

.tp100-move {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 12px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.tp100-move.is-up { color: var(--c-up); background: var(--c-up-bg); }
.tp100-move.is-down { color: var(--c-down); background: var(--c-down-bg); }
.tp100-move.is-flat { color: var(--c-flat); background: var(--c-flat-bg); }
.tp100-move.is-new { color: var(--c-new); background: var(--c-new-bg); }

.tp100-pagination { margin-top: var(--sp-3); text-align: center; }

.tp100-note { margin-top: var(--sp-3); font-size: 15px; color: var(--c-text-secondary); font-weight: 500; }

.tp100-empty { text-align: center; padding: var(--sp-6) 20px; color: var(--c-text-secondary); }

.tp100-empty-icon { font-size: 48px; margin: 0 0 var(--sp-1); font-weight: 400; color: var(--c-flat); }
.tp100-empty h2 { margin: 0 0 6px; color: var(--c-text); font-weight: 600; letter-spacing: -0.02em; font-size: 28px; }

/* 
   Buttons / Cards / Prose
    */

.tp100-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 21px;
    border-radius: var(--r-pill);
    background: var(--c-accent);
    color: #fff;
    font-family: var(--ff);
    font-size: 15px;
    font-weight: 500;
    border: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.tp100-btn:hover { background: var(--c-accent-hover); color: #fff; text-decoration: none; }
.tp100-btn:active { transform: scale(0.98); }
.tp100-btn-ghost { background: var(--c-bg-secondary); color: var(--c-text); }
.tp100-btn-ghost:hover { background: var(--c-border); color: var(--c-text); }

.tp100-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-1); }

.tp100-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-1);
    padding: 16px 18px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--r-card);
    color: var(--c-text);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.tp100-card:hover { box-shadow: var(--shadow-card); border-color: #d2d2d7; text-decoration: none; color: var(--c-text); }
.tp100-card-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.tp100-card-arrow { color: var(--c-accent); font-weight: 500; font-size: 18px; }

.tp100-prose { padding: var(--sp-4) 20px var(--sp-6); max-width: 760px; margin: 0 auto; }
.tp100-prose h2 { font-weight: 600; font-size: 28px; letter-spacing: -0.02em; margin: var(--sp-4) 0 10px; color: var(--c-text); line-height: 1.2; }
.tp100-prose h2:first-child { margin-top: 0; }
.tp100-prose p { color: var(--c-text-secondary); font-weight: 400; line-height: 1.59; }
.tp100-prose li { margin-bottom: 8px; color: var(--c-text-secondary); font-weight: 400; line-height: 1.59; }
.tp100-prose strong { color: var(--c-text); font-weight: 600; }
.tp100-updated { color: var(--c-flat); font-size: 13px; margin-top: var(--sp-3); }

/* 
   Footer
    */

.tp100-footer {
    flex-shrink: 0;
    width: 100%;
    border-top: 1px solid var(--c-border);
    overflow: hidden;
}

.tp100-footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: var(--sp-3);
    padding: var(--sp-5) var(--sp-2) var(--sp-4);
}

.tp100-footer-brand .tp100-brand { color: var(--c-text); margin-bottom: var(--sp-2); }
.tp100-footer-brand .tp100-brand:hover { color: var(--c-text); }
.tp100-footer-brand .tp100-brand-text strong { color: var(--c-text); }
.tp100-footer-brand .tp100-logo { fill: url(#tp100LogoGrad) var(--c-accent); }

.tp100-footer-tag { margin: 0; font-size: 14px; color: var(--c-text-secondary); max-width: 280px; line-height: 1.59; font-weight: 400; }

.tp100-footer-col h5 {
    margin: 0 0 var(--sp-2);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-flat);
}

.tp100-footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.tp100-footer-col a { color: var(--c-text-secondary); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.tp100-footer-col a:hover { color: var(--c-text); text-decoration: none; }
.tp100-footer-social i { font-size: 16px; color: var(--c-flat); }

.tp100-footer-bottom { border-top: 1px solid var(--c-border); background: var(--c-bg-secondary); padding: 18px 0; }

.tp100-footer-bottom-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }

.tp100-copy { font-size: 12px; color: var(--c-flat); font-weight: 500; }

.tp100-legal { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tp100-legal a { color: var(--c-flat); font-size: 12px; white-space: nowrap; font-weight: 500; }
.tp100-legal a:hover { color: var(--c-text); text-decoration: none; }

/* 
   Responsive
    */

@media (max-width: 900px) {
    .tp100-footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
    .tp100-nav { display: none; }
    .tp100-cta:not(.tp100-cta--block) { display: none; }
    .tp100-header-actions { margin-left: auto; }
    .tp100-burger { display: flex; }
    .tp100-header-inner { height: 48px; }
    .tp100-footer-grid { grid-template-columns: 1fr; gap: var(--sp-3); padding: var(--sp-4) var(--sp-2) var(--sp-2); }
    .tp100-footer-bottom-inner { justify-content: center; text-align: center; }
    .tp100-legal { justify-content: center; }
    .tp100-hero h1 { letter-spacing: -0.02em; }
}

@media (max-width: 640px) {
    .tp100-shell { padding-left: 16px; padding-right: 16px; }
    .tp100-row { grid-template-columns: 56px 1fr; padding: 12px 14px; }
    .tp100-rank { font-size: 14px; }
    .tp100-row-logo, .tp100-avatar { width: 40px; height: 40px; flex-basis: 40px; }
    .tp100-name { font-size: 15px; }
    .tp100-brand-text { font-size: 16px; }
    .tp100-logo { width: 24px; height: 24px; flex-basis: 24px; }
    .tp100-movement { min-width: 0; }
    .tp100-move { padding: 4px 10px; font-size: 11px; }
    .tp100-hero { padding-top: var(--sp-3); }
    .tp100-hero h1 { font-size: clamp(28px, 10vw, 44px); line-height: 1.09; }
    .tp100-tabs { width: 100%; }
    .tp100-tab { flex: 1 1 auto; padding: 8px 8px; text-align: center; font-size: 13px; }
    .tp100-select { min-width: 0; width: 100%; }
    .tp100-filters label { width: 100%; }
    .tp100-prose { padding-left: 16px; padding-right: 16px; }
    .tp100-empty { padding-left: 16px; padding-right: 16px; }
}
