/* =========================================================
   KEYS99 - BLOG HOME (/blog/)
   Markup: build/blog-home.js. Behaviour: js/blog-home.js.
   Desktop: hero, topic chips, featured article, 3-column cards
   with a sidebar. Tablet: 2 columns, sidebar below. Phone: a
   list of cards with the picture on the left.
========================================================= */

.blog-home{
  color:var(--ink);
  background:#fff;
  overflow-x:clip;
}

.blog-home a{ text-decoration:none; }
.blog-home h2 a, .blog-home h3 a, .bh-recent-title{ color:inherit; }

.bh-ico{ width:1.15em; height:1.15em; flex:none; }

/* ---------- Hero ---------- */

.bh-hero{
  position:relative;
  padding:52px 0 60px;
  background:linear-gradient(100deg, #fff9ed 0%, #fff 46%, #eaf7f3 100%);
  overflow:hidden;
}

.bh-hero.has-photo{
  background:
    linear-gradient(90deg, #fff 0%, rgba(255,255,255,.92) 38%, rgba(255,255,255,0) 72%),
    url("../assets/blog/hero.jpg") right center / cover no-repeat;
}

.bh-skyline{
  position:absolute;
  right:3%;
  bottom:0;
  height:94%;
  width:auto;
  max-width:48%;
  pointer-events:none;
}

.bh-hero-inner{ position:relative; z-index:1; }

.bh-kicker{
  font-size:var(--fs-label);
  font-weight:800;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--gold-dark);
}

.bh-kicker-line{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}
.bh-kicker-line::before{
  content:"";
  width:34px;
  height:3px;
  border-radius:3px;
  background:var(--gold);
}

.bh-hero h1{
  margin:0 0 14px;
  max-width:640px;
  font-size:clamp(32px, 5vw, 54px);
  line-height:1.1;
  font-weight:800;
  letter-spacing:-.02em;
  color:var(--ink);
}
.bh-hero h1 span{ color:var(--gold-dark); }

.bh-hero p{
  margin:0 0 26px;
  max-width:540px;
  font-size:clamp(15px, 1.6vw, 18px);
  line-height:1.6;
  color:#35505c;
}

.bh-search{
  display:flex;
  align-items:center;
  gap:10px;
  max-width:580px;
  padding:6px 6px 6px 18px;
  border-radius:999px;
  background:#fff;
  box-shadow:0 10px 30px rgba(8,45,56,.14);
}

.bh-search-ico{ color:var(--green); width:20px; height:20px; }

.bh-search input{
  flex:1;
  min-width:0;
  border:0;
  outline:0;
  background:transparent;
  font:inherit;
  font-size:var(--fs-input);
  color:var(--ink);
}
.bh-search input::placeholder{ color:#7b8d95; }

.bh-search button{
  flex:none;
  border:0;
  border-radius:999px;
  padding:12px 26px;
  font:inherit;
  font-weight:700;
  color:#fff;
  background:var(--green);
  cursor:pointer;
  transition:background .2s;
}
.bh-search button:hover{ background:var(--green-dark); }
.bh-search:focus-within{ box-shadow:0 0 0 3px rgba(0,107,91,.28), 0 10px 30px rgba(8,45,56,.14); }

/* ---------- Topic chips ---------- */

.bh-topics{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin:26px 0 8px;
}

.bh-topics button{
  flex:1 1 118px;
  max-width:170px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  padding:14px 8px 12px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  font:inherit;
  font-size:var(--fs-ui);
  color:#35505c;
  cursor:pointer;
  transition:border-color .2s, background .2s, color .2s, transform .2s;
}
.bh-topics button .bh-ico{ width:26px; height:26px; color:var(--green); }
.bh-topics button:hover{ border-color:#cbd9d5; transform:translateY(-1px); }
.bh-topics button.is-active{
  border-color:var(--gold);
  background:var(--cream);
  color:var(--gold-dark);
  font-weight:700;
}
.bh-topics button.is-active .bh-ico{ color:var(--gold-dark); }

/* ---------- Featured article ---------- */

.bh-featured{
  display:grid;
  grid-template-columns:minmax(0, 1fr) minmax(0, 1fr);
  gap:34px;
  align-items:center;
  margin:30px 0 8px;
}

.bh-featured h2{
  margin:10px 0 12px;
  font-size:clamp(24px, 3vw, 36px);
  line-height:1.2;
  font-weight:800;
  letter-spacing:-.01em;
}
.bh-featured h2 a:hover{ color:var(--green); }

.bh-featured p{
  margin:0 0 22px;
  font-size:var(--fs-lead);
  line-height:1.65;
  color:#44606b;
}

.bh-featured .bh-kicker{ display:flex; align-items:center; gap:12px; }
.bh-featured .bh-kicker::before{ content:""; width:34px; height:3px; border-radius:3px; background:var(--gold); }

.bh-featured-cover{
  position:relative;
  display:block;
  aspect-ratio:16 / 10;
  border-radius:18px;
  overflow:hidden;
  background:#e7eeec;
  box-shadow:var(--shadow);
}
.bh-featured-cover img{ width:100%; height:100%; object-fit:cover; display:block; }

.bh-date{
  position:absolute;
  top:14px;
  right:14px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:5px 11px;
  border-radius:999px;
  background:rgba(255,255,255,.92);
  font-size:var(--fs-small);
  font-weight:600;
  color:var(--ink);
}

.bh-btn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding:13px 24px;
  border-radius:999px;
  background:var(--gold);
  color:var(--ink);
  font-weight:800;
  font-size:var(--fs-ui);
  transition:background .2s, transform .2s;
}
.bh-btn:hover{ background:#f0b410; transform:translateY(-1px); }
.bh-btn-dark{ background:var(--green); color:#fff; }
.bh-btn-dark:hover{ background:var(--green-dark); }

/* ---------- Badge and placeholder picture ---------- */

.bh-badge{
  position:absolute;
  top:12px;
  left:12px;
  padding:4px 11px;
  border-radius:8px;
  background:var(--green);
  color:#fff;
  font-size:var(--fs-label);
  font-weight:700;
  line-height:1.4;
}

.bh-ph{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg, var(--ph, #dff3ee), #fff 160%);
  color:var(--green);
}
.bh-ph .bh-ico{ width:34%; height:34%; max-width:84px; max-height:84px; opacity:.55; stroke-width:1.3; }

/* ---------- Layout and cards ---------- */

.bh-layout{
  display:grid;
  grid-template-columns:minmax(0, 1fr) 320px;
  gap:34px;
  margin-top:36px;
  align-items:start;
}

.bh-h2{
  display:flex;
  align-items:center;
  gap:12px;
  margin:0 0 18px;
  font-size:clamp(22px, 2.4vw, 28px);
  font-weight:800;
  letter-spacing:-.01em;
}
.bh-h2::before{ content:""; width:34px; height:3px; border-radius:3px; background:var(--gold); flex:none; }

.bh-section + .bh-section{ margin-top:34px; }

.bh-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(210px, 1fr));
  gap:18px;
}

.bh-card{
  display:flex;
  flex-direction:column;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  overflow:hidden;
  transition:box-shadow .25s, transform .25s;
}
.bh-card:hover{ box-shadow:0 14px 32px rgba(8,45,56,.12); transform:translateY(-2px); }

.bh-cover{
  position:relative;
  display:block;
  aspect-ratio:16 / 10;
  background:#e7eeec;
  overflow:hidden;
}
.bh-cover img{ width:100%; height:100%; object-fit:cover; display:block; transition:transform .5s; }
.bh-card:hover .bh-cover img{ transform:scale(1.04); }

.bh-body{
  display:flex;
  flex-direction:column;
  gap:8px;
  flex:1;
  padding:14px 16px 16px;
}

.bh-meta{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:4px 8px;
  font-size:var(--fs-small);
  color:var(--muted);
}
.bh-meta .bh-ico{ width:14px; height:14px; }
.bh-meta span::before{ content:"·"; margin-right:8px; }

.bh-card h3{
  margin:0;
  font-size:17px;
  line-height:1.35;
  font-weight:800;
}
.bh-card h3 a:hover{ color:var(--green); }

.bh-card p{
  margin:0;
  flex:1;
  font-size:var(--fs-ui);
  line-height:1.6;
  color:#506a75;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.bh-more{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:4px;
  font-size:var(--fs-ui);
  font-weight:700;
  color:var(--green);
}
.bh-more .bh-ico{ width:15px; height:15px; transition:transform .2s; }
.bh-more:hover .bh-ico{ transform:translateX(3px); }

.bh-empty{
  margin:24px 0;
  padding:22px;
  border:1px dashed #cbd9d5;
  border-radius:14px;
  text-align:center;
  color:var(--muted);
}

/* Filtered out by the topic chips or the search box. */
.bh-card[hidden], .bh-section[hidden], .bh-featured[hidden], .bh-empty[hidden]{ display:none; }

/* ---------- Sidebar ---------- */

.bh-side{ display:grid; gap:22px; }

.bh-newsletter,
.bh-recent{
  padding:22px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
}

.bh-newsletter{
  background:linear-gradient(160deg, #fff9ed, #fff 70%);
}

.bh-news-ico{ width:34px; height:34px; color:var(--gold-dark); margin-bottom:6px; }

.bh-newsletter h2,
.bh-recent h2{
  display:flex;
  align-items:center;
  gap:10px;
  margin:0 0 8px;
  font-size:21px;
  line-height:1.25;
  font-weight:800;
}
.bh-recent h2{ font-size:19px; margin-bottom:14px; }
.bh-recent h2 .bh-ico{ color:var(--gold-dark); width:22px; height:22px; }

.bh-newsletter > p{
  margin:0 0 16px;
  font-size:var(--fs-ui);
  line-height:1.6;
  color:#506a75;
}

.bh-newsletter form{ display:grid; gap:10px; }

.bh-newsletter input[type="email"]{
  width:100%;
  padding:13px 18px;
  border:1px solid #d9e3e0;
  border-radius:999px;
  background:#fff;
  font:inherit;
  font-size:var(--fs-input);
  color:var(--ink);
}
.bh-newsletter input[type="email"]:focus{ outline:2px solid rgba(0,107,91,.35); border-color:var(--green); }

.bh-newsletter button{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:13px 18px;
  border:0;
  border-radius:999px;
  background:var(--green);
  color:#fff;
  font:inherit;
  font-weight:700;
  cursor:pointer;
  transition:background .2s;
}
.bh-newsletter button:hover{ background:var(--green-dark); }
.bh-newsletter button[disabled]{ opacity:.6; cursor:default; }

.bh-news-msg{ margin:0; min-height:1.2em; font-size:var(--fs-small); color:var(--green); }
.bh-news-msg.is-error{ color:#b3261e; }

.bh-hp{ position:absolute; left:-9999px; width:1px; height:1px; opacity:0; }

.bh-recent ul{ list-style:none; margin:0; padding:0; display:grid; gap:14px; }
.bh-recent li{ display:flex; gap:12px; align-items:center; }

.bh-recent-thumb{
  position:relative;
  flex:none;
  width:76px;
  aspect-ratio:4 / 3;
  border-radius:9px;
  overflow:hidden;
  background:#e7eeec;
}
.bh-recent-thumb img{ width:100%; height:100%; object-fit:cover; display:block; }

.bh-recent-title{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  font-size:var(--fs-ui);
  line-height:1.35;
  font-weight:700;
}
.bh-recent-title:hover{ color:var(--green); }

.bh-recent-date{
  display:flex;
  align-items:center;
  gap:6px;
  margin-top:4px;
  font-size:var(--fs-small);
  color:var(--muted);
}
.bh-recent-date .bh-ico{ width:13px; height:13px; }

/* ---------- Call to action ---------- */

.bh-cta{
  display:flex;
  align-items:center;
  gap:22px;
  margin:44px 0 56px;
  padding:24px 30px;
  border-radius:20px;
  background:linear-gradient(100deg, #fff1d6, #fff9ed 60%, #eaf7f3);
  border:1px solid #f3e3bd;
}

.bh-cta-art{
  flex:none;
  display:grid;
  place-items:center;
  width:68px;
  height:68px;
  border-radius:50%;
  background:#fff;
  color:var(--gold-dark);
  box-shadow:0 6px 18px rgba(189,131,0,.18);
}
.bh-cta-art .bh-ico{ width:34px; height:34px; }

.bh-cta-text{ flex:1; min-width:0; }
.bh-cta h2{ margin:6px 0 4px; font-size:clamp(22px, 2.6vw, 30px); font-weight:800; line-height:1.2; }
.bh-cta p{ margin:0; font-size:var(--fs-ui); color:#44606b; }

/* ---------- Focus ---------- */

.blog-home a:focus-visible,
.blog-home button:focus-visible{
  outline:3px solid rgba(0,107,91,.45);
  outline-offset:2px;
}

/* ---------- Tablet ---------- */

@media (max-width:1099px){
  .bh-layout{ grid-template-columns:minmax(0, 1fr); gap:28px; }
  .bh-grid{ grid-template-columns:repeat(auto-fit, minmax(260px, 1fr)); }
  .bh-side{ grid-template-columns:repeat(2, minmax(0, 1fr)); align-items:start; }
}

/* ---------- Phone ---------- */

@media (max-width:760px){
  .bh-hero{ padding:34px 0 38px; }
  .bh-hero h1{ max-width:none; }
  .bh-hero.has-photo{
    background:
      linear-gradient(180deg, rgba(255,255,255,.94) 0%, rgba(255,255,255,.82) 60%, rgba(255,255,255,.55) 100%),
      url("../assets/blog/hero.jpg") center / cover no-repeat;
  }
  .bh-skyline{ height:46%; right:-8%; max-width:none; opacity:.32; }

  .bh-search{ padding-left:14px; }
  .bh-search button{ padding:11px 20px; }

  /* Chips scroll sideways instead of wrapping. */
  .bh-topics{
    display:flex;
    flex-wrap:nowrap;
    gap:10px;
    margin:18px -16px 6px;
    padding:2px 16px 8px;
    overflow-x:auto;
    scroll-snap-type:x proximity;
    scrollbar-width:none;
  }
  .bh-topics::-webkit-scrollbar{ display:none; }
  .bh-topics button{ flex:none; max-width:none; min-width:92px; scroll-snap-align:start; padding:11px 12px 10px; font-size:var(--fs-small); }

  .bh-featured{ grid-template-columns:minmax(0, 1fr); gap:16px; margin-top:20px; }
  .bh-featured-cover{ order:-1; aspect-ratio:16 / 9; }
  .bh-featured p{ margin-bottom:16px; font-size:var(--fs-body); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

  .bh-layout{ margin-top:26px; }
  .bh-grid{ grid-template-columns:minmax(0, 1fr); gap:12px; }

  /* Cards become a list: picture on the left, text on the right. */
  .bh-card{ flex-direction:row; align-items:stretch; border-radius:14px; }
  .bh-card .bh-cover{ flex:0 0 38%; aspect-ratio:auto; min-height:118px; }
  .bh-card .bh-badge{ top:8px; left:8px; padding:3px 8px; font-size:10px; }
  .bh-card .bh-body{ gap:5px; padding:11px 12px; }
  .bh-card h3{ font-size:15px; }
  .bh-card p{ font-size:var(--fs-small); -webkit-line-clamp:2; }
  .bh-card .bh-meta{ font-size:12px; }
  .bh-card .bh-meta span{ display:none; }
  .bh-card .bh-more{ margin-top:0; font-size:var(--fs-small); }

  .bh-side{ grid-template-columns:minmax(0, 1fr); gap:16px; }
  .bh-newsletter, .bh-recent{ padding:18px; border-radius:16px; }
  .bh-recent li:nth-child(n+4){ display:none; }

  .bh-cta{ flex-wrap:wrap; gap:14px; margin:30px 0 40px; padding:20px; }
  .bh-cta-art{ width:52px; height:52px; }
  .bh-cta-art .bh-ico{ width:26px; height:26px; }
  .bh-cta .bh-btn{ width:100%; justify-content:center; }
}

@media (prefers-reduced-motion:reduce){
  .bh-card, .bh-card:hover, .bh-cover img, .bh-btn, .bh-topics button, .bh-more .bh-ico{ transition:none; transform:none; }
}
