/* Roboto Mono - Self-hosted, url is relative to css/! */
@font-face {
	font-family: 'Roboto Mono';
	src: url('webfonts/RobotoMono-Variable.woff2') format('woff2-variations');
	font-weight: 100 700;
	font-display: optional;
}

@supports (padding: clamp(10px, 10vh, 100px)) {
    .home-figure {
        --home-figure-gap: clamp(1.5rem, 4vw, 2.5rem);
        --stat-value-fontsize: clamp(2.5rem, 5vw, 3rem);
    }
}

.home-primary {
	margin: calc(var(--base-block-space-rem, 1.5rem) + 0.5rem) auto;
	text-align: center;
	line-height: 1.5;
}

.home-primary h1 {
    margin: max(0.25rem, var(--base-block-space-rem, 1rem)) auto; /* h1 is display: block, so the element itslef must be centered */
    font-size: 2rem;
    font-weight: 700;
}

.home-primary p {
    margin: max(0.25rem, var(--base-block-space-rem, 1rem)) 0; /* no min(), max() and clamp() fallback - use browser default */
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-light);
}

.home-headline-divider {
    margin: var(--base-block-space-rem, 1rem) auto;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--border-light), 
        transparent
    );
}

.home-primary .home-tag {
    margin-bottom: 1.5rem;
}

.home-figure {
    display: flex;
    position: relative;
    flex-wrap: nowrap;
    justify-content: center;
    gap: var(--home-figure-gap, 2.2rem);
    margin: 0; /* override <figure> browser default */
    margin-top: calc(2 * var(--base-block-space-rem, 0.25rem) + 2.5rem);
    margin-bottom: 6lvh;
    --trophy-cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text x="16" y="22" font-size="24" text-anchor="middle" fill="black">🏆</text></svg>') 16 16, crosshair;
    --swords-cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text x="16" y="22" font-size="24" text-anchor="middle" fill="black">⚔️</text></svg>') 16 16, help;
    --shield-cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><text x="16" y="22" font-size="24" text-anchor="middle" fill="black">🛡️</text></svg>') 16 16, not-allowed;
}

.stat-col {
    position: relative;
    text-align: center;
}

.col-vert-divider {
    height: 60px;
    width: 1px;
    background-color: var(--border);
    align-self: center;
}

.stat-col:first-child {
    cursor: var(--trophy-cursor);
}

.stat-col:nth-child(3) {
    cursor: var(--swords-cursor);
}

.stat-col:nth-child(5) {
    cursor: var(--shield-cursor);
}

.home-figure > div:nth-last-of-type(2) {
    /* limit flex grow by simply restricting last stat-label */
    max-width: 10ch;
}

.stat-value {
    font-size: var(--stat-value-fontsize, 2.8rem);
    font-family: var(--mono-strict);
    font-weight: 500;
    font-variant-numeric: tabular-nums slashed-zero;
    font-feature-settings: "tnum" 1, "zero" 1;
    color: var(--primary);
    min-width: 2ch;
}

@keyframes flashAlternate {
    0%, 100% { color: var(--primary); }
    12.5% { color: var(--accent); }
    25% { color: var(--primary); }
    37.5% { color: var(--accent); }
    50% { color: var(--primary); }
    62.5% { color: var(--accent); }
    75% { color: var(--primary); }
    87.5% { color: var(--accent); }
}

/* JS controls animation via inline style */
/* non-JS users see it identically whithout conter animation */
html:not(.js-active) .flashing-breaches .stat-value {
    animation: flashAlternate 1.6s steps(1, end);
    animation-delay: var(--flash-delay-breaches, 0.2s); /* Extra half cycle offset */
}
html:not(.js-active) .flashing-dataloss .stat-value {
    animation: flashAlternate 1.6s steps(1, end);
    animation-delay: var(--flash-delay-dataloss, 0s); /* Base delay after counter */
}

.js-active .stat-col > .stat-value.highlight,
html:not(.js-active) .stat-col:hover > .stat-value,
.stat-col:active > .stat-value { 
    color: var(--accent);
}

/*  NOTE on .stat-value.counter
    Opacity on that element is handled in JavaScript if available,
    which is detected and defined early in accept-lang-autoredirect.js
    (after redirection decision path).  */
.js-active .home-figure > .stat-col > .stat-value.counter { opacity: 0; }

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    min-width: 9ch;
    text-transform: uppercase;
}

.stat-col:first-child > .stat-label {
    /* Increase 'years' spacing to match 2-figure number */
    letter-spacing: 0.1rem;
}

.js-active .stat-col {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.js-active .stat-col::after {
    content: '';
    pointer-events: none;
    position: absolute;
    bottom: 80%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    border: 10px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

html:not(.js-active) .stat-col:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Control CSS ::after triangles via data attribute (synced with JS) */
.js-active .stat-col[data-tooltip-active="true"]::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.js-active .stat-col[data-tooltip-active="false"]::after {
    opacity: 0;
    visibility: hidden;
}

/* tooltip functionality: JavaScript only progressive enhancement!
   Presentation definition here (while not shown at all without JS),
   state management in JS only! */
.stats-proof-point {
    position: absolute;
    /* make 2-line tootlip fit by default */
    bottom: calc(3 * max(1px, calc(var(--base-block-space-pixel) - 5px)) + 106%);
    
    /* Typography - reset inherited styles */
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;

    /* Visual styling */
    text-align: center;
    white-space: normal;
    background: var(--accent-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft-mediumdrop);

    /* "pop up" entrance animation (triggerd by script) */
    transform: translateY(8px);
    transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 1000;
}

html:not(.js-active) .stats-proof-point {
    display: none;
}

/* JS adds this class on hover */
.stats-proof-point.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
    .stats-proof-point.visible {
        transition: none;  /* Remove pop animation */
    }
    .flashing-breaches .stat-value,
    .flashing-dataloss .stat-value {
        animation: none !important;  /* Disable flashing */
        color: var(--primary);  /* Static color */
    }
}

/* TABLET: >= var(--bp-tablet-width) (48rem ^= 768px @1DPR) */
@media (min-width: 32rem) {
	.stats-proof-point { /* Assume tooltip will fit in one line */
		bottom: calc(1.33 * var(--base-block-space-pixel) + 108%);
	}
}
