/* Isolated typography and layout preview. Load after the PerfectHai theme CSS. */
:root {
  --ph-preview-reading: 720px;
  --ph-preview-content: 1240px;
  --ph-preview-map: 1280px;
}

body,
button,
input,
select,
textarea {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

.ph-wrap {
  width: min(var(--ph-preview-content), calc(100% - 48px));
  margin-top: 32px;
  margin-bottom: 52px;
}

.ph-header {
  min-height: 72px;
  padding-inline: max(24px, calc((100% - var(--ph-preview-content)) / 2));
}

.ph-header .ph-brand b {
  letter-spacing: -.01em;
}

.ph-header nav a {
  font-size: 14px;
  letter-spacing: -.01em;
}

.ph-crumbs {
  margin-bottom: 20px;
  color: #607067;
  font-size: 13px;
  line-height: 1.65;
}

.ph-title {
  max-width: 820px;
  margin: 24px 0 30px;
}

.ph-title > p:first-child {
  margin-bottom: 8px;
  color: #527064;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.ph-title h1,
.ph-page > article > h1,
.ph-404 h1 {
  margin: 0 0 14px;
  color: var(--p);
  font-size: clamp(44px, 4vw, 46px);
  line-height: 1.25;
  letter-spacing: -.01em;
}

.ph-title > p:last-child {
  max-width: 700px;
  margin: 0;
  color: #56655d;
  font-size: 16px;
  line-height: 1.75;
}

.ph-filters {
  gap: 12px;
  margin: 20px 0 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .66);
}

.ph-filters label {
  min-width: 154px;
  font-size: 14px;
  letter-spacing: 0;
}

.ph-filters input,
.ph-filters select,
.ph-filters button,
.ph-filters > a,
.ph-map-link,
.ph-404 input,
.ph-404 button {
  min-height: 44px;
  font-size: 16px;
}

.ph-grid {
  gap: 24px 20px;
}

.ph-card {
  grid-template-columns: minmax(0, 1fr) 44px;
  align-content: start;
  gap: 10px;
}

.ph-card-image {
  aspect-ratio: 16 / 10;
  min-height: 0;
  background: #e1e8df;
}

.ph-card img {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 12px;
  object-fit: cover;
}

.ph-card h3 {
  min-height: 3em;
  margin: 4px 0 6px;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: -.01em;
}

.ph-card p {
  margin: 0;
  color: #58665f;
  font-size: 15px;
  line-height: 1.65;
}

.ph-topic-grid,
.ph-destination-list {
  gap: 18px;
}

.ph-topic-grid a {
  padding: 22px;
}

.ph-topic-grid h2,
.ph-destination-group h2,
.ph-related h2 {
  letter-spacing: -.01em;
}

.ph-topic-grid h2 {
  font-size: 26px;
  line-height: 1.32;
}

.ph-topic-grid p {
  font-size: 15px;
  line-height: 1.65;
}

.ph-destination-group {
  margin: 34px 0;
}

.ph-destination-list a {
  min-height: 76px;
  padding: 10px;
}

.ph-single article {
  max-width: none;
}

.ph-single header {
  max-width: 820px;
  margin-bottom: 24px;
}

.ph-single h1 {
  max-width: 820px;
  margin: 6px 0 12px;
  color: var(--p);
  font-size: clamp(40px, 3.5vw, 42px);
  line-height: 1.25;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.ph-single > article > header h1 {
  font-size: clamp(40px, 3.5vw, 42px);
}

.ph-single header > p,
.ph-single time {
  font-size: 14px;
}

.ph-single article > .ph-content,
.ph-page .ph-content {
  max-width: var(--ph-preview-reading);
  font-size: 18px;
  line-height: 1.8;
  letter-spacing: 0;
}

.ph-content > p {
  margin: 0 0 1em;
}

.ph-content h2 {
  margin-top: 1.8em;
  margin-bottom: .55em;
  color: var(--p);
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: -.01em;
}

.ph-content h3 {
  margin-top: 1.6em;
  margin-bottom: .5em;
  color: var(--p);
  font-size: 23px;
  line-height: 1.4;
  letter-spacing: -.01em;
}

/* Elementor long-read wrappers are structural only; keep the reading measure on .ph-article. */
.ph-single .ph-content > .elementor,
.ph-single article > .ph-content > .elementor > .elementor-section,
.ph-single .ph-content > .elementor .elementor-container,
.ph-single .ph-content > .elementor .elementor-column,
.ph-single .ph-content > .elementor .elementor-widget-wrap,
.ph-single .ph-content > .elementor .elementor-widget-text-editor,
.ph-single .ph-content > .elementor .elementor-widget-container {
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ph-single .ph-content .ph-article {
  max-width: var(--ph-preview-reading);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: 18px;
  line-height: 1.8;
}

.ph-single .ph-content .ph-article p {
  margin: 0 0 1em;
  font-weight: 400;
}

.ph-single .ph-content .ph-article h2 {
  margin: 1.8em 0 .55em;
  padding-left: 0;
  border-left: 0;
  color: var(--p);
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: -.01em;
}

.ph-single .ph-content .ph-article h3 {
  margin: 1.6em 0 .5em;
  color: var(--p);
  font-size: 23px;
  line-height: 1.4;
  letter-spacing: -.01em;
}

.ph-single .ph-content .ph-article-intro,
.ph-single .ph-content .ph-article-body,
.ph-single .ph-content .ph-article-sources,
.ph-single .ph-content .ph-article .taiyue-article-style {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ph-single .ph-content .ph-article-sources {
  margin-top: 2.25em;
}

/* Keep media and captions semantic, but remove the decorative frame around every figure. */
.ph-single .ph-content .ph-article figure {
  max-width: 100%;
  margin: 1.8em 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ph-single .ph-content .ph-article-intro > figure:first-child {
  margin-top: 0;
}

.ph-single .ph-content .ph-article figure img,
.ph-single .ph-content .ph-article figure iframe,
.ph-single .ph-content .ph-article figure video {
  border-radius: 4px;
}

.ph-single .ph-content .ph-article figcaption,
.ph-single .ph-content .ph-article .widget-image-caption {
  margin: 8px 0 0;
  color: #5d6861;
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: 0;
}

/* Earlier articles use the same content directly in taiyue-article-style. */
.ph-single .ph-content .taiyue-article-style {
  max-width: var(--ph-preview-reading);
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: 18px;
  line-height: 1.8;
}

.ph-single .ph-content .taiyue-article-style p {
  margin: 0 0 1em;
}

.ph-single .ph-content .taiyue-article-style .taiyue-lead {
  margin: 0 0 1.2em;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: 19px;
  line-height: 1.7;
}

.ph-single .ph-content .taiyue-article-style h2 {
  margin: 1.8em 0 .55em;
  padding-left: 0;
  border-left: 0;
  color: var(--p);
  font-size: 30px;
  line-height: 1.35;
  letter-spacing: -.01em;
}

.ph-single .ph-content .taiyue-article-style h3 {
  margin: 1.6em 0 .5em;
  color: var(--p);
  font-size: 23px;
  line-height: 1.4;
  letter-spacing: -.01em;
}

.ph-single .ph-content .taiyue-article-style h4,
.ph-single .ph-content .taiyue-article-style .ty-repair-title {
  margin: 1.5em 0 .45em;
  color: var(--p);
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -.01em;
}

.ph-single .ph-content .taiyue-article-style h5 {
  margin: 1.4em 0 .4em;
  color: var(--p);
  font-size: 18px;
  line-height: 1.5;
}

.ph-single .ph-content .taiyue-article-style h6 {
  margin: 1.35em 0 .4em;
  color: #365348;
  font-size: 17px;
  line-height: 1.55;
}

.ph-single .ph-content .taiyue-article-style figure {
  max-width: 100%;
  margin: 1.8em 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.ph-single .ph-content .taiyue-article-style img {
  border-radius: 4px;
  box-shadow: none;
}

.ph-single .ph-content .taiyue-article-style figcaption,
.ph-single .ph-content .taiyue-article-style .widget-image-caption {
  margin: 8px 0 0;
  color: #5d6861;
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: 0;
}

.ph-single > article > aside.ph-toc {
  width: 224px;
  margin-left: 32px;
  padding: 16px;
  font-size: 14px;
}

.ph-single > article > aside.ph-toc summary,
.ph-single > article > aside.ph-toc a {
  font-size: 14px;
  line-height: 1.55;
}

/* Older post bodies can contain their own TOC. It is content, never the generated side rail. */
.ph-single .ph-content nav.ph-toc[aria-label='文章目录'] {
  position: static;
  float: none;
  width: auto;
  max-width: none;
  max-height: none;
  margin: 1.5em 0;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: inherit;
}

/* Only suppress the duplicate body TOC after site.js has populated the generated one. */
.ph-single > article:has(> aside.ph-toc a) .ph-content nav.ph-toc:not(.ph-article-toc)[aria-label='文章目录'] {
  display: none;
}

/* New articles ship their own collapsed body TOC; prefer it if both body formats exist. */
.ph-single .ph-content:has(nav.ph-article-toc) nav.ph-toc:not(.ph-article-toc)[aria-label='文章目录'] {
  display: none;
}

.ph-single .ph-content nav.ph-article-toc {
  max-width: var(--ph-preview-reading);
  margin: 1.5em auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

.ph-single .ph-content nav.ph-article-toc summary {
  min-height: 32px;
  cursor: pointer;
  color: var(--p);
  font-weight: 700;
}

/* A converted legacy TOC must not retain the old nested details card. */
.ph-single .ph-content nav.ph-article-toc > details {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Runtime-marked embeds carry their measured ratio without affecting homepage map iframes. */
.ph-single .ph-content iframe.ph-responsive-embed {
  display: block;
  width: 100% !important;
  max-width: 100%;
  height: auto !important;
  aspect-ratio: var(--ph-embed-ratio, 16 / 9) !important;
}

.ph-single .ph-content :is(h2, h3, h4, h5, h6) {
  scroll-margin-top: 96px;
}

/* Only tables measured as too wide get a keyboard-accessible scroll region. */
.ph-single .ph-content .ph-table-scroll {
  max-width: 100%;
  margin: 1.4em 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ph-single .ph-content .ph-table-scroll:focus-visible {
  outline: 3px solid #608b48;
  outline-offset: 3px;
}

.ph-single .ph-content .ph-table-scroll > table {
  display: table;
  width: 100%;
  min-width: 32rem;
  max-width: none;
  margin: 0;
  overflow: visible;
}

.ph-single .ph-content nav.ph-article-toc ol {
  columns: 2;
  gap: 24px;
  margin: 12px 0 0 1.25em;
  padding: 0;
}

.ph-single .ph-content nav.ph-article-toc li {
  break-inside: avoid;
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.55;
}

.ph-single .ph-content nav.taiyue-toc {
  max-width: var(--ph-preview-reading);
  margin: 1.5em auto;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  font-size: 14px;
}

@media (min-width: 801px) {
  .ph-single > article:has(> aside.ph-toc a) .ph-content nav.ph-article-toc {
    display: none;
  }
}

.ph-related,
.ph-comments {
  margin-top: 48px;
}

.ph-contact {
  max-width: 820px;
}

.ph-contact-form {
  gap: 16px;
  padding: 24px;
}

.ph-contact-form label {
  font-size: 14px;
}

.ph-contact-form input,
.ph-contact-form textarea,
.ph-contact-form button {
  font-size: 16px;
}

.ph-contact-privacy {
  font-size: 13px;
  line-height: 1.65;
}

.ph-404 {
  max-width: 720px;
}

.ph-footer {
  margin-top: 56px;
  padding-top: 32px;
  padding-bottom: 28px;
}

.ph-footer-top > div > p,
.ph-footer-bottom {
  font-size: 13px;
  line-height: 1.65;
}

#saved-dialog {
  width: min(560px, calc(100% - 32px));
  padding: 24px;
}

#saved-dialog h2 {
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -.01em;
}

/* Homepage keeps a stronger entry point while using the same reading rhythm. */
.content-wrap {
  width: min(var(--ph-preview-content), calc(100% - 48px));
}

.intro {
  margin-top: 20px;
  padding: 32px 36px;
}

.intro .intro-title h1 {
  font-size: clamp(52px, 4.6vw, 60px);
  line-height: 1.12;
  letter-spacing: -.02em;
}

.explorer.content-wrap {
  width: min(var(--ph-preview-map), calc(100% - 48px));
}

.explorer {
  padding: 24px;
}

.explorer h2,
.home-content h2 {
  font-size: clamp(26px, 2.5vw, 30px);
  line-height: 1.32;
  letter-spacing: -.01em;
}

.home-content {
  padding-top: 44px;
}

.home-content .section-title {
  margin-bottom: 16px;
}

.home-card-image {
  height: auto;
  aspect-ratio: 16 / 10;
}

.home-card-copy h3 {
  min-height: 3em;
  font-size: 18px;
  line-height: 1.5;
  letter-spacing: -.01em;
}

.home-card-copy p {
  font-size: 14px;
  line-height: 1.65;
}

.home-tab-panel .home-card-image {
  height: auto;
  aspect-ratio: 16 / 10;
}

.home-tab-panel .home-save {
  top: auto;
  bottom: 10px;
}

.home-destination-card,
.home-destination-card a {
  min-height: 200px;
}

.home-destination-card strong {
  font-size: 24px;
  letter-spacing: -.01em;
}

@media (min-width: 801px) and (max-width: 1000px) {
  .ph-header {
    gap: 6px;
    padding-inline: 18px;
  }

  .ph-header nav {
    gap: 1px;
  }

  .ph-header nav a {
    padding-inline: 7px;
    font-size: 14px;
  }

  .ph-header .ph-brand b {
    font-size: 18px;
  }

  .ph-saved {
    padding-inline: 9px;
  }

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

@media (max-width: 1000px) {
  .ph-single > article > aside.ph-toc {
    width: 100%;
    max-width: var(--ph-preview-reading);
    margin: 0 0 22px;
  }
}

@media (max-width: 800px) {
  .ph-wrap,
  .content-wrap,
  .explorer.content-wrap {
    width: min(100% - 32px, 720px);
  }

  .ph-wrap {
    margin-top: 26px;
    margin-bottom: 40px;
  }

  .ph-title {
    margin: 18px 0 24px;
  }

  .ph-title h1,
  .ph-page > article > h1,
  .ph-404 h1 {
    font-size: clamp(30px, 8.5vw, 32px);
  }

  .ph-single h1 {
    font-size: clamp(28px, 8vw, 30px);
  }

  .ph-single > article > header h1 {
    font-size: clamp(28px, 8vw, 30px);
  }

  .ph-single article > .ph-content,
  .ph-page .ph-content {
    font-size: 17px;
    line-height: 1.8;
  }

  .ph-single .ph-content .ph-article {
    max-width: 100%;
    font-size: 17px;
    line-height: 1.8;
  }

  .ph-single .ph-content .taiyue-article-style {
    max-width: 100%;
    font-size: 17px;
    line-height: 1.8;
  }

  .ph-single .ph-content .taiyue-article-style .taiyue-lead {
    font-size: 17px;
  }

  .ph-single .ph-content .ph-article figure {
    margin: 1.6em 0;
  }

  .ph-single .ph-content .taiyue-article-style figure {
    margin: 1.6em 0;
  }

  .ph-single > article:has(> .ph-content nav.ph-article-toc) > aside.ph-toc[data-toc] {
    display: none;
  }

  .ph-single > article:has(> aside.ph-toc) .ph-content nav.ph-article-toc {
    display: block;
  }

  .ph-single .ph-content nav.ph-article-toc {
    margin: 1.35em 0;
    padding: 13px 14px;
  }

  .ph-single .ph-content nav.ph-article-toc ol {
    columns: 1;
  }

  .ph-crumbs {
    flex-wrap: nowrap;
  }

  .ph-crumbs > :not(:last-child) {
    flex: 0 0 auto;
  }

  .ph-crumbs > :last-child {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ph-content h2 {
    font-size: 25px;
  }

  .ph-single .ph-content .ph-article h2 {
    font-size: 25px;
  }

  .ph-single .ph-content .taiyue-article-style h2 {
    font-size: 25px;
  }

  .ph-content h3 {
    font-size: 21px;
  }

  .ph-single .ph-content .ph-article h3 {
    font-size: 21px;
  }

  .ph-single .ph-content .taiyue-article-style h3 {
    font-size: 21px;
  }

  .ph-filters {
    padding: 14px;
  }

  .ph-filters label {
    width: 100%;
  }

  .ph-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ph-card h3,
  .home-card-copy h3 {
    min-height: 0;
    font-size: 16px;
  }

  .ph-card p,
  .home-card-copy p {
    font-size: 14px;
    line-height: 1.65;
  }

  .intro {
    padding: 28px 24px;
  }

  .intro .intro-title h1 {
    font-size: clamp(46px, 12vw, 52px);
  }

  .explorer {
    width: 100%;
    padding: 18px 16px;
  }

  .explorer h2,
  .home-content h2 {
    font-size: 26px;
  }

  .home-content {
    padding-top: 32px;
  }

  .home-card-image,
  .home-tab-panel .home-card-image {
    aspect-ratio: 16 / 10;
  }

  .home-tab-panel .home-card-image,
  .home-latest .home-card-image {
    height: 100px;
    aspect-ratio: auto;
  }

  .home-tab-panel .home-card-copy h3,
  .home-latest .home-card-copy h3 {
    font-size: 16px;
  }

  .ph-contact-form {
    padding: 18px;
  }

  .ph-footer {
    margin-top: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ph-topic-grid a,
  .home-topic-grid a,
  .home-card-copy h3 a,
  .ph-card h3 a {
    transition: none;
  }
}

/* A destination may only have one or two real articles. Keep that result dense without changing it. */
@media (min-width: 801px) {
  .ph-collection .ph-grid:has(> .ph-card:nth-child(2):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ph-collection .ph-grid:has(> .ph-card:only-child) {
    grid-template-columns: minmax(0, 620px);
  }

  .ph-collection .ph-grid:has(> .ph-card:nth-child(-n + 2):last-child) > .ph-card {
    grid-template-columns: minmax(150px, 180px) minmax(0, 1fr) 58px;
    column-gap: 14px;
    align-items: start;
    padding-bottom: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .7);
  }

  .ph-collection .ph-grid:has(> .ph-card:nth-child(-n + 2):last-child) > .ph-card .ph-card-image {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: stretch;
    width: 100%;
    min-width: 0;
    min-height: 140px;
    aspect-ratio: auto;
  }

  .ph-collection .ph-grid:has(> .ph-card:nth-child(-n + 2):last-child) > .ph-card .ph-card-image:empty::after {
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    content: '泰悦时光';
    color: #698074;
    font-size: 13px;
    letter-spacing: .08em;
  }

  .ph-collection .ph-grid:has(> .ph-card:nth-child(-n + 2):last-child) > .ph-card .ph-card-body {
    grid-column: 2;
    min-width: 0;
    padding: 14px 0;
  }

  .ph-collection .ph-grid:has(> .ph-card:nth-child(-n + 2):last-child) > .ph-card h3 {
    min-height: 0;
    margin-right: 0;
  }

  .ph-collection .ph-grid:has(> .ph-card:nth-child(-n + 2):last-child) > .ph-card .ph-save {
    grid-column: 3;
    grid-row: 1;
    margin: 14px 14px 0 0;
  }
}

/* Articles use a narrower two-column measure than site listings. */
@media (min-width: 1101px) {
  .ph-wrap.ph-single {
    width: min(1040px, calc(100% - 48px));
  }

  .ph-single > article > aside.ph-toc {
    width: 240px;
    margin-left: 80px;
  }
}

@media (max-width: 1100px) {
  .ph-wrap.ph-single {
    width: min(var(--ph-preview-reading), calc(100% - 48px));
  }

  .ph-single > article > aside.ph-toc {
    float: none;
    position: relative;
    top: auto;
    width: 100%;
    max-width: var(--ph-preview-reading);
    max-height: 260px;
    margin: 0 0 22px;
  }
}

@media (max-width: 800px) {
  .ph-wrap.ph-single {
    width: min(720px, calc(100% - 32px));
  }
}
