/* article.css: moved out of src/views/Article.astro on 2026-10-27, so a style fix is a single file upload. */

@scope (main) to (.tour-card > *, .inquiry > *, .map > *, .climate > *, .profile > *, .blocks) {
  /* The page is built for reading: white paper, one text color, mint only in small marks. */

  .cover {
    position: relative;
    display: grid;
    width: min(100% - var(--gutter) * 2, var(--wrap));
    margin: clamp(20px, 3vw, 36px) auto 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--ink-deep);
    color: var(--paper);
  }
  .cover picture > img,
  .cover-text {
    grid-area: 1 / 1;
  }
  .cover picture > img {
    width: 100%;
    height: 100%;
    aspect-ratio: 21 / 9;
    object-fit: cover;
  }
  .cover-text {
    position: relative;
    display: grid;
    align-content: end;
    justify-items: start;
    gap: 14px;
    padding: clamp(20px, 4vw, 48px);
    background: linear-gradient(180deg, rgb(12 34 45 / 0) 30%, rgb(12 34 45 / 0.82));
  }
  .label {
    padding: 6px 10px;
    border: 1px solid rgb(255 255 255 / 0.7);
    border-radius: 3px;
    font: 700 0.7rem/1 var(--head);
    letter-spacing: 0.14em;
    text-decoration: none;
    text-transform: uppercase;
  }
  .label:hover {
    background: var(--paper);
    color: var(--ink);
  }
  h1 {
    max-width: 20ch;
    font-size: clamp(1.5rem, 1.05rem + 2.3vw, 3rem);
    line-height: 1.14;
    text-shadow: 0 1px 14px rgb(12 34 45 / 0.5);
  }

  /* One quiet line under the cover: where you are, who wrote it and when. */
  .meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 32px;
    padding-block: 18px;
    border-bottom: 1px solid var(--line);
  }
  .byline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
  }
  .byline img {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--card);
  }
  .byline a {
    font-weight: 700;
  }
  .dates {
    display: block;
    font-size: 0.86rem;
    color: var(--ink-soft);
  }
  .dates i {
    margin-inline: 5px;
    font-style: normal;
  }
  .nowrap {
    white-space: nowrap;
  }

  .layout {
    display: grid;
    grid-template-columns: minmax(0, 720px) minmax(0, 1fr);
    gap: clamp(36px, 6vw, 96px);
    align-items: start;
    padding-block: clamp(28px, 4vw, 48px) clamp(48px, 7vw, 88px);
  }
  .main {
    font-size: 1.17rem;
    line-height: 1.7;
  }

  /* Answer: the reply to the search in one larger paragraph, four figures under it. */
  .answer p {
    margin: 0;
    font-size: clamp(1.2rem, 1.9vw, 1.4rem);
    line-height: 1.55;
  }
  .answer dl {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: clamp(22px, 3vw, 30px) 0 0;
    border-block: 1px solid var(--line);
  }
  .answer dl div {
    padding: 16px 12px 16px 0;
  }
  .answer dl div + div {
    padding-left: clamp(12px, 1.8vw, 20px);
    border-left: 1px solid var(--line);
  }
  .answer dt {
    font: 600 clamp(1.15rem, 2vw, 1.4rem) / 1.15 var(--title);
  }
  .answer dd {
    margin: 5px 0 0;
    font-size: 0.86rem;
    line-height: 1.35;
    color: var(--ink-soft);
  }

  .contents {
    display: none;
  }

  /* Sections: a small number above each heading, nothing more. */
  .part {
    padding-top: clamp(40px, 6vw, 64px);
  }
  .num,
  .small {
    display: block;
    font: 700 0.76rem/1 var(--head);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .num {
    margin-bottom: 10px;
    color: var(--accent-deep);
  }
  .part h2 {
    margin-bottom: 0.7em;
    font-size: clamp(1.5rem, 2.8vw, 2rem);
  }
  .faqs {
    font-size: 1.06rem;
  }
  .faqs .acc-body p {
    max-width: 68ch;
  }

  .checked {
    margin-top: clamp(40px, 6vw, 64px);
    padding-top: clamp(24px, 3vw, 32px);
    border-top: 1px solid var(--line);
    font-size: 0.98rem;
    line-height: 1.6;
  }
  .checked h2 {
    margin-bottom: 12px;
    font-size: 1.2rem;
  }
  .checked p {
    max-width: 68ch;
    color: var(--ink-soft);
  }
  .checked ul {
    display: grid;
    gap: 6px;
    margin: 4px 0 16px;
  }
  .stamp {
    margin: 0;
    font-size: 0.88rem;
  }

  .author {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: clamp(16px, 3vw, 26px);
    align-items: start;
    margin-top: clamp(28px, 4vw, 40px);
    padding-top: clamp(28px, 4vw, 40px);
    border-top: 1px solid var(--line);
    font-size: 1rem;
    line-height: 1.6;
  }
  .author img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--card);
  }
  .author h2 {
    margin-top: 8px;
    font-size: 1.35rem;
  }
  .role {
    display: block;
    margin: 4px 0 10px;
    font-size: 0.92rem;
    color: var(--ink-soft);
  }
  .author p {
    color: var(--ink-soft);
  }

  /* Side rail: the contents follow the reading. One line at the end to ask a question. */
  .rail {
    position: sticky;
    top: calc(var(--header) + 28px);
    display: grid;
    gap: 22px;
    /* A fixed width: with justify-self end alone the rail shrank to its longest contents label,
     so articles with short labels got a narrower tour card. */
    width: 100%;
    max-width: 300px;
    justify-self: end;
  }
  /* Five entries at a time; the list scrolls by itself to keep the section being read in view.
   The track is an inset shadow, not a border, so the active mark is not clipped by the scroll box. */
  .rail ol {
    position: relative;
    display: grid;
    max-height: calc(5 * (0.93rem * 1.35 + 12px));
    margin-top: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    box-shadow: inset 1px 0 0 var(--line);
  }
  .rail ol::-webkit-scrollbar {
    display: none;
  }
  /* The button under the list opens the whole contents and closes it again. */
  .rail.open {
    max-height: calc(100vh - var(--header) - 48px);
    overflow-y: auto;
    scrollbar-width: none;
  }
  .rail.open ol {
    max-height: none;
  }
  .toc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 8px 0 0 16px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--ink-soft);
    font: 700 0.8rem/1.2 var(--head);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: color 0.18s;
  }
  .toc-toggle:hover {
    color: var(--ink);
  }
  .toc-toggle svg {
    transition: transform 0.25s;
  }
  .toc-toggle[aria-expanded='true'] svg {
    transform: rotate(180deg);
  }
  .rail nav a {
    display: block;
    padding: 6px 0 6px 16px;
    border-left: 1px solid transparent;
    font-size: 0.93rem;
    line-height: 1.35;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.18s, border-color 0.18s;
  }
  .rail nav a:hover {
    color: var(--ink);
  }
  .rail nav a[aria-current] {
    border-left-color: var(--ink);
    color: var(--ink);
  }
  /* Recommended tour, on the model of the Andean Moments blog card: photo, stars, name, price,
   two facts and one button. */
  .pick {
    display: grid;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }
  .pick article {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 0 2px 10px rgb(18 48 63 / 0.06);
  }
  .pick img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
  }
  .pick-body {
    display: grid;
    gap: 3px;
    padding: 14px 18px 18px;
  }
  .stars {
    color: #f5b301;
    font-size: 0.9rem;
    letter-spacing: 2px;
  }
  .pick-name {
    font: 700 1.08rem/1.3 var(--title);
    color: var(--ink);
    text-decoration: none;
  }
  .pick-name:hover {
    text-decoration: underline;
  }
  .pick-price {
    font-size: 0.86rem;
    color: var(--ink-soft);
  }
  .pick-price b {
    font: 800 1.15rem/1 var(--head);
    color: var(--ink);
  }
  .pick-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 12px 0 14px;
    border-block: 1px solid var(--line);
  }
  .pick-facts div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 8px;
    align-items: center;
    padding: 10px 0;
    color: var(--accent-deep);
  }
  .pick-facts div + div {
    padding-left: 12px;
    border-left: 1px solid var(--line);
  }
  .pick-facts svg {
    grid-row: span 2;
  }
  .pick-facts dt {
    font: 700 0.62rem/1.2 var(--head);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .pick-facts dd {
    margin: 0;
    font: 700 0.9rem/1.25 var(--head);
    color: var(--ink);
  }
  .pick-book {
    display: block;
    padding: 11px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--ink);
    font: 700 0.92rem/1 var(--head);
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
  }
  /* Same hover as the site's mint buttons (.btn.accent). */
  .pick-book:hover {
    background: #89dbab;
  }
  /* The rail always follows the reader and the card always keeps its photo. Short screens, often a desktop
   with a large browser zoom, get a more compact rail; if even that does not fit, it scrolls inside itself. */
  @media (max-height: 760px) {
    .pick img {
      height: 100px;
    }
    .rail ol {
      max-height: calc(4 * (0.93rem * 1.35 + 12px));
    }
  }
  @media (max-height: 640px) {
    .rail {
      top: calc(var(--header) + 12px);
      gap: 14px;
      max-height: calc(100vh - var(--header) - 24px);
      overflow-y: auto;
      scrollbar-width: none;
    }
    .rail ol {
      max-height: calc(3 * (0.93rem * 1.35 + 12px));
    }
    .pick {
      gap: 8px;
      padding-top: 14px;
    }
    .pick img {
      height: 80px;
    }
    .pick-body {
      padding: 10px 14px 12px;
    }
    .pick-name {
      font-size: 0.98rem;
    }
    .pick-facts {
      margin: 8px 0 10px;
    }
    .pick-facts div {
      padding: 6px 0;
    }
    .pick-book {
      padding: 9px 16px;
    }
  }

  .cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 28px 40px;
  }
  .cta p {
    max-width: 52ch;
    margin-top: 12px;
    color: rgb(255 255 255 / 0.8);
  }
  .buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }

  @media (max-width: 1040px) {
    .layout {
      grid-template-columns: minmax(0, 1fr);
    }
    .main {
      max-width: 720px;
      margin-inline: auto;
    }
    .rail {
      display: none;
    }
    .contents {
      display: block;
      margin-top: 22px;
      border-block: 1px solid var(--line);
      font-size: 1rem;
    }
    .contents summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 2px;
      font: 700 0.76rem/1 var(--head);
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--ink-soft);
      cursor: pointer;
      list-style: none;
    }
    .contents summary::-webkit-details-marker {
      display: none;
    }
    .contents summary::after {
      content: '';
      width: 8px;
      height: 8px;
      margin-right: 4px;
      border-right: 2px solid var(--ink-soft);
      border-bottom: 2px solid var(--ink-soft);
      transform: rotate(45deg);
      transition: transform 0.2s;
    }
    .contents[open] summary::after {
      transform: rotate(-135deg);
    }
    .contents ol {
      display: grid;
      padding: 0 2px 10px;
    }
    .contents a {
      display: block;
      padding: 9px 0;
      line-height: 1.35;
      text-decoration: none;
    }
  }
  @media (max-width: 700px) {
    /* Phones: the cover runs edge to edge in an upright 4:5 frame, like the cover of a book. */
    .cover {
      width: 100%;
      margin-top: 0;
      border-radius: 0;
    }
    .cover picture > img {
      aspect-ratio: 4 / 5;
      max-height: 78vh;
    }
    .cover-text {
      gap: 12px;
      padding: 22px var(--gutter);
    }
    .meta {
      padding-block: 14px;
    }
    .main {
      font-size: 1.1rem;
      line-height: 1.65;
    }
    .answer dl {
      grid-template-columns: 1fr 1fr;
    }
    /* `div + div` again so this rule outranks the desktop one. */
    .answer dl div + div:nth-child(odd) {
      padding-left: 0;
      border-left: 0;
    }
    .answer dl div:nth-child(n + 3) {
      border-top: 1px solid var(--line);
    }
    .author {
      grid-template-columns: 64px minmax(0, 1fr);
    }
    .author img {
      width: 64px;
      height: 64px;
    }
    .cta .btn {
      flex: 1 1 100%;
    }
    .buttons {
      width: 100%;
    }
  }
}
