/* ============================================================
   SEIVA · Cozinha Botânica
   Herbário comestível · papel, tinta-verde, ilustração a traço
   Nested CSS
   ============================================================ */

:root {
  --paper:  #f3eede;   /* papel de herbário */
  --paper2: #ece5d0;
  --ink:    #2b3a2e;   /* tinta verde-escura */
  --green:  #3d6b47;
  --sage:   #7d9a76;
  --ochre:  #b98a3e;   /* flor prensada */
  --terra:  #b5623a;
  --muted:  #6f7a63;
  --line:   rgba(43,58,46,0.2);

  --font-serif: "Spectral", Georgia, serif;
  --font-mono:  "IBM Plex Mono", monospace;

  --maxw: 1080px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 300;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  overflow-x: hidden;
  /* faint paper fibres */
  background-image:
    radial-gradient(circle at 20% 30%, rgba(185,138,62,0.05), transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(61,107,71,0.05), transparent 30%);

  &.is-loading { overflow: hidden; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.1; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
::selection { background: var(--sage); color: var(--paper); }

/* ---------- Reveal (placed on paper) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px) rotate(-0.6deg);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  &.is-visible { opacity: 1; transform: none; }
}

/* ============================================================
   Intro — a sprout grows, then the name
   ============================================================ */
.intro {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.4rem;
  background: var(--paper);
  transition: opacity 0.7s ease, visibility 0.7s;

  &.is-done { opacity: 0; visibility: hidden; }

  & .intro__sprout { width: clamp(90px, 22vw, 130px); height: auto; }
  & .stem  { stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1s var(--ease) 0.1s forwards; }
  & .leafL { stroke-dasharray: 90;  stroke-dashoffset: 90;  animation: draw 0.7s var(--ease) 0.9s forwards; }
  & .leafR { stroke-dasharray: 90;  stroke-dashoffset: 90;  animation: draw 0.7s var(--ease) 1.2s forwards; }

  & .intro__word {
    font-family: var(--font-mono);
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    letter-spacing: 0.5em;
    color: var(--green);
    margin: 0.8rem 0 0;
    padding-left: 0.5em;
    opacity: 0;
    animation: fade 0.9s ease 1.5s forwards;
  }
  & .intro__sub {
    font-style: italic;
    color: var(--muted);
    margin: 0;
    opacity: 0;
    animation: fade 0.9s ease 1.75s forwards;
  }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* ============================================================
   Header
   ============================================================ */
.head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem clamp(1rem, 5vw, 3rem);
  transition: background 0.5s var(--ease), padding 0.5s var(--ease), border-color 0.5s;
  border-bottom: 1px solid transparent;

  &.is-scrolled {
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    backdrop-filter: blur(8px);
    border-bottom-color: var(--line);
    padding-block: 0.8rem;
  }

  & .mark {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    letter-spacing: 0.4em;
    padding-left: 0.4em;
    color: var(--green);
  }
  & .nav {
    display: flex;
    gap: clamp(0.8rem, 2.5vw, 1.8rem);
    & a {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--muted);
      transition: color 0.3s;
      &:hover { color: var(--green); }
    }
  }
  & .head__tag {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: var(--paper);
    background: var(--green);
    padding: 0.25rem 0.7rem;
    border-radius: 3px;
  }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  max-width: 780px;
  margin-inline: auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8rem clamp(1.4rem, 6vw, 3rem) 5rem;

  & .hero__eyebrow {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 0.72rem;
    color: var(--ochre);
    margin: 0 0 1.4rem;
  }
  & .hero__title {
    font-family: var(--font-serif);
    font-weight: 300;
    font-size: clamp(2.8rem, 9vw, 5.6rem);
    line-height: 1.02;
    & em { font-style: italic; color: var(--green); }
  }
  & .hero__lede {
    max-width: 34rem;
    margin: 1.8rem 0 2.4rem;
    color: var(--muted);
    font-size: 1.08rem;
  }
}

/* ---------- Button ---------- */
.btn {
  align-self: flex-start;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  padding: 0.8rem 1.8rem;
  border: 1px solid var(--green);
  border-radius: 999px;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
  &:hover { background: var(--green); color: var(--paper); }
}

/* ============================================================
   Plates (chapters)
   ============================================================ */
.plate {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.4rem, 6vw, 3rem);

  &--tint {
    max-width: none;
    background: var(--paper2);
    & > * { max-width: var(--maxw); margin-inline: auto; }
  }

  & .plate__head {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
    padding-bottom: 1.2rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--line);

    & .plate__idx {
      font-family: var(--font-serif);
      font-size: clamp(2rem, 6vw, 3.2rem);
      font-style: italic;
      color: var(--ochre);
      line-height: 1;
    }
    & .plate__title { font-family: var(--font-serif); font-size: clamp(1.7rem, 5vw, 2.6rem); color: var(--ink); }
    & .plate__sub { font-style: italic; color: var(--muted); margin: 0.2rem 0 0; }
  }
}

/* ---------- Specimen cards ---------- */
.specimens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: clamp(1.2rem, 3vw, 2rem);
}

.spec {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.6rem 1.4rem 1.4rem;
  text-align: center;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);

  /* herbarium mounting-tape corner */
  &::before {
    content: "";
    position: absolute;
    top: -7px; left: 50%;
    width: 46px; height: 16px;
    margin-left: -23px;
    background: rgba(185,138,62,0.28);
    transform: rotate(-2deg);
  }

  & .spec__no {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.15em;
    color: var(--ochre);
  }
  & .spec__ico {
    display: block;
    width: 54px; height: 80px;
    margin: 0.6rem auto 0.4rem;
    color: var(--green);
  }
  & .spec__name { font-family: var(--font-serif); font-size: 1.25rem; color: var(--ink); }
  & .spec__latin {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--sage);
    margin: 0.1rem 0 0.5rem;
  }
  & .spec__desc { font-size: 0.88rem; color: var(--muted); margin: 0; min-height: 3.4em; }
  & .spec__price {
    display: inline-block;
    margin-top: 0.8rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--green);
    &::after { content: " €"; color: var(--ochre); }
  }

  &:hover {
    transform: translateY(-5px) rotate(0.5deg);
    box-shadow: 0 16px 30px -20px rgba(43,58,46,0.5);
  }
  &:hover .spec__ico { color: var(--terra); transition: color 0.4s; }
}

/* ============================================================
   Quote divider (no image — pure paper, like a field note)
   ============================================================ */
.quote {
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(3.5rem, 9vw, 6rem) clamp(1.4rem, 6vw, 3rem);
  text-align: center;

  & .quote__body {
    margin: 0;
    & p {
      font-family: var(--font-serif);
      font-style: italic;
      font-weight: 300;
      font-size: clamp(1.5rem, 4vw, 2.4rem);
      line-height: 1.4;
      color: var(--green);
      margin: 0;
      text-wrap: balance;
      &::before, &::after { content: ""; }
    }
    & cite {
      display: block;
      margin-top: 1.4rem;
      font-family: var(--font-mono);
      font-style: normal;
      font-size: 0.74rem;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: var(--ochre);
    }
  }
}

/* ============================================================
   Footer
   ============================================================ */
.foot {
  border-top: 1px solid var(--line);
  text-align: center;
  padding: clamp(3rem, 6vw, 4.5rem) 1.5rem 3.5rem;

  & .foot__ico { display: block; width: 34px; height: 50px; margin: 0 auto 0.8rem; color: var(--green); }
  & .foot__mark { font-family: var(--font-mono); font-size: 1.2rem; letter-spacing: 0.4em; padding-left: 0.4em; color: var(--green); margin: 0 0 0.4rem; }
  & .foot__tag { font-style: italic; color: var(--muted); margin: 0; }
  & .foot__meta { margin: 0.8rem 0 0; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); }
  & .foot__note { margin-top: 1.2rem; font-style: italic; color: var(--sage); font-size: 0.9rem; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  .head .head__tag { display: none; }
  .head .nav { gap: 0.7rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .intro .stem, .intro .leafL, .intro .leafR { stroke-dashoffset: 0; }
  .intro__word, .intro__sub { opacity: 1; }
}
