/* Kalorihaku Engine — V5 maanläheinen tyyli */
.kh-page {
  --bg: #fbf7f0; --bg-warm: #f4ecdd; --bg-card: #ffffff; --bg-cream: #fdf9f1;
  --ink: #2a2419; --ink-soft: #5f5648; --ink-mute: #948a78;
  --line: #e6dcc8; --line-soft: #efe7d6;
  --tomato: #c0492f; --tomato-soft: #d97a64;
  --leaf: #5a7d3c; --leaf-deep: #3f5a29; --leaf-bg: #eef2e3;
  --crust: #c8923f; --crust-bg: #f6ebd6; --berry: #8a5276;
  font-family: 'Bricolage Grotesque', -apple-system, sans-serif;
  color: var(--ink); max-width: 1080px; margin: 0 auto; line-height: 1.55;
}
.kh-page * { box-sizing: border-box; }
.kh-page .r { text-align: right; }
.kh-muted { color: var(--ink-mute); font-weight: 500; }

.kh-crumbs { font-size: 13px; color: var(--ink-mute); margin-bottom: 14px; }
.kh-crumbs a { color: var(--ink-soft); text-decoration: none; }

.kh-title-row h1 { font-family: 'Newsreader', serif; font-size: 38px; font-weight: 500; line-height: 1.1; margin: 0 0 6px; }
.kh-title-row h1 em { font-style: italic; color: var(--tomato); }
.kh-subtitle { font-size: 14px; color: var(--ink-soft); margin-bottom: 26px; }
.kh-source-pill { background: var(--bg-warm); padding: 3px 10px; border-radius: 999px; font-size: 12px; margin-left: 8px; }

.kh-layout-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin-bottom: 36px; }
@media (max-width: 880px) { .kh-layout-grid { grid-template-columns: 1fr; } }

.kh-calc-card, .kh-compare-card { background: var(--bg-card); border: 1.5px solid var(--line); border-radius: 18px; padding: 24px; }
.kh-card-eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); margin-bottom: 16px; font-weight: 600; }

.kh-portion-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }
.kh-chip { background: var(--bg-cream); border: 1.5px solid var(--line); padding: 7px 13px; border-radius: 999px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer; font-family: inherit; font-weight: 500; }
.kh-chip:hover { border-color: var(--tomato-soft); }
.kh-chip.active { background: var(--tomato); border-color: var(--tomato); color: #fff; }

.kh-slider-row { display: grid; grid-template-columns: 1fr 128px; gap: 16px; margin-bottom: 20px; align-items: center; }
.kh-slider-row input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--bg-warm); border-radius: 999px; }
.kh-slider-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--tomato); cursor: pointer; border: 4px solid #fff; box-shadow: 0 2px 8px rgba(192,73,47,.35); }
.kh-slider-row input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--tomato); cursor: pointer; border: 4px solid #fff; }
.kh-amount-input { display: flex; align-items: center; background: var(--bg-cream); border: 1.5px solid var(--line); border-radius: 12px; padding: 6px 12px; box-sizing: border-box; }
.kh-page .kh-amount-input input[type=number] {
  width: 100%; min-width: 0; flex: 1;
  background: transparent !important; border: none !important;
  color: var(--ink); font-size: 17px; font-weight: 600;
  font-family: inherit; text-align: right; outline: none;
  padding: 4px 0 !important; margin: 0 !important; box-shadow: none !important;
  -moz-appearance: textfield;
}
.kh-page .kh-amount-input input[type=number]::-webkit-outer-spin-button,
.kh-page .kh-amount-input input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.kh-unit { font-size: 14px; color: var(--ink-mute); margin-left: 6px; flex-shrink: 0; }

.kh-result-hero { background: var(--crust-bg); border-radius: 14px; padding: 20px 22px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; }
.kh-result-left { display: flex; align-items: baseline; gap: 12px; }
.kh-kcal-big { font-family: 'Newsreader', serif; font-size: 60px; font-weight: 500; color: var(--tomato); line-height: .9; }
.kh-kcal-lbl { font-size: 15px; color: var(--ink-soft); }
.kh-result-right { text-align: right; }
.kh-result-portion { font-size: 14px; font-weight: 600; }
.kh-result-daily { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

.kh-macro-bars { display: grid; gap: 12px; }
.kh-macro-row { display: grid; grid-template-columns: 104px 1fr 60px; gap: 10px; align-items: center; font-size: 13.5px; }
.kh-macro-name { color: var(--ink-soft); font-weight: 500; }
.kh-bar-bg { background: var(--bg-warm); height: 10px; border-radius: 999px; overflow: hidden; }
.kh-bar-fill { height: 100%; border-radius: 999px; transition: width .25s ease; }
.kh-bar-fill.carb { background: var(--crust); }
.kh-bar-fill.protein { background: var(--leaf); }
.kh-bar-fill.fat { background: var(--tomato-soft); }
.kh-bar-fill.fiber { background: var(--berry); }
.kh-macro-val { text-align: right; font-weight: 600; }

.kh-compare-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-mute); margin: 0 0 14px; font-weight: 600; }
.kh-compare-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.kh-compare-row:last-child { border-bottom: none; }
.kh-food-emoji { font-size: 18px; width: 22px; text-align: center; }
.kh-food-name { font-size: 14px; color: var(--ink); flex: 1; font-weight: 500; text-decoration: none; }
a.kh-food-name:hover { color: var(--tomato); }
.kh-food-cal { font-size: 13px; font-weight: 600; }
.kh-compare-row.current { background: var(--leaf-bg); margin: 0 -10px; padding: 11px 10px; border-radius: 10px; border-bottom: none; }
.kh-compare-row.current .kh-food-name { color: var(--leaf-deep); font-weight: 700; }

.kh-intro-block { background: var(--bg-cream); border-radius: 16px; padding: 22px 24px; margin-bottom: 36px; border: 1.5px solid var(--line-soft); }
.kh-intro-block p { font-family: 'Newsreader', serif; font-size: 19px; line-height: 1.6; color: var(--ink-soft); margin: 0; }

.kh-page section { margin-bottom: 36px; }
.kh-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.kh-section-head h2 { font-family: 'Newsreader', serif; font-size: 25px; font-weight: 500; margin: 0; }
.kh-h2-line { flex: 1; height: 1.5px; background: var(--line); border-radius: 2px; }

.kh-data-table { background: var(--bg-card); border: 1.5px solid var(--line); border-radius: 16px; overflow: hidden; }
.kh-data-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.kh-data-table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-mute); font-weight: 600; padding: 13px 16px; text-align: left; background: var(--bg-cream); border-bottom: 1.5px solid var(--line); }
.kh-data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.kh-data-table tr:last-child td { border-bottom: none; }
.kh-data-table td.r { text-align: right; font-weight: 600; }
.kh-data-table tbody tr:hover td { background: var(--bg-cream); }
.kh-weight-note { font-size: 13.5px; color: var(--ink-soft); margin-top: 12px; padding: 0 4px; }

.kh-nutri-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .kh-nutri-grid { grid-template-columns: 1fr; } }
.kh-nutri-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-mute); font-weight: 600; padding: 14px 16px 10px; }
.kh-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.kh-dot.macro { background: var(--crust); }
.kh-dot.micro { background: var(--leaf); }
.kh-data-table td.kh-sub { padding-left: 30px; color: var(--ink-soft); font-size: 13px; }
.kh-data-table td.kh-sub::before { content: "↳ "; color: var(--ink-mute); }

.kh-benefits-card { background: var(--bg-card); border: 1.5px solid var(--line); border-radius: 16px; padding: 26px; }
.kh-benefits-list { display: grid; gap: 14px; }
.kh-benefit-item { display: grid; grid-template-columns: 38px 1fr; gap: 14px; align-items: start; }
.kh-benefit-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--leaf-bg); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.kh-benefit-text h4 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.kh-benefit-text p { font-size: 13.5px; color: var(--ink-soft); margin: 0; line-height: 1.55; }

.kh-safety-note { background: #fdf3e3; border: 1.5px solid #e8d4a8; border-radius: 12px; padding: 14px 18px; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 36px; }
.kh-safety-note strong { color: var(--ink); }

.kh-burn-card { background: var(--leaf-bg); border: 1.5px solid #d8e2c4; border-radius: 16px; padding: 24px; }
.kh-burn-card h3 { font-family: 'Newsreader', serif; font-size: 21px; font-weight: 500; margin: 0 0 3px; }
.kh-burn-card h3 .accent { color: var(--leaf-deep); font-weight: 600; }
.kh-burn-sub { font-size: 13px; color: var(--ink-soft); margin-bottom: 18px; }
.kh-burn-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
@media (max-width: 540px) { .kh-burn-grid { grid-template-columns: repeat(2,1fr); } }
.kh-burn-item { background: var(--bg-card); border-radius: 14px; padding: 18px 14px; text-align: center; }
.kh-burn-emoji { font-size: 24px; margin-bottom: 6px; }
.kh-min { font-family: 'Newsreader', serif; font-size: 30px; font-weight: 600; color: var(--leaf-deep); line-height: 1; }
.kh-min-lbl { font-size: 11px; color: var(--ink-mute); }
.kh-activity { font-size: 13px; color: var(--ink-soft); margin-top: 8px; font-weight: 500; }

.kh-faq-item { background: var(--bg-card); border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 9px; overflow: hidden; }
.kh-faq-item summary { padding: 16px 20px; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.kh-faq-item summary::-webkit-details-marker { display: none; }
.kh-faq-item summary::after { content: "+"; font-size: 22px; color: var(--tomato); font-weight: 300; }
.kh-faq-item[open] summary::after { content: "−"; }
.kh-faq-item[open] summary { border-bottom: 1px solid var(--line-soft); }
.kh-answer { padding: 14px 20px 16px; color: var(--ink-soft); font-size: 14px; line-height: 1.65; }

.kh-source-footer { background: var(--bg-warm); border-radius: 16px; padding: 20px 24px; font-size: 13.5px; color: var(--ink-soft); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.kh-source-footer strong { color: var(--ink); }
.kh-source-footer a { color: var(--tomato); text-decoration: none; font-weight: 600; }

@media (max-width: 540px) {
  .kh-title-row h1 { font-size: 28px; }
  .kh-kcal-big { font-size: 48px; }
  .kh-result-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .kh-result-right { text-align: left; }
}

/* AJAX-haku */
.kh-search-wrap { position: relative; max-width: 420px; }
.kh-search-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; margin-top: 4px; z-index: 50; overflow: hidden; display: none; }
.kh-search-results a { display: flex; justify-content: space-between; padding: 10px 14px; text-decoration: none; color: var(--ink); font-size: 14px; }
.kh-search-results a:hover { background: var(--bg-cream); }
.kh-search-results .kh-sr-kcal { color: var(--ink-mute); font-size: 13px; }

/* ===== Sivuston header (oma, korvaa GeneratePressin) ===== */
.kh-site-header {
  background: #fff;
  border-bottom: 1.5px solid #e6dcc8;
  font-family: 'Bricolage Grotesque', -apple-system, sans-serif;
}
.kh-header-row {
  max-width: 1080px; margin: 0 auto;
  padding: 16px 20px;
  display: flex; align-items: center; gap: 24px;
}

/* Logo */
.kh-logo {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; flex-shrink: 0;
}
.kh-logo-mark {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  background: #c0492f; color: #fff;
}
.kh-logo-text {
  font-family: 'Newsreader', serif;
  font-size: 24px; font-weight: 600; color: #2a2419;
  letter-spacing: -0.01em;
}
.kh-logo-fi { color: #c0492f; }

/* Navigaatio */
.kh-nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto; flex-wrap: wrap;
}
.kh-nav a {
  font-size: 14px; font-weight: 500; color: #5f5648;
  text-decoration: none; padding: 7px 12px; border-radius: 8px;
  white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.kh-nav a:hover { background: #f4ecdd; color: #c0492f; }

/* Mobiilivalikkonappi */
.kh-nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 8px; margin-left: auto;
}
.kh-nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: #2a2419; border-radius: 2px;
}

/* Header-haku */
.kh-header-search {
  border-top: 1px solid #efe7d6;
  background: #fbf7f0;
}
.kh-header-search .kh-search-wrap {
  max-width: 1080px; margin: 0 auto;
  padding: 12px 20px; position: relative;
}
.kh-search-icon {
  position: absolute; left: 34px; top: 50%;
  transform: translateY(-50%); color: #948a78; pointer-events: none;
}
.kh-header-search .kh-search-input {
  width: 100%; box-sizing: border-box;
  font-family: 'Bricolage Grotesque', -apple-system, sans-serif;
  font-size: 15px; padding: 11px 16px 11px 42px;
  border: 1.5px solid #e6dcc8; border-radius: 12px;
  background: #fff; color: #2a2419; outline: none;
}
.kh-header-search .kh-search-input:focus { border-color: #d97a64; }
.kh-header-search .kh-search-input::placeholder { color: #948a78; }
.kh-header-search .kh-search-results { left: 20px; right: 20px; }

@media (max-width: 720px) {
  .kh-nav {
    display: none; position: absolute; left: 0; right: 0;
    background: #fff; border-bottom: 1.5px solid #e6dcc8;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 12px; z-index: 60;
  }
  .kh-nav.kh-open { display: flex; }
  .kh-nav a { padding: 11px 12px; }
  .kh-nav-toggle { display: flex; }
  .kh-site-header { position: relative; }
}

/* ===== Etusivu ===== */
.kh-home .kh-hero-home {
  text-align: center; padding: 40px 20px 30px;
}
.kh-home .kh-hero-home h1 {
  font-family: 'Newsreader', serif; font-size: 40px; font-weight: 500;
  line-height: 1.12; margin: 0 0 14px; color: #2a2419;
}
.kh-home .kh-hero-sub {
  font-size: 16px; color: #5f5648; max-width: 620px;
  margin: 0 auto 26px; line-height: 1.6;
}
.kh-search-big { max-width: 560px; margin: 0 auto; }
.kh-search-big .kh-search-input {
  width: 100%; box-sizing: border-box;
  font-family: 'Bricolage Grotesque', sans-serif; font-size: 16px;
  padding: 15px 20px; border: 1.5px solid #e6dcc8; border-radius: 14px;
  background: #fff; color: #2a2419; outline: none;
}
.kh-search-big .kh-search-input:focus { border-color: #c0492f; }

/* Kategoria-grid */
.kh-cat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.kh-cat-card {
  background: #fff; border: 1.5px solid #e6dcc8; border-radius: 14px;
  padding: 18px 18px; text-decoration: none;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s ease, transform .15s ease;
}
.kh-cat-card:hover { border-color: #c0492f; transform: translateY(-2px); }
.kh-cat-name { font-size: 15px; font-weight: 600; color: #2a2419; }
.kh-cat-count { font-size: 12.5px; color: #948a78; }

/* Ruokakortti-grid */
.kh-food-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.kh-food-card {
  background: #fff; border: 1.5px solid #e6dcc8; border-radius: 14px;
  padding: 16px 18px; text-decoration: none;
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
  transition: border-color .15s ease, transform .15s ease;
}
.kh-food-card:hover { border-color: #c0492f; transform: translateY(-2px); }
.kh-fc-name { font-size: 15px; font-weight: 600; color: #2a2419; }
.kh-fc-kcal { font-size: 14px; font-weight: 600; color: #c0492f; white-space: nowrap; flex-shrink: 0; }
.kh-fc-kcal small { color: #948a78; font-weight: 500; }

/* Footer-teksti */
.kh-footer-copy { font-size: 13.5px; color: #5f5648; }

@media (max-width: 540px) {
  .kh-home .kh-hero-home h1 { font-size: 30px; }
  .kh-home .kh-hero-home { padding: 28px 12px 22px; }
}

/* ===== Layout: poista tyhjä sivupalsta plugin-sivuilta ===== */
/* GeneratePressin oikea sidebar vie 30% leveyttä vaikka on tyhjä —
   plugin-sivuilla sisältö saa koko leveyden ja keskittyy oikein. */
.single-food .site-content .content-area,
.tax-food_category .site-content .content-area,
.post-type-archive-food .site-content .content-area,
.kh-home-page .site-content .content-area {
  width: 100% !important;
}
.single-food #right-sidebar,
.tax-food_category #right-sidebar,
.post-type-archive-food #right-sidebar,
.kh-home-page #right-sidebar {
  display: none !important;
}
