/* =========================
   Tokens / base
   ========================= */
:root{
  --page-max: 1100px;
  --gap-x: 32px;
  --gap-y: 20px;
  --media-w: min(42rem, 40vw);   /* image column width on desktop */
  --radius: 8px;
  --shadow-sm: 0 2px 16px rgba(0,0,0,.10);
  --shadow-md: 0 6px 24px rgba(0,0,0,.15);
  --border-subtle: rgba(0,0,0,.08);
  --bg-card: #f7f7f7;
  --bg-page: #d0c6bf;
  --text: #1e1e1e;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body{
  margin: 1rem;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg-page);
  color: #333;
}

/* Hide truly empty paragraphs */
p:empty { display: none; }

/* =========================
   Recipe list (grid of cards)
   ========================= */
.category-group{ margin-bottom: 3rem; }
.category-group h2{
  font-size: 1.5rem;
  margin: 0 0 1rem;
  border-bottom: 2px solid #ccc;
  padding-bottom: 0.5rem;
}

.recipe-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

/*
@media (min-width: 1200px){
  .recipe-grid{ grid-template-columns: repeat(auto-fill, minmax(600px, 1fr)); }
}*/

.recipe-card{
  position: relative;
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
  transition: background .2s;
  scroll-margin-top: 96px; /* aligns with floatbar */
}
.recipe-card:hover{ background: #e0f0e0; }
.recipe-card img{ width: 100%; height: auto; display: block; }

/* Make whole card clickable when a link is inside */
.stretched-link{
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* =========================
   Floating action bar on recipe page
   ========================= */
.recipe-floatbar{
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}
.recipe-floatbar.is-scrolled{ box-shadow: var(--shadow-md); }

@media (max-width: 840px){
  .recipe-floatbar{ left: auto; right: 12px; transform: none; }
}

.btn-pill{
  appearance: none;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.9);
  padding: 6px 10px;
  border-radius: 999px;
  font: inherit;
  line-height: 1.1;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.btn-pill:hover{
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.btn-pill:active{ transform: translateY(1px); }

/* =========================
   Recipe page layout (grid areas)
   ========================= */
/* Mobile-first: stack everything */
.recipe-layout{
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-y) var(--gap-x);
  align-items: start;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 16px;
}

/* Image styling (applies at all sizes) */
.recipe-header img{
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;              /* change to 'contain' if preferred */
  border-radius: var(--radius);
  padding: .9rem;
  background: #fff;
  filter: drop-shadow(10px 10px 15px);
  transform: rotate(1deg);
}

/* Desktop: define areas and lift children into the parent grid */
@media (min-width: 900px){
  .recipe-layout{
    grid-template-columns: 1fr var(--media-w);
    grid-template-areas:
      "title  image"
      "intro  image"
      "ingred steps";
    padding: 0 24px;
  }

  /* Unwrap wrappers so their children become grid items */
  .recipe-header,
  .recipe-body{
    display: contents;
  }

  /* Map elements to areas */
  .recipe-header h1{ grid-area: title; margin: 0 0 8px 0; }
  .intro{             grid-area: intro; }
  .ingredienser{      grid-area: ingred; }
  .steps{             grid-area: steps; }
  .recipe-header img{ grid-area: image; align-self: start; justify-self: stretch; }
}

/* Ingredients table */
.ingredienser{
  max-width: 25rem;
  padding-right: 1rem;
  padding-bottom: 3px;
}
.ingredienser table{ width: 100%; border-collapse: collapse; }
.ingredienser th, .ingredienser td{ padding: 6px 8px; vertical-align:top; text-align: left;  }
.ingredienser thead th{ border-bottom: 1px solid rgba(0,0,0,.15); }
.ingredienser td{
  border: 1px solid #dbdbdb79;
  border-top: none; border-right: none; border-left: none;
}
.ingredienser-namn,
.ingredienser-mangd{ font-weight: 700; }
.ingredienser-enhet{ color: #666; }

/* Steps list */
.steps{ padding-bottom: 1rem; }
.steps ol{ margin: 0; padding-left: 1.25rem; }
.steps li { 
    margin-top: .35rem; 
    margin-bottom: 1rem;}

/* =========================
   Utilities
   ========================= */
/* If you ever link to a card/section, land below sticky UI */
.recipe-card{ scroll-margin-top: 96px; }



.steps {
  padding-left: 1rem;
  padding-bottom: 1rem;
}
/* Make steps look clickable */
.steps ol li {
  cursor: pointer;
  position: relative;
  padding: .35rem .5rem;
  border-radius: .375rem;
  transition: background .15s ease, transform .05s ease;
}
.steps ol li:hover { background: color-mix(in oklab, #000 8%, transparent); }
.steps ol li:active { transform: scale(0.99); }

/* Overlay modal */
.step-modal {
  position: fixed;
  inset: 0;
  display: none;              /* toggled by .open */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  padding: 2rem;
}
.step-modal.open { display: flex; }

/* Card */
.step-card {
  background: #fff;
  color: #111;
  width: min(800px, 92vw);
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 1.25rem 1.25rem 1rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: .75rem;
}
.step-label {
  font-size: .85rem;
  letter-spacing: .03em;
  color: #666;
}

.step-text {
  font-size: clamp(1.5rem, 2.5vw + 1rem, 2.2rem);
  line-height: 1.6;
    overflow: auto;
  padding-right: .25rem;
}

/* Nav bar */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .25rem;
}
.step-actions {
  display: flex; gap: .5rem;
}

/* Buttons */
.step-btn {
  appearance: none;
  border: 1px solid #ddd;
  background: #f7f7f7;
  border-radius: 12px;
  padding: .5rem .8rem;
  font: inherit;
  cursor: pointer;
}
.step-btn:hover { background: #efefef; }
.step-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Big round arrow buttons (left/right) */
.step-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 10rem;
  height: 10rem;
  font-size: 5.5rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}


.step-arrow:hover { background: #f7f7f7; }
.step-arrow--left  { left: 1rem; }
.step-arrow--right { right: 1rem; }

@media (max-width: 640px) {
  .step-arrow { display: none; } /* rely on swipe/keys/buttons on small screens */
}

/* Reduce motion users */
@media (prefers-reduced-motion: no-preference) {
  .step-card { animation: pop .14s ease-out; }
  @keyframes pop {
    from { transform: scale(.98); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
}

.step-voice-btn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: .6rem .9rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font: inherit;
  cursor: pointer;
  z-index: 1100; /* above modal */
}
.step-voice-btn[aria-pressed="true"] {
  background: #f0fff5; /* subtle active hint */
  border-color: #b7e2c2;
}


.recipe-layout {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}
.intro,
.recipe-header {
  display: block;
}
  
  .mainImage {
    width: 20rem;
    height: auto;
    border-radius: 0.5rem;
  }

.recipe-body {
  display: flex;
  flex-direction: column;
  
}

@media (min-width: 768px) {
  .recipe-body {
    flex-direction: row;
    align-items: flex-start;
  }

  .ingredients,
  .steps {
    flex: 1;
  }
}




.steps {
  padding-left: 1rem;
  padding-bottom: 1rem;
}
/* Make steps look clickable */
.steps ol li {
  cursor: pointer;
  position: relative;
  padding: .35rem .5rem;
  border-radius: .375rem;
  transition: background .15s ease, transform .05s ease;
}
.steps ol li:hover { background: color-mix(in oklab, #000 8%, transparent); }
.steps ol li:active { transform: scale(0.99); }

/* Overlay modal */
.step-modal {
  position: fixed;
  inset: 0;
  display: none;              /* toggled by .open */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  padding: 2rem;
}
.step-modal.open { display: flex; }

/* Card */
.step-card {
  background: #fff;
  color: #111;
  width: min(800px, 92vw);
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  padding: 1.25rem 1.25rem 1rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: .75rem;
}
.step-label {
  font-size: .85rem;
  letter-spacing: .03em;
  color: #666;
}

.step-text {
  font-size: clamp(1.5rem, 2.5vw + 1rem, 2.2rem);
  line-height: 1.6;
    overflow: auto;
  padding-right: .25rem;
}

/* Nav bar */
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-top: .25rem;
}
.step-actions {
  display: flex; gap: .5rem;
}

/* Buttons */
.step-btn {
  appearance: none;
  border: 1px solid #ddd;
  background: #f7f7f7;
  border-radius: 12px;
  padding: .5rem .8rem;
  font: inherit;
  cursor: pointer;
}
.step-btn:hover { background: #efefef; }
.step-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Big round arrow buttons (left/right) */
.step-arrow {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 6rem;
  height: 6rem;
  font-size: 3.5rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}


.step-arrow:hover { background: #f7f7f7; }
.step-arrow--left  { left: 1rem; }
.step-arrow--right { right: 1rem; }

@media (max-width: 800px) {
  .step-arrow { display: none; } /* rely on swipe/keys/buttons on small screens */
}

/* Reduce motion users */
@media (prefers-reduced-motion: no-preference) {
  .step-card { animation: pop .14s ease-out; }
  @keyframes pop {
    from { transform: scale(.98); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
  }
}

.step-voice-btn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: .6rem .9rem;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  font: inherit;
  cursor: pointer;
  z-index: 1100; /* above modal */
}
.step-voice-btn[aria-pressed="true"] {
  background: #f0fff5; /* subtle active hint */
  border-color: #b7e2c2;
}


.recipe-layout {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}
.intro,
.recipe-header {
  display: block;
}
  
  .mainImage {
    width: 20rem;
    height: auto;
    border-radius: 0.5rem;
  }

.recipe-body {
  display: flex;
  flex-direction: column;
  
}

@media (min-width: 768px) {
  .recipe-body {
    flex-direction: row;
    align-items: flex-start;
  }

  .ingredients,
  .steps {
    flex: 1;
  }
}
