/* The DreamWeave tools site (www host). Reuses the palette tokens and header/footer from
   market.css; only the pieces the market has no equivalent for live here. */

.tools-body main {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 16px 56px;
}

/* The Suit Builder is two columns (a 960px working column and a 440px Character panel, 12px apart,
   plus the 16px side padding each way), so its page is wider than the other tools pages. */
.tools-body main.main--wide {
    max-width: calc(960px + 12px + 440px + 32px);
}

.play-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px 32px;
    margin-bottom: 28px;
    padding: 22px 24px;
    background: var(--panel);
    border: 1px solid var(--gold-border);
    border-radius: 8px;
}

.play-intro h1 {
    font-size: 40px;
    line-height: 1.05;
    margin: 0 0 8px;
}

.play-intro p {
    margin: 0;
    max-width: 52ch;
    color: var(--text-2);
}

.play-server {
    display: grid;
    gap: 10px;
    margin: 0;
    align-content: start;
}

.play-server dt {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.play-server dd {
    margin: 2px 0 0;
    color: var(--gold);
    font-size: 18px;
}

.play-server code {
    font-family: inherit;
    user-select: all;
}

.play-steps {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 8px 20px;
    margin: 0;
    padding: 14px 0 0 20px;
    border-top: 1px solid var(--rule);
    color: var(--text-2);
    font-size: 14px;
}

.play-steps a {
    color: var(--gold);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}

.tool-card:hover {
    border-color: var(--gold-border);
    background: var(--gold-tint);
}

.tool-card h2 {
    margin: 0;
    font-size: 26px;
    color: var(--gold);
}

.tool-card p {
    margin: 0;
    color: var(--text-2);
    font-size: 14px;
}

.tool-card .tool-note {
    margin-top: auto;
    color: var(--muted);
    font-size: 12px;
}

.tool-page h1 {
    margin: 0 0 6px;
}

.tool-page .tool-lede {
    margin: 0 0 20px;
    color: var(--text-2);
}

.tool-app {
    min-height: 320px;
}

.tool-notice {
    padding: 14px 16px;
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: 8px;
    color: var(--text-2);
}

@media (max-width: 640px) {
    .play-panel { grid-template-columns: 1fr; padding: 18px 16px; }
    .play-intro h1 { font-size: 32px; }
}

/* Home page backdrop: art behind the top of the page that fades into the ground colour, so the
   cards and Play panel sit on it. body is a stacking context (isolation) so the z-index -1 layer
   paints above body's own background rather than behind it. The narrow file serves phones. */
.home-backdrop {
    position: relative;
    isolation: isolate;
}

.home-backdrop::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: min(100vh, 980px);
    min-height: 620px;
    z-index: -1;
    background:
        linear-gradient(to bottom, rgba(25, 23, 20, 0.30) 0%, rgba(25, 23, 20, 0.45) 55%, var(--ground) 100%),
        url("../img/home-backdrop.webp") center 30% / cover no-repeat;
}

.home-backdrop .play-panel,
.home-backdrop .tool-card {
    background: rgba(31, 28, 24, 0.86);
    backdrop-filter: blur(6px);
}

.home-backdrop .tool-card:hover {
    background: rgba(40, 33, 24, 0.92);
}

/* A short page puts the footer inside the art strip; keep it on solid ground. */
.home-backdrop .site-footer {
    background: var(--ground);
}

@media (max-width: 1000px) {
    .home-backdrop::before {
        background:
            linear-gradient(to bottom, rgba(25, 23, 20, 0.30) 0%, rgba(25, 23, 20, 0.45) 55%, var(--ground) 100%),
            url("../img/home-backdrop-1000.webp") center 30% / cover no-repeat;
    }
}

@media (max-width: 640px) {
    .home-backdrop::before {
        background:
            linear-gradient(to bottom, rgba(25, 23, 20, 0.30) 0%, rgba(25, 23, 20, 0.45) 55%, var(--ground) 100%),
            url("../img/home-backdrop-portrait.webp") center top / cover no-repeat;
    }
}

/* Character Sheets directory (/sheets). Rows are grids, not tables, so nothing forces a minimum
   width: the name column takes the slack (min-width 0 + wrapping) and the page never scrolls sideways
   at phone width. */
.sheets-page h2 {
    margin: 0;
    font-size: 26px;
    color: var(--gold);
}

.sheets-cta a {
    color: var(--gold);
}

.sheets-mine {
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: 8px;
}

.sheets-mine .title-note {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.sheets-mine-list,
.sheets-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sheets-mine-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 10px 0;
    border-top: 1px solid var(--rule);
}

.sheets-mine-row:first-child {
    border-top: 0;
}

.sheets-mine-name {
    flex: 1 1 140px;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
}

/* The "Link copied" chip normally floats BELOW its button; in the panel that lands on the next
   character's row (and above it lands on the previous one), hiding its controls for the ~2s it
   shows. Here it sits in the flow beside the button instead and at rest is visually hidden (1px, clipped,
   still in the accessibility tree so its role="status" announces "Link copied"), so it takes no room, and while it shows it only nudges this row's own
   buttons right and covers nothing. (.is-visible is what market.js sets for the ~2s it shows.) */
.sheets-mine .share-copied-chip {
    position: absolute;
    top: auto;
    left: auto;
    transform: none;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.sheets-mine .share-copied-chip.is-visible {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 0 8px;
    padding: 4px 8px;
    overflow: visible;
    clip-path: none;
    align-self: center;
}

/* market.js's manual-copy fallback input is out-of-flow under the button elsewhere, which here would
   overlay the next row; in the panel it sits in the flow beside the button, and flex-wrap on the wrapper
   drops it beneath the button when the row is too narrow to hold both. */
.sheets-mine .share-icon-wrap {
    flex-wrap: wrap;
}

.sheets-mine .share-fallback {
    position: static;
    width: min(260px, 70vw);
    margin: 8px 0 0;
}

.sheets-state {
    color: var(--muted);
    font-size: 13px;
}

.sheets-state-public {
    color: var(--ok);
}

.sheets-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.sheets-search-label {
    flex: 1 0 100%;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sheets-search .text-input {
    flex: 1 1 200px;
    min-width: 0;
}

.sheets-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 7ch 14ch;
    align-items: baseline;
    gap: 4px 14px;
    padding: 10px 2px;
    border-top: 1px solid var(--rule);
}

.sheets-item:first-child {
    border-top: 0;
}

.sheets-name {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--gold);
}

a.sheets-name:hover {
    text-decoration: underline;
}

.sheets-meta {
    color: var(--text-2);
    font-size: 14px;
}

.sheets-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
}

@media (max-width: 480px) {
    .sheets-item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .sheets-name {
        grid-column: 1 / -1;
    }
}