/* =========================================================
   Crochet Haven — stylesheet
   Mobile-first. Two type families: Fraunces (display) + Karla (body).
   ========================================================= */

:root{
  /* ---- color tokens (yarn-shelf palette) ---- */
  --bg:        #FBF6EA;   /* warm wool cream */
  --bg-alt:    #F1E4CB;   /* deeper oat, for cards/sections */
  --surface:   #FFFDF8;   /* lightest surface, for raised cards */
  --ink:       #2B2320;   /* warm near-black brown, body text */
  --ink-soft:  #6C5C50;   /* muted brown-grey, secondary text */
  --berry:     #A23E4C;   /* cranberry yarn — primary accent */
  --berry-dark:#7C2E39;
  --sage:      #6F7F58;   /* moss green — secondary accent */
  --sage-dark: #566446;
  --mustard:   #D69A34;   /* ochre — tertiary accent */
  --denim:     #4C6B79;   /* soft teal — quaternary accent */
  --border:    #E3D3B4;

  --radius-sm: 6px;
  --radius-md: 14px;
  --shadow-card: 0 2px 0 var(--border), 0 10px 24px -18px rgba(43,35,32,.45);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Karla", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --max-w: 1180px;
}

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

html{
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg{ max-width: 100%; display: block; }

h1, h2, h3, h4{
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 .5em;
  color: var(--ink);
}
h1{ font-size: clamp(2.1rem, 5.5vw, 3.4rem); font-weight: 500; }
h2{ font-size: clamp(1.5rem, 3.6vw, 2.2rem); }
h3{ font-size: clamp(1.15rem, 2.4vw, 1.4rem); }

p{ margin: 0 0 1em; max-width: 68ch; }
a{ color: var(--berry-dark); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover{ color: var(--berry); }

.container{
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.visually-hidden{
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

:focus-visible{
  outline: 3px solid var(--denim);
  outline-offset: 2px;
  border-radius: 3px;
}

/* skip link */
.skip-link{
  position: absolute; left: 1rem; top: -3rem;
  background: var(--ink); color: #fff; padding: .6em 1em;
  border-radius: var(--radius-sm); z-index: 200; transition: top .15s ease;
}
.skip-link:focus{ top: 1rem; }

/* ---------------------------------------------------------
   Header / nav
   --------------------------------------------------------- */
.site-header{
  position: sticky; top: 0; z-index: 100;
  background: rgba(251,246,234,.92);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--border);
}
.nav-row{
  display: flex; align-items: center; justify-content: space-between;
  padding-block: .8rem;
}
.brand{
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover{ color: var(--berry-dark); }
.brand svg{ width: 34px; height: 34px; flex-shrink: 0; }

.nav-toggle{
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: transparent; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.nav-toggle svg{ width: 22px; height: 22px; }
.nav-toggle[aria-expanded="true"] .icon-open{ display:none; }
.nav-toggle[aria-expanded="false"] .icon-close{ display:none; }

.site-nav{
  display: none;
  flex-direction: column;
  gap: .1rem;
  padding-block: .5rem 1rem;
  border-top: 1px solid var(--border);
}
.site-nav.is-open{ display: flex; }
.site-nav a{
  padding: .65rem .2rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1px dashed var(--border);
}
.site-nav a:last-child{ border-bottom: none; }
.site-nav a.is-active{ color: var(--berry-dark); }

@media (min-width: 780px){
  .nav-toggle{ display: none; }
  .site-nav{
    display: flex !important;
    flex-direction: row;
    border-top: none;
    padding-block: 0;
    gap: 1.9rem;
  }
  .site-nav a{ border-bottom: none; padding: .3rem 0; position: relative; }
  .site-nav a::after{
    content: ""; position: absolute; left: 0; right: 100%; bottom: -3px; height: 2px;
    background: var(--berry); transition: right .18s ease;
  }
  .site-nav a:hover::after, .site-nav a.is-active::after{ right: 0; }
}

/* ---------------------------------------------------------
   Social links (header nav + footer)
   --------------------------------------------------------- */
.social-links{
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: 1rem;
  margin-bottom: .3rem;
  padding-top: .9rem;
  border-top: 1px dashed var(--border);
}
.social-link{
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1.5px solid var(--border); border-radius: 50%;
  color: var(--ink-soft);
  line-height: 0;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .12s ease;
}
.social-link svg{ display: block; width: 17px; height: 17px; }
.social-link:hover{
  background: var(--berry); border-color: var(--berry); color: var(--surface);
  transform: translateY(-2px);
}
@media (min-width: 780px){
  .site-nav{ justify-content: flex-start; }
  .site-nav .social-links{
    margin: 0 0 .3rem auto; padding: 0; border: none;
  }
}
.footer-social.social-links{
  margin-top: .9rem; padding-top: 0; border-top: none;
}

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--font-body); font-weight: 700; font-size: .98rem;
  padding: .8em 1.4em; border-radius: 999px;
  border: 2px solid transparent; cursor: pointer;
  text-decoration: none; line-height: 1;
  transition: transform .12s ease, background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0); }
.btn-primary{ background: var(--berry); color: #fff; }
.btn-primary:hover{ background: var(--berry-dark); color: #fff; }
.btn-outline{ background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover{ background: var(--ink); color: var(--bg); }
.btn-block{ width: 100%; }

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */
.hero{
  padding-block: 2.6rem 2rem;
  overflow: hidden;
}
.hero-grid{
  display: grid;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 860px){
  .hero-grid{ grid-template-columns: 1.15fr 1fr; gap: 3rem; }
}
.eyebrow-tag{
  display: inline-block;
  background: var(--bg-alt);
  color: var(--berry-dark);
  border: 1px solid var(--border);
  padding: .3em .9em;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.hero p.lede{ font-size: 1.1rem; color: var(--ink-soft); }
.hero-ctas{ display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.4rem; }
.hero-art{ justify-self: center; width: min(340px, 80%); }

/* ---------------------------------------------------------
   Scalloped divider — crochet edging motif (structural, not decorative filler)
   --------------------------------------------------------- */
.scallop{
  height: 18px;
  width: 100%;
  background-image: radial-gradient(circle at 10px 0, transparent 9px, var(--bg-alt) 9.5px);
  background-size: 20px 18px;
  background-repeat: repeat-x;
}
.scallop.flip{ transform: scaleY(-1); }
.scallop-berry{ background-image: radial-gradient(circle at 10px 0, transparent 9px, var(--berry) 9.5px); }

/* ---------------------------------------------------------
   Sections
   --------------------------------------------------------- */
.section{ padding-block: 2.8rem; }
.section-alt{ background: var(--bg-alt); }
.section-head{
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; margin-bottom: 1.6rem;
}
.section-head p{ margin: 0; color: var(--ink-soft); }

/* ---------------------------------------------------------
   Cards
   --------------------------------------------------------- */
.grid{
  display: grid;
  gap: 1.4rem;
  grid-template-columns: 1fr;
}
@media (min-width: 620px){
  .grid-2{ grid-template-columns: repeat(2, 1fr); }
  .grid-3{ grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 940px){
  .grid-3{ grid-template-columns: repeat(3, 1fr); }
  .grid-4{ grid-template-columns: repeat(4, 1fr); }
}

.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover{ transform: translateY(-3px); }
.card-thumb{
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.card-thumb svg{ width: 46%; height: 46%; }
.card-body{ padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.card-cat{
  font-size: .75rem; font-weight: 800; letter-spacing: .02em;
  color: var(--berry-dark); margin-bottom: .4rem;
}
.card h3{ margin-bottom: .35rem; }
.card p{ color: var(--ink-soft); font-size: .95rem; margin-bottom: .8rem; }
.card-link{ margin-top: auto; font-weight: 800; text-decoration: none; }
.card-link::after{ content: " →"; }

.thumb-berry{ background: var(--berry); }
.thumb-sage{ background: var(--sage); }
.thumb-mustard{ background: var(--mustard); }
.thumb-denim{ background: var(--denim); }

/* Category chip filters */
.chip-row{ display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 1.8rem; }
.chip{
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: .5em 1.05em;
  border-radius: 999px;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
}
.chip:hover{ border-color: var(--berry); }
.chip[aria-pressed="true"]{
  background: var(--ink); border-color: var(--ink); color: var(--bg);
}

/* Category feature cards (categories page top grid) */
.cat-card{
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1.2rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-card);
}
.cat-card:hover{ border-color: var(--berry); color: var(--ink); }
.cat-icon{
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.cat-card h3{ margin-bottom: .15rem; font-size: 1.05rem; }
.cat-card p{ margin: 0; font-size: .88rem; color: var(--ink-soft); }
.cat-count{ font-size: .78rem; color: var(--ink-soft); font-weight: 700; }

/* ---------------------------------------------------------
   Ad slots — clearly labelled, easy to wire up to AdSense
   --------------------------------------------------------- */
.ad-slot{
  margin-block: 2rem;
  padding: 1.6rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  text-align: center;
  min-height: 100px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
}
.ad-slot span{
  font-size: .72rem; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700;
}
.ad-slot--leaderboard{ max-width: 728px; margin-inline: auto; }
.ad-slot--infeed{ grid-column: 1 / -1; }

/* ---------------------------------------------------------
   Newsletter
   --------------------------------------------------------- */
.newsletter{
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-md);
  padding: 2.2rem 1.4rem;
  text-align: center;
}
.newsletter h2, .newsletter p{ color: var(--bg); }
.newsletter p{ color: #E7DCC9; margin-inline: auto; }
.newsletter-form{
  display: flex; flex-direction: column; gap: .7rem;
  max-width: 420px; margin: 1.3rem auto 0;
}
@media (min-width: 520px){
  .newsletter-form{ flex-direction: row; }
}
.newsletter-form input[type="email"]{
  flex: 1;
  padding: .8em 1em;
  border-radius: 999px;
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
}
.form-msg{ margin-top: .8rem; font-size: .9rem; font-weight: 700; }
.form-msg[hidden]{ display: none; }

/* ---------------------------------------------------------
   Forms (contact page)
   --------------------------------------------------------- */
.form-field{ margin-bottom: 1.2rem; }
.form-field label{ display: block; font-weight: 800; margin-bottom: .4rem; font-size: .92rem; }
.form-field input, .form-field textarea{
  width: 100%;
  padding: .75em .9em;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink);
}
.form-field input:focus, .form-field textarea:focus{ border-color: var(--berry); }
.form-hint{ font-size: .8rem; color: var(--ink-soft); margin-top: .3rem; }

/* ---------------------------------------------------------
   Content pages (privacy / terms / about)
   --------------------------------------------------------- */
.prose-page{ padding-block: 2.5rem 3.5rem; }
.prose-page .updated{ color: var(--ink-soft); font-size: .9rem; margin-bottom: 2rem; }
.prose-page h2{ margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.4rem; }
.prose-page h2:first-of-type{ border-top: none; padding-top: 0; }
.prose-page ul{ padding-left: 1.2rem; }
.prose-page li{ margin-bottom: .5rem; }
.toc{
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.2rem 1.4rem; margin-bottom: 2rem;
}
.toc h2{ font-size: 1rem; margin-bottom: .6rem; border: none; padding: 0; }
.toc ol{ margin: 0; padding-left: 1.2rem; }
.toc a{ font-weight: 700; }

/* ---------------------------------------------------------
   Article page (sample tutorial)
   --------------------------------------------------------- */
.article-head{ padding-block: 2.2rem 1.5rem; }
.article-meta{ color: var(--ink-soft); font-size: .92rem; margin-bottom: .8rem; }
.article-body{ padding-block: 1rem 3rem; }
.article-body h2{ margin-top: 2rem; }
.article-body ol, .article-body ul{ padding-left: 1.3rem; }
.article-body li{ margin-bottom: .6rem; }
.materials-box{
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.3rem 1.4rem; margin: 1.6rem 0;
}
.materials-box h2{ margin-top: 0; }
.tag-row{ display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.8rem; }
.tag{
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: .3em .85em; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--ink-soft);
  text-decoration: none;
}

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */
.site-footer{
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding-block: 2.6rem 1.6rem;
  margin-top: 2rem;
}
.footer-grid{
  display: grid; gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 700px){
  .footer-grid{ grid-template-columns: 1.3fr 1fr 1fr; }
}
.footer-brand{ display: flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-size: 1.2rem; margin-bottom: .6rem; }
.footer-brand svg{ width: 28px; height: 28px; }
.footer-col h4{ font-size: .85rem; letter-spacing: .02em; margin-bottom: .8rem; }
.footer-col ul{ list-style: none; margin: 0; padding: 0; }
.footer-col li{ margin-bottom: .55rem; }
.footer-col a{ color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.footer-col a:hover{ color: var(--berry-dark); }
.footer-bottom{
  display: flex; flex-wrap: wrap; gap: .8rem 1.4rem; align-items: center; justify-content: space-between;
  margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--border);
  font-size: .85rem; color: var(--ink-soft);
}
.footer-legal a{ color: var(--ink-soft); margin-right: 1rem; }

/* ---------------------------------------------------------
   Cookie banner
   --------------------------------------------------------- */
.cookie-banner{
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 300;
  max-width: 640px; margin-inline: auto;
  background: var(--ink); color: var(--bg);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; justify-content: space-between;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
}
.cookie-banner[hidden]{ display: none; }
.cookie-banner p{ margin: 0; font-size: .88rem; color: #EFE6D3; flex: 1 1 240px; }
.cookie-banner a{ color: var(--mustard); }
.cookie-actions{ display: flex; gap: .6rem; }
.cookie-actions .btn{ padding: .55em 1.1em; font-size: .85rem; }

/* ---------------------------------------------------------
   Small helpers
   --------------------------------------------------------- */
.center-copy{ max-width: 640px; margin-inline: auto; text-align: center; }
.center-copy p{ margin-inline: auto; }
.mt-0{ margin-top: 0; }
