/* A drawn small site with numbered parts (site/snippets/blocks/smallsite.php,
   public/assets/js/smallsite.js; the Custom websites hub's "What comes with
   a site your size"). One small website drawn in a browser frame, its six
   parts numbered, beside the numbered list. Linked by the block itself
   (peanut_page_css), once per page. Every selector names a smallsite class.
   Tokens only.

   Finished by default (no script, print): the plain list and every drawn
   part, none lit. The script swaps the list for the number buttons and the
   reading box (.is-live) and lights one part (.is-lit): colors only, so
   nothing moves or changes size. The hint and the sample controls are the
   shared ones (industry.css). */

@layer blocks {
  .smallsite__head {
    max-width: 44rem;
    margin-block-end: var(--space-5);
  }

  .smallsite__title {
    margin: 0;
  }

  .smallsite__intro {
    margin: var(--space-3) 0 0;
  }

  /* ---------- the drawing, then the list; side by side from 64rem ---------- */
  .smallsite__demo {
    display: grid;
    grid-template-areas: "frame" "side";
    gap: var(--space-4);
    align-items: start;
  }

  .smallsite__side {
    grid-area: side;
    display: grid;
    gap: var(--space-2);
    min-width: 0;
  }

  .smallsite__frame {
    grid-area: frame;
    min-width: 0;
  }

  @media (min-width: 64rem) {
    .smallsite__demo {
      grid-template-areas: "side frame";
      grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
      gap: var(--space-5);
    }
  }

  /* the number a list part and its drawn part share */
  .smallsite__num {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--color-ink);
    border-radius: 50%;
    background: var(--color-white);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
  }

  /* ---------- no script: the plain numbered list ---------- */
  .smallsite__list,
  .smallsite__picks {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .smallsite__list {
    gap: var(--space-3);
  }

  .smallsite__list[hidden],
  .smallsite__pick[hidden] {
    display: none;
  }

  .smallsite__item {
    display: flex;
    gap: 0.75rem;
    align-items: start;
  }

  .smallsite__itemtext {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
  }

  .smallsite__label,
  .smallsite__readlabel {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-body);
    font-weight: 600;
    line-height: 1.4;
  }

  .smallsite__text {
    margin: 0;
    font-size: var(--text-body);
    line-height: var(--leading-body);
  }

  .smallsite__more {
    margin: 0;
    font-size: var(--text-body);
  }

  .smallsite__link {
    color: var(--color-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }

  .smallsite__outro {
    max-width: var(--measure);
    margin: var(--space-5) 0 0;
  }

  /* ---------- with the script: the number buttons and the reading box ---------- */
  .smallsite__pick {
    display: grid;
    gap: var(--space-2);
  }

  .smallsite__picks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .smallsite__pickbtn {
    display: flex;
    gap: 0.625rem;
    align-items: center;
    width: 100%;
    min-height: 2.75rem;
    margin: 0;
    padding: 0.4375rem 0.75rem 0.4375rem 0.5rem;
    background: var(--color-white);
    border: 1px solid var(--color-ink);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: start;
    cursor: pointer;
  }

  .smallsite__pickbtn[aria-pressed="true"] {
    background: var(--color-ink);
    color: var(--color-white);
  }

  .smallsite__pickbtn[aria-pressed="true"] .smallsite__num {
    background: var(--color-brand);
    color: var(--color-ink);
  }

  .smallsite__pickbtn:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
  }

  /* every text in one cell: the tallest sets the height, so a press never moves the page */
  .smallsite__read {
    display: grid;
    padding: var(--space-3);
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
  }

  .smallsite__panel {
    grid-area: 1 / 1;
    display: grid;
    align-content: start;
    gap: 0.5rem;
    min-width: 0;
  }

  .smallsite__panel:not(.is-shown) {
    visibility: hidden;
  }

  .smallsite__readlabel {
    display: flex;
    gap: 0.625rem;
    align-items: center;
  }

  .smallsite__readlabel .smallsite__num {
    background: var(--color-brand);
  }

  /* ---------- the drawing: one small site in a browser frame ---------- */
  .smallsite__frame {
    overflow: hidden;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hard);
    color: var(--color-ink);
    font-size: 0.8125rem;
    line-height: 1.4;
  }

  .smallsite__bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem var(--space-2);
    background: var(--color-paper);
    border-block-end: var(--border);
    font-size: 0.75rem;
  }

  .smallsite__dots {
    flex: none;
    width: 0.4375rem;
    height: 0.4375rem;
    margin-inline-end: 1.75rem;
    background: var(--color-ink);
    border-radius: 50%;
    box-shadow: 0.75rem 0 0 var(--color-ink), 1.5rem 0 0 var(--color-ink);
    opacity: 0.35;
  }

  .smallsite__url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 0.125rem 0.625rem;
    background: var(--color-white);
    border: var(--border);
    border-radius: var(--radius-pill);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* the site: menu and button on top, the words beside the booking tool,
     the search result beside the edit button */
  .smallsite__site {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    grid-template-areas:
      "p2 p3"
      "p1 p5"
      "p4 p6";
    gap: 0.625rem;
    padding: 0.75rem;
  }

  .smallsite__part {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
    align-items: center;
    align-content: center;
    min-width: 0;
    padding: 0.625rem 0.625rem 0.625rem 2.375rem;
    border: 1px dashed var(--color-ink);
    border-radius: 0.5rem;
    background: var(--color-white);
  }

  .smallsite__part > .smallsite__num {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;
  }

  .smallsite__part.is-lit {
    border-style: solid;
    background: var(--color-brand);
  }

  .smallsite__part.is-lit > .smallsite__num {
    background: var(--color-ink);
    color: var(--color-white);
  }

  .smallsite__part--1 { grid-area: p1; align-content: start; }
  .smallsite__part--2 { grid-area: p2; }
  .smallsite__part--3 { grid-area: p3; justify-content: center; }
  .smallsite__part--4 { grid-area: p4; align-content: start; }
  .smallsite__part--5 { grid-area: p5; align-content: start; }
  .smallsite__part--6 { grid-area: p6; align-content: start; }

  /* 1: the words */
  .smallsite__h {
    flex: 1 1 100%;
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: var(--weight-heading);
    line-height: 1.2;
  }

  .smallsite__lines {
    display: grid;
    flex: 1 1 auto;
    gap: 0.3125rem;
    min-width: 0;
  }

  .smallsite__lines > span {
    display: block;
    height: 0.3125rem;
    border-radius: var(--radius-pill);
    background: var(--color-ink-track);
  }

  .smallsite__lines > span:nth-child(2) { width: 86%; }
  .smallsite__lines > span:nth-child(3) { width: 64%; }

  .smallsite__lines--short {
    flex-basis: 100%;
  }

  .smallsite__pen {
    flex: none;
  }

  /* 2: the menu, a few pages only */
  .smallsite__logo {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid var(--color-ink);
    border-radius: 50%;
    background: var(--color-accent-2);
  }

  .smallsite__menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
  }

  /* 3: the one next step */
  .smallsite__btn {
    display: inline-block;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* 4: a search result that names the work and the area */
  .smallsite__search {
    display: flex;
    flex: 1 1 100%;
    gap: 0.375rem;
    align-items: center;
    min-width: 0;
    padding: 0.25rem 0.5rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-white);
    font-size: 0.75rem;
  }

  .smallsite__search svg {
    flex: none;
  }

  .smallsite__q {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .smallsite__result {
    display: grid;
    flex: 1 1 100%;
    gap: 0.25rem;
    min-width: 0;
  }

  .smallsite__rtitle {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .smallsite__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .smallsite__tags > span {
    padding: 0 0.375rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-paper);
    font-size: 0.6875rem;
  }

  /* 5: the booking tool the site keeps */
  .smallsite__cap {
    flex: 1 1 100%;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .smallsite__cal {
    display: grid;
    flex: 1 1 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
  }

  .smallsite__cal > span {
    display: block;
    aspect-ratio: 1;
    border: 1px solid var(--color-ink);
    border-radius: 0.1875rem;
    background: var(--color-white);
  }

  .smallsite__cal > span.is-on {
    background: var(--color-accent-2);
  }

  /* 6: the edit button */
  .smallsite__edit {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    border: var(--border);
    border-radius: var(--radius-pill);
    background: var(--color-butter);
    font-size: 0.6875rem;
    font-weight: 600;
  }

  /* phones: the drawing tighter, the number buttons one column */
  @media (max-width: 39.9375rem) {
    .smallsite__site {
      gap: 0.5rem;
      padding: 0.5rem;
    }

    .smallsite__part {
      padding: 2.125rem 0.5rem 0.5rem;
    }

    .smallsite__h {
      font-size: 1rem;
    }

    .smallsite__picks {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @media print {
    .smallsite__frame {
      box-shadow: none;
    }
  }
}
