/* Metsäkartta – Ohjeet (help centre). Same visual language as the app (css/styles.css) and the landing page (api/landing.js). */
:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --border: #E2E5EB;
  --border-light: #F0F1F4;
  --text: #1A1D24;
  --text-sec: #6B7280;
  --text-muted: #9CA3AF;
  --primary: #15803D;
  --primary-hover: #166534;
  --primary-light: #ECFDF5;
  --warning: #D97706;
  --warning-light: #FFFBEB;
  --radius: 12px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', monospace;
  --wrap: 960px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
img, svg { max-width: 100%; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }

/* ── Header ── */
.site-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-head .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.3px; color: var(--text); text-decoration: none; }
.brand svg { color: var(--primary); flex: none; }
.brand-sub { font-weight: 500; color: var(--text-sec); padding-left: 10px; border-left: 1px solid var(--border); }
.brand:hover { color: var(--text); }
.head-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.head-nav a.plain { color: var(--text-sec); text-decoration: none; font-weight: 500; font-size: 14px; padding: 8px 10px; border-radius: 8px; }
.head-nav a.plain:hover { color: var(--primary-hover); background: var(--primary-light); }
.head-search { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; height: 38px; width: 240px; }
.head-search:focus-within { border-color: var(--primary); background: var(--surface); }
.head-search svg { color: var(--text-muted); flex: none; }
.head-search input { border: 0; background: transparent; font: 14px var(--font); color: var(--text); width: 100%; outline: none; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 14px var(--font); text-decoration: none; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

/* ── Front page hero + search ── */
.hero { background: linear-gradient(180deg, #DCEBDF 0%, #EDF4EE 60%, var(--bg) 100%); padding: 48px 0 40px; text-align: center; }
.hero h1 { font-size: 38px; line-height: 1.15; letter-spacing: -.6px; margin-bottom: 10px; }
.hero p { color: var(--text-sec); font-size: 17px; max-width: 560px; margin: 0 auto 24px; }
.search-big { display: flex; align-items: center; gap: 10px; max-width: 620px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 16px; height: 56px; box-shadow: 0 10px 30px rgba(21,128,61,.08); }
.search-big:focus-within { border-color: var(--primary); box-shadow: 0 10px 30px rgba(21,128,61,.16); }
.search-big svg { color: var(--text-muted); flex: none; }
.search-big input { flex: 1; min-width: 0; border: 0; outline: none; font: 17px var(--font); color: var(--text); background: transparent; }
.search-hint { font-size: 13px; color: var(--text-sec); margin-top: 12px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; }

/* ── Sections / cards ── */
.block { padding: 32px 0 8px; }
.block-title { font-size: 22px; letter-spacing: -.3px; margin-bottom: 4px; }
.block-lead { color: var(--text-sec); margin-bottom: 16px; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cat-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-decoration: none; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.cat-card:hover { border-color: var(--primary); box-shadow: 0 8px 24px rgba(21,128,61,.10); color: var(--text); transform: translateY(-1px); }
.cat-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.cat-card h3 { font-size: 17px; }
.cat-card p { font-size: 14px; color: var(--text-sec); flex: 1; }
.cat-count { font-size: 13px; color: var(--primary); font-weight: 600; }

.start { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; counter-reset: start; }
.start a { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--text); font-size: 14px; }
.start a:hover { border-color: var(--primary); color: var(--text); }
.start a b { display: block; font-size: 15px; margin-bottom: 4px; }
.start a::before { counter-increment: start; content: counter(start); display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font: 600 13px var(--mono); margin-bottom: 10px; }
.start a span { color: var(--text-sec); }

.link-list { list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.link-list li + li { border-top: 1px solid var(--border-light); }
.link-list a { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 18px; text-decoration: none; color: var(--text); }
.link-list a:hover { background: var(--primary-light); color: var(--text); }
.link-list a::after { content: '›'; color: var(--text-muted); font-size: 20px; line-height: 1; flex: none; }
.link-list .li-title { font-weight: 600; display: block; }
.link-list .li-sub { font-size: 14px; color: var(--text-sec); display: block; margin-top: 2px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Search results (front page) */
#searchResults { padding-top: 24px; }
.no-results { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); padding: 20px; color: var(--text-sec); }
body.searching .home-main { display: none; }

/* ── Breadcrumbs ── */
.crumbs { font-size: 14px; color: var(--text-sec); padding: 20px 0 0; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: '›'; margin-right: 6px; color: var(--text-muted); }
.crumbs a { color: var(--text-sec); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs [aria-current] { color: var(--text); }

/* ── Category page ── */
.cat-head { display: flex; gap: 16px; align-items: flex-start; padding: 16px 0 8px; }
.cat-head h1 { font-size: 32px; letter-spacing: -.5px; line-height: 1.2; }
.cat-head p { color: var(--text-sec); margin-top: 4px; }
.cat-section { padding-top: 24px; }
.cat-section h2 { font-size: 18px; margin-bottom: 10px; }

/* ── Article ── */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 40px; align-items: start; padding: 8px 0 24px; }
.article h1 { font-size: 32px; line-height: 1.2; letter-spacing: -.5px; margin: 12px 0 6px; }
.updated { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.intro { font-size: 18px; color: var(--text-sec); margin-bottom: 20px; }
.article-body h2 { font-size: 22px; letter-spacing: -.3px; margin: 32px 0 10px; scroll-margin-top: 16px; }
.article-body h3 { font-size: 17px; margin: 20px 0 6px; }
.glossary { margin: 0 0 18px; }
.glossary dt { font-weight: 600; margin: 12px 0 2px; }
.glossary dd { margin: 0; color: var(--text-sec, inherit); }
.article-body p { margin: 0 0 12px; }
.article-body ul, .article-body ol { margin: 0 0 14px 22px; }
.article-body li { margin: 4px 0; }
.article-body ol.steps { list-style: none; margin-left: 0; counter-reset: step; }
.article-body ol.steps > li { counter-increment: step; position: relative; padding-left: 40px; margin: 10px 0; min-height: 28px; }
.article-body ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font: 600 13px var(--mono); display: flex; align-items: center; justify-content: center; }
.article-body strong { font-weight: 600; }
.article-body kbd, .article-body code { font-family: var(--mono); font-size: 14px; background: var(--border-light); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.article-body table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 4px 0 16px; background: var(--surface); }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.article-body th { background: var(--primary-light); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.note { border-left: 4px solid var(--primary); background: var(--primary-light); border-radius: 0 10px 10px 0; padding: 12px 16px; margin: 0 0 16px; font-size: 15px; }
.note.warn { border-color: var(--warning); background: var(--warning-light); }
.note b:first-child { display: block; margin-bottom: 2px; }

/* Contact card (yhteystiedot): round photo + name, role, e-mail */
.contact-card { display: flex; align-items: center; gap: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 4px 0 24px; }
.contact-avatar { flex: none; width: 128px; height: 128px; border-radius: 50%; object-fit: cover; border: 4px solid var(--primary-light); box-shadow: 0 0 0 1px var(--border), 0 8px 24px rgba(21,128,61,.14); }
.contact-name { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.contact-role { font-size: 14px; color: var(--text-sec); margin: 2px 0 8px; }
.contact-mail { display: inline-flex; align-items: center; gap: 8px; font: 600 15px var(--font); color: var(--primary); text-decoration: none; padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.contact-mail::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E") center / contain no-repeat; }
.contact-mail:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary-hover); }
.article-body .contact-note { font-size: 14px; color: var(--text-sec); margin: 10px 0 0; }
@media (max-width: 560px) {
  .contact-card { flex-direction: column; text-align: center; gap: 14px; padding: 22px 18px; }
  .contact-avatar { width: 136px; height: 136px; }
}
/* Front page: Yhteystiedot as its own full-width topic card with the photo */
.cat-card.cat-contact { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 20px; }
.cat-avatar { flex: none; width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-light); box-shadow: 0 0 0 1px var(--border); }
.cat-contact-text { display: flex; flex-direction: column; gap: 6px; }
.cat-contact-text p { flex: none; }
.cat-contact-text b { color: var(--text); font-weight: 600; }
@media (max-width: 560px) {
  .cat-card.cat-contact { flex-direction: column; text-align: center; }
  .cat-contact-text { align-items: center; }
}

/* Screenshot placeholder */
.shot-ph { margin: 8px 0 20px; }
.shot-ph .ph { aspect-ratio: 16 / 9; border: 2px dashed var(--border); border-radius: var(--radius); background: repeating-linear-gradient(135deg, var(--surface) 0 14px, var(--border-light) 14px 28px); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.shot-ph figcaption { font-size: 13px; color: var(--text-sec); margin-top: 6px; text-align: center; }

/* Screenshot */
.shot { margin: 8px 0 20px; }
.shot img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.shot figcaption { font-size: 13px; color: var(--text-sec); margin-top: 6px; text-align: center; }

/* TOC */
.toc { position: sticky; top: 16px; font-size: 14px; border-left: 2px solid var(--border); padding-left: 14px; margin-top: 56px; }
.toc-title { font-weight: 600; font-size: 13px; color: var(--text-sec); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.toc ol { list-style: none; }
.toc li { margin: 6px 0; }
.toc a { color: var(--text-sec); text-decoration: none; display: block; }
.toc a:hover, .toc a.active { color: var(--primary); }
.toc a.active { font-weight: 600; }
.toc-inline { display: none; }

/* Feedback */
.feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 32px 0 8px; }
.feedback-q { font-weight: 600; }
.feedback-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.feedback-btns .btn { padding: 7px 14px; }
.feedback-thanks { color: var(--primary-hover); font-weight: 500; }
.related { margin: 24px 0 8px; }
.related h2 { font-size: 18px; margin-bottom: 10px; }

/* ── Footer ── */
.site-foot { background: #0B2E1B; color: #B7CDBD; font-size: 14px; margin-top: 48px; padding: 32px 0; }
.site-foot a { color: #DCEFE1; }
.site-foot b { color: #fff; }
.foot-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 24px; }
.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }
.foot-id { font-size: 13px; margin-top: 10px; color: #9DB5A4; }

/* ── Phone ── */
@media (max-width: 860px) {
  .wrap { padding: 0 16px; }
  .head-search { order: 3; width: 100%; }
  .head-nav a.plain { display: none; }
  /* Phone: Yhteystiedot as an envelope icon button so the brand and the primary button stay on one row */
  .head-nav a.contact { display: inline-flex; width: 38px; height: 38px; padding: 0; font-size: 0; color: transparent; border: 1px solid var(--border); border-radius: 10px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 6 9-6'/%3E%3C/svg%3E") center / 18px no-repeat; }
  .head-nav a.contact:hover { border-color: var(--primary); background-color: var(--primary-light); }
  .site-head .wrap { gap: 10px; }
  .head-nav { gap: 6px; }
  .head-nav .btn { padding: 8px 11px; font-size: 13px; }
  .head-nav a.contact { width: 34px; height: 34px; }
  .hero { padding: 32px 0 28px; }
  .hero h1 { font-size: 28px; }
  .cat-grid, .start, .two-col { grid-template-columns: 1fr; }
  .article-layout { grid-template-columns: 1fr; gap: 0; }
  .toc-side { display: none; }
  .toc-inline { display: block; position: static; margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px 16px; }
  .article h1, .cat-head h1 { font-size: 26px; }
  .intro { font-size: 17px; }
  .brand-sub { display: none; }
}
@media (min-width: 861px) and (max-width: 980px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .start { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .site-head, .site-foot, .feedback, .toc, .related { display: none; }
  .article-layout { grid-template-columns: 1fr; }
}
