/* market.css — Try Swiss Knife Market. Swiss red and black, plus one more colour: weathered
   trail yellow, used only on the signpost. Type: Barlow Condensed for headings, labels and
   signpost plates (it was drawn from road-sign lettering), Barlow for text. */

:root {
    --color-primary: #121212;      /* ink black: headings, plates, selected states */
    --color-accent: #d71920;       /* Swiss red (TSK's red, deepened for white-text contrast) */
    --color-accent-hover: #b3141a;
    --color-accent-soft: #fcebea;
    --color-text-dark: #161616;
    --color-text-medium: #474747;
    --color-text-light: #6b6b6b;
    --color-background: #f3f3f2;
    --color-white: #ffffff;
    --color-border: #e2e2e0;
    --font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Barlow Condensed', 'Arial Narrow', 'Barlow', sans-serif;
    --trail: #e4b322;          /* weathered Swiss hiking-sign yellow, under trail-plate.jpg */
    --trail-ink: #121212;
    --post: #9aa3ad;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --max: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-family);
    color: var(--color-text-dark);
    background: var(--color-background);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent-hover); }
a:focus-visible, .mk-btn:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }


/* ── Header ─────────────────────────────────────────────────────────────── */
.mk-header {
    position: sticky; top: 0; z-index: 1000;
    background: var(--color-white); border-bottom: 1px solid var(--color-border);
}
.mk-header-inner {
    max-width: var(--max); margin: 0 auto; padding: 0 1.5rem;
    min-height: 56px; display: flex; align-items: center; gap: 1.5rem;
}
.mk-brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; flex-shrink: 0; }
.mk-logo { height: 36px; width: auto; display: block; }
.mk-brand-word { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; letter-spacing: 0.01em; color: var(--color-primary); }
.mk-nav { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; }
.mk-nav::-webkit-scrollbar { display: none; }
.mk-nav a {
    white-space: nowrap; text-decoration: none; color: var(--color-text-medium);
    font-size: 0.92rem; font-weight: 500; padding: 0.45rem 0.7rem; border-radius: var(--radius-md);
    min-height: 44px; display: inline-flex; align-items: center; gap: 0.35rem;
}
.mk-nav a:hover { background: var(--color-background); color: var(--color-primary); }
.mk-nav a[aria-current="page"] { background: var(--color-accent-soft); color: var(--color-primary); }

/* Right of the header: account icon, then the language selector. The selector is a
   <details>, so it opens without script; market.js only closes it on an outside click. */
.mk-header-tools { margin-left: auto; display: flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }
.mk-icon-btn, .mk-lang > summary {
    min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem;
    border: 0; background: none; border-radius: var(--radius-md); color: var(--color-text-medium); cursor: pointer;
    font: 600 0.9rem var(--font-family);
}
.mk-icon-btn svg { width: 26px; height: 26px; }
.mk-lang > summary { padding: 0 0.55rem; list-style: none; }
.mk-lang > summary::-webkit-details-marker { display: none; }
.mk-icon-btn:hover, .mk-lang > summary:hover, .mk-lang[open] > summary { background: var(--color-background); color: var(--color-primary); }
.mk-lang { position: relative; }
.mk-lang-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1100; min-width: 190px; list-style: none; padding: 0.35rem;
    background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.mk-lang-menu a, .mk-lang-off {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 44px; padding: 0 0.75rem;
    border-radius: var(--radius-md); text-decoration: none; color: var(--color-text-dark); font-size: 0.95rem;
}
.mk-lang-menu a:hover { background: var(--color-background); }
.mk-lang-menu a[aria-current] { font-weight: 600; box-shadow: inset 3px 0 0 var(--color-accent); }
.mk-lang-off { color: var(--color-text-light); cursor: default; }
.mk-lang-off small {
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--color-background);
}

/* Account (auth.js). Signed in, the glyph turns red; its aria-label and title carry the email,
   so colour is never the only cue. The menu shares the language menu's look. */
.mk-account { position: relative; }
.mk-account-btn.is-signed-in { color: var(--color-accent); }
.mk-account-btn.is-signed-in:hover { color: var(--color-accent-hover); }
.mk-account-menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 1100; min-width: 240px; max-width: calc(100vw - 32px); padding: 0.35rem;
    background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
}
.mk-account-menu[hidden] { display: none; }
.mk-account-who {
    padding: 0.55rem 0.75rem 0.6rem; margin-bottom: 0.25rem; border-bottom: 1px solid var(--color-border);
    font-size: 0.85rem; color: var(--color-text-light); overflow-wrap: anywhere;
}
.mk-account-who strong { display: block; font-size: 0.95rem; font-weight: 600; color: var(--color-text-dark); }
.mk-account-menu a, .mk-account-menu button {
    display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 0.75rem; border: 0; background: none;
    border-radius: var(--radius-md); text-decoration: none; color: var(--color-text-dark); font: 0.95rem var(--font-family); text-align: left; cursor: pointer;
}
.mk-account-menu a[hidden] { display: none; }
.mk-account-menu a:hover, .mk-account-menu button:hover { background: var(--color-background); }
.mk-account-signout { color: var(--color-accent) !important; }

/* Dialogs: sign-in (auth.js) and the owner's Edit chalet / Edit plan (manage.js). */
.mk-dialog {
    width: min(26rem, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 0; margin: auto; border: 0; border-radius: var(--radius-lg);
    background: var(--color-white); color: var(--color-text-dark); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.mk-edit { width: min(36rem, calc(100vw - 32px)); }
.mk-dialog::backdrop { background: rgba(18, 18, 18, 0.55); }
.mk-dialog-form { position: relative; display: flex; flex-direction: column; gap: 0.9rem; padding: 1.75rem 1.5rem 1.5rem; border-top: 5px solid var(--color-accent); border-radius: var(--radius-lg); }
.mk-dialog h2 { font: 700 1.9rem/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; color: var(--color-primary); padding-right: 2.5rem; }
.mk-dialog-lead { font-size: 0.95rem; color: var(--color-text-medium); }
.mk-dialog label, .mk-plan-edit label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; font-weight: 600; color: var(--color-text-medium); }
.mk-dialog input, .mk-dialog textarea, .mk-dialog select, .mk-plan-edit input, .mk-plan-edit textarea {
    min-height: 48px; padding: 0 0.9rem; font: 1rem var(--font-family); color: var(--color-text-dark);
    background: var(--color-white); border: 1.5px solid var(--color-border); border-radius: var(--radius-md);
}
.mk-dialog textarea, .mk-plan-edit textarea { padding: 0.7rem 0.9rem; line-height: 1.5; resize: vertical; }
.mk-dialog input:focus-visible, .mk-dialog textarea:focus-visible, .mk-dialog select:focus-visible,
.mk-plan-edit input:focus-visible, .mk-plan-edit textarea:focus-visible { outline-offset: -2px; }
.mk-dialog [aria-invalid="true"], .mk-plan-edit [aria-invalid="true"] { border-color: var(--color-accent); }
.mk-field-hint { font-size: 0.85rem; font-weight: 400; color: var(--color-text-light); }
.mk-count { align-self: flex-end; margin-top: -0.15rem; font-size: 0.8rem; font-weight: 500; color: var(--color-text-light); font-variant-numeric: tabular-nums; }
.mk-count.is-out { color: var(--color-accent-hover); }
.mk-field-error { font-size: 0.88rem; font-weight: 500; color: var(--color-accent-hover); }
.mk-field-error[hidden] { display: none; }
.mk-edit-more { margin-top: 0.25rem; }
.mk-edit-more > * + * { margin-top: 0.75rem; }
.mk-edit-more > summary {
    cursor: pointer; list-style: none; display: grid; grid-template-columns: 1fr auto; column-gap: 0.75rem; align-items: center;
    min-height: 44px; padding: 0.4rem 0.75rem; border: 1.5px dashed var(--color-border); border-radius: var(--radius-md);
}
.mk-edit-more > summary::-webkit-details-marker { display: none; }
.mk-edit-more > summary:hover { border-color: var(--color-text-light); background: var(--color-background); }
/* A chevron that turns down when the section is open. */
.mk-edit-more > summary::after {
    content: ''; grid-column: 2; grid-row: 1 / span 2; width: 9px; height: 9px; margin-right: 0.2rem;
    border-right: 2px solid var(--color-text-medium); border-bottom: 2px solid var(--color-text-medium); transform: rotate(-45deg); transition: transform 0.15s;
}
.mk-edit-more[open] > summary::after { transform: rotate(45deg); }
.mk-summary-title { font-weight: 600; color: var(--color-primary); }
.mk-summary-hint { grid-column: 1; font-size: 0.85rem; font-weight: 400; color: var(--color-text-light); }
.mk-edit-more[open] > summary .mk-summary-hint { display: none; }
.mk-prefixed { display: flex; align-items: stretch; border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-white); overflow: hidden; }
.mk-prefixed > span { display: flex; align-items: center; padding: 0 0.2rem 0 0.75rem; font-weight: 400; color: var(--color-text-light); white-space: nowrap; background: var(--color-background); border-right: 1px solid var(--color-border); padding-right: 0.6rem; }
.mk-dialog .mk-prefixed input { flex: 1; min-width: 0; border: 0; border-radius: 0; }
.mk-prefixed:has([aria-invalid="true"]) { border-color: var(--color-accent); }
.mk-cats { border: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.mk-cats legend { width: 100%; margin-bottom: 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--color-text-medium); }
/* Categories as a dropdown of ticks: one line when closed (what is ticked, n/3), a short
   scrolling list when open, in the dialog's flow so it is never clipped. */
.mk-cats-drop > summary {
    list-style: none; display: flex; align-items: center; gap: 0.6rem; min-height: 46px; padding: 0 0.85rem; cursor: pointer;
    border: 1.5px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-white);
}
.mk-cats-drop > summary::-webkit-details-marker { display: none; }
.mk-cats-drop > summary::after {
    content: ''; flex: none; width: 8px; height: 8px; margin: -3px 2px 0 0;
    border-right: 2px solid var(--color-text-medium); border-bottom: 2px solid var(--color-text-medium); transform: rotate(45deg); transition: transform 0.15s;
}
.mk-cats-drop[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.mk-cats-drop[open] > summary { border-color: var(--color-text-medium); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.mk-cats-chosen { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--color-text-dark); }
.mk-cats-chosen.is-none { font-weight: 400; color: var(--color-text-light); }
.mk-cats-n { flex: none; font-size: 0.8rem; color: var(--color-text-light); font-variant-numeric: tabular-nums; }
.mk-cats-list {
    display: flex; flex-direction: column; max-height: 232px; overflow-y: auto; padding: 0.3rem;
    border: 1.5px solid var(--color-text-medium); border-top: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); background: var(--color-white);
}
.mk-dialog .mk-check, .mk-plan-edit .mk-check {
    flex-direction: row; align-items: center; gap: 0.6rem; min-height: 42px; padding: 0 0.6rem; cursor: pointer;
    border-radius: 8px; font-weight: 500; color: var(--color-text-dark);
}
.mk-dialog .mk-check:hover, .mk-plan-edit .mk-check:hover { background: var(--color-background); }
.mk-dialog .mk-check input, .mk-plan-edit .mk-check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--color-accent); }
.mk-dialog .mk-check:has(input:checked), .mk-plan-edit .mk-check:has(input:checked) { background: var(--color-accent-soft); }
.mk-dialog .mk-check:has(input:disabled), .mk-plan-edit .mk-check:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.mk-cats[aria-invalid="true"] .mk-cats-drop > summary { border-color: var(--color-accent); }
.mk-dialog-note { font-size: 0.88rem; color: var(--color-text-light); overflow-wrap: anywhere; }
.mk-dialog-error { padding: 0.6rem 0.75rem; border-radius: var(--radius-md); background: var(--color-accent-soft); color: var(--color-accent-hover); font-size: 0.92rem; }
.mk-dialog-error[hidden] { display: none; }
.mk-dialog-actions { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }
.mk-dialog-submit {
    min-height: 48px; padding: 0 1.4rem; border: 0; border-radius: var(--radius-md); cursor: pointer; background: var(--color-primary); color: var(--color-white);
    font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; letter-spacing: 0.05em; text-transform: uppercase;
}
.mk-dialog-submit:hover { background: var(--color-accent); }
.mk-dialog-submit:disabled { opacity: 0.7; cursor: progress; }
.mk-dialog-cancel {
    min-height: 48px; padding: 0 1.2rem; border: 1.5px solid var(--color-border); border-radius: var(--radius-md); cursor: pointer;
    background: var(--color-white); color: var(--color-text-dark); font: 600 1rem var(--font-family);
}
.mk-dialog-cancel:hover { background: var(--color-background); }
.mk-dialog-close {
    position: absolute; top: 0.6rem; right: 0.6rem; width: 44px; height: 44px; border: 0; border-radius: var(--radius-md);
    background: none; color: var(--color-text-light); font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.mk-dialog-close:hover { background: var(--color-background); color: var(--color-primary); }

/* The owner's Edit button (manage.js shows it on your own chalet and plans only): a quiet text
   link inside an existing line. The negative margin keeps a 44px tap area without making the
   line taller. Its aria-label names what it edits ("Edit chalet", "Edit plan"). */
.mk-edit-btn {
    display: inline-flex; align-items: center; gap: 0.3rem; min-height: 44px; margin: -12px 0 -12px 0.25rem; padding: 0 0.4rem;
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--color-accent);
    font: 600 0.88rem var(--font-family); cursor: pointer; vertical-align: middle; text-decoration: none;
}
.mk-edit-btn:hover { background: var(--color-accent-soft); color: var(--color-accent-hover); }
/* On a chalet: Share (everyone) and Edit (the owner) in the profile card's top-right corner.
   Only the name, which sits level with them, keeps its distance; the bio below runs full width. */
.mk-house-actions { position: absolute; top: 0.6rem; right: 0.6rem; display: flex; align-items: center; gap: 0.15rem; }
.mk-house-actions .mk-edit-btn { margin: 0; }
.mk-house-name { padding-right: 3rem; }
.mk-house-face:has(.mk-house-actions .mk-edit-btn:not([hidden])) .mk-house-name { padding-right: 8rem; }
.mk-share-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-md);
    background: none; color: var(--color-text-medium); cursor: pointer;
}
.mk-share-btn svg { width: 22px; height: 22px; }
.mk-share-btn:hover { background: var(--color-background); color: var(--color-primary); }
/* "Link copied": a small label under the corner buttons, for two seconds. */
.mk-share-done {
    position: absolute; top: calc(100% + 4px); right: 0; padding: 0.3rem 0.6rem; border-radius: var(--radius-sm);
    background: var(--color-primary); color: var(--color-white); font-size: 0.82rem; font-weight: 600; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.mk-share-done.is-shown { opacity: 1; }
/* On an item: Share in the category · date line, before the owner's Edit. The negative margin
   keeps its 44px tap area without making the line taller; "Link copied" opens below it. */
.mk-share-inline { position: relative; display: inline-flex; margin: -12px 0; }
.mk-share-inline .mk-share-done { right: auto; left: 0; }
.mk-edit-btn[hidden] { display: none; }
.mk-auth-links { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; color: var(--color-text-medium); }
.mk-auth-links a { color: var(--color-accent); font-weight: 500; }

/* ── Main ───────────────────────────────────────────────────────────────── */
.mk-main { max-width: var(--max); margin: 0 auto; padding: 2rem 1.5rem 3rem; }

.mk-hero { padding: 1.5rem 0 1rem; }
.mk-hero h1 { font-family: var(--font-display); font-size: 2.2rem; font-weight: 700; line-height: 1.1; color: var(--color-primary); margin-bottom: 0.5rem; }
.mk-hero p { font-size: 1.1rem; color: var(--color-text-medium); max-width: 46rem; }
.mk-hero p + p { margin-top: 1rem; }

.mk-section { margin-top: 2.25rem; }
.mk-section h2 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; color: var(--color-primary); margin-bottom: 1rem; }

.mk-page-title { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.1; color: var(--color-primary); }

.mk-empty { color: var(--color-text-light); padding: 2rem 0; }

/* Breadcrumb */
.mk-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.85rem; color: var(--color-text-light); margin-bottom: 0.9rem; }
.mk-crumbs li + li::before { content: '›'; margin-right: 0.35rem; }
.mk-crumbs a { color: var(--color-text-medium); text-decoration: none; }
.mk-crumbs a:hover { text-decoration: underline; }

/* ── Home ───────────────────────────────────────────────────────────────
   Intro across the top; below it the signpost (left, sticky) and the feed. */
.mk-home {
    display: grid; grid-template-columns: 270px minmax(0, 1fr); column-gap: 2.75rem;
    grid-template-areas: "intro intro" "post feed";
}
.mk-home-intro { grid-area: intro; margin-bottom: 1.75rem; display: flex; align-items: flex-end; gap: 2rem; }
.mk-intro-text { flex: 1; min-width: 0; }
.mk-home-intro h1 {
    font-family: var(--font-display); font-weight: 700; font-size: 2.3rem; line-height: 1.05;
    color: var(--color-primary); max-width: 34rem;
}
.mk-home-intro p { margin-top: 0.4rem; font-size: 1.08rem; color: var(--color-text-medium); max-width: 44rem; }
.mk-home-feed { grid-area: feed; min-width: 0; }

/* Search box right of the page heading, so it adds no height above the cards on a laptop;
   under the heading on narrow screens. All plans on home, one tool's plans on a tool page. */
.mk-search { position: relative; display: flex; flex-wrap: wrap; flex: 0 0 22rem; }
.mk-search-icon { position: absolute; left: 0.85rem; top: 14px; width: 20px; height: 20px; color: var(--color-text-light); pointer-events: none; }
.mk-search input {
    flex: 1; min-width: 0; min-height: 48px; padding: 0 0.9rem 0 2.6rem;
    font: 1rem var(--font-family); color: var(--color-text-dark); background: var(--color-white);
    border: 1.5px solid var(--color-border); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.mk-search input:focus-visible { outline-offset: -2px; }
.mk-search button {
    min-height: 48px; padding: 0 1.25rem; border: 0; border-radius: 0 var(--radius-md) var(--radius-md) 0; cursor: pointer;
    background: var(--color-primary); color: var(--color-white);
    font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; letter-spacing: 0.05em; text-transform: uppercase;
}
.mk-search button:hover { background: var(--color-accent); }
.mk-search-note { width: 100%; margin-top: 0.5rem; font-size: 0.92rem; color: var(--color-text-medium); }
/* Home cards are slightly see-through, so the village behind the first row shows faintly.
   Further down they sit on plain grey and read as white. Tool hubs have no village. */
.mk-home-feed .mk-card-link { background: rgba(255, 255, 255, 0.55); -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); }
.mk-hub .mk-home-feed .mk-card-link { background: var(--color-white); -webkit-backdrop-filter: none; backdrop-filter: none; }
.mk-hub .mk-crumbs ol { margin-bottom: 0.5rem; }
.mk-feed-heading {
    font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--color-text-light); margin-bottom: 0.75rem;
}

/* Home scenery: the Alpine village illustration, anchored to the top right of the page
   behind everything, starting just below the header (56px + border) so the summit is never
   hidden under it. Its left and bottom edges fade out so it never shows a hard border
   against the page grey. */
body { position: relative; }
.mk-scenery {
    position: absolute; top: 57px; right: 0; z-index: 0; pointer-events: none;
    width: min(1150px, 72vw); aspect-ratio: 1376 / 768;
    background: url('/assets/market-scenery.webp') right top / cover no-repeat;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 30%), linear-gradient(to bottom, #000 62%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0, #000 30%), linear-gradient(to bottom, #000 62%, transparent 100%);
    mask-composite: intersect;
}
.mk-main, .mk-footer { position: relative; z-index: 1; }

/* ── The signpost ───────────────────────────────────────────────────────
   A grey post; a white "you are here" plate on top (Market · total plans);
   one yellow arrow plate per tool. The arrow shape is clipped on ::before so
   the link itself keeps a rectangular, visible focus outline. */
.mk-post { grid-area: post; position: sticky; top: 84px; align-self: start; padding-bottom: 3rem; }
.mk-post::before {
    content: ''; position: absolute; left: 24px; top: 6px; bottom: 0; width: 10px; border-radius: 2px;
    background: linear-gradient(90deg, #6f757b, #aab0b5 45%, #6f757b);
}
.mk-post-here {
    position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    margin-right: 22px; padding: 0.55rem 0.85rem; background: var(--color-white);
    border: 2px solid var(--trail-ink); border-radius: 3px;
    font-family: var(--font-display); color: var(--trail-ink);
}
.mk-post-here-name {        /* a long tool name wraps under itself, never under the emoji */
    display: flex; align-items: baseline; gap: 0.4rem; min-width: 0;
    font-weight: 700; font-size: 1.15rem; line-height: 1.15; text-transform: uppercase; letter-spacing: 0.04em;
}
.mk-post-here-n { flex-shrink: 0; white-space: nowrap; font-weight: 600; font-size: 0.95rem; }
.mk-post-arrows { list-style: none; display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.mk-arrow {
    position: relative; isolation: isolate; display: flex;
    align-items: center; gap: 0.55rem; min-height: 50px; padding: 0 34px 0 0.85rem;
    font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em;
    color: var(--trail-ink); text-decoration: none;
    filter: drop-shadow(0 1px 0 rgba(20, 23, 26, 0.28));
    transition: transform 0.15s ease;
}
.mk-arrow::before {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: var(--trail) url('/assets/trail-plate.jpg') center / cover;
    clip-path: polygon(0 0, calc(100% - 24px) 0, 100% 50%, calc(100% - 24px) 100%, 0 100%);
    transition: filter 0.15s ease;
}
/* Same texture, different stretch of it, so no two plates wear alike. */
.mk-post-arrows li:nth-child(4n+2) .mk-arrow::before { background-position: 30% 20%; }
.mk-post-arrows li:nth-child(4n+3) .mk-arrow::before { background-position: 75% 80%; background-size: 140% auto; }
.mk-post-arrows li:nth-child(4n+4) .mk-arrow::before { background-position: 10% 60%; background-size: 125% auto; }
.mk-arrow:hover { transform: translateX(4px); }
.mk-arrow:hover::before { filter: brightness(1.08) saturate(1.05); }
.mk-arrow:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }
.mk-arrow-icon { font-size: 1.15rem; }
.mk-arrow-name { flex: 1 1 auto; }   /* pushes the count to the right edge, icon or not */
/* "You are on this trail": the current arrow gets the white-red-white tip of a Swiss
   mountain-trail sign, painted across the tip of the plate in horizontal bands. */
.mk-arrow[aria-current="page"]::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 24px; z-index: -1;
    background: linear-gradient(180deg, #fff 0 34%, var(--color-accent) 34% 66%, #fff 66%);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.mk-arrow-n { font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0.7; }

/* Category chips */
.mk-chip {
    display: inline-flex; align-items: center; min-height: 36px; padding: 0.3rem 0.85rem;
    border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-white);
    color: var(--color-text-medium); font-size: 0.88rem; text-decoration: none;
}
.mk-chip:hover { border-color: var(--color-accent); color: var(--color-primary); }

/* Item cards */
.mk-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.mk-card-link {
    display: flex; flex-direction: column; gap: 0.35rem; height: 100%; padding: 1rem 1.15rem 0.8rem;
    background: var(--color-white); border: 1px solid var(--color-border); border-radius: 10px;
    text-decoration: none; color: inherit; transition: box-shadow 0.15s, border-color 0.15s;
}
.mk-card-link:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); }
.mk-card-link:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.mk-card-tool {
    font-family: var(--font-display); font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--color-text-light);
}
.mk-card-title { font-size: 1.12rem; font-weight: 600; line-height: 1.25; color: var(--color-primary); }
.mk-card-text { font-size: 0.92rem; color: var(--color-text-medium); flex-grow: 1; }
.mk-card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    margin-top: 0.45rem; padding-top: 0.65rem; border-top: 1px solid var(--color-border);
}
.mk-card-by { font-size: 0.85rem; color: var(--color-text-light); }

/* Likes · views · opens (dummy numbers until counting is built) */
.mk-stats { list-style: none; display: flex; gap: 0.75rem; font-size: 0.82rem; color: var(--color-text-medium); white-space: nowrap; }
.mk-stats li { display: inline-flex; align-items: center; gap: 0.25rem; }
.mk-stat-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.mk-stats-lg { font-size: 0.95rem; gap: 1.1rem; margin: -0.4rem 0 1.25rem; }
.mk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* ── Item page ──────────────────────────────────────────────────────────
   One job: get a cold visitor to press Open. The Open link is a Swiss knife,
   pinned to the bottom on phones. */
.mk-item { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 2rem; align-items: start; }
.mk-item-main {
    background: var(--color-white); border: 1px solid var(--color-border); border-radius: 10px;
    padding: 2rem 2.25rem 1.75rem;
}
.mk-item-tool {
    font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--color-text-light); margin-bottom: 0.35rem;
}
.mk-item-title {
    font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1.05;
    color: var(--color-primary); max-width: 40rem;
}
.mk-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1rem 0 1.1rem; font-size: 0.9rem; color: var(--color-text-light); }
/* Until owners can add photos: a small dashed note above the description, not a photo-sized
   frame (Sid, 8 Oct 2026). The photo itself (ADR-012) will bring its own block. */
.mk-item-photos-soon {
    display: inline-flex; align-items: center; gap: 0.45rem; margin: 0 0 1rem; padding: 0.3rem 0.75rem;
    border: 1px dashed var(--color-border); border-radius: 999px;
    font-size: 0.8rem; color: var(--color-text-light);
}
.mk-item-photos-soon svg { width: 15px; height: 15px; flex: none; }
.mk-item-desc { padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.mk-item-desc p { font-size: 1.1rem; line-height: 1.65; color: var(--color-text-dark); margin-bottom: 1rem; max-width: 40rem; }
/* Links in a description (D38). In a sentence: the host in red, the shortened path in grey, a
   small arrow that lifts on hover. */
.mk-link {
    color: var(--color-accent); text-decoration: none; overflow-wrap: anywhere;
    border-bottom: 1.5px solid rgba(215, 25, 32, 0.28); transition: border-color 0.15s, background 0.15s;
}
.mk-link:hover { border-bottom-color: var(--color-accent); background: var(--color-accent-soft); }
.mk-link-host { font-weight: 600; }
.mk-link .mk-link-path { color: var(--color-text-medium); }
.mk-link-arrow { display: inline-block; margin-left: 0.12em; font-size: 0.8em; transition: transform 0.15s; }
.mk-link:hover .mk-link-arrow, .mk-link-card:hover .mk-link-arrow { transform: translate(2px, -2px); }
/* A link on a line of its own: a quiet, content-width card — grey, no shadow, no lift — so
   the Open knife below stays the one thing on the page that asks to be pressed (Sid). */
.mk-item-desc .mk-link-para { margin-bottom: 0.5rem; }
.mk-item-desc .mk-link-para + p:not(.mk-link-para) { margin-top: 1rem; }
.mk-link-card {
    display: inline-flex; align-items: center; gap: 0.6rem; max-width: 100%; padding: 0.45rem 0.8rem 0.45rem 0.5rem;
    border: 1px solid var(--color-border); border-radius: 10px;
    color: var(--color-text-medium); text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.mk-link-card:hover { background: var(--color-background); border-color: #cfcfcc; }
.mk-link-icon {
    flex: none; display: grid; place-items: center; width: 1.9rem; height: 1.9rem;
    border-radius: 8px; background: var(--color-background); font-size: 0.9rem;
}
.mk-link-body { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.mk-link-card .mk-link-host { font-size: 0.92rem; font-weight: 600; color: var(--color-text-dark); overflow-wrap: anywhere; }
.mk-link-card .mk-link-path { font-size: 0.8rem; color: var(--color-text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-link-card .mk-link-arrow { flex: none; margin: 0 0 0 0.2rem; color: var(--color-text-light); font-size: 0.9rem; }

.mk-open-lang { margin: 0.75rem 0 0; font-size: 0.9rem; color: var(--color-text-medium); }
.mk-open { margin-top: 1.75rem; }
/* The Open link is a Swiss knife: a red handle (::before) with two rivets, and a steel blade
   (::after) folded behind it that swings out from the right rivet on hover — opening a plan
   in a tool is flipping out one of TSK's blades. Both layers sit behind the label. */
.mk-open-knife {
    position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 0.6rem;
    min-height: 58px; padding: 0 2.6rem 0 2.4rem; border-radius: 30px;
    font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; letter-spacing: 0.01em;
    color: #fff; text-decoration: none; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.mk-open-knife::before {
    content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
    background:
        radial-gradient(circle at 20px 50%, #f1f3f5 0 3.5px, #8d959c 4px 5px, transparent 5.5px),
        radial-gradient(circle at calc(100% - 20px) 50%, #f1f3f5 0 3.5px, #8d959c 4px 5px, transparent 5.5px),
        linear-gradient(180deg, #ea2f35 0%, #d71920 45%, #a81217 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -2px 0 rgba(0, 0, 0, 0.22), 0 2px 0 rgba(0, 0, 0, 0.28);
    transition: filter 0.15s ease;
}
.mk-open-knife::after {
    content: ''; position: absolute; z-index: -2; top: 50%; left: calc(100% - 26px);
    width: 84px; height: 20px; margin-top: -10px;
    background: linear-gradient(180deg, #fbfcfc 0%, #cfd5da 45%, #8f979e 100%);
    clip-path: polygon(0 20%, 62% 0, 100% 48%, 100% 56%, 0 100%);
    transform-origin: 6px 50%; transform: rotate(180deg);
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.mk-open-knife:hover::before { filter: brightness(1.06); }
.mk-open-knife:hover::after, .mk-open-knife:focus-visible::after { transform: rotate(-24deg); }
.mk-open-knife:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 4px; }
.mk-open-short { display: none; }   /* phones show "Open"; the tool icon says which tool */
.mk-open-facts {
    list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 1rem;
    font-size: 0.9rem; color: var(--color-text-medium);
}
.mk-open-facts li { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Side: who published it, then more from them */
.mk-item-side { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 84px; }
.mk-side-box {
    background: var(--color-white); border: 1px solid var(--color-border); border-radius: 10px; padding: 1.2rem 1.25rem;
}
.mk-side-label {
    font-family: var(--font-display); font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--color-text-light); margin-bottom: 0.75rem;
}
.mk-chalet-mini { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: inherit; }
.mk-chalet-mini > span:last-child { display: flex; flex-direction: column; }
.mk-chalet-name { font-weight: 600; font-size: 1.05rem; color: var(--color-primary); }
.mk-chalet-mini:hover .mk-chalet-name { color: var(--color-accent); }
.mk-handle { font-size: 0.88rem; color: var(--color-text-light); }
.mk-side-bio { margin-top: 0.75rem; font-size: 0.92rem; color: var(--color-text-medium); }
.mk-side-link {
    display: inline-flex; align-items: center; min-height: 44px; margin-top: 0.35rem;
    font-weight: 600; font-size: 0.92rem; color: var(--color-accent); text-decoration: none;
}
.mk-side-link::after { content: '→'; margin-left: 0.35rem; transition: transform 0.15s ease; }
.mk-side-link:hover::after { transform: translateX(3px); }
.mk-more { list-style: none; display: flex; flex-direction: column; }
.mk-more li + li { border-top: 1px solid var(--color-border); }
.mk-more a { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.65rem 0; text-decoration: none; color: inherit; }
.mk-more-tool {
    font-family: var(--font-display); font-size: 0.78rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--color-text-light);
}
.mk-more-title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; color: var(--color-primary); }
.mk-more a:hover .mk-more-title { color: var(--color-accent); }

/* Chalet */
.mk-avatar {
    flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--color-primary); color: var(--color-white); font-weight: 700; font-size: 1.1rem;
}
.mk-avatar-lg { width: 84px; height: 84px; font-size: 2rem; }

/* ── Chalet page ────────────────────────────────────────────────────────
   A white profile card with a carved wooden beam along the bottom, like the
   inscription on an old chalet: "Chalet since …" and its totals. The chalet
   logo in the header is the chalet mark; nothing here repeats it. */
/* The whole chalet page is one centred column, as wide as the profile card, so a tool with
   only one or two plans never leaves the right side of the page empty. Cards run two a row. */
.mk-chalet { max-width: 820px; margin: 0 auto; }
.mk-house { position: relative; margin-top: 0.5rem; }
.mk-house-face {
    position: relative; display: flex; gap: 1.5rem; align-items: flex-start; padding: 1.75rem 2rem 1.5rem;
    background: var(--color-white); border: 1px solid var(--color-border); border-bottom: 0; border-radius: 10px 10px 0 0;
}
/* The chalet mark as a faint watermark in the card's lower right, behind the text; the header
   carries the Market's own logo on every page (Sid, 8 Oct 2026). */
.mk-house-face { isolation: isolate; }
.mk-house-face::before {
    content: ''; position: absolute; z-index: -1; right: 18px; bottom: 14px; width: 150px; height: 134px;
    background: url('/assets/chalet_logo.png') no-repeat right bottom / contain; opacity: 0.07; pointer-events: none;
}
.mk-house .mk-avatar-lg {
    width: 96px; height: 96px; border-radius: 14px; font-size: 2.4rem;
    box-shadow: 0 0 0 4px var(--color-white), 0 0 0 7px var(--color-accent);
    margin: 4px;
}
.mk-house-who { min-width: 0; }
.mk-house-name { font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1.05; color: var(--color-primary); }
.mk-house-bio { margin-top: 0.7rem; max-width: 36rem; font-size: 1.04rem; color: var(--color-text-medium); }
.mk-house-link { margin-top: 0.5rem; }
.mk-house-link a { font-weight: 600; color: var(--color-accent); text-decoration: none; }
.mk-house-link a:hover { text-decoration: underline; }
/* Social profiles (D16): one round brand icon each, only those the owner gave. Quiet grey at
   rest, the brand's own colour on hover and in the Edit dialog's labels. */
.mk-social-instagram { --brand: #e4405f; }
.mk-social-tiktok { --brand: #000000; }
.mk-social-youtube { --brand: #ff0000; }
.mk-social-facebook { --brand: #1877f2; }
.mk-social-linkedin, .mk-social-linkedin-company { --brand: #0a66c2; }
.mk-social-whatsapp { --brand: #25d366; }
.mk-social-icon { width: 20px; height: 20px; flex-shrink: 0; }
/* A plan written in another language than the page (D24). */
.mk-lang-badge {
    display: inline-block; margin-left: 0.3rem; vertical-align: 0.1em; padding: 0.05rem 0.4rem; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
    background: var(--color-background); color: var(--color-text-medium); font: 600 0.72rem var(--font-family); letter-spacing: 0.05em;
}
.mk-house-socials { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; }
.mk-house-socials a {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid var(--color-border); background: var(--color-white); color: var(--color-text-medium);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.mk-house-socials a:hover { color: var(--brand); border-color: var(--brand); }
.mk-social-label { display: inline-flex; align-items: center; gap: 0.45rem; }
.mk-social-label .mk-social-icon { width: 18px; height: 18px; color: var(--brand); }
.mk-house-beam {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.4rem; padding: 0.75rem 2rem;
    border-radius: 0 0 10px 10px; color: #f1dfbd;
    background:
        repeating-linear-gradient(178deg, rgba(255, 235, 200, 0.045) 0 2px, transparent 2px 6px),
        linear-gradient(180deg, #3d2a1c, #2a1c12);
    font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; letter-spacing: 0.05em; text-transform: uppercase;
}
.mk-house-beam .mk-stats { color: inherit; font-family: var(--font-family); text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.mk-house-since { color: #fff4dc; }

.mk-house-group { margin-top: 2.5rem; }
.mk-group-heading {
    display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem;
    font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; color: var(--color-primary);
}
.mk-group-n {
    font-size: 0.85rem; font-weight: 600; padding: 0.1rem 0.55rem; border-radius: 999px;
    background: var(--color-primary); color: var(--color-white);
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.mk-footer {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1.5rem 1rem 2rem; text-align: center;
    border-top: 1px solid var(--color-border); background: var(--color-white);
    font-size: 0.88rem; color: var(--color-text-light);
}
.mk-footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem; }
.mk-footer a { color: var(--color-text-medium); text-decoration: none; }
.mk-footer a:hover { text-decoration: underline; }

/* ── Small screens ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .mk-item { grid-template-columns: minmax(0, 1fr); }
    .mk-item-side { position: static; }
    /* Signpost becomes one swipeable row of plates between the intro and the feed. */
    /* minmax(0, 1fr), not 1fr: a plain 1fr column grows to its widest child's min-content,
       which for the one-line row of plates is the sum of all of them — the whole page then
       scrolls sideways instead of just the signpost row. */
    .mk-home { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "post" "feed"; }
    .mk-home-intro { margin-bottom: 1rem; display: block; }
    .mk-search { max-width: 36rem; margin-top: 1rem; }
    .mk-post { position: static; min-width: 0; padding-bottom: 0; margin: 0 -1.5rem 1.4rem; }
    .mk-post::before, .mk-post-here { display: none; }
    .mk-post-arrows {
        flex-direction: row; margin: 0; padding: 2px 1.5rem 6px; gap: 8px;
        overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
    }
    .mk-post-arrows::-webkit-scrollbar { display: none; }
    .mk-post-arrows li { flex-shrink: 0; scroll-snap-align: start; }
    .mk-arrow { min-height: 46px; font-size: 1.05rem; white-space: nowrap; padding-right: 30px; }
    .mk-arrow:hover { transform: none; }
}
@media (max-width: 768px) {
    .mk-header-inner { flex-wrap: wrap; gap: 0; padding: 0.4rem 1rem 0; }
    .mk-brand { min-height: 48px; }
    .mk-logo { height: 34px; }
    .mk-header-tools { order: 1; }
    .mk-nav { order: 2; width: 100%; margin: 0 -0.7rem; padding-bottom: 0.2rem; }
    .mk-main { padding: 1.25rem 1rem 2.5rem; }
    .mk-hero h1 { font-size: 1.8rem; }
    .mk-page-title { font-size: 1.7rem; }
    .mk-home-intro h1 { font-size: 1.75rem; }
    .mk-home-intro p { font-size: 1rem; }
    .mk-post { margin: 0 -1rem 1.2rem; }
    .mk-post-arrows { padding: 2px 1rem 6px; }
    /* Phone: the illustration sits faintly behind the heading and its text, cropped to the
       mountains and village on its right, and fades out before the signpost row. */
    .mk-scenery {
        top: 0; width: 100%; aspect-ratio: auto; height: 330px; opacity: 0.4;
        background-position: right bottom;
        -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
        mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
        -webkit-mask-composite: source-over; mask-composite: add;
    }
    .mk-item-main { padding: 1.4rem 1.2rem 1.25rem; }
    .mk-item-title { font-size: 2rem; }
    .mk-item-desc p { font-size: 1.04rem; }
    /* The Open arrow stays in reach: pinned to the bottom of the screen until the reader
       scrolls down to its own place under the description. */
    /* Only the knife is pinned; the facts stay in the page flow below it. */
    .mk-open {
        position: sticky; bottom: 0; z-index: 5; margin: 1rem -1.2rem 0; padding: 0.9rem 1.2rem 0.75rem;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 35%);
    }
    /* No hover on a phone: the blade rests half open, and the handle leaves room for it. */
    .mk-open-knife { display: flex; width: calc(100% - 64px); font-size: 1.25rem; min-height: 50px; padding: 0 2.4rem; }
    .mk-open-long { display: none; }
    .mk-open-short { display: inline; }
    .mk-open-knife::after { transform: rotate(-24deg); }
    .mk-open-facts { flex-direction: column; gap: 0.35rem; margin-top: 0.5rem; }
}
/* Phones: the avatar sits beside the name and handle only; the bio and link take the card's
   full width below, instead of a narrow column next to the avatar. */
@media (max-width: 600px) {
    .mk-house-face { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 1rem; align-items: center; }
    .mk-house-who { display: contents; }
    .mk-house .mk-avatar-lg { grid-column: 1; grid-row: 1 / span 2; }
    .mk-house-name { grid-column: 2; grid-row: 1; align-self: end; }
    .mk-house-face > .mk-house-who > .mk-handle { grid-column: 2; grid-row: 2; align-self: start; }
    .mk-house-bio, .mk-house-link, .mk-house-socials { grid-column: 1 / -1; }
    .mk-house-actions .mk-edit-btn { width: 44px; justify-content: center; padding: 0; font-size: 0; }
    .mk-house-actions .mk-edit-btn span { font-size: 1.05rem; }
    .mk-house-face:has(.mk-house-actions .mk-edit-btn:not([hidden])) .mk-house-name { padding-right: 5.5rem; }
}

@media (max-width: 480px) {
    .mk-logo { height: 30px; }
    .mk-brand-word { font-size: 1.2rem; }
    .mk-cards { grid-template-columns: 1fr; }
    .mk-house-face { column-gap: 1rem; padding: 1.3rem 1.1rem 1.1rem; }
    .mk-house-face::before { right: 10px; bottom: 8px; width: 96px; height: 86px; }
    .mk-house .mk-avatar-lg { width: 64px; height: 64px; font-size: 1.7rem; }
    .mk-house-name { font-size: 1.9rem; }
    .mk-house-beam { padding: 0.7rem 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .mk-arrow, .mk-arrow::before, .mk-card-link, .mk-open-knife::after, .mk-side-link::after { transition: none; }
    .mk-arrow:hover,  .mk-side-link:hover::after { transform: none; }
}

/* Delete (IT-3d): quiet red text at the left of the Cancel / Save row in the Edit dialogs, so it is
   found wherever Save is; and the confirmation that replaces the form. The confirm button is the
   one red-filled button on the market. */
.mk-delete-btn {
    display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px; padding: 0 0.5rem; margin: 0 auto 0 -0.5rem;
    border: 0; border-radius: var(--radius-sm); background: none; color: var(--color-accent);
    font: 600 0.9rem var(--font-family); cursor: pointer;
}
.mk-delete-btn:hover { background: var(--color-accent-soft); color: var(--color-accent-hover); }
/* Phone: Cancel and Save keep their row; Delete drops to its own line under them, past a rule. */
@media (max-width: 600px) {
    .mk-dialog-form .mk-delete-btn, .mk-pe-form .mk-delete-btn {
        order: 1; flex: 1 0 100%; justify-content: flex-start; margin: 0.5rem 0 0; padding: 0.75rem 0 0;
        border-top: 1px solid var(--color-border); border-radius: 0;
    }
    .mk-dialog-form .mk-delete-btn:hover, .mk-pe-form .mk-delete-btn:hover { background: none; }
}
/* A plan's edit page (D43): the dialog's fields on a page, a tab per language. */
.mk-plan-edit[hidden], .mk-pe-denied[hidden] { display: none; }
.mk-plan-edit { max-width: 46rem; margin: 0 auto; padding: 0.5rem 0 2rem; }
.mk-pe-title { font: 700 2.2rem/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; color: var(--color-primary); }
.mk-pe-lead { margin: 0.5rem 0 1.25rem; font-size: 0.98rem; line-height: 1.55; color: var(--color-text-medium); }
.mk-pe-form { display: flex; flex-direction: column; gap: 0.9rem; padding: 1.5rem; background: var(--color-white);
    border: 1px solid var(--color-border); border-top: 5px solid var(--color-accent); border-radius: var(--radius-lg); }
.mk-pe-form[hidden] { display: none; }
.mk-pe-tabs { display: flex; gap: 0.35rem; overflow-x: auto; margin: -0.25rem 0 0.25rem; padding-bottom: 2px; border-bottom: 1.5px solid var(--color-border); }
.mk-pe-tab {
    display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; flex: none; min-height: 48px; padding: 0.45rem 0.85rem 0.5rem;
    border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; background: none; cursor: pointer;
    font: 600 0.98rem var(--font-family); color: var(--color-text-medium); text-align: left;
}
.mk-pe-tab:hover { color: var(--color-primary); }
.mk-pe-tab[aria-selected="true"] { color: var(--color-primary); border-bottom-color: var(--color-accent); }
.mk-pe-state { font-size: 0.74rem; font-weight: 500; color: var(--color-text-light); white-space: nowrap; }
.mk-pe-state[data-state="original"], .mk-pe-state[data-state="translated"] { color: #1f7a3a; }
.mk-pe-state[data-state="off"] { color: var(--color-text-light); opacity: 0.8; }
.mk-pe-panel { display: flex; flex-direction: column; gap: 0.9rem; }
.mk-pe-panel[hidden] { display: none; }
.mk-pe-texts { display: flex; flex-direction: column; gap: 0.9rem; }
.mk-plan-edit label.mk-pe-switch { flex-direction: row; align-items: center; gap: 0.6rem; font-size: 1rem; color: var(--color-text-dark); cursor: pointer; }
.mk-plan-edit .mk-pe-switch input { min-height: 0; width: 20px; height: 20px; accent-color: var(--color-accent); }
.mk-plan-edit input:disabled, .mk-plan-edit textarea:disabled { background: var(--color-background); color: var(--color-text-light); }
.mk-plan-edit a.mk-dialog-cancel { display: inline-flex; align-items: center; text-decoration: none; }
@media (max-width: 600px) {
    .mk-pe-form { padding: 1.1rem 1rem; }
    .mk-pe-title { font-size: 1.8rem; }
}
.mk-confirm { padding: 1.75rem 1.5rem 1.5rem; border-top: 5px solid var(--color-accent); border-radius: var(--radius-lg); }
.mk-confirm > * + * { margin-top: 0.75rem; }
.mk-confirm p { line-height: 1.55; color: var(--color-text-medium); }
.mk-confirm .mk-confirm-count { font-weight: 700; color: var(--color-text-dark); }
.mk-confirm .mk-confirm-undone, .mk-confirm .mk-confirm-error { font-weight: 700; color: var(--color-accent); }
.mk-confirm .mk-dialog-actions { margin-top: 1.25rem; }
.mk-confirm-go { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-white); }
.mk-confirm-go:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.mk-confirm[hidden], .mk-dialog-form[hidden] { display: none; }

/* What Try Swiss Knife took down (migration 0007), shown by owner.js to the owner only: a
   notice under the chalet card listing each taken-down plan, or in place of the 404 when the
   whole chalet is suspended. */
.mk-mod[hidden] { display: none; }
.mk-mod {
    max-width: 820px; margin: 1.5rem auto 0; padding: 1.1rem 1.25rem 1.2rem;
    border: 1px solid #f1c9c7; border-left: 4px solid var(--color-accent); border-radius: var(--radius-lg);
    background: var(--color-accent-soft);
}
.mk-mod-title { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.02em; color: var(--color-accent-hover); }
.mk-mod-lead, .mk-mod p { margin-top: 0.4rem; font-size: 0.95rem; line-height: 1.55; color: var(--color-text-medium); }
.mk-mod a { color: var(--color-accent-hover); font-weight: 600; }
.mk-mod-list { list-style: none; margin: 0.9rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.mk-mod-item {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
    padding: 0.7rem 0.85rem; border-radius: var(--radius-md); background: var(--color-white);
}
.mk-mod-what { display: flex; flex-direction: column; min-width: 0; }
.mk-mod-tool { font-size: 0.8rem; color: var(--color-text-light); }
.mk-mod-name { font-size: 1rem; color: var(--color-text-dark); overflow-wrap: anywhere; }
.mk-mod-item .mk-mod-why { font-size: 0.85rem; color: var(--color-text-medium); }
.mk-mod-suspended .mk-mod-why { font-weight: 600; color: var(--color-text-dark); }
.mk-mod-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; }
.mk-mod-actions .mk-mod-ask { flex-basis: 100%; margin: 0; text-align: right; font-size: 0.9rem; font-weight: 600; color: var(--color-text-dark); }
.mk-mod-actions .mk-mod-err { flex-basis: 100%; margin: 0; text-align: right; font-size: 0.85rem; font-weight: 600; color: var(--color-accent); }
.mk-mod-actions .mk-mod-err[hidden] { display: none; }
.mk-mod-actions .mk-dialog-submit, .mk-mod-actions .mk-dialog-cancel { min-height: 40px; font-size: 0.95rem; padding: 0 1rem; }
.mk-mod-suspended { margin-top: 2.5rem; }
@media (max-width: 600px) {
    .mk-mod-item { flex-direction: column; align-items: stretch; }
    .mk-mod-actions, .mk-mod-actions .mk-mod-ask, .mk-mod-actions .mk-mod-err { justify-content: flex-start; text-align: left; }
}

/* The like button on a plan page (D8): the ❤️ count itself, tappable. */
.mk-like {
    display: inline-flex; align-items: center; gap: 0.25rem; min-height: 44px; margin: -10px -0.4rem; padding: 0 0.4rem;
    border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; cursor: pointer;
}
.mk-like:hover { background: var(--color-accent-soft); color: var(--color-accent-hover); }
.mk-like[aria-pressed="true"] { color: var(--color-accent); }
.mk-like:disabled { cursor: progress; }
