/**
 * Order view (SPEC §5.6, §5.8): status flow, period card + bar, items, ink total, details.
 * Markup: inc/order-view.php. Used on the order confirmation and in My Account. Tokens only.
 */

/* Two columns: main + 22rem aside (sticky); stacks under 980px */
.dh-ov {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22rem;
    gap: var(--dh-gap);
    align-items: start;
}

.dh-ov__main,
.dh-ov__aside {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.dh-ov__aside {
    position: sticky;
    top: 16px;
}

@media (max-width: 980px) {
    .dh-ov { grid-template-columns: minmax(0, 1fr); }
    .dh-ov__aside { position: static; }
}

.dh-ov-head {
    display: grid;
    gap: 8px;
}

.dh-ov-head .dh-greet {
    font-size: clamp(1.9rem, 1.25rem + 2vw, 3rem);
}

.dh-ov-head p {
    margin: 0;
    max-width: 65ch;
    color: var(--dh-muted-foreground);
    font-size: 0.9375rem;
}

.dh-ov-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* -----------------------------------------
   Status flow
   ----------------------------------------- */
.dh-ov-flow {
    padding: 20px 24px;
}

.dh-flow {
    position: relative;
    display: grid;
    /* Dots at 0/25/50/75/100 %: the last step sits in a zero-width track
       and is right-aligned, so the line runs the full width */
    grid-template-columns: repeat(4, minmax(0, 1fr)) 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dh-flow::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    height: 2px;
    background: var(--dh-border);
}

.dh-flow li {
    position: relative;
    display: grid;
    gap: 2px;
    margin: 0;
    padding-top: 24px;
    font-size: 0.875rem;
}

.dh-flow li:last-child {
    justify-self: end;
    width: max-content;
    text-align: right;
}

.dh-flow__dot {
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    width: 14px;
    height: 14px;
    border: 2px solid var(--dh-border);
    border-radius: var(--dh-radius-full);
    background: var(--dh-card);
}

.dh-flow li:last-child .dh-flow__dot {
    left: auto;
    right: 0;
}

.dh-flow li.is-done .dh-flow__dot {
    border-color: var(--dh-foreground);
    background: var(--dh-foreground);
}

.dh-flow li.is-current .dh-flow__dot {
    border-color: var(--dh-primary);
    background: var(--dh-primary);
    box-shadow: 0 0 0 4px color-mix(in oklch, var(--dh-primary) 18%, transparent);
}

.dh-flow b {
    font-weight: 500;
}

.dh-flow li:not(.is-current):not(.is-done) b {
    color: var(--dh-muted-foreground);
}

.dh-flow li > span:last-child {
    min-height: 1.2em;
    font-size: 0.8125rem;
    color: var(--dh-muted-foreground);
}

@media (max-width: 600px) {
    .dh-flow {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .dh-flow::before {
        top: 6px;
        bottom: 6px;
        left: 6px;
        right: auto;
        width: 2px;
        height: auto;
    }

    .dh-flow li {
        padding: 0 0 0 26px;
    }

    .dh-flow li:last-child {
        justify-self: stretch;
        width: auto;
        text-align: left;
    }

    .dh-flow li:last-child .dh-flow__dot {
        left: 0;
        right: auto;
    }
}

/* -----------------------------------------
   Period
   ----------------------------------------- */
.dh-ov-period {
    display: grid;
    grid-template-columns: 2fr 3fr 3fr;
    gap: 12px 16px;
    padding: 20px 24px;
}

.dh-ov-period__col {
    display: grid;
    gap: 2px;
    align-content: start;
}

.dh-ov-period__col b {
    font-size: 0.96875rem;
    font-weight: 500;
}

.dh-ov-period__col .dh-muted {
    font-size: 0.8125rem;
}

.dh-ov-period__bar {
    grid-column: 1 / -1;
    display: flex;
    gap: 3px;
    height: 8px;
}

.dh-ov-period__bar i {
    border-radius: var(--dh-radius-full);
    background: var(--dh-blue-soft);
    box-shadow: inset 0 0 0 1.5px var(--dh-blue);
}

.dh-ov-period__bar b {
    border-radius: var(--dh-radius-full);
    background: var(--dh-primary);
}

@media (max-width: 600px) {
    .dh-ov-period { grid-template-columns: 1fr 1fr; }
}

/* -----------------------------------------
   Items
   ----------------------------------------- */
.dh-ov-items {
    display: grid;
    gap: 2px;
    padding: 8px 8px 6px;
}

.dh-ov-items__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 12px 12px 8px;
}

.dh-ov-items__head h2 {
    margin: 0;
    font: 600 1rem/1.5 var(--dh-font-heading);
}

.dh-ov-items__head .dh-muted {
    font-size: 0.875rem;
}

.dh-ov-items__list {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dh-ov-item {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    padding: 10px;
    border-radius: 1rem;
}

.dh-ov-item[hidden] {
    display: none;
}

.dh-ov-item__name {
    display: grid;
    min-width: 0;
}

.dh-ov-item__name a,
.dh-ov-item__name b {
    overflow: hidden;
    color: var(--dh-foreground);
    font-size: 0.90625rem;
    font-weight: 500;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dh-ov-item__name a:hover {
    text-decoration: underline;
}

.dh-ov-item__name span {
    font-size: 0.8125rem;
    color: var(--dh-muted-foreground);
}

.dh-ov-item__qty {
    font-size: 0.875rem;
    color: var(--dh-muted-foreground);
}

.dh-ov-item__price {
    min-width: 70px;
    font-weight: 500;
    text-align: right;
}

.dh-more {
    justify-self: center;
    margin: 2px 0 6px;
}

.dh-more[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

@media (max-width: 600px) {
    .dh-ov-item { grid-template-columns: 40px minmax(0, 1fr) auto; }
    .dh-ov-item .dh-thumb { width: 40px; height: 40px; }
    .dh-ov-item__qty { display: none; }
}

/* -----------------------------------------
   Ink total
   ----------------------------------------- */
.dh-ov-total {
    display: grid;
    gap: 10px;
    padding: 22px 24px;
}

.dh-ov-total__sum {
    font: 500 2.6rem/1 var(--dh-font-heading);
    letter-spacing: -0.04em;
}

.dh-ov-total .dh-kv {
    padding-top: 12px;
    border-top: 1px solid color-mix(in oklch, var(--dh-ink-foreground) 12%, transparent);
}

/* -----------------------------------------
   Details
   ----------------------------------------- */
.dh-ov-details {
    display: grid;
    gap: 16px;
    padding: 20px 24px;
}

.dh-ov-details__docs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--dh-border);
}

/* Page wrapper (confirmation, view-order) */
main.dh-order-received .woocommerce {
    max-width: none;
    margin: 0;
}

.dh-ov-page {
    display: grid;
    gap: var(--dh-gap);
    min-width: 0;
}

.dh-ov-back {
    justify-self: start;
    margin-left: -8px;
}

/* Customer order notes («Oppdateringer») */
.dh-ov-notes {
    display: grid;
    gap: 8px;
    padding: 20px 24px;
}

.dh-ov-notes h2 {
    margin: 0;
    font: 600 1rem/1.5 var(--dh-font-heading);
}

.dh-ov-notes ul {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.dh-ov-notes li {
    display: grid;
    gap: 2px;
    padding: 12px 0;
    border-top: 1px solid var(--dh-border);
    font-size: 0.9375rem;
}

.dh-ov-notes li .dh-muted {
    font-size: 0.8125rem;
}

.dh-ov-notes li p {
    margin: 0;
}
