/*
 * Home hero visual: "Razor in. Plain HTML out." as HTML + CSS (no raster).
 * in (two source cards) -> gem prism (dotnet build) -> out (mini browser showing the Conference sample).
 * Uses site.css tokens (--surface, --text, --edge, --shadow, --accent, --s-*) and the shared bevel inputs
 * (--cut, --bw, --sh) set per element. Token colours are the literals from code-theme.css (all >= 4.5:1 on --surface).
 * The browser page is deliberately fixed light: the Conference sample has no dark mode.
 */
.hh {
    --hh-k: #8A2A9B;
    --hh-s: #8A4B00;
    --hh-n: #0B5C9E;
    --hh-t: #9A2F1F;
    --hh-v: #5B3FA8;
    --hh-c: #5B5B66;
    min-width: 0;
    position: relative;
}

:root[data-theme="dark"] .hh {
    --hh-k: #E59BFF;
    --hh-s: #FFC21A;
    --hh-n: #7CC4FF;
    --hh-t: #FF9C8A;
    --hh-v: #B9A8FF;
    --hh-c: #AAAAB6;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .hh {
        --hh-k: #E59BFF;
        --hh-s: #FFC21A;
        --hh-n: #7CC4FF;
        --hh-t: #FF9C8A;
        --hh-v: #B9A8FF;
        --hh-c: #AAAAB6;
    }
}

.hh__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    margin: 0;
}

.hh__art {
    display: grid;
    grid-template-columns: 240px 140px minmax(0, 1fr);
    align-items: stretch;
    column-gap: 0;
    padding: var(--s-4) 0 0;
}

.hh__in, .hh__out {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hh__in > figure:first-child, .hh__browser {
    margin-top: auto;
}

.hh__cap {
    font: 700 12px/1 var(--mono);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: auto;
    padding-top: var(--s-5);
}

.hh__out .hh__cap {
    text-align: right;
}

/* source cards */
.hh__file {
    --cut: 16px;
    --bw: 2px;
    --sh: 4px;
    --fill: var(--surface);
    margin: 0;
    position: relative;
    color: var(--text);
}

.hh__file figcaption {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font: 700 11px/1 var(--mono);
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
}

.hh__file figcaption .icon {
    font-size: 16px;
}

.hh__file pre {
    margin: 0;
    padding: 10px 8px 12px 10px;
    font: 400 10.5px/18px var(--mono);
    white-space: pre;
    overflow: hidden;
    color: var(--text);
}

.hh__file .k {
    color: var(--hh-k);
}

.hh__file .s {
    color: var(--hh-s);
}

.hh__file .n {
    color: var(--hh-n);
}

.hh__file .t {
    color: var(--hh-t);
}

.hh__file .v {
    color: var(--hh-v);
}

.hh__file .c {
    color: var(--hh-c);
}

.hh__file--razor {
    z-index: 1;
    width: calc(100% - 8px);
}

.hh__file--md {
    --fill: var(--accent-tint);
    margin: -14px 0 0 20px;
    width: calc(100% - 20px);
    z-index: 2;
}

.hh__file--md pre {
    color: var(--text);
}

/* the prism */
.hh__core {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--s-4);
}

.hh__prism {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hh__gem {
    --cut: 12px;
    --bw: 3px;
    --sh: 5px;
    --fill: #FBF6EE;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    flex: none;
}

.hh__gem img {
    width: 44px;
    height: 44px;
    display: block;
}

.hh__cmd {
    font: 700 11px/1 var(--mono);
    background: var(--snippet-bg);
    color: var(--snippet-text);
    padding: 6px 8px;
    white-space: nowrap;
}

/* Horizontal layout budget for the 140px middle column: ray 16 + 12 + gem 64 + 9 + ray 16 + 10 = 127px, so both
   arrowheads (which hang 9px past their ray) stay clear of the source cards and the browser frame. */
.hh__ray {
    flex: none;
    width: 16px;
    height: 3px;
    background: repeating-linear-gradient(90deg, var(--edge) 0 5px, transparent 5px 9px);
    background-size: 9px 3px;
    position: relative;
}

/* Each arrowhead hangs 9px past its ray, so leave room for it: the "in" head must not slide under the gem tile,
   and the "out" ray starts past the gem's 5px drop shadow. */
.hh__ray:first-child {
    margin-left: 0;
    margin-right: 12px;
}

.hh__ray:last-child {
    margin-left: 9px;
    margin-right: 10px;
}

.hh__ray::after {
    content: "";
    position: absolute;
    top: -5px;
    right: -7px;
    border: 6.5px solid transparent;
    border-left: 9px solid var(--edge);
    border-right: 0;
}

/* the browser */
.hh__browser {
    --cut: 20px;
    --bw: 3px;
    --sh: 6px;
    --fill: #FBF6EE;
    color: #16161D;
    position: relative;
}

.hh__chrome {
    display: flex;
    align-items: flex-end;
    gap: var(--s-3);
    background: #16161D;
    padding: 8px 40px 0 10px;
    height: 34px;
}

.hh__dots {
    display: flex;
    gap: 5px;
    align-self: center;
    padding-bottom: 8px;
}

.hh__dots i {
    width: 9px;
    height: 9px;
    background: #FBF6EE;
    display: block;
}

.hh__dots i:nth-child(2) {
    background: #FFC21A;
}

.hh__dots i:nth-child(3) {
    background: #2FD18B;
}

.hh__tab {
    font: 700 11px/1 var(--mono);
    background: #FBF6EE;
    color: #16161D;
    padding: 8px 12px 7px;
}

.hh__url {
    font: 400 10px/1 var(--mono);
    letter-spacing: -0.01em;
    background: #F2EADC;
    color: #16161D;
    padding: 8px 10px;
    border-bottom: 2px solid #16161D;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh__page {
    padding: 12px 14px 16px;
    font-family: var(--sans);
}

.hh__site {
    display: flex;
    align-items: baseline;
    gap: 12px;
    font: 600 11px/1 var(--sans);
    color: #5B5B66;
    padding-bottom: 8px;
    border-bottom: 1px solid #E4DACA;
}

.hh__site b {
    font-weight: 900;
    font-size: 13px;
    color: #16161D;
    margin-right: auto;
}

.hh__site span:first-of-type {
    color: #16161D;
    box-shadow: 0 3px 0 #FFC21A;
}

.hh__page h3 {
    margin: 12px 0 8px;
    font: 900 18px/22px var(--sans);
    letter-spacing: -0.02em;
    color: #16161D;
}

.hh__page h3::after {
    content: "";
    display: block;
    width: 32px;
    height: 4px;
    background: #FFC21A;
    margin-top: 4px;
}

.hh__page ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.hh__page li {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #F2EADC;
    border: 2px solid #16161D;
    padding: 6px 8px;
}

.hh__page time {
    font: 700 11px/1 var(--mono);
    background: #FFC21A;
    color: #16161D;
    padding: 4px 5px;
    flex: none;
}

.hh__page li > span {
    display: grid;
    min-width: 0;
}

.hh__page li b {
    font: 700 12px/16px var(--sans);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hh__page li em {
    font: 400 11px/14px var(--sans);
    font-style: normal;
    color: #5B5B66;
}

/* layout */
@media (min-width: 1200px) {
    .home-hero__grid {
        grid-template-columns: minmax(0, 1fr) 648px;
        gap: var(--s-8);
    }

    .hh {
        margin-right: calc(var(--s-3) * -1);
    }
}

@media (max-width: 1199px) {
    .home-hero__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .hh__art {
        max-width: 720px;
        width: 100%;
        grid-template-columns: 240px 140px minmax(0, 1fr);
    }
}

@media (max-width: 719px) {
    .hh__art {
        grid-template-columns: minmax(0, 1fr);
        row-gap: var(--s-5);
        max-width: 350px;
        padding: 0;
    }

    .hh__in > figure:first-child, .hh__browser {
        margin-top: 0;
    }

    .hh__cap {
        margin-top: 0;
        padding-top: var(--s-5);
    }

    .hh__out .hh__cap {
        text-align: left;
    }

    .hh__out {
        flex-direction: column-reverse;
    }

    .hh__out .hh__cap {
        padding: 0 0 var(--s-5);
    }

    .hh__core {
        flex-direction: row;
        gap: var(--s-4);
    }

    .hh__prism {
        flex-direction: column;
    }

    .hh__ray {
        width: 3px;
        height: 20px;
        background: repeating-linear-gradient(180deg, var(--edge) 0 5px, transparent 5px 9px);
        background-size: 3px 9px;
    }

    .hh__ray:first-child {
        margin: 0 0 12px;
    }

    .hh__ray:last-child {
        margin: 9px 0 10px;
    }

    .hh__ray::after {
        top: auto;
        right: -5px;
        bottom: -7px;
        border: 6.5px solid transparent;
        border-top: 9px solid var(--edge);
        border-bottom: 0;
    }

    .hh__prism .hh__gem {
        margin: 0;
    }
}

/* dashes march toward the gem and out of it, the gem glints once */
@media (prefers-reduced-motion: no-preference) {
    .hh__ray {
        animation: hh-march 1.2s linear infinite;
    }

    .hh__gem img {
        animation: hh-glint 4.8s ease-in-out infinite;
    }
}

@keyframes hh-march {
    to {
        background-position: 9px 0;
    }
}

@keyframes hh-march-down {
    to {
        background-position: 0 9px;
    }
}

@keyframes hh-glint {
    0%, 70%, 100% {
        transform: none;
    }
    80% {
        transform: scale(1.1) rotate(-4deg);
    }
}

@media (max-width: 719px) and (prefers-reduced-motion: no-preference) {
    .hh__ray {
        animation-name: hh-march-down;
    }
}
