/*
 * Rules that belong to one screen only.
 *
 * 1. Sign In and the other single-form pages
 * 2. My Devices: the device card
 */

/* 1. Single-form pages: brand mark, title and one form, centered */
.entry {
    align-items: stretch;
    padding-top: 56px;
}

.entry-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-4);
    text-align: center;
}

.entry-foot {
    text-align: center;
    color: var(--c-muted);
    font-size: var(--t-label);
}

/* 2. My Devices */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: var(--s-4);
}

/* The whole card is the link to the device. It is the customer's first picture
   of the product, so it has its own look: a drawing, the ID and an LED. */
.device-card,
.ui a.device-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--c-line-strong);
    border-radius: var(--r-4);
    background: var(--c-surface);
    color: var(--c-text);
    text-decoration: none;
}

.device-card-off,
.ui a.device-card-off {
    border-color: var(--c-line);
}

.device-card-top {
    display: flex;
    align-items: center;
    gap: var(--s-4);
}

.device-card-names {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    min-width: 0;
}

.device-card-id {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.device-card-state {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    font-size: .9375rem;
    font-weight: 600;
}

.device-card-off .device-card-state {
    color: var(--c-muted);
}

.device-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    padding-top: var(--s-3);
    border-top: 1px solid var(--c-line);
    font-size: .9375rem;
}

.device-card-activity {
    display: flex;
    align-items: center;
    gap: var(--s-2);
}

.device-card-open {
    color: var(--c-link);
    font-weight: 600;
    white-space: nowrap;
}

/* The drawing of the device. Its parts take their colors from the tokens. */
.device-art {
    flex-shrink: 0;
    width: 120px;
    height: 72px;
}

.device-art-body {
    fill: var(--c-raised);
    stroke: var(--c-line-strong);
    stroke-width: 2;
}

.device-art-lens {
    fill: var(--c-bg);
    stroke: var(--c-muted);
    stroke-width: 2;
}

.device-art-glass {
    fill: var(--c-line);
}

.device-art-led {
    fill: var(--c-off);
}

.device-art-badge {
    fill: var(--c-off);
}

.device-card-on .device-art-led {
    fill: var(--c-ok);
}

.device-card-on .device-art-badge {
    fill: var(--c-accent);
}

/* 3. Device dashboard: page layout
      Phone: one column, with room at the bottom for the fixed tab bar.
      Wide screens: the tabs become a menu at the left side. */
.device-page {
    max-width: var(--w-page);
    margin: 0 auto;
    padding: var(--s-5) var(--s-4) 88px;
}

.device-main {
    display: flex;
    flex-direction: column;
    gap: var(--s-4);
    min-width: 0;
}

@media (min-width: 900px) {
    .device-page {
        display: grid;
        grid-template-columns: 200px minmax(0, 1fr);
        align-items: start;
        gap: var(--s-6);
        padding-bottom: var(--s-6);
    }

    .tabs {
        position: sticky;
        top: 76px;
        flex-direction: column;
        gap: var(--s-1);
        border-top: 0;
        background: transparent;
    }

    .tabs a {
        flex: none;
        justify-content: flex-start;
        min-height: var(--h-control);
        padding: 0 var(--s-3);
        border-top: 0;
        border-left: 3px solid transparent;
        border-radius: var(--r-2);
        font-size: var(--t-body);
    }

    .tabs a[aria-current="page"] {
        border-left-color: var(--c-accent);
        background: var(--c-selected);
    }
}

/* 4. Public watch page: as wide as the window allows, but never so wide that
      the 32:9 picture and the title above it no longer fit on one screen. */
.watch-page {
    width: max(min(100% - 2rem, (100vh - 12rem) * 32 / 9), min(100% - 2rem, 20rem));
    max-width: none;
    padding-right: 0;
    padding-left: 0;
}

/* Notifications on wide screens: a fixed-width column at the bottom right. */
@media (min-width: 900px) {
    .toast-stack {
        bottom: var(--s-4);
        left: auto;
        width: 360px;
    }
}
