/* greenhouse: signature marks (borders, cards, header, footer) for the real site
   markup. Tokens live in design-system.css. Every rule starts with
   [data-theme="greenhouse"].

   Marks: a faint window-frame grid behind the page, double-ruled header and
   footer, the hero copy on a taped herbarium sheet beside an arched
   glasshouse window, app cards as arched panes with glazing bars, and each
   card's category chip turned into a numbered specimen label. Pages that
   paint themselves dark (<Base darkApp>) are left alone. */

/* ---------- Page ground: faint glazing grid ---------- */
/* :where() keeps this at element specificity so apps that paint <body>
   still win (same trick as Pixel Meadow). */
:where([data-theme="greenhouse"]:not([data-dark-app])) body {
  background-color: var(--cm-bg);
  background-image:
    linear-gradient(to right, rgba(93, 124, 101, 0.13) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(93, 124, 101, 0.13) 1px, transparent 1px);
  background-size: 132px 176px;
  background-position: -1px -1px;
}

/* ---------- Type ---------- */
[data-theme="greenhouse"]:not([data-dark-app]) .home-grid-title,
[data-theme="greenhouse"]:not([data-dark-app]) .home-more h2 {
  font-style: italic;
}
[data-theme="greenhouse"]:not([data-dark-app]) .home-eyebrow {
  letter-spacing: 0.16em;
  color: var(--cm-ink-2);
}

/* ---------- Header + dropdown ---------- */
[data-theme="greenhouse"]:not([data-dark-app]) .app-header {
  border-bottom: 3px double var(--cm-line-strong);
}
[data-theme="greenhouse"]:not([data-dark-app]) .theme-menu__button,
[data-theme="greenhouse"]:not([data-dark-app]) .theme-switch label {
  font-family: var(--cm-font-ui);
  font-weight: 500;
  letter-spacing: 0.01em;
}
[data-theme="greenhouse"]:not([data-dark-app]) .theme-menu__button {
  background: var(--cm-bg-2);
  border-color: var(--cm-line-strong);
}
[data-theme="greenhouse"]:not([data-dark-app]) .theme-switch--compact {
  border: 1px solid var(--cm-line-strong);
  border-top: 3px double var(--cm-line-strong);
}
[data-theme="greenhouse"]:not([data-dark-app]) .theme-switch--compact .theme-switch__blurb {
  font-family: var(--cm-font-body);
  font-style: italic;
}

/* ---------- Buttons + chips ---------- */
[data-theme="greenhouse"]:not([data-dark-app]) .btn,
[data-theme="greenhouse"] .home-page .btn {
  letter-spacing: 0.02em;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}
[data-theme="greenhouse"] .home-page .btn.secondary {
  background: var(--cm-accent-2);
  color: var(--cm-on-accent-2);
  border: 1px solid #b8892e;
  box-shadow: none;
}
[data-theme="greenhouse"] .home-page .btn.secondary:hover {
  background: var(--cm-accent-2);
  color: var(--cm-on-accent-2);
}
[data-theme="greenhouse"]:not([data-dark-app]) .chip {
  border-style: dashed;
  background: var(--cm-bg-2);
  font-weight: 500;
}
[data-theme="greenhouse"]:not([data-dark-app]) .chip.active,
[data-theme="greenhouse"]:not([data-dark-app]) .filter-button.active {
  border-style: solid;
  background: var(--cm-accent-2);
  font-weight: 700;
}

/* ---------- Home hero: taped sheet + glasshouse window ---------- */
[data-theme="greenhouse"] .home-hero__copy {
  background: rgba(244, 247, 241, 0.92);
  border: 1px solid var(--cm-line);
  box-shadow: var(--cm-shadow);
  padding: 1.9rem 2rem 2rem;
}
/* Two strips of washi tape at the top corners. */
[data-theme="greenhouse"] .home-hero__copy::before,
[data-theme="greenhouse"] .home-hero__copy::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 78px;
  height: 22px;
  background: rgba(217, 164, 65, 0.42);
  border-left: 2px dotted rgba(255, 255, 255, 0.65);
  border-right: 2px dotted rgba(255, 255, 255, 0.65);
  pointer-events: none;
}
[data-theme="greenhouse"] .home-hero__copy::before {
  left: 24px;
  transform: rotate(-4deg);
}
[data-theme="greenhouse"] .home-hero__copy::after {
  right: 24px;
  transform: rotate(5deg);
  background: rgba(122, 163, 106, 0.42);
}

/* The Garden island art gives way to an arched pane with a fern and a
   specimen tag, drawn in CSS so no extra markup or request is needed. */
[data-theme="greenhouse"] .art-garden {
  display: none;
}
[data-theme="greenhouse"] .home-hero__art {
  aspect-ratio: 300 / 340;
  max-width: 330px;
  width: 100%;
  margin: 0 auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 340'%3E%3Cdefs%3E%3CclipPath id='g'%3E%3Cpath d='M52 330V152a98 98 0 0 1 196 0v178z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cpath d='M40 332V150a110 110 0 0 1 220 0v182z' fill='%23f8faf6' stroke='%235d7c65' stroke-width='2'/%3E%3Cg clip-path='url(%23g)'%3E%3Cellipse cx='150' cy='338' rx='100' ry='44' fill='%23cde5c1'/%3E%3Cg stroke='%23dce6d9' stroke-width='3'%3E%3Cpath d='M150 40v300M100 40v300M200 40v300M40 150h220M40 245h220'/%3E%3C/g%3E%3C/g%3E%3Cpath d='M52 330V152a98 98 0 0 1 196 0v178' fill='none' stroke='%235d7c65' stroke-width='1'/%3E%3Cpath d='M32 332h236' stroke='%235d7c65' stroke-width='3'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
/* The fern sways on its own layer, slowly. */
[data-theme="greenhouse"] .home-hero__art::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 22%;
  bottom: 2.5%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 170 250'%3E%3Cdefs%3E%3Cpath id='l' d='M0 0c9-13 31-14 38 0-7 9-29 10-38 0z' fill='%237aa36a' stroke='%232d5b38' stroke-width='1'/%3E%3C/defs%3E%3Cpath d='M110 250C102 190 84 130 46 40' fill='none' stroke='%232d5b38' stroke-width='3' stroke-linecap='round'/%3E%3Cuse href='%23l' transform='translate(104 205) rotate(-160)'/%3E%3Cuse href='%23l' transform='translate(102 190) rotate(-20)'/%3E%3Cuse href='%23l' transform='translate(94 162) rotate(-165)'/%3E%3Cuse href='%23l' transform='translate(90 146) rotate(-25)'/%3E%3Cuse href='%23l' transform='translate(80 118) rotate(-170)'/%3E%3Cuse href='%23l' transform='translate(74 102) rotate(-30)'/%3E%3Cuse href='%23l' transform='translate(64 80) rotate(-175)' /%3E%3Cuse href='%23l' transform='translate(58 66) rotate(-38) scale(.8)'/%3E%3Cuse href='%23l' transform='translate(48 44) rotate(-110) scale(.7)'/%3E%3C/svg%3E")
    center bottom / contain no-repeat;
  transform-origin: 65% 100%;
  animation: gh-sway var(--cm-breath) ease-in-out infinite alternate;
}
/* Specimen tag pinned to the glass. */
[data-theme="greenhouse"] .home-hero__art::after {
  content: "";
  position: absolute;
  left: 3%;
  bottom: 10%;
  width: 40%;
  aspect-ratio: 120 / 58;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 58'%3E%3Cg transform='rotate(-5 60 30)'%3E%3Crect x='6' y='12' width='108' height='40' fill='%23ffffff' stroke='%2346574c'/%3E%3Ctext x='13' y='27' font-family='monospace' font-size='9' font-weight='700' fill='%2317281f'%3ENo. 40%3C/text%3E%3Ctext x='13' y='40' font-family='monospace' font-size='7.5' font-style='italic' fill='%233a4c41'%3Ecloudmaking ludens%3C/text%3E%3Cpath d='M13 46h80' stroke='%23bfcfbd'/%3E%3Crect x='40' y='5' width='40' height='13' fill='%23d9a441' fill-opacity='.5'/%3E%3C/g%3E%3C/svg%3E")
    center / contain no-repeat;
}
@keyframes gh-sway {
  from { transform: rotate(-1.6deg); }
  to { transform: rotate(1.8deg); }
}

/* ---------- Home app cards: arched glasshouse panes ---------- */
[data-theme="greenhouse"] .app-cards {
  counter-reset: gh-specimen;
  gap: 2.6rem 1.75rem;
}
[data-theme="greenhouse"] .app-card {
  counter-increment: gh-specimen;
  border-radius: 160px 160px 6px 6px;
}
[data-theme="greenhouse"] .app-image-link {
  margin: 14px 14px 0;
  aspect-ratio: 5 / 4;
  border-radius: 160px 160px 3px 3px;
  border: 1px solid var(--cm-line-strong);
  background: var(--cm-bg-2);
}
/* Glazing bars: one mullion and one transom over the art. */
[data-theme="greenhouse"] .app-image-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(50% - 1.5px), rgba(244, 247, 241, 0.85) calc(50% - 1.5px) calc(50% + 1.5px), transparent calc(50% + 1.5px)),
    linear-gradient(to bottom, transparent 40%, rgba(244, 247, 241, 0.85) 40% calc(40% + 3px), transparent calc(40% + 3px));
}
[data-theme="greenhouse"] .app-content {
  padding: 0.9rem 1.25rem 1.25rem;
}
/* Category chip becomes a numbered herbarium label. */
[data-theme="greenhouse"] .app-meta {
  align-items: center;
}
[data-theme="greenhouse"] .app-chip {
  display: inline-block;
  border: 1px solid var(--cm-ink-3);
  background: var(--cm-bg-2);
  color: var(--cm-ink-2);
  padding: 2px 8px;
  font-size: 0.76rem;
  font-style: italic;
}
[data-theme="greenhouse"] .app-chip::before {
  content: "No. " counter(gh-specimen, decimal-leading-zero) "\2002";
  font-style: normal;
  font-weight: 700;
  color: var(--cm-ink);
}
/* Category pips as little leaves. */
[data-theme="greenhouse"] .app-pips {
  display: flex;
  gap: 5px;
  padding-right: 2px;
}
[data-theme="greenhouse"] .app-pips i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50% 0;
  transform: rotate(45deg);
  background: var(--cm-deco-6);
  border: 1px solid var(--cm-line-strong);
}
[data-theme="greenhouse"] .app-pips i.on {
  background: var(--cm-deco-1);
}
[data-theme="greenhouse"] .app-content h2 {
  font-size: 1.75rem;
  line-height: 1.05;
}
[data-theme="greenhouse"] .app-actions {
  justify-content: flex-start;
}
[data-theme="greenhouse"] .app-actions .btn {
  background: var(--cm-accent);
  color: var(--cm-on-accent);
}
[data-theme="greenhouse"] .app-actions .btn:hover {
  color: var(--cm-on-accent);
}
[data-theme="greenhouse"] .app-actions .btn.secondary {
  background: var(--cm-accent-2);
  color: var(--cm-on-accent-2);
  border: 1px solid #b8892e;
}

/* ---------- Generic panels and blog cards: double hairline frame ---------- */
[data-theme="greenhouse"]:not([data-dark-app]) .blog-card {
  background: var(--cm-surface);
  border: 1px solid var(--cm-line-strong);
  border-radius: var(--cm-radius);
  box-shadow: 0 0 0 4px var(--cm-surface), 0 0 0 5px var(--cm-line), var(--cm-shadow);
}
[data-theme="greenhouse"]:not([data-dark-app]) .blog-meta {
  font-family: var(--cm-font-mono);
}

/* A blog post is pinned up as one sheet, so long reading never runs over
   the glazing grid. */
[data-theme="greenhouse"]:not([data-dark-app]) .blog-post {
  position: relative;
  background: var(--cm-surface);
  border: 1px solid var(--cm-line);
  box-shadow: var(--cm-shadow);
  padding: 1.75rem clamp(1.1rem, 4vw, 2.75rem) 2rem;
  margin-top: 1.5rem;
}
[data-theme="greenhouse"]:not([data-dark-app]) .blog-post::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 84px;
  height: 22px;
  margin-left: -42px;
  background: rgba(217, 164, 65, 0.42);
  border-left: 2px dotted rgba(255, 255, 255, 0.65);
  border-right: 2px dotted rgba(255, 255, 255, 0.65);
  transform: rotate(-2deg);
  pointer-events: none;
}

/* Music Generator borrows the card radius; the full arch would clip its
   rectangular stage, so it gets a shallow glasshouse curve instead. */
[data-theme="greenhouse"] .mg {
  border-radius: 28px 28px 6px 6px;
}

/* ---------- Footer: herbarium sheet under a double rule ---------- */
/* The 5rem gap above stays transparent so the glazing grid runs on. */
[data-theme="greenhouse"]:not([data-dark-app]) .page-footer {
  background: linear-gradient(transparent 0 5rem, var(--cm-surface) 5rem);
}
[data-theme="greenhouse"]:not([data-dark-app]) .page-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5rem;
  border-top: 3px double var(--cm-line-strong);
}
[data-theme="greenhouse"]:not([data-dark-app]) .footer-clouds {
  display: none;
}

@media (max-width: 860px) {
  [data-theme="greenhouse"] .home-hero__art {
    max-width: 240px;
    margin-bottom: 1.25rem;
  }
}
@media (max-width: 560px) {
  [data-theme="greenhouse"] .home-hero__art {
    max-width: 190px;
  }
  [data-theme="greenhouse"] .home-hero__copy {
    padding: 1.5rem 1.15rem 1.4rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  [data-theme="greenhouse"] .home-hero__art::before {
    animation: none;
  }
}
