@font-face {
    font-family: "Press Start 2P";
    src: url("../fonts/PressStart2P-Regular.1ce708e1c9cc.ttf") format("truetype");
    font-display: swap;
}

@font-face {
    font-family: "AlibabaPuHuiTi";
    src: url("../fonts/AlibabaPuHuiTi-Regular.a86e744979eb.otf") format("opentype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "AlibabaPuHuiTi";
    src: url("../fonts/AlibabaPuHuiTi-Bold.8668b98c7b8b.otf") format("opentype");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg-base: #3daa84;
    --bg-dot: #4fb089;
    --bg-deep: #2a7f61; /* darkened from #2e8c6b so white footer text passes WCAG AA (4.88) */
    --paper: #ffffff;
    --paper-muted: #edf8f3;
    --ink: #1a1a1a;
    --ink-soft: #3a3a3a;
    --gray-pixel: #9e9e9e;
    --py-yellow: #f9ca33;
    --py-orange: #f19640;
    --py-redhot: #e27344;
    --py-red: #ec4567;
    --py-pink: #b6316c;
    --py-purple: #8312dc;
    --py-indigo: #424990;
    --py-blue: #149ada;
    --py-green: #75be4e;
    --accent: #0e6c9e;
    --accent-bright: var(--py-blue);
    --brick-on-light: var(--ink);
    --brick-on-dark: #ffffff;
    --font-pixel: "Press Start 2P", "AlibabaPuHuiTi", system-ui, sans-serif;
    --font-body: "AlibabaPuHuiTi", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --border-ink: 2px solid var(--ink);
    --border-pixel: var(--border-ink);
    --stud-size: 14px;
    --brick-depth: 6px;
    --pixel-step: 6px;
    --radius-pixel: 0;
    --content-width: 1200px;
    --ease-ui: 180ms ease-out;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    padding-top: 80px;
    color: var(--ink);
    background-color: var(--bg-base);
    background-image: radial-gradient(var(--bg-dot) 2.5px, transparent 2.5px);
    background-size: 22px 22px;
    font-family: var(--font-body);
    line-height: 1.6;
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-body);
}

img {
    display: block;
    height: auto;
    max-width: 100%;
}

a {
    color: var(--accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.16em;
    transition: color var(--ease-ui), background-color var(--ease-ui), transform var(--ease-ui), box-shadow var(--ease-ui);
}

/* Hover only for classless (richtext/content) links — component links manage
   their own colors (a bare a:hover once leaked accent-bright onto them, making
   text invisible on the blue brick). Text color stays --accent on hover too:
   accent-bright on white is only 3.15, below AA 4.5 for body text. Hover is
   signalled by the underline, which has no text-contrast requirement. */
a:not([class]):hover {
    text-decoration-color: var(--accent-bright);
    text-decoration-thickness: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--py-blue);
    outline-offset: 3px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ink);
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    margin: 0 0 1rem;
}

p {
    margin: 0 0 1rem;
}

main {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 0 auto;
}

.page-shell {
    position: relative;
    isolation: isolate;
    overflow: clip;
}

.site-corner {
    position: absolute;
    z-index: 1;
    width: clamp(120px, 14vw, 240px);
    height: auto;
    pointer-events: none;
}

.site-corner-tl { top: 0; left: 0; }
.site-corner-tr { top: 0; right: 0; }
.site-corner-bl { bottom: 0; left: 0; }
.site-corner-br { right: 0; bottom: 0; }

@media (max-width: 700px) {
    .site-corner { display: none; }
}

.content {
    overflow: hidden;
}

.content a {
    color: var(--accent);
}

.richtext-image.right {
    float: right;
    margin-bottom: 10px;
    margin-left: 15px;
}

.richtext-image.left {
    float: left;
    margin-right: 15px;
    margin-bottom: 10px;
}

.richtext-image.full-width {
    display: block;
    margin-right: auto;
    margin-left: auto;
}

/* Shared pixel surface */
.card {
    --brick-color: var(--paper);
    --brick-on: var(--brick-on-light);
    position: relative;
    z-index: 1;
    margin-bottom: 20px;
    padding: 1rem;
    overflow: visible;
    border: 0;
    border-radius: 10px;
    border-bottom: 2px solid var(--ink);
    background: var(--brick-color);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 38%);
    box-shadow: 0 var(--brick-depth) 0 color-mix(in srgb, var(--brick-color) 68%, #000), 0 var(--brick-depth) 0 1px color-mix(in srgb, var(--brick-color) 50%, #000);
    color: var(--brick-on);
    transition: transform var(--ease-ui), box-shadow var(--ease-ui);
}

.card::before {
    position: absolute;
    top: -9px;
    left: 22px;
    right: 22px;
    height: var(--stud-size);
    background: radial-gradient(circle at 9px center, color-mix(in srgb, var(--brick-color) 82%, #000) 0 7px, transparent 7px);
    background-repeat: repeat-x;
    background-size: 30px 18px;
    content: "";
    opacity: 0.62;
    pointer-events: none;
}

.card.studded::after {
    position: absolute;
    top: -9px;
    left: 22px;
    right: 22px;
    height: 9px;
    background: radial-gradient(circle at 9px 4px, rgba(255, 255, 255, 0.35) 0 5px, transparent 5px);
    background-repeat: repeat-x;
    background-size: 30px 18px;
    content: "";
    pointer-events: none;
}

.card:hover {
    box-shadow: 0 calc(var(--brick-depth) + 3px) 0 color-mix(in srgb, var(--brick-color) 68%, #000), 0 calc(var(--brick-depth) + 3px) 0 1px color-mix(in srgb, var(--brick-color) 50%, #000);
    transform: translateY(-3px);
}

.card:active {
    box-shadow: 0 2px 0 color-mix(in srgb, var(--brick-color) 68%, #000);
    transform: translateY(2px);
}

.card-header {
    margin: 0 0 10px;
    padding: calc(var(--stud-size) + 10px) 0 10px;
    border-bottom: 2px solid var(--brick-on);
    color: var(--brick-on);
    font-size: 1.3rem;
    font-weight: 700;
}

.card-body {
    overflow-x: auto;
}

/* Shared paper content panel — single DRY definition. `.talk-content` is the
   established alias already used by talk/schedule/article/error templates;
   new consumers should use `.content-panel`. Spacing/layout deltas stay in app CSS. */
.content-panel,
.talk-content {
    position: relative;
    padding: 30px 24px 24px;
    border-radius: 10px;
    background: var(--paper);
    box-shadow: 0 var(--brick-depth) 0 color-mix(in srgb, var(--paper) 68%, #000);
}

@media (max-width: 700px) {
    .content-panel,
    .talk-content {
        padding: 24px 18px 20px;
    }
}

.page-intro {
    margin-bottom: 32px;
}

.title,
.page-title,
.pixel-title {
    font-family: var(--font-pixel);
    font-weight: 400;
    font-synthesis: none;
    text-shadow: 1px 0 var(--ink), -1px 0 var(--ink), 0 1px var(--ink), 0 -1px var(--ink), 3px 3px 0 rgba(26, 26, 26, 0.22);
}

.title {
    display: inline-block;
    margin-bottom: 20px;
    padding: 16px 18px;
    border: var(--border-ink);
    background: var(--py-yellow);
    color: var(--ink);
    border-bottom: calc(var(--brick-depth) + 2px) solid color-mix(in srgb, var(--py-yellow) 70%, #000);
    font-size: clamp(1.1rem, 3vw, 1.8rem);
    line-height: 1.45;
}

.page-container {
    width: min(calc(100% - 32px), var(--content-width));
    margin: 0 auto;
    padding: 20px 0;
}

.page-header {
    margin-bottom: 40px;
    text-align: center;
}

/* Intro copy now always sits on a .content-panel (never bare on the baseplate),
   so links keep the standard accent-on-paper treatment (AA 5.74). If content must
   ever sit directly on the baseplate, use ink text — accent fails there (1.99). */

.page-title {
    display: inline-block;
    max-width: 100%;
    margin: 0;
    padding: 22px 24px;
    border: var(--border-ink);
    background: var(--py-yellow);
    color: var(--ink);
    border-bottom: calc(var(--brick-depth) + 2px) solid color-mix(in srgb, var(--py-yellow) 70%, #000);
    font-size: clamp(1.25rem, 4vw, 2.25rem);
    line-height: 1.45;
}

.page-button,
.button,
button:not(.language-btn):not(.mobile-close) {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 10px 18px;
    border: var(--border-ink);
    background: var(--py-yellow);
    border-bottom: calc(var(--brick-depth) + 2px) solid color-mix(in srgb, var(--py-yellow) 70%, #000);
    color: var(--ink);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
    transition: transform var(--ease-ui), border-bottom-width var(--ease-ui), background-color var(--ease-ui);
}

.page-button:hover,
.button:hover,
button:not(.language-btn):not(.mobile-close):hover {
    background: var(--py-orange);
    color: var(--ink);
    transform: translateY(-3px);
}

.page-button:active,
.button:active,
button:not(.language-btn):not(.mobile-close):active {
    border-bottom-width: 2px;
    transform: translateY(2px);
}

.talk-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.35em 0.6em;
    border: 2px solid var(--ink);
    border-radius: 0;
    color: var(--ink);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    vertical-align: baseline;
    white-space: nowrap;
}

.talk-badge.keynote {
    background: var(--py-yellow);
}

.talk-badge.lightning {
    background: var(--py-blue);
}

/* Navigation */
.navbar {
    position: fixed;
    z-index: 1000;
    top: 0;
    right: 0;
    left: 0;
    border-bottom: 0;
    background: var(--bg-base);
    background-image: radial-gradient(var(--bg-dot) 2px, transparent 2px);
    background-size: 18px 18px;
}

.navbar-container {
    display: flex;
    width: min(100%, 1400px);
    height: 76px;
    align-items: center;
    justify-content: space-between;
    margin: 0 auto;
    padding: 0 24px;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-image {
    width: auto;
    height: 42px;
}

.logo-text {
    display: flex;
    flex-direction: column;
    color: var(--ink);
    line-height: 1.1;
}

.brand-name {
    font-family: var(--font-pixel);
    font-size: 0.78rem;
}

.brand-year {
    color: var(--py-red);
    font-family: var(--font-pixel);
    font-size: 0.62rem;
    line-height: 1.5;
}

.nav-desktop,
.nav-links {
    display: flex;
    align-items: center;
}

.nav-links {
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-item,
.language-switch,
.language-dropdown {
    position: relative;
}

.nav-link,
.language-btn {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 0;
    border-radius: 2px;
    background: #fff5a8;
    box-shadow: 0 3px 0 rgba(26, 26, 26, 0.22);
    color: var(--ink);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
}

.nav-item:nth-child(2n) .nav-link,
.nav-item:nth-child(2n) .language-btn { background: #bde7ff; }
.nav-item:nth-child(3n) .nav-link,
.nav-item:nth-child(3n) .language-btn { background: #ffd0dc; }
.nav-item:nth-child(4n) .nav-link,
.nav-item:nth-child(4n) .language-btn { background: #d9f3bb; }
.nav-item:nth-child(5n) .nav-link,
.nav-item:nth-child(5n) .language-btn { background: #ffd7a7; }
.nav-item:nth-child(odd) .nav-link,
.nav-item:nth-child(odd) .language-btn { transform: rotate(-2deg); }
.nav-item:nth-child(even) .nav-link,
.nav-item:nth-child(even) .language-btn { transform: rotate(2deg); }

.nav-link:hover,
.language-btn:hover,
.language-btn[aria-expanded="true"] {
    background: #ffffff;
    box-shadow: 0 5px 0 rgba(26, 26, 26, 0.18);
    color: var(--ink);
    transform: translateY(-3px) rotate(0deg);
}

.nav-icon {
    width: 1em;
    text-align: center;
}

.dropdown-arrow {
    font-size: 0.72rem;
    transition: transform var(--ease-ui);
}

.dropdown-toggle.active .dropdown-arrow,
.language-btn[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

.language-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    min-width: 180px;
    padding: 6px;
    border: var(--border-pixel);
    border-radius: var(--radius-pixel);
    background: var(--paper);
    box-shadow: 0 6px 0 color-mix(in srgb, var(--paper) 68%, #000);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity var(--ease-ui), transform var(--ease-ui);
}

.language-dropdown-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.language-option {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 2px solid transparent;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.language-option:hover,
.language-option.active {
    border-color: var(--ink);
    background: var(--py-blue);
    color: var(--ink);
}

.option-check {
    opacity: 0;
}

.language-option.active .option-check {
    opacity: 1;
}

.mobile-menu-toggle {
    display: none;
    padding: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hamburger-line {
    display: block;
    width: 28px;
    height: 4px;
    background: var(--ink);
    transition: opacity var(--ease-ui), transform var(--ease-ui);
}

.hamburger.active .hamburger-line {
    opacity: 0;
}

.nav-mobile {
    position: fixed;
    z-index: 1001;
    top: 0;
    right: -100%;
    width: min(360px, 88vw);
    height: 100dvh;
    overflow-y: auto;
    border-left: var(--border-pixel);
    background: var(--bg-base);
    box-shadow: -6px 0 0 var(--ink);
    transition: right 240ms ease-out;
}

.nav-mobile.active {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: var(--border-pixel);
    background: var(--paper);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-family: var(--font-pixel);
    font-size: 0.68rem;
}

.mobile-logo {
    width: auto;
    height: 30px;
}

.mobile-close {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: var(--border-pixel);
    border-radius: 0;
    background: var(--py-red);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.15rem;
}

.mobile-nav-links {
    margin: 0;
    padding: 18px;
    list-style: none;
}

.mobile-nav-item {
    margin-bottom: 8px;
}

.mobile-nav-link {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border: 0;
    border-radius: 2px;
    background: #fff5a8;
    box-shadow: 0 3px 0 rgba(26, 26, 26, 0.22);
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
}

.mobile-nav-item:nth-child(2n) .mobile-nav-link { background: #bde7ff; }
.mobile-nav-item:nth-child(3n) .mobile-nav-link { background: #ffd0dc; }
.mobile-nav-item:nth-child(4n) .mobile-nav-link { background: #d9f3bb; }
.mobile-nav-item:nth-child(5n) .mobile-nav-link { background: #ffd7a7; }
.mobile-nav-item:nth-child(odd) .mobile-nav-link { transform: rotate(-2deg); }
.mobile-nav-item:nth-child(even) .mobile-nav-link { transform: rotate(2deg); }

.mobile-nav-link:hover,
.mobile-nav-link.active {
    background: #ffffff;
    box-shadow: 0 5px 0 rgba(26, 26, 26, 0.18);
    color: var(--ink);
    transform: translateY(-3px) rotate(0deg);
}

.language-switch-mobile {
    margin-top: 18px;
    border-top: 3px solid var(--ink);
}

.mobile-language-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0 6px;
    color: var(--ink);
    font-family: var(--font-pixel);
    font-size: 0.62rem;
    line-height: 1.5;
}

.mobile-language-item {
    margin-left: 14px;
}

.mobile-overlay {
    position: fixed;
    z-index: 999;
    inset: 0;
    background: rgba(26, 26, 26, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ease-ui);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Footer */
.modern-footer {
    position: relative;
    margin-top: 80px;
    border-top: var(--border-pixel);
    background: var(--bg-deep);
    color: var(--paper);
}

.footer-background {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.12) 2px, transparent 2px);
    background-size: 22px 22px;
    pointer-events: none;
}

.footer-container {
    position: relative;
    width: min(calc(100% - 48px), 1400px);
    margin: 0 auto;
    padding: 56px 0 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 36px;
}

.footer-brand,
.footer-section {
    color: var(--paper);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.footer-logo-img {
    width: auto;
    height: 48px;
    filter: brightness(0) invert(1);
}

.footer-title {
    margin: 0 0 4px;
    color: var(--paper);
    font-family: var(--font-pixel);
    font-size: 0.82rem;
    line-height: 1.6;
}

.footer-subtitle,
.footer-description {
    margin: 0;
    color: var(--paper);
}

.footer-subtitle {
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.social-link {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 2px solid var(--ink);
    background: var(--py-yellow);
    box-shadow: 0 5px 0 color-mix(in srgb, var(--py-yellow) 68%, #000);
    color: var(--ink);
    text-decoration: none;
}

.social-link:hover {
    background: var(--py-orange);
    box-shadow: 0 2px 0 color-mix(in srgb, var(--py-orange) 68%, #000);
    color: var(--ink);
    transform: translate(2px, 2px);
}

.section-title {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--py-yellow);
    color: var(--paper);
    font-size: 1rem;
    font-weight: 700;
}

.conferences-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.conference-link {
    display: grid;
    min-height: 36px;
    place-items: center;
    border: 2px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.conference-link:hover {
    background: var(--py-blue);
    color: var(--ink);
    transform: translate(-1px, -1px);
}

.quick-links,
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-link {
    display: flex;
    min-height: 32px;
    align-items: center;
    gap: 10px;
    color: var(--paper);
    font-weight: 700;
    text-decoration: none;
}

.quick-link:hover {
    color: var(--py-yellow);
    transform: translateX(3px);
}

.quick-link i {
    width: 1.25em;
    color: var(--py-yellow);
    text-align: center;
}

.footer-bottom {
    padding: 20px 0;
    border-top: 3px solid rgba(255, 255, 255, 0.6);
}

.footer-bottom-content,
.footer-tech {
    display: flex;
    align-items: center;
}

.footer-bottom-content {
    justify-content: space-between;
    gap: 16px;
}

.footer-tech {
    gap: 10px;
}

.copyright p {
    margin: 0;
}

.tech-icons {
    color: var(--py-yellow);
}

@media (min-width: 992px) {
    .card {
        padding: 1rem 2rem;
    }
}

@media (max-width: 1100px) {
    .nav-link,
    .language-btn {
        padding: 8px 9px;
        font-size: 0.82rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 800px) {
    body {
        padding-top: 70px;
    }

    .navbar-container {
        height: 66px;
        padding: 0 16px;
    }

    .nav-desktop {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .brand-name {
        font-size: 0.66rem;
    }

    .brand-year {
        font-size: 0.52rem;
    }

    .logo-image {
        height: 34px;
    }

    main,
    .page-container {
        width: min(calc(100% - 24px), var(--content-width));
    }

    .page-container {
        padding: 16px 0;
    }

    .footer-container {
        width: min(calc(100% - 32px), 1400px);
        padding-top: 40px;
    }
}

@media (max-width: 560px) {
    html {
        font-size: 16px;
    }

    .title,
    .page-title {
        padding: 14px;
        font-size: 0.88rem;
    }

    .card {
        padding: 14px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .footer-logo {
        align-items: flex-start;
    }

    .footer-bottom-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .conferences-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
