/*
 * static/css/style.css
 * Margretelund Lantbruk AB – main stylesheet
 * Built by Mats-Olof Liljegren, e-pro (https://e-pro.se)
 *
 * Structure:
 *   1.  CSS custom properties (design tokens)
 *   2.  Reset / base styles
 *   3.  Site header – banner image
 *   4.  Navigation – sticky nav-row, desktop, hamburger, mobile overlay
 *   5.  Page content
 *   6.  Float figure – heart-potato image on home page
 *   7.  Site footer
 *   8.  Utility classes
 *   9.  Responsive – mobile (max 640px)
 */

/* =============================================================================
   1. CSS custom properties – edit here to restyle the entire site
   ============================================================================= */
:root {
  /* Brand colors */
  --color-primary:      #4a7c3f;   /* dark green – nav links, accents */
  --color-primary-dark: #3a6130;   /* hover / focus state */
  --color-accent:       #f5a623;   /* orange – active nav link */
  --color-white:        #ffffff;
  --color-bg:           #ffffff;
  --color-text:         #222222;
  --color-text-muted:   #555555;
  --color-border:       #dddddd;
  --color-footer-bg:    #f4f4f4;

  /* Typefaces */
  --font-body:    Georgia, "Times New Roman", serif;
  --font-heading: Arial, Helvetica, sans-serif;
  --font-nav:     Arial, Helvetica, sans-serif;

  /* Font sizes */
  --font-size-base:  1rem;       /* 16px */
  --font-size-small: 0.875rem;   /* 14px */
  --font-size-nav:   0.9375rem;  /* 15px */
  --font-size-h1:    1.75rem;
  --font-size-h2:    1.375rem;
  --font-size-h3:    1.125rem;

  /* Spacing scale */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-xxl: 3rem;

  /* Layout */
  --max-width:  960px;
  --logo-width: 180px;
}

/* =============================================================================
   2. Reset and base styles
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary); text-decoration: underline; }
a:hover, a:focus { color: var(--color-primary-dark); }

ul { padding-left: var(--space-lg); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.25;
  color: var(--color-text);
}
h1 { font-size: var(--font-size-h1); margin-bottom: var(--space-md); }
h2 { font-size: var(--font-size-h2); margin-top: var(--space-xl); margin-bottom: var(--space-sm); }
h3 { font-size: var(--font-size-h3); margin-bottom: var(--space-sm); }

p { margin-bottom: var(--space-md); }

/* =============================================================================
   3. Site header
   The banner image (logga_potatis.jpg) contains the company logotype and
   scrolls away with the page. Only the nav-row is sticky.
   ============================================================================= */
.site-header { background-color: var(--color-white); }

.site-header__banner { width: 100%; background-color: #e8f0e5; }
.site-header__banner-img { width: 100%; height: auto; display: block; }

.site-header__inner {
  display: flex;
  align-items: flex-start;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
}

.site-header__right { flex: 1; }

/* =============================================================================
   4. Navigation
   ============================================================================= */

/* Sticky nav-row */
.nav-desktop-row {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-white);
  border-bottom: 2px solid var(--color-border);
  padding: var(--space-sm) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Desktop nav – horizontal links with animated underline */
.nav-desktop {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2rem;
}

.nav-desktop a {
  display: inline-block;
  font-family: var(--font-nav);
  font-size: var(--font-size-nav);
  font-weight: bold;
  text-decoration: none;
  color: var(--color-text-muted);
  background: none;
  padding: 0;
  position: relative;
  transition: color 0.2s;
}

.nav-desktop a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--color-primary);
  transition: width 0.25s ease;
}
.nav-desktop a:hover,
.nav-desktop a.active        { color: var(--color-primary); background: none; }
.nav-desktop a:hover::after,
.nav-desktop a.active::after { width: 100%; }

/* Hamburger – hidden on desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--color-text);
  transition: transform 0.3s, opacity 0.3s;
}
.nav-hamburger.open span:first-child { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:last-child  { transform: translateY(-7px) rotate(-45deg); }

/* Fullscreen mobile overlay */
.nav-overlay {
  position: fixed; inset: 0;
  background: var(--color-primary);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-overlay.open { opacity: 1; pointer-events: all; }

.nav-close {
  position: absolute;
  top: 1.5rem; right: 2rem;
  background: none; border: none;
  color: rgba(255,255,255,0.7);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}
.nav-close:hover { color: var(--color-white); }

.nav-fullscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}
.nav-fullscreen-link {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease, color 0.2s;
}
.nav-fullscreen-link.visible { opacity: 1; transform: translateY(0); }
.nav-fullscreen-link:hover   { color: var(--color-white); }

/* =============================================================================
   5. Page content
   ============================================================================= */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md) var(--space-md);
}

.page { max-width: 700px; }

.page__title {
  font-size: clamp(1rem, 5vw, var(--font-size-h1));
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.page__intro {
  font-family: var(--font-heading);
  font-size: var(--font-size-h3);
  font-weight: bold;
  margin-bottom: var(--space-sm);
}

.page__tagline {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: var(--space-lg);
  color: var(--color-text-muted);
}

.page__body    { font-size: var(--font-size-base); }
.page__body ul { margin-bottom: var(--space-md); }
.page__body li { margin-bottom: var(--space-sm); }

/* =============================================================================
   6. Float figure – heart-potato image on home page
   ============================================================================= */
.img-float-right {
  float: right;
  width: 20%;
  margin: 0 0 var(--space-md) var(--space-lg);
  border-radius: 4px;
}

.img-float-right figcaption {
  font-size: var(--font-size-small);
  font-style: italic;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
  text-align: center;
}

/* Clearfix – prevents float from bleeding into footer */
.page__body::after { content: ""; display: table; clear: both; }

/* =============================================================================
   7. Site footer
   Uses a two-row flex layout:
     Row 1: logo + contact info (flex)
     Row 2: built-by credit (full width, right-aligned)
   ============================================================================= */
.site-footer {
  background-color: var(--color-footer-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-xl) 0 var(--space-md);
  margin-top: var(--space-md);
}

/* Wrapping flex container – allows credit to sit on its own row */
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.site-footer__logo     { flex-shrink: 0; }
.site-footer__logo-img { width: 100px; height: auto; }

.site-footer__contact {
  font-style: normal;
  font-size: var(--font-size-small);
  line-height: 1.8;
}
.site-footer__company     { font-weight: bold; font-size: var(--font-size-base); margin-bottom: var(--space-xs); }
.site-footer__address     { margin-bottom: var(--space-sm); color: var(--color-text-muted); }
.site-footer__person      { margin-bottom: var(--space-xs); }
.site-footer__email       { color: var(--color-primary); }
.site-footer__person-info { color: var(--color-text-muted); }
.site-footer__office      { margin-top: var(--space-sm); color: var(--color-text-muted); }

/* Credit row – full width, sits below logo+contact */
.site-footer__credit {
  width: 100%;
  text-align: right;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-border);
  font-size: 0.75rem;
  font-style: italic;
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.site-footer__credit a { color: var(--color-text-muted); text-decoration: none; }
.site-footer__credit a:hover { color: var(--color-primary); }

/* =============================================================================
   8. Utility classes
   ============================================================================= */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================================
   9. Responsive – mobile (max 640px)
   ============================================================================= */
@media (max-width: 640px) {

  /* Banner: taller crop anchored left so embedded logotype stays visible */
  .site-header__banner-img {
    height: 180px;
    object-fit: cover;
    object-position: left center;
  }

  /* Hide desktop nav, show hamburger */
  .nav-desktop   { display: none; }
  .nav-hamburger { display: flex; }

  /* Heart-potato: full column width, no float */
  .img-float-right {
    float: none;
    width: 100%;
    margin: 0 0 var(--space-md) 0;
  }

  /* Footer: stack columns vertically */
  .site-footer__inner { flex-direction: column; }
}
