/* Unix Timestamp Converter (/unix-timestamp-converter): only what is the app's own (the live clock, the timestamp
   field, the zone cards, the date pickers and the unit rows). Panels, tiles, fields, buttons, tables and colours come
   from the app kit (css/app-kit, docs/app-kit.md). Loaded only on this app's page (StylePaths in its demo catalog entry). */

/* On a phone the site's photo-app rule (seo-pages.css) sets align-items: start on every stage, which beats the kit's
   stretch: the panels would shrink to their own width. */
.utc-landing-app > .ak-stage > * {
    align-self: stretch;
}

.utc-landing-app .utc-mono,
.utc-landing-app .utc-now-value,
.utc-landing-app .utc-out-value,
.utc-landing-app .utc-code {
    font-family: var(--ak-font-mono);
    font-variant-numeric: tabular-nums;
}

/* Numbers and ISO strings read left to right in every language. */
.utc-landing-app [dir="ltr"] {
    unicode-bidi: isolate;
}

/* --- The live clock ------------------------------------------------------------------------------------------------ */

.utc-landing-app .utc-now {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
}

.utc-landing-app .utc-now-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.utc-landing-app .utc-now-label {
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
    font-weight: 600;
}

.utc-landing-app .utc-now-value {
    color: var(--ak-text);
    font-size: var(--ak-fs-lg);
    font-weight: 700;
}

.utc-landing-app .utc-now-item--main .utc-now-value {
    color: var(--ak-accent);
    font-size: var(--ak-fs-xl);
}

.utc-landing-app .utc-now-iso {
    margin-inline-start: auto;
    color: var(--ak-muted);
    font-family: var(--ak-font-mono);
    font-size: var(--ak-fs-sm);
}

/* --- The timestamp field ------------------------------------------------------------------------------------------- */

.utc-landing-app .utc-input-row {
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
}

.utc-landing-app .utc-ts-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.utc-landing-app .utc-ts {
    width: 100%;
    min-width: 0;
    padding-inline-end: 6.5rem;
    font-family: var(--ak-font-mono);
    font-size: var(--ak-fs-lg);
    font-weight: 700;
    text-align: left;
}

/* The unit the number is read in, inside the field at its end. */
.utc-landing-app .utc-unit-hint {
    position: absolute;
    top: 50%;
    right: 0.6rem;
    transform: translateY(-50%);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--ak-hover);
    color: var(--ak-muted);
    font-size: var(--ak-fs-xs);
    font-weight: 700;
    pointer-events: none;
}

.utc-landing-app .utc-unit-hint:empty {
    display: none;
}

.utc-landing-app .ak-stat-value.utc-warn {
    color: var(--ak-warning);
}

/* --- One card per zone: UTC, local time, the chosen zone ----------------------------------------------------------- */

/* A zone per row: the written-out date on the left, the ISO 8601 and RFC 2822 strings on the right, so even a
   nanosecond ISO string stays on one line; stacked when the stage is narrow. */
.utc-landing-app .utc-zones {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    container-type: inline-size;
}

.utc-landing-app .utc-zones:empty {
    display: none;
}

.utc-landing-app .utc-zone {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
    min-width: 0;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--ak-border);
    border-radius: var(--ak-radius);
    background: var(--ak-field);
}

.utc-landing-app .utc-zone-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.5rem;
    font-size: var(--ak-fs-sm);
}

.utc-landing-app .utc-zone-name {
    color: var(--ak-text);
    font-weight: 700;
}

.utc-landing-app .utc-zone-hint,
.utc-landing-app .utc-zone-off {
    color: var(--ak-muted);
}

.utc-landing-app .utc-zone-off {
    margin-inline-start: auto;
    font-family: var(--ak-font-mono);
    font-size: var(--ak-fs-xs);
}

.utc-landing-app .utc-human {
    margin: 0;
    color: var(--ak-accent);
    font-size: var(--ak-fs-md);
    font-weight: 700;
    line-height: 1.3;
}

.utc-landing-app .utc-meta {
    margin: 0;
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
}

/* A format: its name above, the string and its Copy button below, so a whole ISO or RFC string fits on one line. */
.utc-landing-app .utc-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 0.4rem;
}

.utc-landing-app .utc-fmt {
    grid-column: 1 / -1;
    color: var(--ak-muted);
    font-size: var(--ak-fs-xs);
    font-weight: 600;
    white-space: nowrap;
}

.utc-landing-app .utc-code {
    min-width: 0;
    color: var(--ak-text);
    font-size: 0.8rem;
    overflow-wrap: anywhere;
}

@container (min-width: 40rem) {
    .utc-landing-app .utc-zone {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
        grid-template-areas: "head head" "human iso" "meta rfc";
        gap: 0.2rem 1rem;
    }

    .utc-landing-app .utc-zone-head { grid-area: head; }
    .utc-landing-app .utc-human { grid-area: human; align-self: center; }
    .utc-landing-app .utc-meta { grid-area: meta; align-self: center; }
    .utc-landing-app .utc-line--iso { grid-area: iso; }
    .utc-landing-app .utc-line--rfc { grid-area: rfc; }

    /* Side by side, the format name sits before the string. */
    .utc-landing-app .utc-line {
        grid-template-columns: 4.5rem minmax(0, 1fr) auto;
    }

    .utc-landing-app .utc-fmt {
        grid-column: auto;
    }
}

/* --- Date to timestamp --------------------------------------------------------------------------------------------- */

.utc-landing-app .utc-pick {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
    gap: 0.5rem 0.75rem;
}

.utc-landing-app .utc-pick-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.utc-landing-app .utc-pick-field--text {
    grid-column: 1 / -1;
}

.utc-landing-app .utc-pick-field .ak-field {
    width: 100%;
    min-width: 0;
}

.utc-landing-app .utc-pick-field--text .ak-field {
    font-family: var(--ak-font-mono);
}

.utc-landing-app .utc-pick-label {
    color: var(--ak-muted);
    font-size: var(--ak-fs-sm);
    font-weight: 600;
}

.utc-landing-app .utc-out {
    display: grid;
    grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.35rem 0.75rem;
}

.utc-landing-app .utc-out-row {
    display: contents;
}

.utc-landing-app .utc-out-label {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    color: var(--ak-text);
    font-size: var(--ak-fs-sm);
    font-weight: 600;
}

.utc-landing-app .utc-out-unit {
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--ak-hover);
    color: var(--ak-muted);
    font-family: var(--ak-font-mono);
    font-size: 0.72rem;
}

.utc-landing-app .utc-out-value {
    min-width: 0;
    color: var(--ak-text);
    font-size: var(--ak-fs-md);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.utc-landing-app .utc-out-row:first-child .utc-out-value {
    color: var(--ak-accent);
}

.utc-landing-app .utc-back-utc {
    grid-column: 1 / -1;
    color: var(--ak-muted);
    font-family: var(--ak-font-mono);
    font-size: var(--ak-fs-sm);
}

.utc-landing-app .utc-back-utc:empty {
    display: none;
}

/* --- Batch --------------------------------------------------------------------------------------------------------- */

.utc-landing-app textarea.utc-batch-input {
    min-height: 8rem;
}

.utc-landing-app .utc-batch-head {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.utc-landing-app .utc-batch-count {
    margin-inline-end: auto;
    font-size: var(--ak-fs-sm);
}

.utc-landing-app .utc-batch-table td {
    white-space: nowrap;
}

.utc-landing-app .utc-batch-table td.ak-mono {
    font-size: 0.8rem;
}

.utc-landing-app .utc-batch-table tr.utc-bad td {
    color: var(--ak-danger);
}

/* --- Right to left: the timestamp field keeps its digits on the left, the unit pill on the right. ----------------- */

[dir="rtl"] .utc-landing-app .utc-ts {
    text-align: left;
}

@media (max-width: 560px) {
    .utc-landing-app .utc-now-iso {
        margin-inline-start: 0;
        flex-basis: 100%;
    }

    .utc-landing-app .utc-out {
        grid-template-columns: minmax(0, max-content) minmax(0, 1fr) auto;
    }
}
