/* ==========================================================================
   Info pages (/licenses, /privacy, /terms, /updates) - shared .info-*
   An index down the left, the content in one readable column. The short
   version of a page (or, on /licenses, the credits that licenses actually
   require) sits in a "sewn-in label" (a dashed chalk stitch line inside the
   border). On /licenses the credits
   that licenses actually require sit in a "sewn-in label" (a dashed chalk
   stitch line inside the border) - the same chalk dashed tag marks every
   other entry that asks for a credit, so the obligation reads at a glance.
   Optional fonts are a specimen sheet, each name drawn in its own face from
   the pre-rendered previews Pattern Editor already uses (masked, so they
   take the text color without downloading the font files themselves).
   ========================================================================== */

.info-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: 46rem;
    margin: 0 auto;
    padding-bottom: 2rem;
}

@media (min-width: 992px) {
    .info-page {
        grid-template-columns: 11rem minmax(0, 46rem);
        column-gap: 3.5rem;
        max-width: 60.5rem;
    }

    .info-page > * {
        grid-column: 2;
    }

    .info-page > .info-index {
        grid-column: 1;
        grid-row: 2 / span 40;
        align-self: start;
        position: sticky;
        top: 6rem;
        flex-direction: column;
        gap: 0.15rem;
        margin-top: 3.4rem;
        padding: 0 0 0 0.9rem;
        border-left: 1px solid var(--border-subtle);
    }
}

.info-title {
    font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    margin: 0 0 0.9rem;
}

.info-lede {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 62ch;
    margin: 0;
}

.info-index {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
    margin-top: 1.75rem;
    font-size: 0.875rem;
}

.info-index a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.2rem 0;
}

.info-index a:hover,
.info-index a:focus-visible {
    color: var(--text-primary);
}

.info-index a span {
    font-variant-numeric: tabular-nums;
    color: var(--border-strong);
    margin-left: 0.2rem;
}

.info-section {
    margin-top: 3.5rem;
    scroll-margin-top: 6rem;
}

.info-h2 {
    font-size: 1.3rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin: 0 0 0.6rem;
}

.info-h3 {
    font-size: 1rem;
    font-weight: 650;
    margin: 2.25rem 0 0.4rem;
}

.info-muted {
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 65ch;
    margin: 0 0 1.25rem;
}

.info-meta {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.info-section p {
    line-height: 1.65;
    max-width: 65ch;
    margin: 0 0 1rem;
}

.info-section p:last-child {
    margin-bottom: 0;
}

.info-section .info-h2 + p.info-muted {
    margin-bottom: 1.25rem;
}

/* The short version of a page, inside the sewn-in label */
.info-short {
    list-style: none;
    margin: 0;
    padding: 0;
}

.info-short li {
    position: relative;
    padding: 0.7rem 0 0.7rem 1.4rem;
    border-bottom: 1px dashed var(--border-subtle);
    line-height: 1.55;
}

.info-short li:last-child {
    border-bottom: none;
    padding-bottom: 0.2rem;
}

.info-short li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.38rem;
    width: 0.7rem;
    border-top: 1.5px dashed var(--chalk-500);
}

/* License tags - quiet outline for "just keep the license text with it",
   chalk dashed for "this one asks for a visible credit". */
.info-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.5;
    padding: 0.05rem 0.55rem;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    vertical-align: 0.1em;
}

a.info-tag:hover,
a.info-tag:focus-visible {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.info-tag--credit {
    color: var(--chalk-400);
    border: 1px dashed rgba(var(--chalk-rgb), 0.6);
}

a.info-tag--credit:hover,
a.info-tag--credit:focus-visible {
    color: var(--chalk-400);
    border-color: var(--chalk-500);
    background: rgba(var(--chalk-rgb), 0.08);
}

/* The sewn-in label */
.info-label {
    position: relative;
    padding: 1.4rem 1.25rem 1rem;
    background: var(--surface-1);
    border: 1px solid rgba(var(--chalk-rgb), 0.22);
    border-radius: 12px;
}

.info-label::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 1px dashed rgba(var(--chalk-rgb), 0.45);
    border-radius: 8px;
    pointer-events: none;
}

@media (min-width: 576px) {
    .info-label {
        padding: 1.9rem 1.9rem 1.4rem;
    }
}

.lic-credits,
.lic-engines {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin: 0;
}

.lic-credits dt,
.lic-engines dt {
    font-weight: 600;
    padding-top: 0.85rem;
}

.lic-credits dt {
    font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--chalk-400);
}

.lic-credits dd,
.lic-engines dd {
    margin: 0;
    padding: 0.2rem 0 0.85rem;
    border-bottom: 1px dashed var(--border-subtle);
    line-height: 1.55;
}

.lic-credits dd:last-of-type {
    border-bottom: none;
    padding-bottom: 0.2rem;
}

.lic-engines dd {
    color: var(--text-muted);
    border-bottom-style: solid;
}

@media (min-width: 576px) {
    .lic-credits,
    .lic-engines {
        grid-template-columns: 11rem minmax(0, 1fr);
        column-gap: 1.5rem;
    }

    .lic-credits dt,
    .lic-engines dt {
        padding-bottom: 0.85rem;
        border-bottom: 1px dashed var(--border-subtle);
    }

    .lic-engines dt {
        border-bottom-style: solid;
    }

    .lic-credits dd {
        padding-top: 0.85rem;
    }

    .lic-engines dd {
        padding-top: 0.85rem;
    }

    .lic-credits dt:last-of-type {
        border-bottom: none;
        padding-bottom: 0.2rem;
    }
}

.lic-credits .info-tag {
    margin-left: 0.35rem;
}

/* Name / what it does / version + license rows */
.info-rows {
    border-top: 1px solid var(--border-subtle);
}

.info-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.25rem 1.25rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.info-row-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.info-row-name.mono {
    font-size: 0.82rem;
    padding-top: 0.1rem;
}

.info-row-use {
    grid-row: 2;
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.info-row-meta {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.6rem;
    white-space: nowrap;
}

.info-row-meta .mono {
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .info-row {
        grid-template-columns: 11rem minmax(0, 1fr) auto;
        align-items: baseline;
    }

    .info-row-use {
        grid-row: auto;
        grid-column: auto;
    }
}

/* Specimen sheet - one hairline grid, tiles share their borders. */
.lic-specimens {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
}

/* Each tile draws its right and bottom hairline; the ones on the outer
   edge are clipped by the list's own border, and a short last row leaves
   plain background rather than empty grey cells. */
.lic-specimens > li {
    box-shadow: 1px 0 0 var(--border-subtle), 0 1px 0 var(--border-subtle);
}

.lic-specimen {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.1rem;
    height: 100%;
    padding: 1.4rem 1.1rem 0.85rem;
    background: var(--surface-0);
    color: var(--text-primary);
    text-decoration: none;
}

.lic-specimen-glyphs {
    display: block;
    height: 2.1rem;
    background-color: currentColor;
    -webkit-mask: var(--preview) left center / contain no-repeat;
    mask: var(--preview) left center / contain no-repeat;
}

.lic-specimen-caption {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.lic-specimen:hover,
.lic-specimen:focus-visible {
    background: var(--surface-1);
    color: var(--accent-400);
}

.lic-specimen:focus-visible {
    outline: 2px solid var(--accent-500);
    outline-offset: -2px;
}

/* Updates - entries grouped by month, a date column and the change. */
.info-month {
    font-size: 1.05rem;
    font-weight: 650;
    margin: 2.75rem 0 0.5rem;
    scroll-margin-top: 6rem;
}

.info-month:first-of-type {
    margin-top: 0;
}

.info-log {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border-subtle);
}

.info-log li {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-subtle);
    line-height: 1.55;
}

.info-log time {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    padding-top: 0.1rem;
}

.info-log p {
    margin: 0;
    overflow-wrap: anywhere;
}

.info-empty {
    padding: 2.5rem 1.5rem;
    border: 1px dashed var(--border-strong);
    border-radius: 12px;
    color: var(--text-muted);
    text-align: center;
}

.info-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    font-size: 0.9rem;
}

.info-pager > span {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Full crate list */
.lic-all {
    margin-top: 1.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0 1.25rem;
}

.lic-all > summary {
    cursor: pointer;
    font-weight: 600;
    padding: 1rem 0;
}

.lic-all[open] > summary {
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1rem;
}

.lic-all .table-responsive {
    max-height: 28rem;
    overflow-y: auto;
    margin-bottom: 1.25rem;
}

.lic-table {
    font-size: 0.84rem;
}

.lic-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-0);
    font-weight: 600;
}

.lic-table td a {
    color: var(--text-primary);
}

.lic-table td:last-child {
    color: var(--text-muted);
}

.lic-foot {
    margin: 3.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}
