.portal-layout {
  --portal-gap: clamp(1rem, 3vw, 2.65rem);
  --portal-rule: var(--line);
  --portal-pad: clamp(1rem, 3.2vw, 3rem);
}
.portal-layout a { text-underline-offset: .18em; }
.portal-layout > section { margin-block: clamp(3rem, 6vw, 6rem); }
.portal-layout > section[id] { scroll-margin-top: 2rem; }
.portal-layout h1, .portal-layout h2 { text-wrap: balance; }
.portal-layout h2 { margin: 0 0 clamp(1rem, 2.5vw, 1.85rem); }
.portal-layout h3 { margin: 0 0 .5rem; }
.portal-layout h4 { margin: 0; }
.portal-layout figure { margin: 0; min-width: 0; }
.portal-layout figcaption { margin: .45rem 0 0; }
.portal-layout p { margin-block: 0 1em; }
.portal-layout .card {
  border-radius: .45rem;
  box-shadow: none;
  min-width: 0;
  padding: clamp(.9rem, 2.2vw, 1.45rem);
}
.portal-layout .card a { overflow-wrap: anywhere; }
.portal-layout .card p:last-child { margin-bottom: 0; }
.portal-layout .portal-photo { display: block; width: 100%; height: auto; object-fit: cover; }
.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: var(--portal-gap);
}
.portal-layout .home-hero {
  margin-block: 0 1.5rem;
  padding: var(--portal-pad);
  background: var(--moss);
  border-radius: .65rem;
}
.home-hero h1 { max-width: 13ch; }
.home-hero .portal-photo { aspect-ratio: 1.17; border-radius: .4rem; }
.home-hero p:not(.portal-brand), .directory-hero p, .portal-index-intro > p {
  max-width: 46ch;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
}
.portal-brand { font-size: .875rem; letter-spacing: .12em; font-weight: 750; color: var(--forest); }
.portal-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.portal-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .6rem .9rem;
  border: 1px solid var(--forest);
  border-radius: .35rem;
  color: var(--forest);
  font-weight: 700;
  text-decoration: none;
}
.portal-actions a:first-child { background: var(--forest); color: #fff; }
.portal-actions a:hover { text-decoration: underline; }
.portal-jump { margin-block: 1rem; }
.portal-jump ul { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin: 0; padding: .5rem 0; list-style: none; }
.portal-jump li { margin: 0; }
.portal-jump a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; }
.portal-stat { margin: 0; }
.portal-stat > div { display: grid; grid-template-columns: minmax(5rem, max-content) 1fr; gap: .45rem; border-top: 1px solid var(--portal-rule); padding-block: .45rem; }
.portal-stat dd { margin: 0; min-width: 0; }
.portal-layout .portal-result { margin: .5rem 0; }
.portal-result strong { color: var(--forest); margin-inline-end: .25em; }
.portal-home > section:not(.home-hero) { margin-block: clamp(2.5rem, 4.5vw, 4rem); }
.home-directory-links, .home-projects, .home-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.home-directory-links li { margin: 0; border-top: 2px solid var(--portal-rule); padding: .3rem .1rem .4rem; }
.home-directory-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.portal-home .home-directory-links p { margin: 0; color: var(--muted); }
.home-interests { margin-block-start: 1.3rem; }
.home-interests .portal-jump { margin: 0; }
.home-interests .portal-jump ul { padding: 0; gap: 0 1.1rem; }
.home-projects { gap: clamp(.8rem, 2vw, 1.4rem); }
.home-projects > li { margin: 0; background: var(--surface); border: 1px solid var(--portal-rule); border-radius: .5rem; overflow: hidden; }
.home-projects .portal-photo, .home-project-frames { aspect-ratio: 1.8; }
.home-projects > li:last-child > img { object-position: center 44%; }
.home-project-frames { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem; }
.home-project-frames .portal-photo { height: 100%; aspect-ratio: auto; }
.home-project-copy { padding: clamp(.9rem, 2vw, 1.35rem); }
.portal-home .home-project-meta { font-size: .875rem; color: var(--muted); font-weight: 650; margin-block: 0 .45rem; }
.portal-home .home-project-copy .portal-result { border-top: 1px solid var(--portal-rule); padding-top: .75rem; margin: 0; }
.home-steps { counter-reset: home-step; gap: var(--portal-gap); }
.home-steps li { counter-increment: home-step; margin: 0; }
.home-steps li::before {
  content: counter(home-step);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: .7rem;
  border-radius: 50%;
  background: var(--moss);
  color: var(--forest);
  font-weight: 750;
}
.portal-home .home-steps p { margin-bottom: 0; }
.home-mission {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  align-items: start;
  gap: var(--portal-gap);
  padding: var(--portal-pad);
  background: var(--peach);
  border-radius: .55rem;
}
.home-mission ol { margin: 0 0 .8rem; padding-inline-start: 1.3rem; }
.home-mission li + li { margin-top: .4rem; }
.portal-home .home-mission div:last-child > p:last-child { margin-bottom: 0; }
.portal-reading { max-width: 72ch; margin-block: 2rem; }
.theme-related {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: var(--portal-gap);
  margin-block-start: 1.4rem;
}
.portal-demo { border-inline-start: 3px solid var(--portal-rule); background: var(--moss); padding: .45rem .8rem; overflow-wrap: anywhere; }
.portal-demo ul { list-style: none; margin: .25rem 0 0; padding: 0; }
.portal-demo li { font-variant-numeric: tabular-nums; }

.directory-hero { padding: var(--portal-pad); background: var(--moss); border-radius: .6rem; }
.directory-hero .portal-photo { aspect-ratio: 1.9; border-radius: .32rem; }
.cycle-week .directory-hero { grid-template-columns: 1.2fr .8fr; }
.cycle-stages .directory-hero { background: var(--peach); }
.cycle-milestones .directory-hero { grid-template-columns: 1fr 1.1fr; }
.cycle-milestones .directory-hero h1 { color: var(--ink); background: none; padding: 0; }
.cycle-milestones .directory-hero .portal-photo { aspect-ratio: 1.45; }
.weekly-route { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; list-style: none; padding: 0; margin-block: 0 1rem; }
.weekly-route li { background: var(--surface); border: 1px solid var(--portal-rule); padding: .8rem; }
.weekly-route strong, .weekly-route span { display: block; }
.stage-project, .milestone-project { display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--portal-gap); align-items: start; }
.stage-project img { aspect-ratio: 1.35; border-radius: .35rem; }
.stage-frames { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; }
.stage-frames img { aspect-ratio: 1; }
.stage-timeline, .milestone-list { margin: 0; padding-inline-start: 1.7rem; }
.stage-timeline li { padding: .45rem 0 .45rem .35rem; border-bottom: 1px solid var(--portal-rule); }
.milestone-project { background: var(--surface); border: 1px solid var(--portal-rule); padding: var(--portal-pad); }
.milestone-list { border-inline-start: 2px solid var(--forest); }
.milestone-list li { padding: .6rem 0; }
.portal-project-links { list-style: none; padding: 0; margin: 1rem 0 0; }
.portal-project-links li { display: grid; grid-template-columns: 1fr max-content; gap: .2rem 1rem; border-top: 1px solid var(--portal-rule); padding: .8rem 0; }
.portal-project-links li > a { font-weight: 700; }
.portal-project-links li span { font-size: .875rem; color: var(--muted); }
.portal-project-links li p { grid-column: 1/-1; }
.portal-catalog { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .85rem; }
.portal-catalog .card { margin: 0; }
.portal-layout .filters { padding: .9rem 1rem .4rem; border: 1px solid var(--portal-rule); border-radius: .45rem; background: var(--surface); margin-block-end: 1.1rem; }
.portal-layout .filters [data-filters]:not([hidden]) { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); align-items: end; gap: .85rem; }
.portal-layout .filters label { min-width: 0; margin: 0; }
.portal-layout .filters select { width: 100%; min-width: 0; }
.portal-layout .filters button { justify-self: start; }
.portal-layout .filters [data-count] { margin-block: .65rem 0; }
.cycle-milestones .portal-catalog { grid-template-columns: 1fr; }
.cycle-milestones .portal-catalog article:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(12rem,.62fr) minmax(0,1.38fr);
  gap: .2rem 1.25rem;
}
.cycle-milestones .portal-catalog [data-card-copy],
.cycle-milestones .portal-catalog .challenge-outcome { grid-column: 2; }
.cycle-milestones .portal-catalog .challenge-outcome { grid-row: 3; }
.cycle-milestones .portal-catalog .challenge-facts { grid-row: 3; grid-column: 1; }

.theme-practice { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--portal-gap); align-items: start; }
.theme-practice :is(ul,ol,dl) { padding-inline-start: 1.2rem; margin: 0; }
.theme-practice li { padding: .32rem 0; }
.theme-practice .topic-method p { margin: .2rem 0 .35rem; }
.theme-practice .topic-method dd { margin-inline-start: 0; }
.theme-practice .topic-method > div { padding-block: .4rem; border-top: 1px solid var(--portal-rule); }
.theme-practice .portal-stat { padding-inline-start: 0; }
.theme-practice .portal-stat > div { grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); }
.theme-routine .theme-practice { border-top: 2px solid var(--forest); padding-top: .85rem; }
.theme-workbench .theme-practice { background: var(--peach); padding: var(--portal-pad); }
.topic-photographs { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.topic-photographs img { aspect-ratio: 1.25; border-radius: .25rem; }
.theme-field-route .theme-practice li { border-inline-start: 2px solid var(--forest); padding-inline-start: .75rem; }
.theme-tasting-notes .theme-practice { grid-template-columns: 1fr 1.35fr; }
.theme-tasting-notes .theme-practice li, .theme-observation-log .theme-practice li { border-bottom: 1px solid var(--portal-rule); }
.theme-play-shelf .portal-project-links, .theme-fiction-file .portal-project-links {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem;
}
.theme-play-shelf .portal-project-links li, .theme-fiction-file .portal-project-links li { display: block; }
.theme-play-shelf .portal-project-links span, .theme-fiction-file .portal-project-links span { display: block; }
.theme-fiction-file .theme-practice { background: var(--violet); border: 1px solid var(--portal-rule); padding: var(--portal-pad); }
.theme-trial-log .theme-practice { border-block: 1px solid var(--portal-rule); padding-block: 1rem; }
.theme-observation-log .theme-practice { background: var(--surface); padding: var(--portal-pad); }
.theme-archive-shelf .theme-practice { border-inline-start: 4px solid var(--ochre); padding-inline-start: 1rem; }

.portal-index-intro { padding-block: .5rem .75rem; border-bottom: 1px solid var(--portal-rule); }
.tool-shelf, .worksheet-index-list, .guide-index-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.tool-shelf .card { margin: 0; }
.tool-shelf .portal-demo { margin-block: .8rem; }
.tool-create > article { border-inline-start: 4px solid var(--forest); }
.tool-play { grid-template-columns: repeat(3,minmax(0,1fr)); }
.tool-play .card { border-top: 3px solid var(--clay); }
.tool-collect { grid-template-columns: 1fr; }
.tool-collect .card-body { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr); gap: .35rem 1rem; }
.tool-collect .card-body > h3 { grid-column: 1/-1; }
.tool-collect .card-body > :is(p,.portal-demo) { grid-column: 1; }
.tool-collect .card-body > dl { grid-column: 2; grid-row: 2/span 2; }
.guide-cover { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--portal-gap); align-items: center; }
.guide-cover img { aspect-ratio: 2; border-radius: .45rem; }
.guide-index-list { grid-template-columns: 1.25fr 1fr 1fr; }
.guide-index-list .card { border: 0; border-top: 2px solid var(--portal-rule); border-radius: 0; background: transparent; padding-inline: 0; }
.guide-index-list .card:first-child h3 { font-family: var(--display); font-size: clamp(1.28rem,2.15vw,1.7rem); }
.worksheet-preview-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.worksheet-preview-row > section { margin: 0; }
.worksheet-index-list .paper-preview { border-bottom: 1px solid var(--portal-rule); margin-bottom: .8rem; }

@media (max-width: 64rem) {
  .portal-layout .filters [data-filters]:not([hidden]) { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 48rem) {
  .tool-play, .guide-index-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 44rem) {
  .home-directory-links, .home-projects, .home-steps, .home-mission { grid-template-columns: 1fr; }
}
@media (max-width: 38rem) {
  .portal-hero.home-hero, .portal-hero.directory-hero,
  .theme-related, .stage-project, .milestone-project,
  .portal-catalog, .theme-practice, .theme-tasting-notes .theme-practice, .tool-shelf, .guide-cover,
  .guide-index-list, .worksheet-index-list, .worksheet-preview-row { grid-template-columns: 1fr; }
  .home-hero .portal-photo { aspect-ratio: 1.5; }
  .weekly-route, .portal-layout .filters [data-filters]:not([hidden]) { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cycle-milestones .portal-catalog article:not([hidden]), .tool-collect .card-body { display: block; }
  .portal-project-links li { grid-template-columns: 1fr; }
  .theme-play-shelf .portal-project-links, .theme-fiction-file .portal-project-links { grid-template-columns: 1fr; gap: .3rem; }
}
