/* ===================================================================
   Devtools theme - IDE-inspired aesthetic for developers
   Version: 1.0.1
   Author: Reveloni
   For: CMS 6.0.1+
   
   Tokyo Night palette + JetBrains Mono with ligatures + line numbers +
   View Transitions API + scroll-driven animations + container queries +
   :has() selectors + spring easing via linear() + @property animated
   gradients. Light mode (GitHub Light) supported.
   
   Made with respect for the craft. View source enthusiasts welcome.
   
   Changelog:
     1.0.1 - .animate-on-scroll now reads var(--animation-offset, 20px)
             so admin "Animation intensity" slider controls scroll
             animation translation distance.
     1.0.0 - Initial release.
   =================================================================== */

/* === @PROPERTY: animated gradient angles (Chrome 85+) === */
@property --grad-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@property --shine-pos {
    syntax: '<percentage>';
    initial-value: -100%;
    inherits: false;
}

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Tokyo Night dark palette */
    --tn-bg: #1a1b26;
    --tn-bg-dark: #16161e;
    --tn-bg-highlight: #292e42;
    --tn-fg: #c0caf5;
    --tn-fg-dark: #a9b1d6;
    --tn-fg-gutter: #3b4261;
    --tn-comment: #565f89;
    
    /* Syntax highlight tokens (used as accents on top of palette) */
    --tn-blue: #7aa2f7;
    --tn-cyan: #7dcfff;
    --tn-magenta: #bb9af7;
    --tn-orange: #ff9e64;
    --tn-yellow: #e0af68;
    --tn-green: #9ece6a;
    --tn-red: #f7768e;
    
    /* Mapped to theme tokens */
    --text: var(--tn-fg);
    --text-secondary: var(--tn-fg-dark);
    --text-muted: var(--tn-comment);
    --bg: var(--tn-bg);
    --bg-elevated: var(--tn-bg-highlight);
    --bg-card: #1f2335;
    --border: rgba(192, 202, 245, 0.08);
    --border-strong: rgba(192, 202, 245, 0.15);
    --gutter: var(--tn-fg-gutter);
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4),
                 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.5),
                 0 2px 6px rgba(0, 0, 0, 0.3);
    
    /* Spring easings using linear() - CSS Working Group magic */
    --ease-spring: linear(
        0, 0.005, 0.022, 0.05, 0.092, 0.151, 0.232, 0.339, 0.474, 0.638,
        0.823, 1.011, 1.171, 1.281, 1.341, 1.36, 1.353, 1.331, 1.302,
        1.272, 1.244, 1.222, 1.205, 1.196, 1.193 75.59%, 1.196, 1.202,
        1.207, 1.207, 1.205, 1.202, 1.198, 1.195, 1.193 96.21%, 1.197, 1.2
    );
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-snap: cubic-bezier(0.5, 0, 0, 1);
    
    --transition: 0.4s var(--ease-out);
    --transition-fast: 0.2s var(--ease-out);
    --transition-spring: 0.6s var(--ease-spring);
    
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Monaco, Consolas, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    --font-features: 'cv11', 'cv12', 'cv13', 'calt', 'liga', 'ss02';
}

/* GitHub Light mode override */
[data-theme="light"] {
    --tn-bg: #ffffff;
    --tn-bg-dark: #f6f8fa;
    --tn-bg-highlight: #f6f8fa;
    --tn-fg: #1f2328;
    --tn-fg-dark: #424a53;
    --tn-fg-gutter: #d1d9e0;
    --tn-comment: #6e7781;
    
    --tn-blue: #0969da;
    --tn-cyan: #1f6feb;
    --tn-magenta: #8250df;
    --tn-orange: #bc4c00;
    --tn-yellow: #9a6700;
    --tn-green: #1a7f37;
    --tn-red: #cf222e;
    
    --bg-card: #ffffff;
    --border: rgba(31, 35, 40, 0.1);
    --border-strong: rgba(31, 35, 40, 0.18);
    
    --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.06);
    --shadow-md: 0 4px 12px rgba(31, 35, 40, 0.1),
                 0 1px 3px rgba(31, 35, 40, 0.06);
    --shadow-lg: 0 12px 28px rgba(31, 35, 40, 0.12),
                 0 2px 6px rgba(31, 35, 40, 0.06);
}

/* === ANIMATIONS === */
@keyframes cursor-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes shine {
    to { --shine-pos: 200%; }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes border-flow {
    to { --grad-angle: 360deg; }
}

/* === VIEW TRANSITIONS === */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 200ms var(--ease-snap) both fade-out;
}

::view-transition-new(root) {
    animation: 320ms var(--ease-out) both fade-in-up;
}

@keyframes fade-out {
    to { opacity: 0; }
}

@keyframes fade-in-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === BASE === */
html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

[data-theme="light"] html,
html[data-theme="light"] {
    color-scheme: light;
}

body {
    font-family: var(--font-mono);
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    transition: background var(--transition), color var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: var(--font-features);
    font-variant-ligatures: contextual;
    font-size: 15px;
    
    /* Subtle scanline-free, just clean editor bg */
    background-image: 
        radial-gradient(ellipse at top right, rgba(122, 162, 247, 0.04), transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(187, 154, 247, 0.03), transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(ellipse at top right, rgba(9, 105, 218, 0.025), transparent 50%),
        radial-gradient(ellipse at bottom left, rgba(130, 80, 223, 0.02), transparent 50%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* CMS animations - scroll-driven for browsers that support it */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(var(--animation-offset, 20px));
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

body.js-ready[data-animations-enabled="true"] .animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

body:not([data-animations-enabled="true"]) .animate-on-scroll {
    opacity: 1;
    transform: none;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

h1 { font-size: 1.75rem; margin-bottom: 1.25rem; }
h2 { font-size: 1.35rem; margin-bottom: 1rem; margin-top: 2rem; color: var(--tn-blue); }
h3 { font-size: 1.15rem; margin-bottom: 0.75rem; margin-top: 1.5rem; color: var(--tn-cyan); }
h4 { font-size: 1rem; margin-bottom: 0.5rem; color: var(--tn-magenta); }

/* H2 prefix as Markdown header */
.content-section h2::before {
    content: '## ';
    color: var(--text-muted);
    font-weight: 400;
}

.content-section h3::before {
    content: '### ';
    color: var(--text-muted);
    font-weight: 400;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.7;
    text-wrap: pretty;
}

a {
    color: var(--tn-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--tn-cyan);
}

strong {
    font-weight: 700;
    color: var(--text);
}

code, pre {
    font-family: var(--font-mono);
    font-feature-settings: var(--font-features);
}

code {
    background: var(--bg-elevated);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--tn-orange);
}

pre {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    margin: 1.25rem 0;
    font-size: 0.9em;
    line-height: 1.6;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: inherit;
}

/* === DARK MODE TOGGLE === */
.dark-mode-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text);
    z-index: 50;
    transition: all var(--transition);
    font-family: var(--font-mono);
}

.dark-mode-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--tn-blue);
    box-shadow: var(--shadow-lg), 0 0 0 3px rgba(122, 162, 247, 0.15);
}

/* === HEADER (Tab bar) === */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(26, 27, 38, 0.85);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
}

/* Backdrop blur on a pseudo-element, not on <header> (menu fix).
   Prevents the header from becoming a containing block for the mobile
   dropdown's position:fixed - which collapsed it to a strip and pushed
   it off-screen. Frosted look unchanged. */
header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="light"] header {
    background: rgba(255, 255, 255, 0.85);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    gap: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.logo-container img {
    height: 80px;
    width: auto;
}

.logo-container a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.site-title {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.site-title::before {
    content: '~/';
    color: var(--text-muted);
    font-weight: 400;
    margin-right: 0.15em;
}

/* === BREADCRUMBS (file path style) === */
.breadcrumbs {
    padding: 1.25rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.breadcrumbs a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.breadcrumbs a:hover {
    color: var(--tn-blue);
}

.breadcrumbs span {
    margin: 0 0.25rem;
    color: var(--text-muted);
    opacity: 0.5;
}

/* === NAVIGATION === */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
}

.hamburger-menu {
    position: relative;
}

.hamburger-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
}

/* v1.0.4: removed the ::before command-glyph - the markup ships its own
   <span>☰</span>, so the extra icon doubled it. Classic hamburger stays. */

.hamburger-btn:hover {
    border-color: var(--tn-blue);
    color: var(--tn-blue);
    box-shadow: 0 0 0 3px rgba(122, 162, 247, 0.12);
}

.hamburger-btn:hover::before {
    color: var(--tn-blue);
}

/* Dropdown menu */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 260px;
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0.4rem 0;
    list-style: none;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    font-family: var(--font-mono);
}

.dropdown-menu.active {
    display: block;
    animation: fade-up 0.2s var(--ease-out);
}

.dropdown-menu ul {
    display: block;
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    font-weight: 400;
    font-size: 0.85rem;
    transition: background var(--transition-fast), color var(--transition-fast);
    position: relative;
}

.dropdown-menu a::before {
    content: '› ';
    color: var(--text-muted);
    margin-right: 0.15em;
    transition: color var(--transition-fast);
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
    background: var(--bg-elevated);
    color: var(--tn-blue);
}

.dropdown-menu a:hover::before,
.dropdown-menu a.active::before {
    color: var(--tn-blue);
}

.dropdown-submenu {
    padding-left: 1rem;
    font-size: 0.82rem;
    list-style: none;
    margin: 0;
}

.dropdown-submenu a {
    padding: 0.4rem 1rem;
}

.dropdown-subsubmenu {
    padding-left: 2rem;
    font-size: 0.78rem;
    list-style: none;
    margin: 0;
}

.dropdown-subsubmenu a {
    padding: 0.35rem 1rem;
}

/* === HERO === */
.hero {
    position: relative;
    padding: 4rem 0 3rem;
    overflow: hidden;
}

/* File path comment above hero title */
.hero .container::before {
    content: '// pages / index.md';
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    letter-spacing: 0;
}

.hero h1 {
    font-family: var(--font-mono);
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    max-width: 720px;
    text-wrap: balance;
    /* Cursor at end of hero h1 */
    position: relative;
    display: inline-block;
}

.hero h1::after {
    content: '';
    display: inline-block;
    width: 0.55em;
    height: 1.05em;
    background: var(--tn-blue);
    margin-left: 0.15em;
    vertical-align: text-bottom;
    animation: cursor-blink 1.06s steps(2) infinite;
    border-radius: 1px;
}

.hero p {
    font-family: var(--font-sans);
    font-size: clamp(0.95rem, 1.3vw, 1.05rem);
    color: var(--text-secondary);
    max-width: 620px;
    margin: 0 0 1.5rem;
    line-height: 1.65;
}

/* === CONTENT SECTIONS (with line numbers) === */
.content-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 2.5rem 2.5rem 4.5rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-sm);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    container-type: inline-size;
}

/* Line numbers gutter */
.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3rem;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    background-image: 
        linear-gradient(to bottom,
            transparent 0,
            transparent calc(1.5em - 0.5px),
            var(--gutter) calc(1.5em - 0.5px),
            var(--gutter) calc(1.5em + 0.5px),
            transparent calc(1.5em + 0.5px)
        );
    background-size: 100% 3em;
    background-position: 0 1.5em;
    opacity: 0.4;
}

.content-section::after {
    content: '01\A 02\A 03\A 04\A 05\A 06\A 07\A 08\A 09\A 10\A 11\A 12\A 13\A 14\A 15\A 16\A 17\A 18\A 19\A 20\A 21\A 22\A 23\A 24\A 25\A 26\A 27\A 28\A 29\A 30';
    white-space: pre;
    position: absolute;
    top: 2.5rem;
    left: 0;
    width: 3rem;
    text-align: right;
    padding-right: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.7;
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
    overflow: hidden;
}

.content-section h1 {
    font-size: 1.65rem;
    margin-top: 0;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.content-section ul,
.content-section ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.content-section li {
    margin-bottom: 0.4rem;
}

/* Content links - bracket Markdown style */
.content-section a:not(.cta-button):not(.price-tag):not(.btn) {
    color: var(--tn-blue);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dotted transparent;
    transition: border-color var(--transition-fast), color var(--transition-fast);
    position: relative;
}

.content-section a:not(.cta-button):not(.price-tag):not(.btn)::before {
    content: '[';
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.content-section a:not(.cta-button):not(.price-tag):not(.btn)::after {
    content: ']';
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.content-section a:not(.cta-button):not(.price-tag):not(.btn):hover {
    color: var(--tn-cyan);
    border-bottom-color: var(--tn-cyan);
}

.content-section a:not(.cta-button):not(.price-tag):not(.btn):hover::before,
.content-section a:not(.cta-button):not(.price-tag):not(.btn):hover::after {
    color: var(--tn-cyan);
}

/* === PAGE CARDS (file placeholders) === */
.page-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    padding: 2rem 0;
    container-type: inline-size;
}

.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition), border-color var(--transition-fast);
    display: flex;
    flex-direction: column;
    position: relative;
    will-change: transform;
}

.page-card::before {
    /* File-style top bar with "filename" */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    z-index: 1;
}

.page-card::after {
    /* Three "window dots" - ●●● */
    content: '●●●';
    position: absolute;
    top: 7px;
    left: 12px;
    color: var(--text-muted);
    font-size: 0.55rem;
    letter-spacing: 0.3em;
    opacity: 0.6;
    z-index: 2;
}

.page-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.page-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-elevated);
    margin-top: 28px;
}

/* Placeholder when card has no image - file with <> icon */
.page-card-placeholder {
    position: relative;
    height: 180px;
    margin-top: 28px;
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

/* Hide engine emoji */
.page-card-placeholder span {
    display: none;
}

.page-card-placeholder::after {
    content: '<>';
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tn-blue);
    opacity: 0.35;
    transition: opacity var(--transition), transform var(--transition), color var(--transition-fast);
    letter-spacing: 0.05em;
}

.page-card:hover .page-card-placeholder::after {
    opacity: 0.7;
    color: var(--tn-cyan);
    transform: scale(1.05);
}

.page-card-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.page-card h3,
.page-card-title {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.01em;
    line-height: 1.4;
}

.page-card h3::before,
.page-card-title::before {
    content: '> ';
    color: var(--tn-magenta);
    font-weight: 400;
}

.page-card-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    line-height: 1.55;
}

.page-card-link {
    color: var(--tn-blue);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.8rem;
    align-self: flex-start;
    transition: color var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.page-card-link::before {
    content: '$ ';
    color: var(--text-muted);
    font-weight: 400;
}

.page-card-link::after {
    content: '→';
    transition: transform var(--transition);
    display: inline-block;
}

.page-card-link:hover {
    color: var(--tn-cyan);
}

.page-card:hover .page-card-link::after {
    transform: translateX(4px);
}

/* :has() power: cards WITH images get different padding than placeholder cards */
.page-card:has(.page-card-image) .page-card-content {
    padding-top: 1rem;
}

.page-card:has(.page-card-placeholder) .page-card-content {
    padding-top: 1.25rem;
}

/* === GALLERY === */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem;
    margin: 2rem 0;
}

.gallery-item {
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform var(--transition-fast), box-shadow var(--transition), border-color var(--transition-fast);
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--tn-blue);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease-out);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* === LIGHTBOX === */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(22, 22, 30, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(192, 202, 245, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: var(--tn-fg);
    border: 1px solid rgba(192, 202, 245, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-family: var(--font-mono);
    transition: all var(--transition-fast);
}

.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(192, 202, 245, 0.2);
    border-color: var(--tn-blue);
}

/* === TESTIMONIALS (block quotes) === */
.testimonial-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--tn-magenta);
    border-radius: var(--radius-md);
    padding: 1.75rem 2rem;
    margin-bottom: 1rem;
    position: relative;
    transition: transform var(--transition-fast), box-shadow var(--transition);
    font-family: var(--font-sans);
}

.testimonial-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.testimonial-card::before {
    content: '">"';
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--tn-magenta);
    opacity: 0.6;
    font-weight: 700;
}

.testimonial-card p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    font-family: var(--font-sans);
    padding-left: 1rem;
}

.testimonial-author {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    padding-left: 1rem;
}

.testimonial-author::before {
    content: '— @';
    color: var(--tn-magenta);
}

/* === CONTACT FORM === */
.contact-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem;
    box-shadow: var(--shadow-sm);
    max-width: 700px;
    margin: 2.5rem auto;
}

.contact-form h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--tn-blue);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.85rem;
}

.form-group label::before {
    content: '> ';
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--tn-blue);
    box-shadow: 0 0 0 3px rgba(122, 162, 247, 0.15);
}

[data-theme="light"] .form-group input:focus,
[data-theme="light"] .form-group textarea:focus,
[data-theme="light"] .form-group select:focus {
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* === BUTTONS === */
.btn {
    display: inline-block;
    background: var(--tn-blue);
    color: #ffffff;
    text-shadow: none;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    opacity: 1;
    background: var(--tn-cyan);
    color: #ffffff;
}

.btn:active {
    transform: translateY(0);
}

/* === CTA BUTTON & PRICE TAG === */
.cta-button {
    display: inline-block;
    padding: 0.85rem 2rem;
    background: var(--primary);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    font-family: var(--font-mono);
    line-height: 1.4;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: all var(--transition);
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    --shine-pos: -100%;
}

/* @property animated shine on hover */
.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--shine-pos);
    width: 50%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.25),
        transparent
    );
    transition: --shine-pos 0.7s var(--ease-out);
    pointer-events: none;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.cta-button:hover::before {
    --shine-pos: 200%;
}

.cta-button:active {
    transform: translateY(0);
}

.price-tag {
    display: inline-block;
    background: var(--accent);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    padding: 0.4rem 1.15rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    line-height: 1.4;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    margin-top: 0.5rem;
}

a.price-tag:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: #ffffff;
}

/* === MESSAGES === */
.error, .success {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.error {
    background: rgba(247, 118, 142, 0.12);
    color: var(--tn-red);
    border-color: rgba(247, 118, 142, 0.35);
}

.error::before {
    content: '✗ ERROR: ';
    font-weight: 700;
}

.success {
    background: rgba(158, 206, 106, 0.12);
    color: var(--tn-green);
    border-color: rgba(158, 206, 106, 0.35);
}

.success::before {
    content: '✓ OK: ';
    font-weight: 700;
}

/* === FOOTER === */
footer {
    /* v1.0.2: literal dark fallback (#16161e) instead of var(--tn-bg-dark),
       which the light-mode block redefines to near-white - that flip made
       the hard-coded white footer text invisible in light mode */
    background: var(--footer-bg, #16161e);
    color: rgba(255, 255, 255, 0.85);
    padding: 3.5rem 0 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
}

/* v1.0.2: the light-mode footer override was removed here. It set the footer
   background to --tn-bg-dark, which light mode redefines to #f6f8fa - white
   text on a near-white strip. The footer now stays IDE-dark in both modes,
   like a real editor status bar; user-selected footer colors still apply
   via --footer-bg. */

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.85);
    padding-bottom: 1.5rem;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section:first-child {
    text-align: left;
}

.footer-section:last-child {
    text-align: right;
}

.footer-section h3 {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer-section h3::before {
    content: '// ';
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.footer-section p {
    margin: 0.4rem 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.footer-section ul,
.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section li,
.footer-menu li {
    margin: 0.4rem 0;
}

.footer-section a,
.footer-menu a {
    color: rgba(255, 255, 255, 0.85);
    transition: color var(--transition-fast);
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.footer-section a:hover,
.footer-menu a:hover {
    color: var(--tn-cyan);
    opacity: 1;
}

.social-links {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.footer-section:last-child .social-links {
    justify-content: flex-end;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
}

.social-links a:hover {
    background: rgba(122, 162, 247, 0.15);
    border-color: var(--tn-blue);
    color: var(--tn-blue);
    transform: translateY(-2px);
}

/* Copyright section as VS Code STATUS BAR */
.copyright {
    margin-top: 0;
    padding: 0.5rem 1.5rem;
    background: var(--tn-blue);
    color: #ffffff;
    text-align: center;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
    border-top: none;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
}

.copyright p {
    margin: 0;
    color: inherit;
    font-family: var(--font-mono);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Status bar items - fake VS Code stuff */
.copyright::before {
    content: '⎇ main';
    color: rgba(255, 255, 255, 0.95);
}

.copyright::after {
    content: 'UTF-8 · Markdown · LF';
    color: rgba(255, 255, 255, 0.85);
}

.copyright a {
    color: #ffffff;
    transition: opacity var(--transition-fast);
}

.copyright a:hover {
    opacity: 0.8;
}

footer .container {
    padding-bottom: 0;
}

/* Make footer span full width for status bar effect */
footer > .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .page-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-section { padding: 2rem 2rem 2rem 4rem; }
}

@media (max-width: 768px) {
    /* Mobile menu fix (6.2.5): pin the dropdown to the screen and bind
       top AND bottom so its scroll area equals the visible viewport -
       reaches the last item in landscape. Paired with the body-scroll
       lock in script.js (prevents the page underneath from scrolling). */
    .dropdown-menu {
        position: fixed;
        top: 64px;
        bottom: 12px;
        left: auto;
        right: 8px;
        max-height: none;
        margin-top: 0;
        padding-bottom: 0.4rem;
        min-width: 220px;
    }

    .container { padding: 0 1rem; }
    .header-content { padding: 14px 0; }
    .logo-container img { height: 56px; }
    
    body { font-size: 14px; }
    
    .hero {
        padding: 3rem 0 2rem;
    }
    
    .content-section {
        padding: 1.5rem 1.25rem 1.5rem 3rem;
    }
    
    .content-section::before { width: 2.25rem; }
    .content-section::after { width: 2.25rem; padding-right: 0.5rem; }
    
    .content-section h1 { font-size: 1.4rem; }
    
    .page-cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.5rem 0;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.6rem;
    }
    
    .contact-form {
        padding: 1.75rem 1.25rem;
    }
    
    .dark-mode-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }
    
    .footer-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1.75rem;
    }
    
    .footer-section:last-child {
        text-align: left;
    }
    
    .footer-section:last-child .social-links {
        justify-content: flex-start;
    }
    
    .copyright {
        gap: 0.75rem;
        font-size: 0.7rem;
        padding: 0.4rem 1rem;
    }
}

@media (max-width: 480px) {
    .logo-container img { height: 48px; }
    .header-content { padding: 12px 0; }
    
    .hero h1::after {
        width: 0.5em;
        height: 1em;
    }
    
    .copyright::before,
    .copyright::after { display: none; }
}

/* === CONTAINER QUERIES (modern flex) === */
@container (max-width: 500px) {
    .content-section h2 { font-size: 1.15rem; }
    .content-section h3 { font-size: 1rem; }
}

/* === SCROLL-DRIVEN ANIMATIONS (CSS only, modern browsers) === */
@supports (animation-timeline: scroll()) {
    .content-section,
    .testimonial-card,
    .page-card {
        animation: fade-up linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 50%;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    .hero h1::after {
        animation: none !important;
    }
    
    .page-card,
    .content-section,
    .testimonial-card {
        animation: none !important;
    }
    
    .cta-button::before {
        display: none !important;
    }
    
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* === PRINT === */
@media print {
    body { background: #fff; color: #000; font-family: var(--font-sans); }
    header, footer, .dark-mode-toggle, .hamburger-btn, .hamburger-menu { display: none !important; }
    .hero {
        padding: 1rem 0;
    }
    .hero h1::after { display: none; }
    .hero .container::before { display: none; }
    .content-section,
    .page-card,
    .testimonial-card,
    .contact-form {
        background: #fff;
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
        padding: 1rem;
    }
    .content-section::before,
    .content-section::after { display: none; }
    .page-card::before,
    .page-card::after { display: none; }
}

/* === PLACEHOLDER COMPOSITIONS (v1.0.3) ===
   Empty buffer: syntax-colored token bars and a block cursor; on hover
   the cursor advances a column, as if someone started typing. */
.page-card-placeholder {
    position: relative;
    overflow: hidden;
    background: var(--tn-bg-dark);
}

.page-card-placeholder span { display: none; }

.page-card-placeholder::before,
.page-card-placeholder::after {
    content: '';
    position: absolute;
    animation: none;
    -webkit-mask-image: none;
    mask-image: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    filter: none;
    opacity: 1;
    width: auto;
    height: auto;
    inset: auto;
    transition: transform 0.4s ease;
}

/* Composition 1: four token lines + cursor */
.page-card-placeholder::before {
    inset: 0;
    background:
        linear-gradient(var(--tn-blue),    var(--tn-blue))    12% 26% / 38% 8px no-repeat,
        linear-gradient(var(--tn-green),   var(--tn-green))   12% 42% / 56% 8px no-repeat,
        linear-gradient(var(--tn-comment), var(--tn-comment)) 12% 58% / 30% 8px no-repeat,
        linear-gradient(var(--tn-cyan),    var(--tn-cyan))    12% 74% / 46% 8px no-repeat;
    opacity: 0.9;
    border-radius: 2px;
}

.page-card-placeholder::after {
    width: 9px;
    height: 17px;
    top: calc(74% - 5px);
    left: 56%;
    background: var(--tn-blue);
}

/* Composition 2: indented block + brackets */
.page-card:nth-child(2n) .page-card-placeholder::before {
    background:
        linear-gradient(var(--tn-cyan),    var(--tn-cyan))    12% 24% / 30% 8px no-repeat,
        linear-gradient(var(--tn-comment), var(--tn-comment)) 22% 40% / 44% 8px no-repeat,
        linear-gradient(var(--tn-blue),    var(--tn-blue))    22% 56% / 36% 8px no-repeat,
        linear-gradient(var(--tn-green),   var(--tn-green))   12% 72% / 18% 8px no-repeat,
        linear-gradient(var(--tn-fg-gutter), var(--tn-fg-gutter)) 17% 32% / 2px 44% no-repeat;
}

.page-card:nth-child(2n) .page-card-placeholder::after {
    left: 34%;
    top: calc(72% - 5px);
    background: var(--tn-green);
}

/* Composition 3: diff view - added/removed gutter marks */
.page-card:nth-child(3n) .page-card-placeholder::before {
    background:
        linear-gradient(var(--tn-green),   var(--tn-green))   18% 30% / 50% 8px no-repeat,
        linear-gradient(var(--tn-green),   var(--tn-green))   10% 30% / 4% 8px no-repeat,
        linear-gradient(var(--tn-red, #f7768e), var(--tn-red, #f7768e)) 18% 50% / 40% 8px no-repeat,
        linear-gradient(var(--tn-red, #f7768e), var(--tn-red, #f7768e)) 10% 50% / 4% 8px no-repeat,
        linear-gradient(var(--tn-comment), var(--tn-comment)) 18% 70% / 56% 8px no-repeat;
}

.page-card:nth-child(3n) .page-card-placeholder::after {
    left: 70%;
    top: calc(70% - 5px);
    background: var(--tn-comment);
}

.page-card:hover .page-card-placeholder::before {
    transform: none;
}

.page-card:hover .page-card-placeholder::after {
    transform: translateX(12px);
}

@media (prefers-reduced-motion: reduce) {
    .page-card-placeholder::before,
    .page-card-placeholder::after {
        transition: none !important;
    }
}

/* === KEYBOARD FOCUS (6.2.4 accessibility) === */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* === HERO BACKGROUND IMAGE (6.3.3) ===
   DevTools dims the photo behind an IDE-dark editor tone. Content centered, four overlay levels. Overrides the engine's
   universal fallback (loaded earlier) by cascade order. No image set ->
   this block stays inert. */
.hero--has-bg {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem 3rem;
}

.hero--has-bg .hero-bg-media {
    position: absolute;
    inset: 0;
    z-index: -2;
    display: block;
}

.hero--has-bg .hero-bg-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero--has-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(13, 17, 23, 0.58);
}

.hero--has-bg h1 {
    color: #fff;
    -webkit-text-fill-color: #fff;
    background: none;
    text-shadow: 0 2px 14px rgba(0,0,0,0.6);
    max-width: 22ch;
}

.hero--overlay-none::after   { background: rgba(13, 17, 23, 0.2); }
.hero--overlay-light::after  { background: rgba(13, 17, 23, 0.4); }
.hero--overlay-medium::after { background: rgba(13, 17, 23, 0.58); }
.hero--overlay-strong::after { background: rgba(13, 17, 23, 0.74); }
