/* ==========================================================================
   Wishlist page (the public grid)

   Builds on /styles.css (tokens, shell, article head). Only what the
   wishlist needs lives here, and /wishlist/ is the only page that loads it.
   The list is written by local tools (website/wishlist/README.md). The only
   thing visitors can change is the Bought marks, at the end of this file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Status line and header extras
   -------------------------------------------------------------------------- */

.wishlist-updated,
.wishlist-note {
    color: var(--paper-faint);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

/* Loading / empty / error text. Sits in a soft panel so the page never looks blank. */
.wishlist-status {
    padding: 28px 22px;
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius);
    background: rgba(18, 29, 34, 0.55);
    color: var(--paper-dim);
    text-align: center;
}

.wishlist-status[hidden],
.wishlist-grid[hidden],
.wishlist-note[hidden],
.wishlist-updated[hidden] {
    display: none;
}

.wishlist-note {
    margin-top: 22px;
}

/* --------------------------------------------------------------------------
   Card grid

   auto-fill with a 165px floor: two columns on most phones, one below ~350px
   min(100%, ...) stops the track overflowing), two on larger phones, and
   as many as fit on desktop. The cards stretch to equal height per row.
   -------------------------------------------------------------------------- */

.wishlist-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr));
    gap: 18px;
}

.wishlist-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: rgba(18, 29, 34, 0.78);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.wishlist-card:hover,
.wishlist-card:focus-within {
    border-color: var(--rule-strong);
    background: rgba(22, 36, 42, 0.9);
}

/* A fixed square keeps rows aligned and stops layout jumping as pictures
   load. Amazon pictures are on white, so the frame is light; object-fit:
   contain avoids cropping products. */
.wishlist-photo {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f3f5f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Absolutely positioned so the picture never sizes the frame. In normal flow
   a tall product shot (500px high, 200px wide) overrode aspect-ratio through
   the frame's min-height: auto and stretched its whole row of cards. */
.wishlist-photo img {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Shown when an item has no picture or the picture failed to load: a
   contour-style ring on the dark ground, in keeping with the site. */
.wishlist-photo.is-placeholder {
    background:
        radial-gradient(circle at 50% 50%, transparent 0 22%, rgba(111, 181, 164, 0.22) 22% 23%, transparent 23% 36%,
            rgba(111, 181, 164, 0.16) 36% 37%, transparent 37% 50%, rgba(111, 181, 164, 0.1) 50% 51%, transparent 51%),
        var(--ink-raised);
}

.wishlist-photo.is-placeholder::after {
    content: "No picture";
    color: var(--paper-faint);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.wishlist-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
}

.wishlist-title {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--paper);
    /* Clamp long Amazon titles to three lines; the full text stays in the DOM. */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.wishlist-price {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--contour);
}

/* Sits in .wishlist-actions (below), which pins it to the card bottom. */
.wishlist-link {
    font-size: 0.88rem;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-card {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Bought marks

   Anyone can tick "Bought" on a card (wishlist.js, website/wishlist-bought).
   A bought card stays where it is: its picture and text fade and a tag goes
   on the picture, but the checkbox keeps full contrast so it can always be
   unticked.
   -------------------------------------------------------------------------- */

.wishlist-hint {
    color: var(--paper-dim);
    font-size: 0.92rem;
    line-height: 1.5;
}

.wishlist-hint[hidden] {
    display: none;
}

/* The link and the checkbox share the card's bottom row. margin-top:auto
   pins the row to the bottom of the card whatever the title's length. */
.wishlist-actions {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
}

/* A pill around the checkbox and its word, so the whole thing is one
   comfortable click or tap target. */
.wishlist-bought {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 4px 12px 4px 9px;
    border: 1px solid var(--rule-strong);
    border-radius: 999px;
    color: var(--paper-dim);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.wishlist-bought:hover {
    border-color: var(--contour);
    color: var(--paper);
}

.wishlist-bought input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--contour);
    cursor: pointer;
}

.wishlist-card.is-bought .wishlist-bought {
    border-color: var(--contour);
    background: rgba(111, 181, 164, 0.14);
    color: var(--contour);
}

/* While a save is on its way. */
.wishlist-card.is-saving .wishlist-bought {
    opacity: 0.6;
    cursor: progress;
}

.wishlist-card.is-bought .wishlist-photo img {
    opacity: 0.38;
    filter: grayscale(1);
}

.wishlist-card.is-bought .wishlist-title,
.wishlist-card.is-bought .wishlist-price {
    color: var(--paper-faint);
}

/* Above the picture (z-index), which is absolutely positioned in the same
   frame. Shown only on a bought card. */
.wishlist-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    display: none;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--contour);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.wishlist-card.is-bought .wishlist-tag {
    display: block;
}

/* "That didn't save" messages: fixed to the bottom of the screen so they're
   seen wherever the visitor has scrolled to. */
.wishlist-toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 10;
    width: max-content;
    max-width: min(calc(100vw - 32px), 440px);
    transform: translateX(-50%);
    padding: 12px 18px;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--ink-raised);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    color: var(--paper);
    font-size: 0.9rem;
    text-align: center;
}

.wishlist-toast:empty {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .wishlist-bought {
        transition: none;
    }
}
