/*
 * Folio, the sections layer: side heads, ruled entries with Hebrew clause
 * markers (deadlines, services, steps), the FAQ, the closing block and the
 * hub's index of practice areas. Needs styles.css.
 */

/* ---------- Sections: side heads and ruled columns ----------------------- */
.section {
  padding-block: 56px;
}

.section > .wrap:not(.areas) {
  display: grid;
  gap: 24px;
}

.section > .wrap > h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.005em;
  padding-top: 14px;
  border-top: 2px solid var(--rule-ink);
}

/* The alternate background is gone: sections are separated by rules and
   space, not by bands. */
.section-alt {
  background: none;
}

.cards,
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  counter-reset: item;
}

.card,
.steps li {
  counter-increment: item;
  position: relative;
  padding-block: 20px 24px;
  border-top: 1px solid var(--rule);
}

.card:first-child,
.steps li:first-child {
  border-top: 0;
}

/* Clause markers in Hebrew letters: א׳ ב׳ ג׳ */
.card h3::before,
.steps li::before {
  content: counter(item, hebrew) "׳";
  /* Empty alt text: keeps the geresh out of the heading's accessible name. */
  content: counter(item, hebrew) "׳" / "";
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-deep);
}

.card h3::before {
  font-size: 1.125rem;
  margin-bottom: 6px;
}

.card h3 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0 0 8px;
}

.card p {
  color: var(--text-2);
  max-width: 60ch;
}

/* Deadlines read as a schedule, not as product metrics. */
.card:has(.figure) h3::before {
  content: none;
}

.figure {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
  margin-bottom: 10px;
}

.card:has(.figure) h3 {
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 4px;
}

.steps li {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  align-content: start;
  column-gap: 12px;
  color: var(--text-2);
}

.steps li::before {
  grid-row: 1 / span 2;
  font-size: 2.25rem;
  line-height: 1;
}

.steps strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 4px;
}

/* About: the first paragraph is the standfirst. */
.about p {
  max-width: 62ch;
  color: var(--text-2);
}

.about p:first-of-type {
  /* 62ch in the display face, in em so the fallback font keeps the measure
     (see hero.css) */
  max-width: 34.9em;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.55;
  color: var(--ink);
}

/* FAQ: ruled entries with a plus that turns into a cross. */
.faq details {
  border-bottom: 1px solid var(--rule);
}

.faq summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding-block: 14px;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.35;
  user-select: none;
  -webkit-user-select: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  background:
    linear-gradient(var(--gold-deep), var(--gold-deep)) center / 14px 2px
      no-repeat,
    linear-gradient(var(--gold-deep), var(--gold-deep)) center / 2px 14px
      no-repeat;
  transition: transform 200ms var(--ease-out);
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: reduce) {
  .faq summary::after {
    transition: none;
  }
}

.faq details p {
  padding-bottom: 18px;
  color: var(--text-2);
  max-width: 65ch;
}

.faq .hint {
  margin-top: 16px;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.faq ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  font-size: 1rem;
}

.faq li a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  text-decoration-color: var(--rule);
}

/* An "opens elsewhere" arrow, pointing forward in the reading direction. */
.faq li a::after {
  width: 0.85em;
  height: 0.85em;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 7h10v10'/%3E%3Cpath d='M7 17 17 7'/%3E%3C/svg%3E");
  color: var(--gold-deep);
}

@media (hover: hover) and (pointer: fine) {
  .faq li a:hover {
    text-decoration-color: var(--ink);
  }
}

/* Closing block: set on the page like the end of an article, not a band. */
.cta-band {
  padding-block: 8px 64px;
}

.cta-band .wrap {
  display: grid;
  gap: 10px;
}

.cta-band .wrap::before {
  content: "";
  height: 5px;
  border-top: 2px solid var(--rule-ink);
  border-bottom: 1px solid var(--rule-ink);
  margin-bottom: 18px;
}

.cta-band h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  line-height: 1.15;
}

.cta-band p {
  color: var(--text-2);
}

.cta-band .actions {
  margin-top: 10px;
}

/* ---------- Hub: the index of practice areas ---------------------------- */
.section:has(> .areas) {
  padding-block: 0 56px;
}

.areas {
  display: grid;
  counter-reset: area;
}

.area {
  counter-increment: area;
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  column-gap: 12px;
  padding-block: 20px 22px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: background-color var(--dur-hover) ease;
  -webkit-user-select: none;
  user-select: none;
}

.area:first-child {
  border-top: 2px solid var(--rule-ink);
}

.area::before {
  content: counter(area, hebrew) "׳";
  /* Empty alt text: keeps the geresh out of the link's accessible name. */
  content: counter(area, hebrew) "׳" / "";
  grid-row: 1 / span 2;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.375rem;
  line-height: 1.35;
  color: var(--gold-deep);
}

.area h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 1.625rem;
  line-height: 1.25;
}

/* A forward arrow, pointing in the reading direction. */
.area h2::after {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
  width: 1.25rem;
  height: 1.25rem;
  color: var(--gold-deep);
}

[dir="rtl"] .area h2::after,
[dir="rtl"] .faq li a::after {
  transform: scaleX(-1);
}

.area p {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 1.0625rem;
  line-height: 1.55;
}

.area:active {
  background: rgb(170 137 53 / 10%);
}

/* The online order is a different kind of visit from the three practice
   areas: a small letterhead sheet set apart from the ruled index, like the
   order form it leads to. */
.area-online {
  margin-top: 32px;
  padding: 18px 16px 22px;
  border-top: 4px solid var(--rule-ink);
  border-bottom: 0;
  border-radius: 0 0 var(--r-3) var(--r-3);
  background: var(--sheet);
  box-shadow: var(--shadow-edge);
}

.area-online:active {
  background: #fbf6ea;
}

@media (hover: hover) and (pointer: fine) {
  .area:hover {
    background: rgb(170 137 53 / 7%);
  }
  .area-online:hover {
    background: #fdf9ef;
  }
  .area:hover h2 {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
    text-decoration-color: var(--gold-rule);
  }
}

@media (prefers-contrast: more) {
  .area-online {
    box-shadow: 0 0 0 1px var(--ink);
  }
}

/* ---------- Wider screens ------------------------------------------------- */
/* Tablets: the three practice areas as a ruled rail, the order below it. */
@media (min-width: 720px) {
  .areas {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .area {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    align-content: start;
    padding: 22px 20px 28px;
    border-top: 2px solid var(--rule-ink);
    border-bottom: 0;
    border-inline-start: 1px solid var(--rule);
  }
  .area:first-child {
    border-inline-start: 0;
    padding-inline-start: 0;
  }
  .area::before {
    grid-row: auto;
    font-size: 1.125rem;
    margin-bottom: 10px;
  }
  .area p {
    margin-top: 10px;
  }
  .area-online {
    grid-column: 1 / -1;
    grid-template-columns: 2.5rem 1fr;
    grid-template-rows: auto;
    column-gap: 12px;
    padding: 20px 24px 24px;
    border-top-width: 4px;
    border-inline-start: 0;
  }
  .area-online::before {
    grid-row: 1 / span 2;
    font-size: 1.375rem;
    margin-bottom: 0;
  }
}

@media (min-width: 1024px) {
  .section {
    padding-block: 72px;
  }

  /* Side heads: the section title holds a narrow column at the start. */
  .section > .wrap:not(.areas) {
    grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
    column-gap: 56px;
    row-gap: 0;
    align-items: start;
  }
  .section > .wrap:not(.areas) > h2 {
    grid-column: 1;
    grid-row: 1 / span 12;
  }
  .section > .wrap:not(.areas) > :not(h2) {
    grid-column: 2;
  }
  .about p + p {
    margin-top: 20px;
  }
  /* The first column item opens with the same rule as the side head. */
  .about p:first-of-type {
    padding-top: 12px;
    border-top: 2px solid var(--rule-ink);
  }
  .faq .hint {
    margin-top: 28px;
  }
  .faq details:first-of-type {
    border-top: 2px solid var(--rule-ink);
  }

  .section .cards,
  .section .steps {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    border-top: 2px solid var(--rule-ink);
  }
  .section .card,
  .section .steps li {
    padding: 22px 28px 8px;
    border-top: 0;
    border-inline-start: 1px solid var(--rule);
  }
  .section .card:first-child,
  .section .steps li:first-child {
    border-inline-start: 0;
    padding-inline-start: 0;
  }
  .section .steps li {
    grid-template-columns: 1fr;
  }
  .section .steps li::before {
    grid-row: auto;
    font-size: 2.75rem;
    margin-bottom: 14px;
  }

  /* The index: three practice areas on one rule, the order set apart. */
  .section:has(> .areas) {
    padding-block: 0 72px;
  }
  .areas {
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.1fr);
  }
  .area {
    padding: 22px 24px 28px;
  }
  .area h2 {
    font-size: 1.75rem;
  }
  .area-online {
    grid-column: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    margin: 0;
    margin-inline-start: 40px;
    padding: 20px 24px 28px;
  }
  .area-online::before {
    grid-row: auto;
    font-size: 1.125rem;
    margin-bottom: 10px;
  }
}
