/* style.css - KANYIGO site styles
   Includes:
   - Sticky header
   - Card hover/keyboard/touch interactions (scale + green text)
   - Responsive layout (3 → 2 → 1 columns)
   - Mobile cards stacked in descending visual order
   - Larger images on small screens
   - Scroll reveal animations using CSS classes
*/

/* Color & sizing variables */
:root{
  --primary: #32aa27;
  --text: #162415;
  --muted: #666;
  --bg: #f7f7f7;
  --card-bg: #efefef;
  --max-width: 1200px;
  --gap: 1.25rem;
  --radius: 8px;
  --transition-fast: 180ms;
  --transition-med: 260ms;
}

/* Reset / base */
*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Georgia, 'Times New Roman', Times, serif, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  line-height:1.5;
}

/* Layout container */
.container{ max-width:var(--max-width); margin:0 auto; padding:0 1rem; }

/* Header (sticky) */
header{
  position:sticky;
  top:0;
  z-index:1100;
  background: linear-gradient(180deg, rgba(22,36,21,0.98), rgba(22,36,21,0.98));
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:0.6rem 0;
}
.brand{
  color:#fff;
  font-weight:800;
  letter-spacing:2px;
  font-size:1.25rem;
  text-decoration:none;
  display:inline-block;
  padding: .15rem .25rem;
}
nav.main-nav{
  display:flex;
  gap:1rem;
  align-items:center;
}
nav.main-nav a{
  color: var(--primary);
  text-decoration:none;
  margin:0 0.5rem;
  font-weight:bold;
  padding:.35rem .45rem;
  border-radius:4px;
}
nav.main-nav a:hover,
nav.main-nav a:focus{
  color:#fff;
  background:rgba(255,255,255,0.06);
  text-decoration: none;
  outline: none;
}

/* Hero */
.hero{
  background: #333 url('../images/hero.jpg') center/cover no-repeat;
  color:#fff;
  padding:3.5rem 1rem;
  text-align:left;
  margin-bottom:1rem;
  border-radius: 0;
}
.hero h1{ margin:0 0 .25rem; font-size:2rem; font-weight:700; }
.hero p{ margin:.5rem 0 1rem; color:#f0f0f0; }

/* Buttons */
.button{
  display:inline-block;
  background:var(--primary);
  color:#fff;
  padding:.7em 1.5em;
  border-radius:3px;
  text-decoration:none;
  font-weight:600;
}
.button.secondary{
  background:#eee;
  color:#333;
  border:2px solid var(--primary);
}

/* Section styling */
section{
  background:#fff;
  margin:1.25rem auto;
  padding:1.25rem;
  border-radius:6px;
  max-width:900px;
}

/* About */
.about-row{
  display:flex;
  gap:2rem;
  flex-wrap:wrap;
  align-items:center;
}
.about-text{ flex:1; min-width:260px; }
.about-img{ flex:1; min-width:260px; }
.about-img img{
  width:100%;
  max-width:450px;
  border-radius:6px;
  display:block;
  object-fit:cover;
}

/* SERVICES / CARDS */
.services-row{
  display:flex;
  flex-wrap:wrap;
  gap:var(--gap);
  align-items:flex-start;
  justify-content:space-between;
}

/* Card base */
.card{
  background:var(--card-bg);
  border-radius:6px;
  flex:1 1 calc(33.333% - var(--gap));
  max-width: calc(33.333% - var(--gap));
  min-width:220px;
  display:flex;
  flex-direction:column;
  text-align:left;
  padding:0;
  overflow:hidden;
  box-shadow:0 2px 8px rgba(0,0,0,0.10);
  transition: transform var(--transition-med) ease, box-shadow var(--transition-med) ease;
  text-decoration:none;
  color:inherit;
  cursor:pointer;
  will-change: transform;
}

/* Ensure anchor cards are focusable and accessible (a is focusable by default) */

/* Thumb / image covers top of card */
.card .thumb{
  width:100%;
  height:320px; /* desktop default */
  overflow:hidden;
  background:#ddd;
  display:block;
}
.card .thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transition: transform 350ms ease;
}

/* content */
.card .body{
  padding:1rem;
  flex:1 1 auto;
}
.card h4{ margin:0 0 .5rem; font-size:1.05rem; transition: color var(--transition-fast) ease; }
.card p{ margin:0; color:var(--muted); transition: color var(--transition-fast) ease; }

/* Hover / focus / keyboard focus / touched toggled state:
   enlarge and change text to primary green */
.card:hover,
.card:focus,
.card:focus-within,
.card.hovered {
  transform: scale(1.04);
  box-shadow: 0 12px 36px rgba(0,0,0,0.18);
}
.card:hover .thumb img,
.card.hovered .thumb img {
  transform: scale(1.03);
}
.card:hover h4,
.card:focus h4,
.card.hovered h4,
.card:hover p,
.card:focus p,
.card.hovered p {
  color: var(--primary);
}

/* Flash */
.flash{
  background:#dff0d8;
  color:#3c763d;
  padding:.75em 1em;
  margin-bottom:1em;
  border-radius:4px;
  border:1px solid #d4f1d4;
}

/* Contact form */
.contact-form{
  max-width:720px;
  margin-top:1em;
  display:flex;
  flex-direction:column;
  gap:.6rem;
}
.contact-form label{ display:block; color:#333; }
.contact-form input,
.contact-form textarea{
  font-size:1rem;
  width:100%;
  padding:.6rem .5rem;
  border-radius:6px;
  border:1px solid #ccc;
  resize:vertical;
}
.contact-form button{
  background:var(--primary);
  color:#fff;
  border:none;
  padding:.6rem 1.2rem;
  border-radius:6px;
  cursor:pointer;
  font-weight:600;
}

/* Contact info */
.contact-info{ margin-top:1rem; color:var(--muted); }
.contact-info a{ color:#0275d8; }

/* Footer */
footer{
  text-align:center;
  font-size:1.05rem;
  padding:1rem 0;
  background:#162415;
  color:#fff;
}

/* Accessibility focus ring for keyboard users */
.card:focus-within{
  outline: 3px solid rgba(50,170,39,0.12);
  outline-offset: 2px;
}

/* Scroll reveal initial state & active state */
.reveal{
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms cubic-bezier(.2,.9,.2,1), transform 520ms cubic-bezier(.2,.9,.2,1);
  will-change: opacity, transform;
}
.reveal.in-view{
  opacity: 1;
  transform: translateY(0);
}

/* Responsive rules */
/* Tablet - two columns */
@media (max-width: 991px){
  .about-row{ flex-direction: column-reverse; align-items:center; }
  .card{ flex:1 1 calc(50% - var(--gap)); max-width: calc(50% - var(--gap)); }
  .card .thumb{ height:360px; }
  .hero h1{ font-size:1.8rem; }
}

/* Mobile - single column stacked and descending order */
@media (max-width: 767px){
  .services-row{
    flex-direction: column-reverse; /* descending visual order */
    align-items: stretch;
  }
  .card{
    flex:1 1 100%;
    max-width:100%;
  }
  .card .thumb{
    height: 45vh;      /* large image height on small screens */
    min-height: 320px;
  }
  .hero{ padding: 2.5rem 1rem; }
  nav.main-nav{ display:none; } /* hide nav on small screens (optional) */
  .brand{ font-size:1.35rem; }
}

/* Utility: make card anchors display:block to fill the tile */
.card[role="listitem"]{ display:block; }