:root {
    color-scheme: light;
    --paper: #fffdfa;
    --canvas: #f5eee5;
    --sand: #f4e5d5;
    --line: #e8d8c8;
    --ink: #322721;
    --muted: #6e584f;
    --wine: #781e37;
    --wine-dark: #501226;
    --panel-top-padding: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font: 16px/1.6 "DM Sans", system-ui, sans-serif;
}

.site, .brand {
    width: min(950px, calc(100% - 40px));
    margin-inline: auto;
}

.brand {
    overflow: hidden;
    container-type: inline-size;
    margin-block: 10px;
    border-radius: 12px;
    background: var(--wine-dark);
    box-shadow: 0 0 0 1px var(--line);
}

#header {
    display: grid;
    width: 760px;
    grid-template-columns: 153px 468px 139px;
    grid-template-rows: 5px 60px 81px 29px;
    margin-inline: auto;
    zoom: min(1.25, calc(100cqw / 760px));
}

#header img { display: block; width: 100%; height: auto; filter: saturate(.86) contrast(.96); }
.brand-top { grid-area: 1 / 1 / 2 / 4; }
.brand-left { grid-area: 2 / 1 / 4 / 2; }
.brand-banner { grid-area: 2 / 2 / 3 / 3; }
.brand-center { grid-area: 3 / 2 / 4 / 3; }
.brand-right { grid-area: 2 / 3 / 4 / 4; overflow: hidden; }
#header::after {
    content: "";
    grid-area: 2 / 1 / 4 / 4;
    align-self: end;
    height: 36px;
    background: linear-gradient(transparent, #50122636);
    pointer-events: none;
}
.brand-links {
    grid-area: 4 / 1 / 5 / 4;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding-inline: 10px;
    background: linear-gradient(100deg, var(--sand), #fcf3ea, var(--sand));
    border-top: 1px solid #c69187;
}
.brand-links a {
    padding-inline: 12px;
    color: var(--wine-dark);
    font: 650 13px/1.2 system-ui, sans-serif;
}
.brand-links a + a { border-inline-start: 1px solid #b884795c; }
.brand-links a:hover { color: var(--wine); text-decoration: underline; }
.brand-links a:focus-visible { outline-color: var(--wine); }

@media (max-width: 600px) {
    #header {
        width: 100%;
        grid-template-columns: 20.13% 61.58% 18.29%;
        grid-template-rows: auto auto auto auto;
        zoom: 1;
    }
    .brand-right { grid-row: 2 / 4; overflow: hidden; }
    .brand-links { grid-column: 1 / -1; padding-block: 5px; }
    .brand-links a { padding: 5px 8px; }
}

.layout {
    display: grid;
    grid-template-columns: minmax(125px, 145px) minmax(0, 1fr) minmax(125px, 150px);
    align-items: start;
    gap: 10px;
}

.menu, .content {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.menu {
    background: var(--sand);
    padding: var(--panel-top-padding) 12px 12px;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.menu table { width: 100%; border-spacing: 0; background: transparent; }
.menu td { background: transparent; }
.menu td:empty { padding: 0; }
.menu img, .content img { max-width: 100%; height: auto; }

.menu-primary a {
    display: block;
    padding: 7px 9px;
    color: var(--wine-dark);
    font-weight: 650;
    line-height: 1.35;
    border-radius: 6px;
}

.menu-primary a:hover, .menu-primary a:focus-visible {
    color: var(--wine-dark);
    background: var(--paper);
}

.menu-secondary { text-align: center; }
.menu-secondary a { display: inline-block; margin-block: 3px; }

.content {
    background: var(--paper);
    padding: clamp(20px, 3vw, 34px);
    padding-block-start: var(--panel-top-padding);
    overflow-wrap: anywhere;
}

.content h1, .content h2 {
    font-family: Georgia, serif;
    font-weight: 600;
    color: var(--wine-dark);
    line-height: 1.18;
}

.content h1 { margin: 0 0 20px; font-size: clamp(29px, 4vw, 40px); }
.content h2 { margin: 22px 0 10px; font-size: 24px; }
.content article { padding-block: 4px 20px; border-bottom: 1px solid var(--line); }
.content article p { margin-block: 8px 16px; }

.content-horoscope > h1 { margin-bottom: 8px; }
.content-horoscope > p { margin-block: 0 8px; }
.content-horoscope > article { padding-block: 8px; }
.content-horoscope > article h2 { margin-block: 0 4px; }
.content-horoscope > article p { margin: 0; }
.content time { color: var(--muted); font-size: 14px; }
.content table { max-width: 100%; }
.content td { padding: 4px; }
.content li { margin-block: 6px; }

.content a, .menu-secondary a, .site-footer a { color: var(--wine); }
.content a:hover, .menu-secondary a:hover, .site-footer a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }

.news-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-block: 12px;
}

.news-topics a {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--sand);
    font-size: 14px;
    font-weight: 650;
}

.site-footer { margin-block: 24px; text-align: center; font-size: 14px; }

@media (max-width: 720px) {
    .site, .brand { width: calc(100% - 24px); }
    .layout { grid-template-columns: minmax(0, 1fr); }
    .menu-primary table, .menu-primary tbody, .menu-primary tr { display: contents; }
    .menu-primary td { display: inline-block; }
    .menu-primary td:empty { display: none; }
    .content table { width: 100%; table-layout: fixed; }
    .content td { width: auto; }
}

.terms-content p { margin-block: 12px 22px; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.gallery-thumbs img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }

.content .listing-title h1 { align-self: start; margin-bottom: 0; }
.listing-title {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}
.content .listing-add {
    display: inline-block;
    padding: 9px 14px;
    border-radius: 7px;
    background: var(--wine);
    color: var(--paper);
    font-size: 14px;
    font-weight: 650;
}
.content .listing-add:hover { background: var(--wine-dark); }
.listing-categories {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.content .listing-category {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 8px;
    padding: 13px 14px;
    background: var(--sand);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--wine-dark);
    font-weight: 650;
}
.content .listing-category:hover {
    background: var(--canvas);
    border-color: var(--wine);
    text-decoration: none;
}

@media (max-width: 460px) {
    .listing-categories { grid-template-columns: 1fr; }
}

.listing-overview .menu-primary tr:not(:has(a)) { display: none; }
.content .listing-category {
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    min-height: 76px;
}
.listing-arrow { grid-area: auto; }
.listing-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: var(--wine);
    background: var(--paper);
    font: 20px/1 Georgia, serif;
}

.listing-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.listing-form { color: var(--wine-dark); }
.listing-form > label { display: grid; align-content: start; gap: 5px; font-weight: 600; }
.listing-form input:not([type=hidden]), .listing-form select, .listing-form textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--wine-dark);
    background: white;
    font: inherit;
}
.listing-form select option { color: var(--wine-dark); }
.listing-submit-form > label,
.listing-submit-form :is(input, select, option, textarea) { font-weight: 700; }
.listing-form .form-wide { grid-column: 1 / -1; }
.listing-form .muted { color: var(--wine); margin: 0; font-size: 14px; }
.listing-form .button {
    padding: 9px 14px;
    border: 0;
    border-radius: 7px;
    background: var(--wine);
    color: white;
    font: 650 14px/1.4 system-ui, sans-serif;
    cursor: pointer;
}
.listing-form .honey { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.photo-picker { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.listing-form .photo-picker input[type=file] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    clip-path: inset(50%);
}
.photo-picker input:focus-visible + .photo-picker-button {
    outline: 2px solid var(--wine);
    outline-offset: 2px;
}
.photo-filename { display: block; margin-block: 6px; }
.photo-filename:empty { display: none; }
.photo-preview-wrap:not([hidden]) { display: flex; align-items: start; gap: 8px; }
.photo-preview { width: min(180px, 85%); height: auto; border-radius: 6px; }
.photo-preview-close { cursor: pointer; }
.listing-notice { padding: 10px 14px; background: var(--sand); border: 1px solid var(--line); border-radius: 7px; }
.listing-notice ul { margin-block: 0; }
.listing-pending-status { color: var(--wine-dark); }

@media (max-width: 540px) {
    .listing-form { grid-template-columns: 1fr; }
}
.menu-group + .menu-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid #d6bda7; }
.menu-group h2, .listing-sidebar h2, .right-menu-group h2 {
    margin: 0 0 5px;
    padding: 4px 7px;
    border-radius: 5px;
    background: var(--wine-dark);
    color: var(--paper);
    font-size: 15px;
    line-height: 1.6;
    font-weight: 700;
    text-align: center;
}
.listing-sidebar { text-align: start; }
.listing-sample { padding: 9px 4px; border-bottom: 1px solid var(--line); }
.listing-sample h3 { margin: 0; color: var(--wine-dark); font-size: 14px; line-height: 1.3; }
.listing-sample p { margin: 3px 0; font-size: 12px; line-height: 1.45; }
.listing-location { color: var(--muted); }
.listing-sample a { margin: 3px 0 0; font-size: 13px; font-weight: 650; }
.content article[id^="kuulutus-"] { scroll-margin-top: 16px; }
.content article[id^="kuulutus-"]:target { outline: 2px solid var(--wine); outline-offset: 5px; border-radius: 4px; }

@media (max-width: 720px) {
    .menu-group a { display: inline-block; }
}
.home-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.content .home-section {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--sand);
    color: var(--wine-dark);
    font-weight: 650;
}
.content .home-section-primary { grid-column: 1 / -1; padding: 16px 12px; font-size: 18px; }
.content .home-section:hover { border-color: var(--wine); text-decoration: none; }
.home-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: var(--paper);
    color: var(--wine);
    font-size: 20px;
}
.home-news ul { margin: 0; padding: 0; list-style: none; }
.home-news li { padding-block: 9px; border-bottom: 1px solid var(--line); }
.home-news li span { display: block; color: var(--muted); font-size: 13px; }
.listing-sample-photo { float: left; display: block; width: 30px; height: 30px; margin: 0 6px 4px 0; border-radius: 4px; object-fit: cover; }
.listing-sample { display: flow-root; }

@media (max-width: 460px) {
    .home-sections { grid-template-columns: 1fr; }
}

.content .listing-card {
    padding: 16px;
    margin-block: 0 14px;
    border: 1px solid var(--wine-dark);
    border-radius: 8px;
}
.content .listing-notice + .listing-card { margin-block-start: 10px; }
.listing-card h2 { margin-top: 0; }
.listing-card .listing-location { color: var(--wine-dark); }
.listing-meta {
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 5px;
    background: var(--wine-dark);
    color: var(--paper);
    font-size: 14px;
}
.content .listing-meta p { margin: 0; }
.content .listing-meta p + p { margin-top: 4px; }
.content .listing-meta time { color: inherit; }
.listing-sidebar .listing-sample {
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--wine-dark);
    border-radius: 6px;
}
.game-grid, .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.content .game-card, .content .gallery-card { display: grid; align-content: start; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--sand); font-weight: 650; }
.game-card img, .gallery-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.game-card span, .gallery-card span { padding: 8px; }
.game-frame { display: block; width: 100%; height: clamp(340px, 58vw, 540px); border: 1px solid var(--wine-dark); border-radius: 8px; background: #161616; }
.gallery-full { display: block; margin-inline: auto; max-height: 75vh; object-fit: contain; }

.content .listing-sms-button {
    display: inline-block;
    margin-block: 6px;
    padding: 6px 10px;
    border: 1px solid currentColor;
    border-radius: 6px;
    font-weight: 650;
}
.listing-meta .listing-sms-button { color: var(--paper); }
.listing-meta .listing-sms-button:focus-visible { outline-color: var(--paper); }

.school-intro { color: var(--muted); }
.school-articles { padding-inline-start: 1.6em; }
.school-articles li { padding-block: 5px; border-bottom: 1px solid var(--line); }
.school-articles li::marker { color: var(--wine); font-weight: 650; }

.reading-topics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.content .reading-topic {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: start;
    gap: 10px;
    min-height: 90px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--sand);
    color: var(--wine-dark);
}
.content .reading-topic:hover {
    border-color: var(--wine);
    text-decoration: none;
}
.reading-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--paper);
    color: var(--wine);
}
.reading-topic strong, .reading-topic small { display: block; }
.reading-topic small { margin-top: 3px; color: var(--muted); line-height: 1.4; }
.reading-archive { margin-top: 24px; }
.reading-archive ul { padding: 0; margin: 0; list-style: none; }
.reading-archive li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding-block: 8px;
    border-bottom: 1px solid var(--line);
}
.reading-archive time { white-space: nowrap; }

@media (max-width: 540px) {
    .reading-topics { grid-template-columns: 1fr; }
    .reading-archive li { flex-wrap: wrap; gap: 2px 10px; }
}

.right-menu { text-align: start; }
.right-menu-group + .right-menu-group,
.right-menu-listings + .right-menu-group {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #d6bda7;
}
.right-menu-group a {
    display: block;
    margin: 0;
    padding: 5px 6px;
    border-radius: 5px;
    color: var(--wine-dark);
}
.right-menu-group a:hover, .right-menu-group a:focus-visible {
    background: var(--paper);
    text-decoration: underline;
}

.listing-pagination { justify-content: center; }
.content .listing-meta .listing-sms-button,
.listing-activation-mobile { display: none; }

@media (max-width: 767px), (hover: none) and (pointer: coarse) {
    .content .listing-meta .listing-sms-button { display: inline-block; }
    .listing-activation-mobile { display: block; }
}
.school-inline {
    padding: 8px 12px;
    background: var(--sand);
    border-left: 3px solid var(--wine);
    border-radius: 4px;
}
.school-topic ul { margin: 0; }

.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form .button:hover { background: var(--wine-dark); }
.contact-error { margin-bottom: 16px; border-color: var(--wine); }
.contact-success { margin-bottom: 16px; }
.contact-success p { margin: 0; }

.menu-primary, .right-menu, .content {
    position: relative;
    isolation: isolate;
}
.menu-primary::before, .right-menu::before, .content::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 auto;
    height: 160px;
    border-radius: inherit;
    background: url("/assets/tussuland-mosaic.png") top left / 235px auto no-repeat;
    opacity: .32;
    pointer-events: none;
}
.right-menu::before { transform: scaleX(-1); }
.content::before {
    height: 235px;
    background-position: top right;
    background-size: min(100%, 560px) auto;
    opacity: .24;
}
.content-home {
    background: radial-gradient(ellipse at 100% 0, var(--sand), transparent 55%), var(--paper);
}
.content .home-section-primary {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}
.home-section-primary::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0 0 0 auto;
    width: 48%;
    background: url("/assets/tussuland-mosaic.png") right top / cover no-repeat;
    mask-image: linear-gradient(to right, transparent, #000 68%);
    opacity: .35;
    pointer-events: none;
}
.home-section-primary .home-icon {
    background: var(--paper) url("/assets/listing-icons/motiiv-paar.png") center / 90% no-repeat;
}
.listing-card { display: flow-root; }
.listing-card .listing-photo-link, .listing-card .listing-placeholder {
    float: right;
    max-width: min(100px, 40%);
    margin: 0 0 10px 14px;
    border-radius: 6px;
}
.listing-card .listing-photo-link { cursor: zoom-in; }
.listing-card .listing-photo { display: block; width: auto; max-width: 100%; max-height: 135px; object-fit: contain; }
.listing-card .listing-placeholder { width: 100px; height: auto; }
.listing-card .listing-meta { clear: both; }
.listing-image-dialog { max-width: min(94vw, 960px); padding: 10px; border: 0; border-radius: 8px; background: var(--paper); }
.listing-image-dialog::backdrop { background: #18070cbb; }
.listing-image-dialog img { display: block; max-width: 100%; max-height: 80vh; object-fit: contain; }
.listing-image-dialog button { margin-bottom: 8px; cursor: pointer; }

.listing-silhouettes {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f7e8df;
}
.listing-silhouettes.listing-mark { background: var(--paper); }
.listing-silhouette {
    position: relative;
    flex: 0 0 42%;
    height: 88%;
    overflow: hidden;
}
.listing-silhouette:only-child { flex-basis: 62%; }
.listing-silhouettes .listing-silhouette img {
    position: absolute;
    top: 0;
    left: 50%;
    width: auto;
    max-width: none;
    height: 100%;
    transform: translateX(-25%);
}
.listing-silhouettes .listing-silhouette-man img { transform: translateX(-75%); }
.listing-silhouettes.listing-sample-photo .listing-silhouette img,
.listing-silhouettes.listing-mark .listing-silhouette img {
    height: 168%;
    top: -4%;
}

.brand-home #header { grid-template-rows: 5px 60px 81px; }
.content .home-listing-shortcuts {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}
.home-listing-main {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--wine-dark);
}
.home-listing-main .home-icon { flex: 0 0 32px; }
.home-category-links { display: flex; gap: 5px; }
.home-category-links a {
    display: block;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper);
}
.home-category-links a:hover { border-color: var(--wine); }
.home-category-avatar { width: 34px; height: 34px; border-radius: 4px; pointer-events: none; }
.home-category-avatar:has(.listing-silhouette:nth-child(3)) .listing-silhouette { flex-basis: 32%; }

@media (max-width: 600px) {
    .brand-home #header { grid-template-rows: auto auto auto; }
}
@media (max-width: 860px) {
    .content .home-listing-shortcuts { grid-template-columns: 1fr; }
    .home-category-links { flex-wrap: wrap; }
}
