/* Start page sections and "customize sections" mode. */

.topbar__tools { display: flex; align-items: center; gap: 4px; }

.toggle__hint { color: var(--ink-muted); font-size: 0.8rem; }

/* ---------- Account ---------- */

.account { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

.account__avatar {
    width: 40px;
    height: 40px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

.account__info { min-width: 0; display: flex; flex-direction: column; }
.account__info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__info small { color: var(--ink-muted); }
.account__info small.is-error { color: var(--danger); }

.account__actions { display: flex; align-items: center; gap: 12px; }
.account__actions .secondary-button { margin: 0; }

.account__hint { margin: 0 0 12px; color: var(--ink-muted); font-size: 0.9rem; line-height: 1.5; }
.account__tabs { margin-bottom: 12px; width: fit-content; }
.account__form { display: flex; flex-direction: column; gap: 12px; }
.account__form .primary-button { align-self: flex-start; }
.account__rules { margin: -4px 0 0; color: var(--ink-muted); font-size: 0.8rem; }

.layout-bar {
    position: sticky;
    top: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px 14px 20px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.layout-bar div { display: flex; flex-direction: column; gap: 2px; }
.layout-bar span { color: var(--ink-muted); font-size: 0.9rem; }

/* ---------- The start page's dashboard ----------
   Sections are tiles in a two-column grid: half width or the whole width (start-section--wide). Each tile has the
   same head (icon in the section's area colour, name, "see all"); the sections' own titles step back. */

.dash {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    align-items: stretch;
}

.start-section {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    box-shadow: var(--shadow);
    transition: border-color var(--dur), background-color var(--dur), outline-color var(--dur);
}
.start-section--wide { grid-column: 1 / -1; }
.start-section__content { min-width: 0; }

.start-section__head { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; }
.start-section__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    font-size: var(--text-md);
    font-weight: 650;
    letter-spacing: 0.01em;
}
.start-section__title .icon {
    width: 28px;
    height: 28px;
    padding: 5px;
    flex: none;
    border-radius: 9px;
    background: color-mix(in srgb, var(--area) 15%, transparent);
    color: var(--area);
}
.start-section__more { margin-left: auto; color: var(--ink-muted); font-size: var(--text-sm); font-weight: 500; text-decoration: none; white-space: nowrap; }
.start-section__more:hover { color: var(--accent); }

/* Inside a tile the section is already on a card: its own first card, titles and heads flatten. */
.start-section__content > .card,
.start-section__content > section > .card:first-child:only-child { border: 0; border-radius: 0; background: none; box-shadow: none; padding: 0; }
.start-section__content .card { box-shadow: none; }
.start-section .hub-section__title, .start-section .news__header h2, .start-section .releases__header h2 { display: none; }
.start-section .news__header { justify-content: flex-end; margin-top: calc(-1 * (32px + var(--space-3))); min-height: 32px; }
.start-section .releases__header { justify-content: flex-start; }

/* Clocks in a tile: smaller, side by side. */
.start-section[data-type="clocks"] .clock-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--space-4); }
.start-section[data-type="clocks"] .clock-card { width: 100%; max-width: 170px; justify-self: center; }
.start-section[data-type="clocks"] .clock-card { gap: 10px; }

/* Customizing: the tiles are previews to move around. */
.home.is-editing .start-section {
    outline: 1.5px dashed var(--line);
    outline-offset: 3px;
    cursor: grab;
}
.home.is-editing .start-section:active { cursor: grabbing; }
.home.is-editing .start-section.is-drop-target { outline-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.home.is-editing .start-section.is-hidden .start-section__content { opacity: 0.35; filter: grayscale(1); }
.home.is-editing .start-section__content { pointer-events: none; user-select: none; max-height: 320px; overflow: hidden; mask-image: linear-gradient(#000 75%, transparent); }

.start-section__handle { display: grid; place-items: center; color: var(--ink-muted); }
.start-section__handle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.start-section__tools { margin-left: auto; display: flex; gap: 2px; }

/* Phones (and the Fold's cover screen): one column. The opened Fold and tablets upright keep two, a bit tighter. */
@media (max-width: 820px) {
    .dash { gap: var(--space-3); }
    .start-section { padding: var(--space-3) var(--space-4) var(--space-4); border-radius: var(--radius-lg); }
}
@media (max-width: 599px) {
    .dash { grid-template-columns: minmax(0, 1fr); }
    .start-section__size { display: none; }
}
/* Wide and ultrawide monitors: more room, more columns (a wide tile still spans them all). */
@media (min-width: 1800px) {
    .home { max-width: 1680px; }
    /* A wide tile takes two columns, not the whole row, and later tiles fill the gaps beside it. */
    .dash { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; }
    .start-section--wide { grid-column: span 2; }
}
@media (min-width: 2800px) {
    .home { max-width: 2400px; }
    .dash { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.add-sections {
    padding: 20px;
    border: 1.5px dashed var(--line);
    border-radius: var(--radius-xl);
}

.add-sections h2 {
    margin: 0 0 12px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.add-sections p { margin: 0; color: var(--ink-muted); }

.add-sections__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

.add-sections__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    text-align: left;
    cursor: pointer;
}

.add-sections__item:hover { border-color: var(--accent); }
.add-sections__item span { display: flex; flex-direction: column; gap: 2px; }
.add-sections__item small { color: var(--ink-muted); }

.add-sections__item svg {
    width: 20px;
    height: 20px;
    flex: none;
    margin-top: 1px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
}

/* ---------- Start page: greeting and today ---------- */

.home-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-2) var(--space-6); }
.home-hero__text { min-width: 0; }
.home-hero__time {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 200;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: color-mix(in srgb, var(--ink) 80%, transparent);
    text-shadow: var(--glow);
}

.home-today { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.home-today:not(:has(*)) { display: none; }
.home-today .todays-dish { margin-top: 0; }
.home-today > * { flex: 1 1 320px; min-width: 0; }
.home-today .now-gaming { margin: 0; }

@media (max-width: 720px) {
    .home-hero { align-items: flex-start; }
    .home-hero__time { display: none; }
}
/* "Add a clock" is a small row under the clocks in the tile, not a third big circle. */
.start-section[data-type="clocks"] .clock-card:has(.add-tile) { grid-column: 1 / -1; flex-direction: row; justify-content: center; max-width: none; gap: 10px; }
.start-section[data-type="clocks"] .add-tile { width: 34px; }
.start-section[data-type="clocks"] .add-tile svg { width: 45%; height: 45%; }
.start-section[data-type="clocks"] .clock-card:has(.add-tile) .clock-card__hint { opacity: 1; letter-spacing: 0.08em; }
