/* Mobile first. One wide row per pattern; the layout adds a button column from 640 px.
   Light and warm by default (raspberry + sunshine), never pure white. Dark colors only with data-theme="dark".
   Signature of the site: the running stitch (dashed lines), as on the logo and the illustrations. */
@font-face {
    font-family: "Nunito";
    src: url("../fonts.h/nunito-variable.h.woff2") format("woff2");
    font-weight: 200 1000;
    font-style: normal;
    font-display: swap;
}

:root {
    --color-text: #2a2430;
    --color-background: #fdf1e6;
    --color-accent: #d6336c;
    --color-accent-hover: #b82a5b;
    --color-accent-text: #fff6ec;
    --color-accent-soft: #fde0ea;
    --color-sun: #ffc83d;
    --color-sun-soft: #ffeebd;
    --color-muted: #6e5e72;
    --color-card: #fffaf4;
    --color-border: #f2dcc9;
    --color-free: #14704b;
    --color-free-soft: #d3f1e0;
    --color-signup: #1f54b3;
    --color-signup-soft: #dfe9fc;
    --color-until: #a8430a;
    --color-until-soft: #ffe4d1;
    --color-libre: #5e3b9e;
    --color-libre-soft: #ebe1fa;
    --color-paid: #544b5c;
    --color-paid-soft: #eae4ec;
    --color-error: #b3261e;
    --color-ok: #14704b;
    --shadow-card: 0 1px 2px rgba(120, 50, 80, 0.05), 0 6px 18px rgba(120, 50, 80, 0.06);
    --shadow-card-hover: 0 2px 4px rgba(120, 50, 80, 0.06), 0 14px 30px rgba(120, 50, 80, 0.13);
    --radius: 20px;
    --radius-small: 14px;
}

:root[data-theme="dark"] {
    --color-text: #f3ecf1;
    --color-background: #211a22;
    --color-accent: #ff7aa8;
    --color-accent-hover: #ff9bbd;
    --color-accent-text: #211a22;
    --color-accent-soft: #3f2a38;
    --color-sun-soft: #3d3420;
    --color-muted: #b9aeb8;
    --color-card: #2d2430;
    --color-border: #44384a;
    --color-error: #f2b8b5;
    --shadow-card: none;
    --shadow-card-hover: none;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: "Nunito", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 17px;
    color: var(--color-text);
    background: var(--color-background);
    line-height: 1.55;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--color-accent); }

::selection { background: var(--color-sun); color: #2a2430; }

:focus-visible {
    outline: 3px solid var(--color-sun);
    outline-offset: 2px;
}

h1 {
    margin: 0 0 10px;
    font-size: 1.85em;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.015em;
}

h2 { line-height: 1.25; }

/* ---------- Header, footer, page frame ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 10px 16px 13px;
    background: var(--color-accent);
    box-shadow: 0 3px 14px rgba(120, 50, 80, 0.22);
}

/* The seam under the header */
.site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 4px;
    border-bottom: 2px dashed var(--color-sun);
    opacity: 0.85;
    pointer-events: none;
}

.site-header-name {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 1.3em;
    font-weight: 900;
    letter-spacing: -0.015em;
    color: var(--color-accent-text);
    text-decoration: none;
}

.site-logo-mark {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    box-shadow: 0 2px 6px rgba(80, 20, 50, 0.3);
    transform: rotate(-6deg);
    transition: transform 0.25s ease;
}

.site-header-name:hover .site-logo-mark { transform: rotate(6deg) scale(1.08); }

.site-wordmark { font-size: 1.1em; }

.site-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.site-nav a {
    padding: 7px 12px;
    border-radius: 999px;
    color: var(--color-accent-text);
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s ease;
}

.site-nav a:hover { background: rgba(255, 246, 236, 0.2); }

.site-nav .nav-button {
    margin-left: 6px;
    padding: 7px 15px;
    background: var(--color-sun);
    color: #2a2430;
    box-shadow: 0 2px 6px rgba(80, 20, 50, 0.22);
}

.site-nav .nav-button:hover { background: #ffd966; }

.site-main {
    flex: 1;
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 24px 16px 44px;
}

/* Text pages and forms are narrower. Text pages sit on a card, so they read like a page and not like raw text. */
.section-info,
.section-submit,
.page-report,
.page-edit { max-width: 760px; }

.section-info {
    flex: 0 1 auto;
    width: calc(100% - 24px);
    margin-top: 20px;
    margin-bottom: 36px;
    padding: 22px 20px 26px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.section-info > h1,
.section-submit > h1,
.page-report > h1 { margin-bottom: 18px; }

/* A form inside a text page: the page is already the card. */
.section-info .submit-form {
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
}

.section-info > h2 {
    margin: 28px 0 8px;
    font-size: 1.2em;
    font-weight: 800;
}

.section-info > ul { padding-left: 22px; }
.section-info > ul li { margin-bottom: 8px; }

.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 26px 16px 32px;
    background: var(--color-accent-soft);
    border-top: 2px dashed var(--color-accent);
    font-size: 0.9em;
    text-align: center;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text);
    font-size: 1.15em;
    font-weight: 900;
    text-decoration: none;
}

.footer-brand img { display: block; width: 28px; height: 28px; border-radius: 8px; }

.footer-tagline { margin: -6px 0 0; color: var(--color-muted); }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
}

.site-footer a { color: var(--color-text); font-weight: 700; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--color-accent); text-decoration: underline; }

.page-lead {
    margin: 0 0 18px;
    color: var(--color-muted);
}

.notice { color: var(--color-muted); }

.license-text summary { font-weight: 700; cursor: pointer; }
.license-text pre {
    margin: 10px 0 0;
    padding: 12px;
    border-radius: var(--radius-small);
    background: var(--color-background);
    font-size: 0.78em;
    white-space: pre-wrap;
}

/* ---------- Home title ---------- */

.home-title {
    margin: 0 0 16px;
    font-size: 1.6em;
}

/* ---------- Search, tags, "Nouveau" badge, share ---------- */

/* One pill: the field and its button live inside the same shape. */
.search-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 16px;
    padding: 5px;
    border: 2px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease;
}

.search-form:focus-within { border-color: var(--color-accent); }

.search-form input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: 8px 14px;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font: inherit;
    outline: none;
}

.search-form input[type="search"]::placeholder { color: var(--color-muted); opacity: 0.85; }

.search-form .button-primary {
    flex: 0 0 auto;
    gap: 7px;
    min-height: 42px;
    padding: 8px 14px;
}

.search-icon { display: block; width: 19px; height: 19px; }

.search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

/* Tags stay quiet: the price badge is what must catch the eye. */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-muted);
    font-size: 0.84em;
    font-weight: 700;
    text-decoration: none;
}

a.tag:hover { color: var(--color-accent); }

.tag-active {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: 0.9em;
}

a.tag-active:hover { background: var(--color-accent-hover); color: var(--color-accent-text); }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin: 0 0 8px;
}

.tags-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 46px;
    padding: 6px 8px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-background);
    cursor: text;
}

.tags-input .tag {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--color-sun-soft);
    color: #5c3d00;
}

.submit-form .tags-input input[type="text"] {
    flex: 1;
    min-width: 110px;
    width: auto;
    padding: 4px;
    border: 0;
    background: transparent;
}

.submit-form .tags-input input[type="text"]:focus { outline: none; }

.tags-input .tag button {
    padding: 0 2px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.new-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--color-sun);
    color: #2a2430;
    font-size: 0.78em;
    font-weight: 800;
    line-height: 1.5;
}

/* In the rows, a discreet link; on the pattern page, a full button. */
.share-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-accent);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.share-button:hover { text-decoration: underline; }

.share-button-big {
    min-height: 46px;
    margin: 0;
    padding: 8px 18px;
    border: 2px solid var(--color-border);
    border-radius: 999px;
    font-size: 1em;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.share-button-big:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
    text-decoration: none;
}

/* ---------- Toolbar: ranking tabs and filters on one row ---------- */

.browse-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    margin-bottom: 16px;
}

.browse-tabs {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: var(--color-accent-soft);
}

.browse-tabs a {
    padding: 7px 18px;
    border-radius: 999px;
    color: var(--color-text);
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s ease;
}

.browse-tabs a.is-active {
    background: var(--color-accent);
    color: var(--color-accent-text);
    box-shadow: 0 2px 6px rgba(160, 40, 90, 0.28);
}

.browse-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.browse-filters select {
    max-width: 100%;
    padding: 9px 34px 9px 15px;
    border: 2px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d6336c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 13px center / 11px;
    color: var(--color-text);
    font: inherit;
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.browse-filters select:focus { outline: none; border-color: var(--color-accent); }

/* ---------- Category links: a small drawing and a name ---------- */

/* Only the fullest categories are shown, so that the patterns stay near the top of the screen.
   All the links stay in the HTML for search engines. The checkbox opens the rest, without JavaScript. */
.category-chips {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 18px;
}

.category-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.category-toggle:not(:checked) ~ a.category-chip:nth-of-type(n+4) { display: none; }

.category-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 13px 3px 3px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: 0.9em;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.category-chip img {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.category-chip:hover { border-color: var(--color-accent); color: var(--color-accent); }
.category-chip-crochet { background: var(--color-sun-soft); border-color: #f5dc9c; }

.category-more {
    min-height: 38px;
    padding: 3px 14px;
    border-style: dashed;
    background: transparent;
    color: var(--color-accent);
    cursor: pointer;
    user-select: none;
}

.category-more-open { display: none; }
.category-toggle:checked ~ .category-more .category-more-open { display: inline; }
.category-toggle:checked ~ .category-more .category-more-closed { display: none; }
.category-toggle:focus-visible ~ .category-more { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.category-intro {
    max-width: 680px;
    margin: 0 0 18px;
    color: var(--color-muted);
}

/* ---------- Pattern rows (one wide row per pattern) ---------- */

.pattern-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pattern-row {
    display: grid;
    grid-template-columns: auto 104px minmax(0, 1fr);
    gap: 12px 13px;
    align-items: start;
    padding: 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.pattern-row:hover {
    transform: translateY(-2px);
    border-color: #efc3cf;
    box-shadow: var(--shadow-card-hover);
}

.pattern-row-vote { grid-column: 1; grid-row: 1; }

.pattern-row-vote .vote-form { flex-direction: column; align-items: stretch; }

.pattern-row-vote .vote-group {
    flex-direction: column;
    border-radius: 22px;
}

.pattern-row-vote .vote-button { width: 38px; height: 38px; }

.pattern-row-media {
    grid-column: 2;
    grid-row: 1;
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius-small);
    background: var(--color-accent-soft);
}

.pattern-row-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.pattern-row:hover .pattern-row-image { transform: scale(1.05); }

.pattern-row-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 2em;
    color: var(--color-accent);
}

.pattern-row-body {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
}

.pattern-row-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.pattern-row-title {
    margin: 6px 0 4px;
    font-size: 1.08em;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.005em;
}

.pattern-row-title a {
    color: var(--color-text);
    text-decoration: none;
}

.pattern-row-title a:hover { color: var(--color-accent); }

.pattern-row-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 6px;
    font-size: 0.93em;
    line-height: 1.45;
}

.pattern-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 12px;
    margin: 0;
    font-size: 0.84em;
    color: var(--color-muted);
}

.pattern-row-button {
    grid-column: 2 / -1;
    grid-row: 2;
}

@media (min-width: 640px) {
    .pattern-row {
        grid-template-columns: auto 164px minmax(0, 1fr) auto;
        gap: 24px;
        align-items: center;
        padding: 18px 24px 18px 20px;
    }

    .pattern-row-title { margin: 8px 0 6px; font-size: 1.28em; }

    .pattern-row-description {
        margin-bottom: 8px;
        font-size: 0.97em;
    }

    .pattern-row-meta { font-size: 0.88em; }

    .pattern-row-vote .vote-button { width: 42px; height: 42px; }

    .pattern-row-body { grid-column: 3; }

    .pattern-row-button {
        grid-column: 4;
        grid-row: 1;
    }
}

/* ---------- Pager (the script replaces it with infinite scroll) ---------- */

.pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 24px;
    border: 2px solid var(--color-accent);
    border-radius: 999px;
    color: var(--color-accent);
    font-weight: 800;
    text-decoration: none;
    transition: background 0.15s ease;
}

.pager-link:hover { background: var(--color-accent-soft); }

/* ---------- Price badges: soft tints, each kind of price keeps its color ---------- */

.price-badge {
    display: inline-block;
    padding: 2px 11px;
    border-radius: 999px;
    background: var(--color-paid-soft);
    color: var(--color-paid);
    font-size: 0.8em;
    font-weight: 800;
    line-height: 1.5;
}

.price-free { background: var(--color-free-soft); color: var(--color-free); }
.price-free_with_signup { background: var(--color-signup-soft); color: var(--color-signup); }
.price-free_until { background: var(--color-until-soft); color: var(--color-until); }
.price-pay_what_you_want { background: var(--color-libre-soft); color: var(--color-libre); }

/* ---------- "Does it work?" feedback ---------- */

.works-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78em;
    font-weight: 800;
    line-height: 1.5;
}

.works-badge-good { background: #c7ecd4; color: #145c3d; }
.works-badge-mixed { background: var(--color-sun-soft); color: #6b4b00; }
.works-badge-bad { background: #d9d6dc; color: #4a4450; }

/* Grey veil over a pattern that visitors say does not work. Everything stays readable and clickable. */
.is-broken {
    filter: grayscale(1);
    opacity: 0.62;
}

.is-broken:hover { opacity: 0.9; }

.works-box {
    margin: 22px 0 0;
    padding: 16px 18px;
    border-radius: var(--radius-small);
    background: var(--color-background);
}

.works-box h2 {
    margin: 0 0 10px;
    font-size: 1em;
    font-weight: 800;
}

.works-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.works-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 16px;
    border: 2px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    color: var(--color-text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.works-yes:hover, .works-yes.is-voted { background: var(--color-free); border-color: var(--color-free); color: var(--color-accent-text); }
.works-no:hover, .works-no.is-voted { background: #6b6573; border-color: #6b6573; color: var(--color-accent-text); }

.works-count { font-weight: 600; opacity: 0.85; }

.works-reason {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85em;
    color: var(--color-muted);
}

.works-reason select {
    padding: 8px 10px;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-card);
    color: var(--color-text);
    font: inherit;
}

.works-box .works-badge { margin: 10px 0 0; }
.works-box .notice { margin: 10px 0 0; font-size: 0.85em; }

/* ---------- Votes ---------- */

.vote-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.vote-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    border-radius: 999px;
    background: var(--color-background);
}

.vote-count-number {
    min-width: 2ch;
    font-weight: 900;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.vote-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--color-muted);
    font: inherit;
    font-size: 0.95em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.vote-up:hover { color: var(--color-free); background: var(--color-free-soft); }
.vote-down:hover { color: var(--color-error); background: var(--color-accent-soft); }

.vote-up.is-voted { background: var(--color-free); color: var(--color-accent-text); }
.vote-down.is-voted { background: var(--color-error); color: var(--color-card); }

.vote-button:disabled { opacity: 0.6; cursor: wait; }

.vote-message {
    flex-basis: 100%;
    font-size: 0.85em;
    color: var(--color-error);
}

.vote-message:empty { display: none; }

/* ---------- Pattern page ---------- */

.back-link {
    margin: 0 0 14px;
    color: var(--color-muted);
    font-size: 0.92em;
}

.back-link a {
    color: var(--color-muted);
    font-weight: 700;
    text-decoration: none;
}

.back-link a:hover { color: var(--color-accent); text-decoration: underline; }

.pattern-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 14px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.pattern-detail-info { padding: 0 6px 6px; }

.pattern-detail h1 { margin-top: 10px; font-size: 1.75em; }

@media (min-width: 720px) {
    .pattern-detail {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 32px;
        align-items: start;
        padding: 22px;
    }

    .pattern-detail-info { padding: 8px 8px 8px 0; }

    .pattern-detail h1 { font-size: 2em; }
}

.pattern-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-small);
}

.pattern-detail-info .price-badge,
.pattern-detail-info .new-badge { font-size: 0.88em; }

.pattern-meta {
    margin: 0 0 14px;
    color: var(--color-muted);
    font-size: 0.92em;
}

.pattern-description { margin: 0 0 14px; }

.pattern-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.pattern-actions > .button-primary { flex: 1 1 100%; min-height: 52px; font-size: 1.08em; }

@media (min-width: 720px) {
    .pattern-actions > .button-primary { flex: 0 1 auto; padding-left: 28px; padding-right: 28px; }
}

.pattern-source {
    margin: 14px 0 0;
    font-size: 0.85em;
    color: var(--color-muted);
}

.pattern-source a { color: var(--color-muted); }
.pattern-source a:hover { color: var(--color-accent); }

.button-primary,
.submit-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border: 0;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font: inherit;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(160, 40, 90, 0.24);
    transition: background 0.15s ease, transform 0.15s ease;
}

.button-primary:hover,
.submit-form button:hover { background: var(--color-accent-hover); }

.button-primary:active,
.submit-form button:active { transform: translateY(1px); }

/* Second-level button: repeated on every row, so it must not shout. */
.button-soft {
    background: var(--color-accent-soft);
    color: #a81f50;
    box-shadow: none;
}

.button-soft:hover { background: var(--color-accent); color: var(--color-accent-text); }

/* ---------- Publication and report forms ---------- */

.submit-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.submit-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.95em;
    font-weight: 800;
}

.submit-form input[type="text"],
.submit-form input[type="url"],
.submit-form input[type="email"],
.submit-form input[type="date"],
.submit-form input[type="password"],
.submit-form input[type="file"],
.submit-form select,
.submit-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-background);
    color: var(--color-text);
    font: inherit;
    font-weight: 500;
    transition: border-color 0.15s ease;
}

.submit-form select,
.works-reason select {
    padding-right: 36px;
    background: var(--color-background) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23d6336c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 11px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.works-reason select { background-color: var(--color-card); }

.submit-form input[type="file"] { padding: 8px 10px; cursor: pointer; }

.submit-form input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 7px 15px;
    border: 0;
    border-radius: 999px;
    background: var(--color-accent-soft);
    color: #a81f50;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

/* Shown by the script only for the matching price type (always visible without JavaScript). */
.submit-form label[hidden] { display: none; }

.submit-form input:focus,
.submit-form select:focus,
.submit-form textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.submit-form .rights-check {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-small);
    background: var(--color-background);
    font-weight: 500;
}

.submit-form .rights-check input { margin-top: 4px; accent-color: var(--color-accent); }

.submit-form button { align-self: stretch; min-height: 50px; font-size: 1.05em; }

.notice-error,
.notice-ok {
    padding: 11px 14px;
    border-left: 4px solid var(--color-error);
    border-radius: 10px;
    background: var(--color-card);
    color: var(--color-error);
}

.notice-ok {
    border-left-color: var(--color-ok);
    color: var(--color-ok);
}

/* Honeypot: invisible to visitors, still present for bots. */
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---------- Comments ---------- */

.comments {
    margin-top: 34px;
    padding-top: 26px;
    border-top: 2px dashed var(--color-border);
}

.comments h2 { margin: 0 0 14px; font-size: 1.25rem; }

.comment-list, .comment-replies { margin: 0; padding: 0; list-style: none; }
.comment-list > li { margin-bottom: 12px; }

.comment-replies {
    margin: 8px 0 0 14px;
    padding-left: 12px;
    border-left: 2px dashed var(--color-border);
}

.comment-replies > li { margin-bottom: 8px; }

.comment {
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-card);
    scroll-margin-top: 90px;
}

.comment:target { border-color: var(--color-accent); }

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    margin: 0 0 4px;
    font-size: 0.88em;
    color: var(--color-muted);
}

.comment-meta strong { color: var(--color-text); }

.comment-body { margin: 0; overflow-wrap: anywhere; }

.comment-removed { margin: 0; font-size: 0.9em; font-style: italic; color: var(--color-muted); }

.comment-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
    font-size: 0.85em;
}

.comment-actions a,
.comment-actions button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-muted);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.comment-actions a:hover,
.comment-actions button:hover { color: var(--color-accent); }

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
    padding: 16px;
    border-radius: var(--radius-small);
    background: var(--color-card);
    box-shadow: var(--shadow-card);
    scroll-margin-top: 90px;
}

.comment-form h3 { margin: 0; font-size: 1.05rem; }

.comment-form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-weight: 800;
}

.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-background);
    color: var(--color-text);
    font: inherit;
    font-weight: 500;
}

.comment-form input:focus,
.comment-form textarea:focus { outline: none; border-color: var(--color-accent); }

.comment-form .notice { margin: 0; }
.comment-form .button-primary { align-self: flex-start; }

.comment-reply-cancel { margin: 0; font-size: 0.88em; }

.comment-form-note { margin: 0; font-size: 0.82em; color: var(--color-muted); }

.comments-link { color: var(--color-muted); font-weight: 700; text-decoration: none; }
.comments-link:hover { color: var(--color-accent); }

/* ---------- Accounts ---------- */

.site-nav .nav-account {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: 2px;
    padding: 0;
    border-radius: 50%;
}

.nav-account svg { width: 22px; height: 22px; }

.nav-badge {
    position: absolute;
    top: -3px;
    right: -4px;
    min-width: 17px;
    padding: 1px 4px;
    border-radius: 999px;
    background: var(--color-sun);
    color: #2a2430;
    font-size: 11px;
    font-weight: 800;
    line-height: 15px;
    text-align: center;
}

.nav-badge-inline {
    display: inline-block;
    min-width: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: 0.8em;
    text-align: center;
}

.auth-box { max-width: 460px; margin: 0 auto; }
.auth-box .submit-form { margin-top: 14px; }

.auth-links { margin: 16px 0; font-size: 0.95em; }
.auth-note { margin: 0; font-size: 0.86em; font-weight: 500; color: var(--color-muted); }

.account-menu {
    display: flex;
    gap: 6px;
    margin: 0 -16px 18px;
    padding: 2px 16px 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.account-menu::-webkit-scrollbar { display: none; }

.account-menu a {
    flex: 0 0 auto;
    padding: 7px 14px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: 0.92em;
    font-weight: 700;
    text-decoration: none;
}

.account-menu a.is-active {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-accent-text);
}

.account-list { margin: 0 0 22px; padding: 0; list-style: none; }

.account-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 14px;
    margin-bottom: 8px;
    padding: 11px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-card);
}

.account-item > div:first-child { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.account-item.is-unread { border-left: 4px solid var(--color-accent); }

.account-meta { margin: 3px 0 0; font-size: 0.86em; color: var(--color-muted); }

.account-tag {
    display: inline-block;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--color-sun-soft);
    font-size: 0.8em;
    font-weight: 700;
}

.account-actions { display: flex; align-items: center; gap: 12px; font-size: 0.88em; }

.account-actions a,
.account-actions button,
.button-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-accent);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

.account-panel {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: var(--radius-small);
    background: var(--color-card);
    box-shadow: var(--shadow-card);
}

.account-panel h2 { margin: 0 0 8px; font-size: 1.1rem; }
.account-panel .submit-form { margin-bottom: 8px; padding: 0; border: 0; background: none; box-shadow: none; }
.account-danger { border: 1px solid var(--color-error); }

.account-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }

.favorite-form { display: inline; margin: 0; }

.favorite-button {
    display: inline-block;
    padding: 0 2px;
    border: 0;
    background: none;
    color: var(--color-accent);
    font: inherit;
    font-size: 1.25em;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.favorite-button:hover { transform: scale(1.15); }

.pattern-actions .favorite-button { font-size: 1.8em; }

.author-link { color: inherit; font-weight: 700; }
.author-link:hover { color: var(--color-accent); }

.category-follow { margin: 0 0 16px; }
.category-follow .button-primary { min-height: 40px; padding: 8px 16px; font-size: 0.92em; }

@media (max-width: 400px) {
    .site-nav .nav-account { width: 32px; height: 32px; }
}

/* ---------- Cookie window: both answers weigh the same ---------- */

.consent-box {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 18px;
    max-width: 760px;
    margin: 0 auto;
    padding: 14px 16px;
    border: 2px dashed var(--color-accent);
    border-radius: var(--radius-small);
    background: var(--color-card);
    box-shadow: 0 6px 24px rgba(120, 50, 80, 0.22);
}

.consent-box[hidden] { display: none; }

.consent-box p { flex: 1 1 280px; margin: 0; font-size: 0.92em; }

.consent-buttons { display: flex; flex: 1 1 200px; gap: 8px; max-width: 280px; }

.consent-buttons button {
    flex: 1;
    min-height: 44px;
    border: 2px solid var(--color-accent);
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.footer-consent {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.footer-consent:hover { color: var(--color-accent); text-decoration: underline; }

/* ---------- Guides ---------- */

.guide { max-width: 720px; }
.guide h1 { margin-top: 0; }
.guide h2 { margin: 26px 0 8px; font-size: 1.25rem; }
.guide h3 { margin: 18px 0 4px; font-size: 1.02rem; }
.guide li { margin-bottom: 5px; }
.guide-lead { font-size: 1.1em; font-weight: 600; }
.guide-selection { margin-top: 30px; }
.guide-selection h2 { margin: 0 0 14px; font-size: 1.25rem; }
.guide-faq { margin-top: 30px; }
.guide-more { margin-top: 28px; padding-top: 20px; border-top: 2px dashed var(--color-border); }
.guide-more h2 { margin: 0 0 8px; font-size: 1.1rem; }
.guide-hint { margin: 0 0 12px; font-size: 0.94em; }

.guide-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.guide-list a {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-card);
    color: var(--color-text);
    text-decoration: none;
}

.guide-list a:hover { border-color: var(--color-accent); }
.guide-list strong { display: block; margin-bottom: 3px; }
.guide-list span { font-size: 0.9em; color: var(--color-muted); }

@media (min-width: 720px) {
    .guide-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Pattern page without image, patterns of the same category ---------- */

.pattern-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: var(--radius-small);
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-size: 4rem;
}

.similar-patterns {
    margin-top: 34px;
    padding-top: 26px;
    border-top: 2px dashed var(--color-border);
}

.similar-patterns h2 {
    margin: 0 0 14px;
    font-size: 1.25rem;
    font-weight: 800;
}

.similar-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.similar-card {
    display: flex;
    flex-direction: column;
    gap: 7px;
    height: 100%;
    padding: 10px 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    box-shadow: var(--shadow-card);
    color: var(--color-text);
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.similar-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

.similar-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: var(--radius-small);
    object-fit: cover;
}

.similar-card .pattern-row-placeholder { aspect-ratio: 1; }

.similar-title { font-weight: 800; line-height: 1.25; }

.similar-card .price-badge { align-self: flex-start; font-size: 0.74em; }

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
    .search-form .button-primary { padding: 8px 20px; }

    .search-label {
        position: static;
        width: auto;
        height: auto;
        clip-path: none;
    }
}

@media (min-width: 720px) {
    .site-header { padding: 12px 24px 15px; }

    .site-main { padding-top: 32px; }

    .home-title { font-size: 1.85em; }

    .section-info { width: 100%; padding: 34px 40px 38px; }

    .category-chips { margin-bottom: 20px; }

    .category-toggle:not(:checked) ~ a.category-chip:nth-of-type(-n+4) { display: inline-flex; }

    .similar-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

    .submit-form { padding: 28px; }
}

/* Very small phones: the header stays on one line. */
@media (max-width: 400px) {
    .site-wordmark { font-size: 0.95em; }
    .site-nav a { padding: 7px 8px; font-size: 0.92em; }
    .site-nav .nav-button { margin-left: 2px; padding: 7px 11px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .pattern-row:hover,
    .similar-card:hover { transform: none; }
    .pattern-row:hover .pattern-row-image { transform: none; }
}
