/* The hub's pages (/home, /login, /register, /account), laid out by HubLayout.razor.
   Builds on app.css: its tokens (--color-*, --space-*, --control-height) and its buttons (.btn-primary, .btn-link). */

/* app.css centers the landing page's puzzle in a body exactly one screen tall. A hub page taller than that
   would spill above the top of the screen, out of reach: on a phone, as soon as the browser's toolbars show
   (100vh counts them), the header with the account link went there. The hub's pages start at the top and
   scroll like any page; full width too, whatever app.css makes of #app. */
body:has(.hub) {
    height: auto;
    min-height: 100%;
    justify-content: flex-start;
    align-items: stretch;
}

.hub {
    width: min(640px, 100%);
    align-self: center;
    display: flex;
    flex-direction: column;
    padding: 0 var(--space-md);
}

.hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    min-height: var(--control-height);
    padding: var(--space-md) 0;
}

.hub-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-fg);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hub-mark {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--color-fg);
}

/* ---- Account link (AccountLink.razor): in the hub's header, and in the corner of the landing page ---- */

/* Full strength, unlike other .btn-link: it is the only way in to the account and must be found at a glance, on a phone too. */
.account-link {
    opacity: 1;
    white-space: nowrap;
}

.hub-header .account-link {
    padding-right: 0;     /* right edge aligned with the page's content */
}

.corner-account {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
}

.hub-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg) 0;
}

.hub-title {
    font-size: 1.5rem;
    font-weight: 500;
}

/* App.razor's FocusOnNavigate focuses the page's h1 after each navigation (for screen readers):
   no visible ring for a focus the visitor didn't ask for. */
h1:focus {
    outline: none;
}

.hub-aside,
.hub-hint {
    font-size: 0.85rem;
    opacity: 0.7;
}

.hub-aside a {
    color: var(--color-fg);
    text-underline-offset: 4px;
}

/* ---- Forms ---- */

.hub-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 360px;
}

.hub-form label {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.hub-form input {
    height: var(--control-height);
    padding: 0 var(--space-sm);
    border: 1.5px solid var(--color-fg);
    border-radius: 0;
    background: var(--color-bg);
    color: var(--color-fg);
    font-family: var(--font-family);
    font-size: 1rem;
    letter-spacing: normal;
    text-transform: none;
}

.hub-form input:focus-visible {
    outline: 2px solid var(--color-fg);
    outline-offset: 2px;
}

.hub-form .btn-primary {
    align-self: flex-start;
    margin-top: var(--space-md);
}

.hub-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.hub-actions .btn-primary {
    margin-top: 0;
}

.hub-error {
    font-size: 0.85rem;
    font-weight: 500;
}

.hub-error::before {
    content: "\00d7\00a0";
}

.hub-signout {
    align-self: flex-start;
    padding-left: 0;
}

/* ---- Projects (/home): a card each, with a capture of it ---- */

/* Wider than the forms' pages: the captures are seen first. */
.hub:has(.project-grid) {
    width: min(960px, 100%);
}

/* Two side by side on a phone, three wider: however many there are, they stay easy to look through. */
.project-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem var(--space-md);
    margin-top: var(--space-sm);
}

@media (min-width: 720px) {
    .project-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2.5rem 1.5rem;
    }
}

/* The page opening: the cards come in one after the other (HomePage gives each its --i, up to 8). */
.project {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    color: var(--color-fg);
    text-decoration: none;
    outline: none;
    animation: project-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) calc(0.05s + var(--i, 0) * 0.07s) backwards;
}

@keyframes project-in {
    from { opacity: 0; transform: translateY(10px); }
}

/* The capture, in a black frame; without one, the project's initial on a black square, like the logo's letters. */
.project-shot {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    margin-bottom: var(--space-sm);
    overflow: hidden;
    background: var(--color-fg);
    color: var(--color-bg);
    container-type: inline-size;
    transition: transform 0.15s ease-out;
}

.project-shot::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 1.5px var(--color-fg);
    pointer-events: none;
    transition: box-shadow 0.2s ease-out;
}

.project-shot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.4s ease-out, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-initial {
    font-size: 40cqi;
    font-weight: 500;
    line-height: 1;
}

/* Invitation only: a label on the frame's corner. */
.project-tag {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    padding: 0.25rem 0.5rem;
    background: var(--color-fg);
    color: var(--color-bg);
    font-size: 0.55rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* With a mouse: the page stays black and white; the project under it shows in colour, a little closer. */
@media (hover: hover) {
    .project-shot img {
        filter: grayscale(1);
    }

    .project:hover .project-shot img {
        filter: none;
        transform: scale(1.04);
    }

    .project:hover .project-shot::after {
        box-shadow: inset 0 0 0 4px var(--color-fg);
    }
}

.project:focus-visible .project-shot img {
    filter: none;
    transform: scale(1.04);
}

.project:focus-visible .project-shot::after {
    box-shadow: inset 0 0 0 4px var(--color-fg);
}

/* Pressed (mouse or finger): it gives way, the time the project opens. */
.project:active .project-shot {
    transform: scale(0.98);
}

.project-heading {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    min-width: 0;
}

.project-number {
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    opacity: 0.45;
}

.project-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-underline-offset: 4px;
}

.project:hover .project-name,
.project:focus-visible .project-name {
    text-decoration: underline;
}

.project-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-size: 0.8rem;
    line-height: 1.45;
    opacity: 0.65;
}

@media (max-width: 479px) {
    .project-description {
        font-size: 0.72rem;
    }

    .project-tag {
        padding: 0.15rem 0.35rem;
        font-size: 0.5rem;
        letter-spacing: 0.12em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project,
    .project-shot,
    .project-shot::after,
    .project-shot img {
        animation: none;
        transition: none;
    }
}

