/* Pilcothink's public folio shares the reader layout and paper palette. */
.brand .masthead { gap: 1rem; }
.brand .cover {
  grid-template-columns: minmax(0, 1.24fr) minmax(0, .76fr);
  grid-template-areas: "heading portrait" "copy portrait";
  align-content: center;
  align-items: center;
  column-gap: clamp(2rem, 6vw, 6rem);
  row-gap: 1.45rem;
  background-image: radial-gradient(ellipse at 76% 43%, #354359, #202b3a 34%, transparent 72%),
    linear-gradient(125deg, #12191e, #222329);
}

.cover-heading { grid-area: heading; align-self: end; z-index: 1; }
.brand .cover-copy { grid-area: copy; align-self: start; }
.brand .cover h1 {
  font-size: clamp(2.5rem, 6.1vw, 6.4rem);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.brand .cover-intro { max-width: 32em; margin-top: 0; }
.brand .cover .quiet-link { padding-block: .6rem; }
.brand .cover .text-links { gap: .55rem 1.2rem; }

.brand-portrait {
  grid-area: portrait;
  position: relative;
  width: min(100%, 18.4rem);
  margin: 0 auto;
  isolation: isolate;
}
.brand-portrait::before,
.brand-portrait::after {
  position: absolute;
  z-index: -1;
  content: "";
  border: 1px solid #c4a77760;
  border-radius: 50%;
  pointer-events: none;
}
.brand-portrait::before { inset: -11% -17% 8%; transform: rotate(24deg); }
.brand-portrait::after { inset: -6% -12% 1%; transform: rotate(-27deg); border-style: dashed; }
.moon-window {
  position: relative;
  padding: 6px;
  border: 1px solid #c7ad83;
  border-radius: 49% 49% 9px 9px;
  background: #141a24;
}
.moon-window .window-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center bottom;
  border-radius: 49% 49% 6px 6px;
  background: radial-gradient(ellipse at 55% 31%, #687890, #35455d 57%, #222d3b);
}
.brand-portrait figcaption {
  padding: .78rem 0 .68rem .15rem;
  color: #eee0c7;
  font: 700 .8rem/1.3 Georgia, serif;
  letter-spacing: .16em;
}
.luna-signature {
  width: 100%;
  height: auto;
  border: 1px solid #c7ad834a;
  border-radius: 10px;
  background: #16223d;
}

.brand .chapter-title .chapter-intro { max-width: 50rem; margin-top: .55rem; }
.entries h4,
.entries p,
.service h3,
.service p,
.brand-contact .chapter-intro {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.activity-entries {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.1rem, 3vw, 2.6rem);
}
.activity-entries article {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(1rem, 2.2vw, 1.6rem);
  border: 1px solid #b3a68e;
  border-top: 3px solid #87705a;
  border-radius: 4px 14px 4px 4px;
  background: #fff4df51;
}
.entry-source {
  min-height: 2.2rem;
  color: #70513b;
  font: 700 .74rem/1.45 var(--sans);
  letter-spacing: .07em;
}
.activity-entries h4 { margin: 0; }
.activity-entries h4,
.service h3 { font: 700 clamp(1.25rem, 2.3vw, 1.85rem)/1.35 var(--serif); letter-spacing: -.047em; }
.activity-entries p,
.service p { color: #484a42; line-height: 1.66; margin: .65rem 0 .9rem; }
.activity-entries a,
.service-link { color: #663c26; font-weight: 700; }
.activity-entries a { margin-top: auto; align-self: flex-start; }

.activity-group + .activity-group { margin-top: clamp(1.85rem, 4vw, 3.5rem); }
.activity-subtitle {
  margin: 0 0 .8rem;
  color: #38362b;
  font: 700 clamp(1.15rem, 2vw, 1.6rem)/1.35 var(--serif);
  letter-spacing: -.035em;
}
.entry-facts {
  display: grid;
  gap: .3rem;
  list-style: none;
  margin: 0 0 .95rem;
  color: #425246;
  font-size: .88rem;
  line-height: 1.43;
}
.entry-facts li {
  padding-left: .6rem;
  border-left: 2px solid #889687;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.entry-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  margin-top: auto;
}
.entry-links a { margin-top: 0; }

#collaboration { padding-block: clamp(1.25rem, 4vh, 3rem); }
#collaboration .chapter-title {
  margin-bottom: clamp(1rem, 2.6vh, 1.5rem);
  padding-bottom: clamp(.8rem, 1.8vh, 1.35rem);
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.75rem, 2.6vw, 1.35rem);
}
.service {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  padding: clamp(1.05rem, 2.4vw, 1.5rem);
  border: 1px solid #b3a68e;
  border-radius: 5px 15px 5px 5px;
  background: #f9efdd;
}
.service--offline { background: #e4e6d8; border-color: #a0aa95; }
.service .service-result {
  padding: .75rem 0;
  margin: auto 0 0;
  border-top: 1px solid #bcb09a;
  font-size: .95rem;
}
.service-result strong { display: inline-block; margin-right: .3rem; color: #473c2e; }
.service-link { display: inline-block; align-self: flex-start; margin-top: auto; padding-block: .25rem; }
.service-capacity {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: .7rem 0 .2rem;
}
.service-capacity li {
  padding: .28rem .53rem;
  border: 1px solid #bfb29a;
  border-radius: 4px;
  background: #fff5e5;
  color: #3e372b;
  font-size: .94rem;
}

.contact-brief { display: grid; gap: .7rem; margin-top: 1.4rem; }
.contact-brief div { display: grid; grid-template-columns: 2.8rem minmax(0, 1fr); gap: .6rem; }
.contact-brief dt { font-weight: 700; }
.contact-brief dd { color: #484a42; word-break: keep-all; overflow-wrap: anywhere; }
.brand-contact #email-form { gap: .6rem; }
.brand-contact #email-form select {
  width: 100%;
  padding: .55rem .6rem;
  min-height: 44px;
  border: 1px solid #9f927d;
  background: #fff8ea;
  color: #342c21;
}
.brand-contact #email-form :is(select, input) { margin-bottom: .18rem; }

.chat-launcher[hidden],
.mini-chat[hidden] { display: none; }
.chat-launcher {
  position: fixed;
  z-index: 11;
  right: max(1rem, env(safe-area-inset-right));
  bottom: 5.4rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .32rem .7rem .32rem .4rem;
  border: 1px solid #8a7358;
  border-radius: 6px 12px 6px 6px;
  color: #f2e2c6;
  background: #181e25;
  box-shadow: 0 8px 22px #0007;
  font-size: .9rem;
}
.assistant-avatar {
  display: block;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  border: 1px solid #8a7358;
  border-radius: 50%;
  object-fit: cover;
}
.mini-chat {
  position: fixed;
  z-index: 12;
  right: max(1rem, env(safe-area-inset-right));
  bottom: 9rem;
  width: min(24.5rem, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 1px solid #8a7358;
  border-radius: 8px 16px 8px 8px;
  background: #1a212a;
  box-shadow: 0 14px 40px #0009;
  color: #f2e2c6;
}
.mini-chat-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .7rem;
  padding: .65rem .75rem .65rem 1rem;
  border-bottom: 1px solid #77664f;
  background: #222b36;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.mini-chat-bar h2 { font: 700 1rem/1.4 var(--sans); }
.mini-chat-identity { display: flex; align-items: center; gap: .6rem; }
.mini-chat-bar button {
  width: 40px;
  height: 40px;
  color: inherit;
  background: #ffffff0d;
  border: 1px solid #77664f;
  border-radius: 5px;
  font-size: 1.3rem;
  line-height: 1;
}
.mini-chat-body { padding: 1rem; }
.mini-chat-body p { line-height: 1.65; word-break: keep-all; }
.mini-chat-links { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: .8rem; }
.mini-chat-links a { color: #f0d0a4; padding: .2rem 0; font-weight: 700; }

@media (max-width: 880px) {
  .brand .cover { column-gap: 2rem; }
  .activity-entries { grid-template-columns: 1fr; }
  .entry-source { min-height: auto; margin-bottom: .4rem; }
}

@media (max-width: 760px) {
  .brand .cover {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas: "heading" "portrait" "copy";
    align-content: start;
    row-gap: .97rem;
  }
  .brand .cover h1 { font-size: clamp(2.65rem, 10vw, 4.2rem); }
  .brand .cover .rubric { margin-bottom: .65rem; }
  .brand-portrait { width: min(69%, 12.2rem); }
  .moon-window { padding: 4px; }
  .brand-portrait figcaption { padding-block: .57rem .48rem; }
  .brand .cover .text-links { margin-top: .65rem; }
  .service-grid { grid-template-columns: 1fr; }
  .brand .masthead { gap: .5rem; }
  .brand .mobile-index { margin-left: auto; }
  .brand .chat-launcher { position: static; padding: .2rem; box-shadow: none; }
  .brand .chat-launcher > span:last-child { display: none; }
  .mini-chat {
    inset: auto max(10px, env(safe-area-inset-right)) calc(62px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    width: auto;
  }
  .mini-chat-bar { cursor: default; touch-action: auto; }
}

@media (max-height: 730px) and (min-width: 761px) {
  .brand-portrait { width: min(100%, 14.75rem); }
  .brand .cover { row-gap: .85rem; }
}

@media (max-width: 400px) and (max-height: 730px) {
  .brand-portrait { width: min(63%, 10rem); }
  .brand .cover { row-gap: .7rem; padding-block: 1.1rem; }
}

@media print {
  .chat-launcher, .mini-chat { display: none; }
}

.language-switch[hidden] { display: none; }
.language-switch {
  flex: 0 0 auto;
  min-width: 2.6rem;
  min-height: 42px;
  padding: .28rem .44rem;
  border: 1px solid #77664f;
  border-radius: 5px 9px 5px 5px;
  background: transparent;
  color: #f3e2c1;
  font: 700 .78rem/1 var(--sans);
}
.language-switch:hover { background: #32312e; }
.brand .chapter-nav { margin-left: auto; }
.reader .brand .site { grid-template-columns: minmax(0, 1fr); }

#activity {
  padding-block: clamp(1.3rem, 4.3vh, 3.2rem);
}
#activity .chapter-title {
  margin-bottom: clamp(.9rem, 2.45vh, 1.5rem);
  padding-bottom: clamp(.7rem, 1.8vh, 1.25rem);
}
.activity-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.6rem, 2vw, 1.25rem);
}
.activity-metric {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: .24rem;
  padding: clamp(.65rem, 2vw, 1.3rem) clamp(.64rem, 2.3vw, 1.7rem);
  border: 1px solid #625742;
  border-radius: 5px 17px 5px 5px;
  background: linear-gradient(134deg, #263443, #1a242e 70%);
  color: #f7e8ca;
  text-decoration: none;
}
.activity-metric:nth-child(2) {
  background: linear-gradient(138deg, #39463e, #24332e 75%);
}
.activity-metric:hover { border-color: #9e7d50; }
.activity-metric:hover strong { text-decoration: underline; text-underline-offset: .2em; }
.metric-label {
  color: #f1d4a5;
  font: 700 .82rem/1.34 var(--sans);
}
.metric-number {
  font: 600 clamp(2rem, 4.65vw, 4.45rem)/1.05 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.043em;
  white-space: nowrap;
}
.activity-metric strong {
  font-size: .91rem;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.metric-description {
  font-size: .875rem;
  color: #ded4c1;
  overflow-wrap: anywhere;
  word-break: keep-all;
}
.metrics-date {
  margin: .45rem 0 1.05rem;
  color: #665542;
  font-size: .8rem;
  text-align: right;
}

@media (max-width: 760px) {
  .brand .masthead { gap: .38rem; }
  .brand .signature { gap: .45rem; }
  .brand .signature > span:last-child { font-size: .79rem; letter-spacing: .13em; }
  .brand .mobile-index select { min-width: 0; max-width: 7rem; padding-inline: .4rem; }
  .brand .chat-launcher {
    gap: .33rem;
    padding: .2rem .36rem .2rem .24rem;
    font-size: .76rem;
    white-space: nowrap;
  }
  .brand .chat-launcher > span:last-child { display: inline; }
  .brand .chat-launcher .assistant-avatar { width: 28px; height: 28px; }
  .language-switch { min-width: 2.25rem; min-height: 40px; }
  .metric-label { min-height: 2.68em; font-size: .75rem; word-break: keep-all; }
  .activity-metric strong { font-size: .8rem; }
  .metric-description { font-size: .77rem; }
  .metrics-date { margin-bottom: .85rem; }
}

@media (max-width: 440px) {
  html[lang="en"] .brand .masthead .signature > span:last-child { display: none; }
}

@media (max-width: 365px) {
  .brand .masthead .signature > span:last-child { display: none; }
  .metric-number { font-size: clamp(1.6rem, 8vw, 2rem); }
}

@media (max-width: 760px) {
  html[lang="en"] .brand .cover h1 { font-size: clamp(2.3rem, 8.4vw, 3.9rem); }
}
