/* Load after styles.css, features.css, and qimen.css.
   Character portraits and the blank nine-cell motif are decorative world art.
   This stylesheet neither supplies nor substitutes calculated chart values. */
:root {
  --qimen-chief-x: 0%;
  --qimen-moon-x: 50%;
  --qimen-bond-x: 100%;
  --qimen-portrait-y: 0%;
}

/* Copy and illustration occupy separate grid cells, including at enlarged text. */
.hero.qimen-hero {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  align-items: center;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 3px;
  background: var(--ivory);
}
.hero.qimen-hero::before { display: none; }
.hero.qimen-hero::after {
  content: "";
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  background: url('/assets/hero-qimen.jpg') right top / 145% auto no-repeat;
  pointer-events: none;
}
.qimen-hero .hero-copy {
  position: relative;
  grid-column: 1;
  grid-row: 1;
  width: auto;
  min-width: 0;
  padding: 46px 24px 42px 40px;
}
.qimen-hero .hero-art {
  position: static;
  grid-column: 2;
  grid-row: 1;
  order: initial;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  min-height: 450px;
  max-height: 570px;
  object-fit: contain;
  object-position: center;
  mask-image: none;
  background: var(--ivory);
  opacity: 0;
}
.qimen-hero .hero-kicker { margin-bottom: 23px; color: var(--brand-dark); }
.qimen-hero .hero-title {
  max-width: 100%;
  margin: 0 0 29px;
  font-size: clamp(34px, 3.55vw, 48px);
  line-height: 1.48;
  letter-spacing: -.055em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.qimen-hero .hero-title > span { display: inline; }
.qimen-hero .hero-title > span::after { display: none; }
.qimen-hero .hero-description {
  max-width: 100%;
  margin-bottom: 27px;
  color: #685d51;
  font-size: 13px;
  line-height: 1.9;
}
.qimen-hero .hero-actions { align-items: stretch; gap: 10px; }
.qimen-hero .hero-actions > a {
  min-height: 48px;
  max-width: 100%;
  padding: 12px 17px;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.qimen-hero p.hero-offer-note { margin: 13px 0 0; color: var(--brand-dark); font-size: 13px; line-height: 1.7; }
.home-faq { max-width: 820px; margin-top: 58px; }
.home-faq h2 { margin: 0 0 23px; font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1.5; letter-spacing: -.04em; }
.home-faq details { border-top: 1px solid var(--line); }
.home-faq details:last-child { border-bottom: 1px solid var(--line); }
.home-faq summary { min-height: 52px; padding: 15px 3px; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.7; cursor: pointer; }
.home-faq details p { margin: 0; padding: 0 3px 19px; color: var(--muted); font-size: 13px; line-height: 1.9; word-break: keep-all; }
.qimen-hero .hero-caption {
  position: static;
  grid-column: 1 / -1;
  width: auto;
  max-width: none;
  padding: 11px 28px 15px;
  color: #7e6c58;
  font-size: 13px;
  line-height: 1.8;
  text-align: right;
}

/* Open editorial spacing, with each character's text below its picture. */
.world-intro { margin-top: 64px; padding-top: 4px; }
.world-intro > .eyebrow { margin-bottom: 18px; color: var(--brand-dark); }
.world-intro h2 {
  max-width: 680px;
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -.05em;
}
.world-intro > p {
  max-width: 670px;
  margin: 0 0 29px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.95;
  word-break: keep-all;
}
.world-intro > .world-caption { margin: 21px 0 0; color: #93806e; font-size: 13px; line-height: 1.8; }
.guardian-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 25px;
  margin-top: 30px;
}
.guardian-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.guardian-portrait {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 340px;
  overflow: hidden;
  border-radius: 3px;
  background-color: var(--ivory);
  background-image: url('/assets/portraits-qimen.jpg');
  background-repeat: no-repeat;
  background-size: 300% auto;
  background-position: var(--guide-x, var(--qimen-chief-x)) var(--qimen-portrait-y);
}
/* A bounded hidden img preserves its source/load state; the same art is cropped
   as a CSS background without enlarging the element's rectangle. */
.guardian-portrait img { width: 100%; height: 100%; object-fit: cover; visibility: hidden; }
img.guardian-portrait {
  background-image: none;
  object-fit: cover;
  object-position: var(--guide-x, var(--qimen-chief-x)) var(--qimen-portrait-y);
}
.guardian-card[data-guide=chief] { --guide-x: var(--qimen-chief-x); }
.guardian-card[data-guide=moon] { --guide-x: var(--qimen-moon-x); }
.guardian-card[data-guide=bond] { --guide-x: var(--qimen-bond-x); }
.guardian-copy { min-width: 0; padding: 21px 0 0; }
.guardian-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px 12px; margin: 0 0 8px; color: var(--ink); font-family: var(--serif); font-size: 23px; font-weight: 600; line-height: 1.5; letter-spacing: -.035em; }
.guardian-name h3 { margin: 0; font: inherit; color: inherit; }
.guardian-name span { color: #9d7256; font-family: var(--sans); font-size: 13px; font-weight: 400; letter-spacing: .06em; }
.guardian-role { margin: 0 0 8px; color: var(--brand-dark); font-size: 13px; font-weight: 600; line-height: 1.7; }
.guardian-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.9; word-break: keep-all; overflow-wrap: anywhere; }
.guardian-copy p + p { margin-top: 8px; }
.guardian-copy p.guardian-role { margin-bottom: 8px; color: var(--brand-dark); font-size: 13px; font-weight: 600; }
.product-guide-label { display: block; margin: 7px 0 0; color: #9b7861; font-size: 13px; font-weight: 400; line-height: 1.7; }
.product-art[data-guide] {
  --portrait-image: url('/assets/portraits-qimen.jpg');
  --portrait-size: 300% auto;
  --portrait-position: var(--guide-x, var(--qimen-chief-x)) 12%;
  background-image: var(--portrait-image);
  background-repeat: no-repeat;
  background-size: var(--portrait-size);
  background-position: var(--portrait-position);
}
.product-art[data-guide=chief] { --guide-x: var(--qimen-chief-x); }
.product-art[data-guide=moon] { --guide-x: var(--qimen-moon-x); }
.product-art[data-guide=bond] { --guide-x: var(--qimen-bond-x); }
.product-art[data-guide] .product-character { visibility: hidden; }

/* The nine blank cells are a visual motif; no palace, gate, or spirit labels. */
.qimen-method-banner {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) auto;
  align-items: center;
  gap: 31px;
  margin-top: 59px;
  padding: 31px 36px;
  border-top: 1px solid #d8c9b7;
  border-bottom: 1px solid #d8c9b7;
  background: #f1eadf;
}
.method-symbol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  width: 92px;
  height: 92px;
  padding: 7px;
  border: 1px solid #b89d7c;
  border-radius: 50%;
  transform: rotate(-7deg);
}
.method-symbol span { display: block; min-width: 0; border: 1px solid #c5ae90; border-radius: 2px; background: rgba(251, 249, 245, .4); }
.method-symbol span:nth-child(5) { border-color: var(--ink); background: var(--ink); }
.method-symbol span:nth-child(2), .method-symbol span:nth-child(7) { border-color: #c9a08b; background: #dcb7a0; }
.method-copy { min-width: 0; }
.method-copy h2 { margin: 0 0 10px; font-family: var(--serif); font-size: 25px; font-weight: 500; line-height: 1.55; letter-spacing: -.035em; }
.method-copy p { max-width: 640px; margin: 0; color: #7a6957; font-size: 13px; line-height: 1.9; word-break: keep-all; }
.qimen-method-banner > a, .qimen-method-banner .text-link { min-height: 48px; max-width: 100%; padding: 11px 14px; color: #6c4c38; font-size: 13px; text-align: center; white-space: normal; overflow-wrap: anywhere; }

/* Actual Hongguk chart: preserve its order and data, clarify layers. */
.reading-summary.qimen-summary { padding: 27px; border-top: 2px solid #b2916c; background: #f2ece2; }
.qimen-summary .summary-name { margin-bottom: 11px; color: #674a32; font-size: 14px; }
.qimen-summary .chart-note { color: #786958; font-size: 13px; line-height: 1.85; }
.qimen-summary .qimen-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin: 20px 0 18px; }
.qimen-summary .qimen-palace { min-width: 0; padding: 17px 13px; border: 1px solid #dfd2c1; border-radius: 3px; background: var(--paper); word-break: keep-all; overflow-wrap: anywhere; }
.qimen-summary .qimen-palace h3 { margin: 0 0 5px; color: #594836; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.45; }
.qimen-summary .qimen-direction { margin: 0 0 14px; color: #8e7a64; font-size: 13px; line-height: 1.6; }
.qimen-summary .qimen-layer { display: flex; flex-direction: column; gap: 5px; margin: 9px 0; padding: 9px 10px; border-radius: 0; background: #f1e9de; color: #4c3e31; font-size: 16px; font-weight: 500; line-height: 1.65; }
.qimen-summary .qimen-layer span { color: #886546; font-size: 13px; font-weight: 600; letter-spacing: .04em; line-height: 1.6; }
.qimen-summary .qimen-layer + .qimen-layer { background: #f0eee7; }
.qimen-summary .qimen-layer + .qimen-layer span { color: #6e7565; }
.qimen-summary .qimen-relation { margin: 11px 0 0; padding-top: 9px; border-top: 1px solid #e6dbcb; color: #82705d; font-size: 13px; line-height: 1.8; }
.qimen-summary .qimen-centre { border-color: var(--ink); background: var(--ink); }
.qimen-summary .qimen-centre h3 { color: #faf3e8; }
.qimen-summary .qimen-centre .qimen-direction { color: #c6b9a6; }
.qimen-summary .qimen-centre .qimen-layer { background: #353029; color: #fbf4e9; }
.qimen-summary .qimen-centre .qimen-layer span { color: #d3b594; }
.qimen-summary .qimen-centre .qimen-layer + .qimen-layer { background: #312e28; }
.qimen-summary .qimen-centre .qimen-layer + .qimen-layer span { color: #c3c4b5; }
.qimen-summary .qimen-centre .qimen-relation { border-top-color: #5a4e40; color: #d0c1ad; }
.qimen-summary .chart-details { margin-top: 17px; padding: 0; border-top: 1px solid #d9c9b5; color: #705d49; font-size: 13px; }
.qimen-summary .chart-details summary { width: 100%; min-height: 48px; padding: 14px 2px; color: #6b4b32; font-size: 13px; font-weight: 600; line-height: 1.7; cursor: pointer; }
.qimen-summary .chart-details[open] summary { margin-bottom: 9px; border-bottom: 1px solid #e0d2bf; }
.qimen-summary .chart-details p { margin: 10px 0; line-height: 1.85; overflow-wrap: anywhere; }
.qimen-input-note { padding: 13px 16px; background: var(--ivory); color: #76634e; font-size: 13px; line-height: 1.85; }

/* Focus and press feedback work without relying on hover. */
.qimen-hero .hero-actions > a:focus-visible,
.qimen-method-banner > a:focus-visible,
.qimen-summary .chart-details summary:focus-visible { outline: 3px solid var(--brand); outline-offset: 4px; }
.qimen-hero .hero-actions > a:active { background: #4c4035; color: #fff; border-color: #4c4035; }
.qimen-method-banner > a:active { background: #e7d6c4; }
.qimen-summary .chart-details summary:active { background: #eadccb; }
@media (hover: hover) {
  .qimen-method-banner > a:hover { color: var(--brand-dark); background: #ebe0d1; }
  .qimen-summary .chart-details summary:hover { color: var(--brand-dark); }
}

@media (max-width: 960px) {
  .hero.qimen-hero { grid-template-columns: minmax(0, 1fr); }
  .qimen-hero .hero-copy { grid-column: 1; grid-row: 1; padding: 33px 32px 25px; }
  .qimen-hero .hero-title { font-size: 41px; max-width: 100%; }
  .qimen-hero .hero-description { max-width: 100%; }
  .qimen-hero .hero-art { grid-column: 1; grid-row: 2; min-height: 0; max-height: none; height: auto; max-width: 100%; aspect-ratio: 1.9; object-fit: contain; }
  .hero.qimen-hero::after { grid-column: 1; grid-row: 2; }
  .qimen-hero .hero-caption { grid-column: 1; grid-row: 3; padding-top: 7px; }
  .guardian-strip { gap: 19px; }
  .guardian-portrait { height: 242px; background-size: 300% auto; }
  .guardian-name { font-size: 22px; }
  .qimen-method-banner { grid-template-columns: 85px minmax(0, 1fr); gap: 22px; padding: 28px; }
  .method-symbol { width: 82px; height: 82px; }
  .qimen-method-banner > a { grid-column: 2; justify-self: start; padding-left: 0; }
}
@media (max-width: 600px) {
  .qimen-hero .hero-copy { padding: 27px 22px 21px; }
  .qimen-hero .hero-kicker { margin-bottom: 19px; font-size: 13px; }
  .qimen-hero .hero-title { margin-bottom: 22px; font-size: clamp(26px, 7.5vw, 35px); line-height: 1.5; letter-spacing: -.045em; }
  .qimen-hero .hero-description { margin-bottom: 23px; font-size: 13px; line-height: 1.85; }
  .qimen-hero .hero-actions { gap: 9px; }
  .qimen-hero .hero-actions > a { min-height: 46px; padding: 11px 13px; font-size: 13px; }
  .qimen-hero .hero-art { height: auto; min-height: 0; aspect-ratio: 1.32; object-fit: contain; object-position: center; }
  .qimen-hero .hero-caption { padding: 7px 20px 13px; font-size: 13px; text-align: center; }
  .world-intro { margin-top: 44px; }
  .world-intro h2 { font-size: 27px; }
  .world-intro > .eyebrow { margin-bottom: 14px; font-size: 13px; }
  .world-intro > p { margin-bottom: 23px; font-size: 13px; line-height: 1.9; }
  .guardian-strip { grid-template-columns: minmax(0, 1fr); gap: 23px; margin-top: 24px; }
  .guardian-card { grid-template-columns: 113px minmax(0, 1fr); gap: 18px; align-items: start; }
  .guardian-portrait { height: 147px; background-size: 300% auto; }
  .guardian-copy { padding-top: 5px; }
  .guardian-name { gap: 2px 8px; margin-bottom: 7px; font-size: 22px; }
  .guardian-name span { font-size: 13px; }
  .guardian-role, .guardian-copy p.guardian-role { font-size: 13px; }
  .guardian-copy p { font-size: 13px; line-height: 1.8; }
  .product-guide-label { margin-top: 5px; font-size: 13px; }
  .product-art[data-guide] { --portrait-size: 300% auto !important; }
  .qimen-method-banner { grid-template-columns: 62px minmax(0, 1fr); gap: 13px 17px; margin-top: 40px; padding: 25px 19px; }
  .method-symbol { width: 60px; height: 60px; padding: 5px; gap: 3px; }
  .method-copy h2 { margin-bottom: 9px; font-size: 22px; line-height: 1.55; }
  .method-copy p { font-size: 13px; line-height: 1.85; }
  .qimen-method-banner > a { grid-column: 1 / -1; justify-self: start; min-height: 46px; padding-left: 0; font-size: 13px; }
  .reading-summary.qimen-summary { padding: 19px 14px; }
  .qimen-summary .summary-name { font-size: 13px; }
  .qimen-summary .chart-note { font-size: 13px; }
  .qimen-summary .qimen-grid { gap: 6px; margin: 17px 0; }
  .qimen-summary .qimen-palace { padding: 12px 8px; }
  .qimen-summary .qimen-palace h3 { font-size: 16px; line-height: 1.55; }
  .qimen-summary .qimen-direction { margin-bottom: 11px; font-size: 13px; }
  .qimen-summary .qimen-layer { gap: 4px; margin: 8px 0; padding: 7px 6px; font-size: 14px; line-height: 1.65; }
  .qimen-summary .qimen-layer span { font-size: 13px; }
  .qimen-summary .qimen-relation { margin-top: 9px; padding-top: 7px; font-size: 13px; line-height: 1.7; }
  .qimen-summary .chart-details { font-size: 13px; }
  .qimen-summary .chart-details summary { min-height: 48px; font-size: 13px; }
  .qimen-input-note { padding: 12px; font-size: 13px; }
}
@media (max-width: 360px) {
  .qimen-hero .hero-copy { padding: 25px 18px 21px; }
  .qimen-hero .hero-title { font-size: 25px; }
  .qimen-hero .hero-actions { flex-direction: column; }
  .qimen-hero .hero-actions > a { width: 100%; min-height: 46px; font-size: 13px; }
  .qimen-hero .hero-art { aspect-ratio: 1.24; }
  .world-intro h2 { font-size: 25px; }
  .guardian-card { grid-template-columns: 96px minmax(0, 1fr); gap: 15px; }
  .guardian-portrait { height: 136px; }
  .guardian-name { font-size: 20px; }
  .qimen-method-banner { grid-template-columns: 54px minmax(0, 1fr); gap: 13px; padding: 22px 15px; }
  .method-symbol { width: 52px; height: 52px; padding: 4px; gap: 3px; }
  .method-copy h2 { font-size: 20px; }
  .reading-summary.qimen-summary { padding: 17px 11px; }
  .qimen-summary .qimen-grid { gap: 5px; }
  .qimen-summary .qimen-palace { padding: 10px 6px; }
  .qimen-summary .qimen-palace h3 { font-size: 15px; }
  .qimen-summary .qimen-layer { padding: 7px 5px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .qimen-hero *, .guardian-strip *, .qimen-method-banner *, .qimen-summary * { animation: none !important; transition: none !important; }
  .qimen-hero .hero-actions > a:active { transform: none; }
}
@media print {
  .qimen-summary { background: var(--surface) !important; }
  .qimen-summary .qimen-grid { break-inside: avoid; gap: 6px; }
  .qimen-summary .qimen-palace { border: 1px solid #aaa; background: var(--surface); }
  .qimen-summary .qimen-centre { background: #f0f0f0; }
  .qimen-summary .qimen-centre h3, .qimen-summary .qimen-centre .qimen-layer { color: #211f1d; }
  .qimen-summary .qimen-centre .qimen-layer, .qimen-summary .qimen-centre .qimen-layer + .qimen-layer { background: var(--surface); }
  .qimen-summary .qimen-centre .qimen-layer span, .qimen-summary .qimen-centre .qimen-direction, .qimen-summary .qimen-centre .qimen-relation { color: #555; }
}
