/* 2Chat brand layer for Casper.
   Mirrors the tokens of 2chat.co (src/theme in the commercial site): Lyyra Standard,
   primary #2244FF, text #212B36 / #637381, 8px radius, white header and footer.
   Loaded after built/screen.css, so nothing in Casper's own CSS needs rebuilding. */

@font-face {
    font-family: "Lyyra Standard";
    src: url("../fonts/LyyraStandard-Light.woff2") format("woff2");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Lyyra Standard";
    src: url("../fonts/LyyraStandard-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Lyyra Standard";
    src: url("../fonts/LyyraStandard-Medium.woff2") format("woff2");
    font-weight: 500 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Lyyra Standard";
    src: url("../fonts/LyyraStandard-Bold.woff2") format("woff2");
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --tc-primary: #2244FF;
    --tc-primary-dark: #1830b3;
    --tc-primary-lighter: #d3daff;
    --tc-text: #212B36;
    --tc-text-secondary: #637381;
    --tc-text-disabled: #919EAB;
    --tc-neutral: #F4F6F8;
    --tc-divider: rgba(145, 158, 171, 0.24);
    --tc-radius: 8px;
    --tc-radius-lg: 16px;

    /* Surface and text tokens; redefined for dark mode below */
    --tc-bg: #fff;
    --tc-bg-translucent: rgba(255, 255, 255, 0.9);
    --tc-body-text: #212B36;
    --tc-link: #2244FF;
    --tc-link-underline: rgba(34, 68, 255, 0.4);
    --tc-selection: #d3daff;
    --tc-cta-bg: #000;
    --tc-cta-text: #fff;

    /* Casper reads these for every heading and body font, serif or sans */
    --font-sans: "Lyyra Standard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --font-serif: var(--font-sans);
    --gh-font-heading: var(--font-sans);
    --gh-font-body: var(--font-sans);
}

/* Dark mode: same palette as the dark theme of 2chat.co (grey 900 background, grey 500 secondary text).
   The class is set on <html> by the script in default.hbs (system setting, or the visitor's choice). */
html.dark-mode {
    --tc-text: #fff;
    --tc-text-secondary: #919EAB;
    --tc-text-disabled: #637381;
    --tc-neutral: rgba(145, 158, 171, 0.12);
    --tc-bg: #161C24;
    --tc-bg-translucent: rgba(22, 28, 36, 0.9);
    --tc-body-text: rgba(255, 255, 255, 0.82);
    --tc-link: #8ea2ff;
    --tc-link-underline: rgba(142, 162, 255, 0.45);
    --tc-selection: rgba(34, 68, 255, 0.45);
    --tc-cta-bg: #fff;
    --tc-cta-text: #161C24;
    --color-darkmode: #161C24;
    color-scheme: dark;
}

body.tc-theme,
html.dark-mode body.tc-theme {
    font-family: var(--font-sans);
    color: var(--tc-text);
    background: var(--tc-bg);
}

.tc-theme h1,
.tc-theme h2,
.tc-theme h3,
.tc-theme h4,
.tc-theme h5,
.tc-theme h6 {
    color: var(--tc-text);
}

.tc-theme ::selection {
    background: var(--tc-selection);
}


/* Header: white, sticky, slightly translucent like the 2chat.co app bar
/* ---------------------------------------------------------- */

.tc-theme .gh-head,
html.dark-mode body.tc-theme .gh-head {
    position: sticky;
    top: 0;
    height: 80px;
    color: var(--tc-text);
    background-color: var(--tc-bg-translucent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--tc-divider);
}

/* Casper hides the header logo on the home page (it expects it on the cover) */
.tc-theme.is-head-left-logo.home-template .gh-head:not(.is-header-hidden) .gh-head-logo,
.tc-theme .gh-head-logo.tc-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--tc-text);
}

.tc-theme.is-head-left-logo.home-template .gh-head:not(.is-header-hidden) .gh-head-menu {
    margin-left: 0;
}

.tc-theme .tc-logo img {
    width: auto;
    height: 26px;
    max-height: 26px;
    opacity: 1;
}

.tc-theme .tc-logo-dark,
html.dark-mode .tc-theme .tc-logo-light {
    display: none;
}

html.dark-mode .tc-theme .tc-logo-dark {
    display: block;
}

.tc-theme .tc-logo-label {
    padding-left: 12px;
    border-left: 1px solid var(--tc-divider);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 26px;
    color: var(--tc-text-secondary);
}

.tc-theme .gh-head-menu .nav a,
.tc-theme .gh-head-link {
    font-weight: 500;
    color: var(--tc-text);
}

.tc-theme .gh-head-menu .nav a:hover,
.tc-theme .gh-head-link:hover {
    opacity: 0.72;
}

.tc-theme .gh-head-button {
    height: 40px;
    padding: 0 18px;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0;
    color: #fff;
    background: var(--tc-primary);
    border-radius: var(--tc-radius);
    transition: background-color 0.15s;
}

.tc-theme .gh-head-button:hover {
    background: var(--tc-primary-dark);
    opacity: 1;
}

/* Language switch: outlined, like the language selector on 2chat.co */
.tc-theme #lang-switch.gh-head-button {
    color: var(--tc-text);
    background: transparent;
    border: 1px solid var(--tc-divider);
}

.tc-theme #lang-switch.gh-head-button:hover {
    background: var(--tc-neutral);
}

.tc-theme .gh-search:hover,
.tc-theme .tc-theme-toggle:hover {
    background: var(--tc-neutral);
}

/* Dark mode toggle: moon while light, sun while dark */
.tc-theme .tc-theme-toggle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.tc-theme .tc-icon-sun,
html.dark-mode .tc-theme .tc-icon-moon {
    display: none;
}

html.dark-mode .tc-theme .tc-icon-sun {
    display: block;
}


/* Home hero
/* ---------------------------------------------------------- */

.tc-theme .site-header-content.tc-hero {
    min-height: 0;
    padding: clamp(48px, 9vmin, 96px) 0 clamp(40px, 7vmin, 72px);
    color: var(--tc-text);
    background: var(--tc-bg);
    text-align: center;
}

.tc-theme .tc-hero .site-header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tc-theme .tc-overline {
    margin-bottom: 16px;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tc-link);
}

.tc-theme .tc-hero .site-title {
    margin: 0;
    font-size: clamp(4rem, 6vw, 6rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--tc-text);
}

.tc-theme .tc-hero .site-description {
    max-width: 680px;
    margin: 20px 0 0;
    font-size: clamp(1.8rem, 2vw, 2.1rem);
    font-weight: 400;
    line-height: 1.55;
    color: var(--tc-text-secondary);
    opacity: 1;
}


/* Post cards
/* ---------------------------------------------------------- */

.tc-theme .post-card-image-link {
    margin-bottom: 24px;
    border-radius: var(--tc-radius-lg);
    background: var(--tc-neutral);
}

.tc-theme .post-card-image {
    transition: transform 0.35s ease;
}

.tc-theme .post-card:hover .post-card-image {
    transform: scale(1.03);
}

.tc-theme .post-card-primary-tag,
.tc-theme .post-card-primary-tag a {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tc-link);
}

.tc-theme .post-card-title {
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--tc-text);
}

.tc-theme .post-card-content-link:hover .post-card-title {
    color: var(--tc-link);
}

.tc-theme .post-card-excerpt {
    font-family: var(--font-sans);
    font-size: 1.6rem;
    line-height: 1.6;
    color: var(--tc-text-secondary);
}

.tc-theme .post-card-meta {
    color: var(--tc-text-disabled);
}

.tc-theme .post-feed {
    padding-top: 8px;
}


/* Article
/* ---------------------------------------------------------- */

.tc-theme .article-title {
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: -0.01em;
    color: var(--tc-text);
}

.tc-theme .article-excerpt {
    font-family: var(--font-sans);
    color: var(--tc-text-secondary);
}

.tc-theme .author-name,
.tc-theme .author-name a {
    font-weight: 600;
    color: var(--tc-text);
}

.tc-theme .byline-meta-content {
    color: var(--tc-text-secondary);
}

.tc-theme .article-image img,
.tc-theme .gh-content .kg-image-card:not(.kg-width-full) img {
    border-radius: var(--tc-radius-lg);
}

.tc-theme .gh-content {
    font-family: var(--font-sans);
    font-size: 1.9rem;
    line-height: 1.7;
    color: var(--tc-body-text);
}

.tc-theme .gh-content > [id] {
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--tc-text);
}

.tc-theme .gh-content > h4[id],
.tc-theme .gh-content > h5[id],
.tc-theme .gh-content > h6[id] {
    font-weight: 600;
}

.tc-theme .gh-content a {
    color: var(--tc-link);
    text-decoration-color: var(--tc-link-underline);
}

.tc-theme .gh-content a:hover {
    text-decoration-color: currentColor;
}

.tc-theme .gh-content blockquote {
    border-left-color: var(--tc-primary);
}

.tc-theme .gh-content :not(pre) > code {
    color: var(--tc-text);
    background: var(--tc-neutral);
    border-radius: 6px;
}

.tc-theme .gh-content .kg-btn-accent,
.tc-theme .gh-content .kg-btn {
    border-radius: var(--tc-radius);
    font-family: var(--font-sans);
    font-weight: 600;
}


/* Subscribe call to action at the end of a post
/* ---------------------------------------------------------- */

.tc-theme .footer-cta .inner {
    padding: clamp(32px, 6vmin, 64px) 24px;
    background: var(--tc-neutral);
    border: 1px solid var(--tc-divider);
    border-radius: var(--tc-radius-lg);
}

.tc-theme .footer-cta-title {
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--tc-text);
}

.tc-theme .footer-cta-button {
    background: var(--tc-bg);
    border: 1px solid var(--tc-divider);
    border-radius: var(--tc-radius);
}

.tc-theme .footer-cta-input {
    color: var(--tc-text-secondary);
}

.tc-theme .footer-cta-button span {
    color: var(--tc-cta-text);
    background: var(--tc-cta-bg);
    border-radius: 6px;
}


/* Footer: light, like 2chat.co
/* ---------------------------------------------------------- */

.tc-theme .site-footer {
    padding-top: 40px;
    padding-bottom: 56px;
    color: var(--tc-text-secondary);
    background: var(--tc-bg);
    border-top: 1px solid var(--tc-divider);
}

.tc-theme .site-footer .inner {
    color: var(--tc-text-secondary);
}

.tc-theme .site-footer a {
    color: var(--tc-text-secondary);
}

.tc-theme .site-footer a:hover {
    color: var(--tc-text);
}

.tc-theme .site-footer .copyright a {
    font-weight: 600;
    color: var(--tc-text);
}

.tc-theme .site-footer-nav li:not(:first-child) a:before {
    background: var(--tc-text-disabled);
}

.tc-theme .site-footer-social-links svg {
    width: 18px;
    height: 18px;
}


/* Dark mode details Casper's own dark rules don't cover
/* ---------------------------------------------------------- */

html.dark-mode .tc-theme .post-card-image-link,
html.dark-mode .tc-theme .post-card-image {
    background: var(--tc-neutral);
}

html.dark-mode .tc-theme .gh-content :not(pre) > code {
    color: var(--tc-text);
    background: var(--tc-neutral);
}

html.dark-mode .tc-theme .gh-button-share {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
}

html.dark-mode .tc-theme .gh-head-open #gh-head,
html.dark-mode .tc-theme .gh-head-open #gh-head .gh-head-actions {
    background: var(--tc-bg);
}


/* Small screens
/* ---------------------------------------------------------- */

@media (max-width: 767px) {
    .tc-theme .gh-head {
        height: 64px;
    }

    .tc-theme .tc-logo img {
        height: 22px;
    }

    .tc-theme .tc-logo-label {
        font-size: 1.8rem;
    }

    /* Inside the open mobile menu the buttons are full width */
    .tc-theme #gh-head .gh-head-button {
        height: 48px;
        font-size: 1.7rem;
    }

    .tc-theme .site-footer .copyright,
    .tc-theme .site-footer .copyright a {
        color: var(--tc-text);
    }
}
