/* Enhancements. Nothing here changes the look of the theme at rest. */

/* Browser surfaces */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

::selection {
    background: var(--text-color);
    color: var(--background-color);
}

a,
button {
    -webkit-tap-highlight-color: transparent;
}

/* Page transitions (browsers with cross-document View Transitions; others navigate as before) */

@view-transition {
    navigation: auto;
}

::view-transition-group(*) {
    animation-duration: 450ms;
    animation-timing-function: cubic-bezier(.23,1,.32,1);
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 300ms;
}

/* The fixed header and indicator stay put instead of crossfading */
custom-header {
    view-transition-name: mono-header;
}

custom-indicator {
    view-transition-name: mono-indicator;
}

.mono-view-transition .header.opacity-animation,
.mono-view-transition custom-indicator.opacity-animation {
    opacity: 1 !important;
}

/* Arriving from a card: the hero image is already on screen, so it doesn't fade in again */
.mono-arrived-from-card .hero.opacity-animation,
.mono-arrived-from-card .artist-hero.opacity-animation {
    opacity: 1 !important;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

/* Dark mode: the black logo is inverted so it reads white on black */

html[data-theme="dark"] .logo-image {
    filter: invert(1);
}

/* Header and section label over photos (desktop): white text with a soft shadow, so they read on
   any image without painting over it. enhancements.js adds the classes while a large image passes behind them. */

custom-header a,
custom-header button,
custom-header .logo-image,
custom-indicator .section-text,
custom-indicator .section-text a {
    transition: color 250ms ease, filter 250ms ease, text-shadow 250ms ease;
}

.header-on-image custom-header,
.indicator-on-image custom-indicator {
    --text-color: #fff;
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35);
}

.header-on-image custom-header *,
.indicator-on-image custom-indicator * {
    text-shadow: inherit;
}

/* The logo turns white too, with the same soft shadow (in dark mode it is already inverted, so it stays white) */
.header-on-image custom-header .logo-image {
    filter: invert(1) drop-shadow(0 0 6px rgba(0, 0, 0, 0.45));
}

/* Interviews: questions in the theme's mono face, answers in the reading face */
.post-content .interview-question {
    font-family: var(--font1);
    font-size: 1em;
    line-height: 1.45;
    letter-spacing: -.01em;
    margin-top: 2.4em;
}

.post-content .interview-question strong {
    font-weight: 500;
}

/* Images in posts: a single top-to-bottom reveal as they come into view */
.mono-reveal {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 900ms cubic-bezier(.19,1,.22,1);
}

.mono-reveal.is-revealed {
    clip-path: inset(0 0 0 0);
}

/* Depth: card photos are slightly larger than their frame and drift inside it (set by enhancements.js).
   Uses the individual translate/scale properties so the existing hover zoom still composes on top. */
.mono-parallax {
    scale: 1.1;
    translate: var(--mono-parallax, 0%) 0;
}

/* Cursor label over cards */
.mono-cursor-label {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    pointer-events: none;
    padding: 4px 8px;
    font-family: var(--font1);
    font-size: max(12px, calc(0.83vw * var(--scale)));
    line-height: 1.3;
    white-space: nowrap;
    color: var(--text-color);
    background-color: var(--background-color);
    opacity: 0;
    transition: opacity 150ms ease;
}

.mono-cursor-label.is-visible {
    opacity: 1;
}

@media (hover: none), (max-width: 991px) {
    .mono-cursor-label {
        display: none;
    }
}

/* ---- Review panel, round 1 ---- */

/* If GSAP can't load, the track scrolls sideways natively instead of being stuck */
.no-gsap .horizontal-outer {
    overflow-x: auto;
}

/* Card titles are the headline: full ink. Hovering or focusing a card dims the others instead */
.image-animation .title-opacity,
.image-animation:hover .title-opacity {
    opacity: 1 !important;
}

.grid .card,
.grid .tag-card {
    transition: opacity 400ms ease;
}

@media (hover: hover) and (min-width: 992px) {
    /* .55 keeps the dimmed titles above 4.5:1 contrast */
    .grid:has(.image-animation:hover, .image-animation:focus-visible) > :not(:has(.image-animation:hover, .image-animation:focus-visible)):is(.card, .tag-card) {
        opacity: 0.55;
    }

    .card .card-title .two-lines {
        -webkit-line-clamp: 3;
    }
}

/* Homepage statement: the site description is the headline; the site title is its label */
.home-intro {
    width: max(420px, calc(34vw * var(--scale)));
}

.home-site-title {
    font-size: max(14px, calc(0.97vw * var(--scale)));
    line-height: 130%;
    letter-spacing: 0;
}

.home-statement {
    font-family: var(--font1);
    font-size: max(30px, calc(2.6vw * var(--scale)));
    line-height: 1.1;
    letter-spacing: -.02em;
    text-transform: var(--text-style);
    text-wrap: balance;
    opacity: 1;
    margin-bottom: max(15px, calc(1.04vw * var(--scale)));
}

@media (max-width: 991px) {
    .home-intro {
        width: 100%;
    }

    .home-statement {
        font-size: 30px;
    }
}

/* Mobile: the first screen leaves room for the start of the content below */
@media (max-width: 991px) {
    html .hero-section {
        min-height: calc(100vh - 140px);
        min-height: calc(100svh - 140px);
    }
}

/* ---- Review panel, round 2 ---- */

/* Brackets always have inner spaces: "[ MOCKINGBIRD ]", not "[MOCKINGBIRD]" (extra spaces collapse where
   the template already has whitespace). The mobile icon brackets keep their tight look. */
html[data-cta-style="Square Bracket"] .bracket:not(.mobile-navbar-link)::before,
html[data-cta-style="Mixed"] .bracket:not(.mobile-navbar-link)::before,
html[data-cta-style="Square Bracket"] .subtitle::before,
html[data-cta-style="Mixed"] .subtitle::before {
    content: "[ ";
}

html[data-cta-style="Square Bracket"] .bracket:not(.mobile-navbar-link)::after,
html[data-cta-style="Mixed"] .bracket:not(.mobile-navbar-link)::after,
html[data-cta-style="Square Bracket"] .subtitle::after,
html[data-cta-style="Mixed"] .subtitle::after {
    content: " ]";
}

/* Homepage statement: room between it and the social links */
.home-statement {
    margin-bottom: max(28px, calc(2vw * var(--scale)));
}

/* Artist pages: the name at the same display scale as an interview title */
.artist-hero .hero-title {
    font-size: max(44px, calc(3.61vw * var(--scale)));
    line-height: 1.05;
}

@media (max-width: 991px) {
    .artist-hero .hero-title {
        font-size: 40px;
    }
}

/* In-article sign-up: one quiet line after the interview */
.post-signup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: max(12px, calc(0.83vw * var(--scale)));
    margin-top: max(28px, calc(1.94vw * var(--scale)));
    padding: max(16px, calc(1.11vw * var(--scale))) 0;
    border-top: 1px solid var(--text-color-20);
    border-bottom: 1px solid var(--text-color-20);
}

.post-content .post-signup-text {
    margin: 0;
    font-family: var(--font1);
    text-transform: var(--text-style);
    opacity: 1;
}

/* Inside the article, these blocks keep Mono's label styling rather than the article's link styling */
.post-content .post-artist,
.post-content .post-artist *,
.post-content .post-signup a {
    text-decoration: none;
    color: var(--text-color);
}

/* The article text resets case on everything inside it, so the labels need the override to stay Mono */
.post-content .post-artist .subtitle,
.post-content .post-artist-name,
.post-content .post-artist .button,
.post-content .post-signup .button {
    font-family: var(--font1);
    text-transform: var(--text-style) !important;
}

.post-content .post-artist:hover .post-artist-name {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* The sign-up line directly under the artist block shares its rule instead of doubling it */
.post-artist-section + .post-signup {
    border-top: none;
    margin-top: 0;
}

/* Interviews: the artist this conversation is with (inside the reading column, after the share icons) */
.post-artist-section {
    margin-top: max(28px, calc(1.94vw * var(--scale)));
}

.post-artist {
    display: flex;
    align-items: center;
    gap: var(--grid-gap);
    margin: 0;
    padding: max(20px, calc(1.4vw * var(--scale))) 0;
    border-top: 1px solid var(--text-color-20);
    border-bottom: 1px solid var(--text-color-20);
}

.post-artist-image {
    flex: 0 0 max(110px, calc(9vw * var(--scale)));
    width: max(110px, calc(9vw * var(--scale)));
    aspect-ratio: 4 / 5;
    height: auto;
}

.post-artist-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: max(8px, calc(0.55vw * var(--scale)));
}

.post-artist-excerpt {
    font-family: var(--font2);
    opacity: 0.6;
    text-transform: none;
}

/* Interviews: more from the same topic */
.more-conversations {
    max-width: calc(56vw * var(--scale) + 2 * var(--small-padding));
    margin: max(46px, calc(3.19vw * var(--scale))) auto 0;
}

.more-conversations-title {
    margin-bottom: max(12px, calc(0.83vw * var(--scale)));
}

.more-conversations-list {
    list-style: none;
    padding: 0;
}

.more-conversation {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--grid-gap);
    padding: max(12px, calc(0.83vw * var(--scale))) 0;
    border-bottom: 1px solid var(--text-color-20);
    font-family: var(--font1);
}

.more-conversation-date {
    opacity: 0.6;
    white-space: nowrap;
}

.more-conversation:hover .more-conversation-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* An empty older/newer slot at the end of a post is hidden rather than left as a blank half */
.related-post-wrapper:not(:has(.card)) {
    display: none;
}

/* ...and so is the divider between them ( :has() can't be nested, so each side is checked separately) */
.related-posts-inner:not(:has(.older-post .card)) .related-posts-separator,
.related-posts-inner:not(:has(.newer-post .card)) .related-posts-separator {
    display: none;
}

/* The section label is one line, like a running head (full name in its tooltip) */
@media (min-width: 992px) {
    .section-text {
        display: block;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
}

/* Newsletter: one bracket group, "[ YOUR.EMAIL…   SEND ]", instead of "][" touching */
html[data-cta-style="Square Bracket"] .subscribe-inner::after,
html[data-cta-style="Square Bracket"] .subscribe-wrapper .submit-button::before {
    content: none;
}

/* Over a photo, filled buttons (non-bracket CTA styles) become outlined so they don't turn white-on-white */
.header-on-image custom-header .button {
    color: #fff;
    background-color: transparent;
    box-shadow: inset 0 0 0 1px #fff;
}

/* Text areas follow the theme colors like the inputs do (the browser's grey showed in dark mode) */
html textarea {
    background-color: var(--background-color);
    color: var(--text-color);
}

/* Cards without an image show the item's name inside the frame instead of a generic icon */
.placeholder-label {
    font-family: var(--font1);
    font-size: max(18px, calc(1.25vw * var(--scale)));
    line-height: 1.2;
    letter-spacing: -.02em;
    text-align: center;
    padding: 12%;
    overflow-wrap: anywhere;
    text-wrap: balance;
    opacity: 0.6;
    transition: opacity .2s ease;
}

.image-animation:hover .placeholder-label {
    opacity: 1;
}

/* The mobile menu hides the account row's links (they're icons there); keep the switch */
@media (max-width: 991px) {
    .navbar-account-links .theme-toggle {
        display: block;
        font-size: 20px;
    }
}

@media (max-width: 479px) {
    .navbar-account-links .theme-toggle {
        font-size: 18px;
    }
}

/* Keyboard focus: only shown when navigating with the keyboard */

:where(a, button, input, textarea, select, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 1px dashed var(--text-color) !important;
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    padding: 8px 12px;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font1);
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
}

.nav-landmark {
    display: contents;
}

/* Dropdown links become visible when reached by keyboard or opened with Enter */

.nav li:focus-within .secondary-links,
.nav li.is-open .secondary-links {
    opacity: 1;
    pointer-events: all;
}

.nav li:focus-within .secondary-links-inner li,
.nav li.is-open .secondary-links-inner li {
    opacity: 1 !important;
    transform: none !important;
}

.nav li:focus-within .dropdown-vertical-line,
.nav li.is-open .dropdown-vertical-line {
    height: 0% !important;
}

/* Larger hit areas without changing the drawn size */

.indicator-line {
    position: relative;
}

.indicator-line::after {
    content: "";
    position: absolute;
    inset: -12px 0;
}

/* Logo: the bird above "BIRD" hops once on hover.
   The box values are measured from the Mockingbird logo (bird = x 53.9–68.3%, y 0–34.6%);
   if the logo file changes, update them or remove this block. */

.header .logo {
    position: relative;
    --bird-left: 53.86%;
    --bird-right: 31.69%;
    --bird-bottom: 65.4%;
}

.logo-bird {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: inset(0 var(--bird-right) var(--bird-bottom) var(--bird-left));
    transform-origin: 61% 34.6%;
    pointer-events: none;
    visibility: hidden;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .header .logo:is(:hover, :focus-visible) .logo-bird {
        visibility: visible;
        animation: mono-bird-hop 520ms cubic-bezier(.23,1,.32,1);
    }

    /* The wordmark gives under the bird: a dip as it pushes off, a softer one as it lands */
    .header .logo:is(:hover, :focus-visible) {
        transform-origin: 50% 100%;
        animation: mono-logo-spring 520ms cubic-bezier(.23,1,.32,1);
    }

    /* Hide the original bird while the copy hops, so there is only ever one */
    .header .logo:is(:hover, :focus-visible) .logo-image:not(.logo-bird) {
        -webkit-mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
        mask-image: linear-gradient(#000 0 0), linear-gradient(#000 0 0);
        -webkit-mask-size: 100% 100%, 14.45% 34.6%;
        mask-size: 100% 100%, 14.45% 34.6%;
        -webkit-mask-position: 0 0, 62.96% 0;
        mask-position: 0 0, 62.96% 0;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-composite: xor;
        mask-composite: exclude;
    }
}

@keyframes mono-logo-spring {
    0% { transform: none; }
    12% { transform: translateY(1px) scaleY(0.97); }
    30% { transform: none; }
    68% { transform: translateY(0.5px) scaleY(0.985); }
    85% { transform: none; }
    100% { transform: none; }
}

@keyframes mono-bird-hop {
    0% { transform: none; }
    35% { transform: translateY(-3px) rotate(-8deg); }
    70% { transform: translateY(0) rotate(2deg); }
    100% { transform: none; }
}

/* Typography: better line breaks and no overflowing long words */

h1, h2, h3, .hero-title, .post-heading, .medium-text {
    text-wrap: balance;
    overflow-wrap: break-word;
}

p, blockquote, li {
    text-wrap: pretty;
}

.post-content-inner {
    overflow-wrap: break-word;
}

blockquote {
    hanging-punctuation: first;
}

/* Touch screens wider than the mobile breakpoint (e.g. iPad landscape):
   hover effects should not stick after a tap */

@media (hover: none) and (min-width: 992px) {
    .image-animation:hover img,
    .image-animation:hover svg {
        transform: scale(1) !important;
    }

    .image-animation:hover .border-radius-animation figure,
    .image-animation:hover .border-radius-animation .placeholder {
        border-radius: 0;
    }

    .image-animation:hover .title-opacity {
        opacity: 0.6;
    }

    html[data-cta-style="Square Bracket"] .button:hover::before,
    html[data-cta-style="Square Bracket"] .kg-btn:hover::before,
    .social:hover::before {
        left: 0;
    }

    html[data-cta-style="Square Bracket"] .button:hover::after,
    html[data-cta-style="Square Bracket"] .kg-btn:hover::after,
    .social:hover::after {
        right: 0;
    }
}

/* Print: interviews print as clean black text */

@media print {
    custom-header,
    custom-indicator,
    .skip-link,
    .post-share,
    .comments-section,
    .related-posts,
    .vertical-page-footer-wrapper,
    .demo-buttons-container,
    .background-blur {
        display: none !important;
    }

    .opacity-animation,
    .hidden-post-content,
    .translate-animation {
        opacity: 1 !important;
        transform: none !important;
    }

    p {
        opacity: 1;
        color: #000;
    }

    main,
    .horizontal-container {
        height: auto !important;
        display: block !important;
    }

    .narrow-container {
        min-width: 0;
        width: 100%;
    }

    .post-content a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: .8em;
    }

    h1, h2, h3, blockquote, figure {
        break-inside: avoid;
    }
}

@keyframes mono-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mono-rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mono-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Departure-board flip (artist counts) */

.mono-flap {
    display: inline-block;
    white-space: pre;
    transform-origin: 50% 50%;
    backface-visibility: hidden;
}

/* Typewriter (404 message) */

.mono-type-cursor {
    animation: mono-blink 1s steps(1) infinite;
}

.mono-type-rest {
    visibility: hidden;
}

@keyframes mono-blink {
    50% { opacity: 0; }
}

/* Press feedback */

.button,
button:not(.unstyled-button),
.kg-btn {
    transition: opacity .2s ease, transform 160ms ease-out;
}

.button:active,
button:not(.unstyled-button):active,
.kg-btn:active {
    transform: scale(0.97);
}

/* Form and clipboard messages fade in instead of appearing instantly */

form.error .error-alert,
form.success .success-alert,
form.loading .loading-alert {
    animation: mono-fade-in 200ms ease-out;
}

.clipboard-alert {
    animation: mono-fade-in 200ms ease-out;
    transition: opacity 200ms ease-in;
}

.clipboard-alert.is-leaving {
    opacity: 0;
}

/* Toggle cards open and close instead of snapping */

html .kg-toggle-card {
    interpolate-size: allow-keywords;
}

html .kg-toggle-card[data-kg-toggle-state] .kg-toggle-content {
    overflow: hidden;
    transition: height 300ms cubic-bezier(.19,1,.22,1);
}

html .kg-toggle-card .dropdown-vertical-line {
    transition: height 200ms ease-out;
}

/* Mobile menu links rise in one after another, like the desktop dropdown */

@media (max-width: 991px) {
    .navbar-links-outer[isopen="true"] .navbar-links-inner li {
        animation: mono-rise 600ms cubic-bezier(.19,1,.22,1) both;
    }

    .navbar-links-outer[isopen="true"] .navbar-links-inner li:nth-child(2) { animation-delay: 40ms; }
    .navbar-links-outer[isopen="true"] .navbar-links-inner li:nth-child(3) { animation-delay: 80ms; }
    .navbar-links-outer[isopen="true"] .navbar-links-inner li:nth-child(4) { animation-delay: 120ms; }
    .navbar-links-outer[isopen="true"] .navbar-links-inner li:nth-child(5) { animation-delay: 160ms; }
    .navbar-links-outer[isopen="true"] .navbar-links-inner li:nth-child(n+6) { animation-delay: 200ms; }
}

@media (prefers-reduced-motion: reduce) {
    .navbar-links-outer[isopen="true"] .navbar-links-inner li {
        animation-name: mono-fade-in;
    }

    .image-animation:hover img,
    .image-animation:hover svg {
        transform: none !important;
    }

    .image-animation img,
    .image-animation svg,
    .card-image-inner,
    .section-text {
        transition: none !important;
    }

    .button:active,
    button:not(.unstyled-button):active,
    .kg-btn:active {
        transform: none;
    }
}
