/* German compounds need real wrapping at narrow widths; do not clip the page
   or shorten the translated headings to hide an overflow. */
html[lang="de"] main :is(h1, h2, h3) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

/* The language selector belongs to the header, beside the saved-look heart. */
.language-menu { flex: 0 0 auto; }
.language-menu > summary {
  min-width: 76px;
  min-height: 44px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #f7f5ed38;
  border-radius: 999px;
  cursor: pointer;
  list-style: none;
  transition: background .18s, border-color .18s;
}
.language-menu > summary:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
.language-menu > summary::-webkit-details-marker { display: none; }
.language-menu > summary::marker { content: ''; }
.language-menu > summary:hover,
.language-menu[open] > summary { background: #f7f5ed12; border-color: #f7f5ed80; }
.language-menu > summary > svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.language-code { font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.language-menu > summary > .language-chevron { width: 12px; height: 12px; transition: transform .18s; }
.language-menu[open] .language-chevron { transform: rotate(180deg); }
.language-switcher {
  position: absolute;
  inset-block-start: calc(100% - 4px);
  inset-inline-end: max(16px, 4.2%);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(540px, calc(100dvh - 110px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #2b163060 transparent;
  padding: 12px;
  border: 1px solid #2b163025;
  border-radius: 18px;
  background: var(--cream);
  color: var(--plum);
  box-shadow: 0 18px 60px #1a0b2433;
  font-size: 13px;
  text-align: start;
}
.language-menu-label {
  grid-column: 1 / -1;
  padding: 5px 10px 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .03em;
}
.language-switcher a {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  line-height: 1.4;
}
.language-switcher a:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }
.language-switcher a:hover { background: #2b16300b; }
.language-switcher a[aria-current="page"] { background: var(--plum); color: var(--cream); font-weight: 600; }
.language-switcher a[aria-current="page"]::after { content: '✓'; }
@media (min-width: 761px) and (max-width: 1150px) {
  .header .desktop-nav { display: none; }
  .header .menu-toggle { display: block; }
  .header .header-actions { margin-inline-start: auto; }
}
@media (max-width: 760px) {
  .language-menu > summary { width: 44px; min-width: 44px; padding: 0; border-color: transparent; }
  .language-code, .language-menu > summary > .language-chevron { display: none; }
  .header-actions { gap: 4px; }
}
@media (max-width: 360px) {
  .header { padding-inline: 16px; gap: 6px; }
  .header .logo { font-size: 24px; }
  .header .header-actions { gap: 2px; }
}
@media print { .language-menu { display: none; } }

@media (max-width: 360px) {
  html[lang="de"] .cta-brand-word {
    font-size: 44px;
  }
}

/* Keep Japanese headlines complete, with comfortable character spacing. */
html[lang="ja"] main :is(h1, h2, h3) {
  text-wrap: balance;
  line-break: strict;
}
html[lang="ja"] .home .hero h1 {
  font-size: clamp(48px, 5.5vw, 84px);
  line-height: 1.2;
  letter-spacing: -.035em;
}
html[lang="ja"] .home .hero h1 em {
  display: inline-block;
  font-family: inherit;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: -.035em;
}
html[lang="ja"] .cta-brand-orbit { width: 90%; }
html[lang="ja"] .cta-brand-word {
  font-size: clamp(28px, 3.2vw, 50px);
  line-height: 1.3;
  letter-spacing: -.035em;
  max-width: 90%;
}
html[lang="ja"] .cta-brand-word em { font-style: normal; letter-spacing: -.035em; }
@media (max-width: 760px) {
  html[lang="ja"] .home .hero h1 { font-size: clamp(40px, 10.5vw, 64px); }
}

/* Korean words stay together where space allows; long headings can still wrap. */
html[lang="ko"] main :is(h1, h2, h3, p, li) {
  word-break: keep-all;
  overflow-wrap: anywhere;
}
html[lang="ko"] main :is(h1, h2, h3) { text-wrap: balance; }
html[lang="ko"] .home .hero h1 {
  font-size: clamp(48px, 5.5vw, 84px);
  line-height: 1.2;
  letter-spacing: -.035em;
}
html[lang="ko"] .home .hero h1 em {
  display: inline-block;
  line-height: 1.2;
  letter-spacing: -.035em;
}
html[lang="ko"] .cta-brand-orbit { width: 90%; }
html[lang="ko"] .cta-brand-word {
  font-size: clamp(28px, 3.2vw, 50px);
  line-height: 1.3;
  letter-spacing: -.035em;
  max-width: 90%;
}
@media (max-width: 760px) {
  html[lang="ko"] .home .hero h1 { font-size: clamp(40px, 10.5vw, 64px); }
}

/* Chinese CTA copy needs room inside the rotated decorative orbit. */
html[lang="zh-Hans"] .cta-brand-orbit { width: 90%; }
html[lang="zh-Hans"] .cta-brand-word {
  font-size: clamp(28px, 3.2vw, 50px);
  line-height: 1.3;
  letter-spacing: 0;
  max-width: 90%;
}
html[lang="zh-Hans"] .cta-brand-word em {
  font-family: inherit;
  font-style: normal;
  letter-spacing: 0;
}

/* Polish inflections can produce long words in narrow editorial headings. */
html[lang="pl"] main :is(h1, h2, h3) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

/* Dutch compounds stay complete and readable inside narrow editorial columns. */
html[lang="nl"] main :is(h1, h2, h3) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

/* Keep the Dutch app invitation inside its decorative orbit on small screens. */
html[lang="nl"] .cta-brand-orbit { width: 90%; }
html[lang="nl"] .cta-brand-word {
  font-size: clamp(32px, 4vw, 54px);
  max-width: 90%;
}

/* Turkish suffixes need wrapping in narrow headings; keep the app invitation inside its orbit. */
html[lang="tr"] main :is(h1, h2, h3) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
html[lang="tr"] .cta-copy { min-width: 0; }
html[lang="tr"] .cta-brand-orbit { width: 90%; }
html[lang="tr"] .cta-brand-word {
  font-size: clamp(32px, 4vw, 54px);
  max-width: 90%;
}

/* Czech inflected headings wrap within narrow cards and editorial columns. */
html[lang="cs"] main :is(h1, h2, h3) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
html[lang="cs"] .cta-copy { min-width: 0; }
html[lang="cs"] .cta-brand-orbit { width: 90%; }
html[lang="cs"] .cta-brand-word {
  font-size: clamp(32px, 4vw, 54px);
  max-width: 90%;
}

/* Arabic comparisons and galleries follow the document's right-to-left flow. */
html[lang="ar"] :is([data-table-prev], [data-direction-prev]) svg { transform: none; }
html[lang="ar"] :is([data-table-next], [data-direction-next]) svg { transform: rotate(180deg); }
html[lang="ar"] .depth-table-wrap :is(th, td, caption) { text-align: start; }
html[lang="ar"] .logo { direction: ltr; unicode-bidi: isolate; }
/* The gallery's first-button rule is more specific than its table counterpart. */
html[lang="ar"] .gallery-controls .round-arrow:first-child svg { transform: none; }

/* Swedish compounds need wrapping in narrow editorial headings and cards. */
html[lang="sv"] main :is(h1, h2, h3, .card-title) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
html[lang="sv"] .cta-copy { min-width: 0; }
html[lang="sv"] .cta-brand-orbit { width: 90%; }
html[lang="sv"] .cta-brand-word {
  font-size: clamp(32px, 4vw, 54px);
  max-width: 90%;
}
@media (max-width: 600px) {
  html[lang="sv"] .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  html[lang="sv"] .section-heading .text-link { max-width: 100%; }
}

/* Danish: long words and compact app invitations at narrow widths. */
html[lang="da"] main :is(h1,h2,h3,.card-title,.mood-card-title){overflow-wrap:anywhere;word-break:normal;hyphens:auto}
html[lang="da"] .cta-copy{min-width:0}
html[lang="da"] .cta-brand-orbit{width:90%}
html[lang="da"] .cta-brand-word{font-size:clamp(32px,4vw,54px);max-width:90%}
@media(max-width:600px){html[lang="da"] .section-heading{flex-direction:column;align-items:flex-start;gap:24px}html[lang="da"] .section-heading .text-link{max-width:100%}}

/* Norwegian compounds retain their full text at narrow viewport widths. */
html[lang="nb"] main :is(h1,h2,h3,.card-title,.mood-card-title){overflow-wrap:anywhere;word-break:normal;hyphens:auto}
html[lang="nb"] .cta-copy{min-width:0}
html[lang="nb"] .cta-brand-orbit{width:90%}
html[lang="nb"] .cta-brand-word{font-size:clamp(32px,4vw,54px);max-width:90%}
@media(max-width:600px){html[lang="nb"] .section-heading{flex-direction:column;align-items:flex-start;gap:24px}html[lang="nb"] .section-heading .text-link{max-width:100%}}

/* Keep the Vietnamese closing invitation inside the rotated brand artwork. */
html[lang="vi"] .cta-brand-orbit { width: 90%; }
html[lang="vi"] .cta-brand-word {
  font-size: clamp(32px, 4vw, 54px);
  max-width: 90%;
}

/* Indonesian headings and invitations retain their complete text on mobile. */
html[lang="id"] main :is(h1, h2, h3) {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
html[lang="id"] .cta-copy { min-width: 0; }
html[lang="id"] .cta-brand-orbit { width: 90%; }
html[lang="id"] .cta-brand-word {
  font-size: clamp(32px, 4vw, 54px);
  max-width: 90%;
}
html[lang="id"] .routine-timeline article .routine-marker { font-size: 26px; }
@media (max-width: 600px) {
  html[lang="id"] .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  html[lang="id"] .section-heading .text-link { max-width: 100%; }
  html[lang="id"] .routine-timeline article .routine-marker { font-size: 18px; }
}

/* Keep the original English collection link below its heading at 320px. */
@media (max-width: 360px) {
  html[lang="en"] .section-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  html[lang="en"] .section-heading .text-link { max-width: 100%; }
}
