/* ------------------------------------------------------------------
   Madeira Travel Guide (/madeira-travel-guide/).
   Scoped to .tg-* so nothing here reaches other pages.
   Brand: #222 header, #FFC107 yellow, Ubuntu.
   ------------------------------------------------------------------ */

.tg, .tg-sticky-cta {
    --tg-ink: #1c1c1e;
    --tg-text: #3d3d42;
    --tg-muted: #6b6b73;
    --tg-line: #e6e6ec;
    --tg-bg: #f4f4f9;
    --tg-card: #ffffff;
    --tg-yellow: #ffc107;
    --tg-yellow-dark: #e0a800;
    --tg-dark: #222222;
    --tg-radius: 16px;
    --tg-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
    color: var(--tg-text);
    background: var(--tg-bg);
    font-family: 'Ubuntu', system-ui, sans-serif;
    line-height: 1.65;
    overflow-x: clip;
}
.tg *, .tg *::before, .tg *::after { box-sizing: border-box; }
.tg [id] { scroll-margin-top: 90px; }
.tg-visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* style.css sets overflow-x:hidden on html AND body, which makes body a
   scroll container and silently breaks position:sticky (site header and
   the guide sidebar). clip stops sideways scroll without that side effect. */
html:has(.tg), body:has(.tg) { overflow-x: clip; }

/* Neutralise the site-wide section / h2 / p rules in style.css
   ("section { padding: 80px 20px }", centred h2 and p). :where() keeps
   these at element-level specificity so every .tg-* class below wins. */
:where(.tg) section { padding: 0; margin: 0; }
:where(.tg) section h2 { text-align: inherit; font-weight: 700; margin: 0; }
:where(.tg) section p { text-align: inherit; max-width: none; color: inherit; margin: 0; }

/* ---------------- Buttons ---------------- */
.tg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 48px; padding: .75rem 1.4rem; border-radius: 999px;
    font-weight: 700; font-size: 1rem; text-decoration: none; line-height: 1.2;
    transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.tg-btn:hover { transform: translateY(-1px); }
.tg-btn-primary { background: var(--tg-yellow); color: #1a1a1a; box-shadow: 0 6px 18px rgba(255,193,7,.35); }
.tg-btn-primary:hover { background: var(--tg-yellow-dark); }
.tg-btn-ghost { color: #fff; border: 1.5px solid rgba(255,255,255,.7); background: rgba(255,255,255,.08); backdrop-filter: blur(4px); }
.tg-btn-ghost:hover { background: rgba(255,255,255,.18); }
.tg-btn-dark { background: var(--tg-dark); color: #fff; }

/* ---------------- Hero ---------------- */
.tg-hero {
    position: relative; isolation: isolate;
    min-height: min(78vh, 640px);
    display: flex; align-items: flex-end;
    color: #fff; overflow: hidden;
}
.tg-hero-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; object-position: center 40%; z-index: -2;
}
.tg-hero::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(180deg, rgba(0,0,0,.45) 0%, rgba(0,0,0,.15) 35%, rgba(0,0,0,.75) 100%);
}
.tg-hero-inner {
    width: 100%; max-width: 1200px; margin: 0 auto;
    padding: 1.25rem 1.25rem 6.5rem;
}
.tg-hero h1 {
    font-size: clamp(2.1rem, 5.2vw, 3.6rem); line-height: 1.08; letter-spacing: -.02em;
    margin: .6rem 0 1rem; max-width: 16ch; color: #fff; text-shadow: 0 2px 20px rgba(0,0,0,.35);
}
.tg-lead { font-size: clamp(1.02rem, 1.6vw, 1.2rem); max-width: 60ch; color: rgba(255,255,255,.92); margin: 0 0 1.1rem; }
.tg-kicker {
    display: inline-flex; align-items: center; gap: .45rem;
    background: var(--tg-yellow); color: #1a1a1a; font-weight: 700; font-size: .8rem;
    letter-spacing: .06em; text-transform: uppercase; padding: .35rem .8rem; border-radius: 999px;
}
.tg-meta { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; padding: 0; margin: 0 0 1.5rem; font-size: .92rem; color: rgba(255,255,255,.85); }
.tg-meta i { color: var(--tg-yellow); margin-right: .3rem; }
.tg-hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; }

/* Breadcrumb (inside the hero, above the title) */
.tg-breadcrumb { position: absolute; top: 1.25rem; left: 0; right: 0; max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.tg-breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin: 0; padding: 0; font-size: .875rem; }
.tg-breadcrumb li { display: inline-flex; align-items: center; gap: .35rem; color: #fff; font-weight: 600; }
.tg-breadcrumb li + li::before { content: "›"; color: rgba(255,255,255,.6); font-weight: 400; margin-right: .1rem; }
.tg-breadcrumb a { color: rgba(255,255,255,.82); text-decoration: none; font-weight: 400; }
.tg-breadcrumb a:hover { color: #fff; text-decoration: underline; }

/* ---------------- Quick facts ---------------- */
.tg-facts {
    position: relative; z-index: 2;
    max-width: 1160px; margin: -4.5rem auto 0; padding: 0 1.25rem;
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem;
}
.tg-facts > div {
    background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow);
    padding: 1.1rem 1.2rem; display: grid; grid-template-columns: auto 1fr; column-gap: .8rem; align-items: center;
}
.tg-facts i {
    grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: #fff6d6; color: #8a6400; font-size: 1.1rem;
}
.tg-facts strong { color: var(--tg-ink); font-size: .95rem; }
.tg-facts span { color: var(--tg-muted); font-size: .88rem; line-height: 1.35; }

/* ---------------- Layout ---------------- */
.tg-layout {
    max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem;
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2.5rem; align-items: start;
}
.tg-content { min-width: 0; }
.tg-intro p { font-size: 1.12rem; color: var(--tg-ink); margin: 0; }

.tg-section { margin-top: 3.5rem; }
.tg-section h2 {
    font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; letter-spacing: -.01em;
    color: var(--tg-ink); margin: 0 0 .6rem;
}
.tg-section-lead { color: var(--tg-muted); margin: 0 0 1.25rem; }

/* ---------------- Top 10 table ---------------- */
.tg-table-wrap { overflow-x: auto; border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); background: var(--tg-card); margin-top: 1rem; }
.tg-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tg-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tg-muted); background: #fafafc; padding: .85rem 1rem; border-bottom: 1px solid var(--tg-line); }
.tg-table td { padding: .8rem 1rem; border-bottom: 1px solid var(--tg-line); vertical-align: top; }
.tg-table tr:last-child td { border-bottom: 0; }
.tg-table td:first-child { font-weight: 700; color: #8a6400; width: 3rem; }
.tg-table a { color: var(--tg-ink); font-weight: 600; text-decoration: none; }
.tg-table a:hover { text-decoration: underline; text-decoration-color: var(--tg-yellow); text-decoration-thickness: 2px; }
.tg-table td:nth-child(3), .tg-table td:nth-child(4) { color: var(--tg-muted); white-space: nowrap; }

/* ---------------- Filters ---------------- */
.tg-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.tg-chip {
    font: inherit; font-size: .9rem; font-weight: 500; cursor: pointer;
    display: inline-flex; align-items: center; gap: .4rem;
    min-height: 40px; padding: .45rem .95rem; border-radius: 999px;
    border: 1px solid var(--tg-line); background: var(--tg-card); color: var(--tg-text);
    transition: background-color .15s, border-color .15s, color .15s;
}
.tg-chip span { font-size: .75rem; background: var(--tg-bg); color: var(--tg-muted); border-radius: 999px; padding: .05rem .45rem; }
.tg-chip:hover { border-color: #c9c9d3; }
.tg-chip.is-active { background: var(--tg-dark); border-color: var(--tg-dark); color: #fff; }
.tg-chip.is-active span { background: var(--tg-yellow); color: #1a1a1a; }
.tg-chip:focus-visible, .tg-btn:focus-visible, .tg a:focus-visible { outline: 3px solid var(--tg-yellow); outline-offset: 2px; }

/* ---------------- Attraction cards ---------------- */
.tg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.tg-card {
    background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow);
    overflow: hidden; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}
.tg-card[hidden], .tg-banner[hidden] { display: none; }
.tg-card-media { position: relative; min-height: 100%; background: #e9e9ef; }
.tg-card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tg-card-placeholder {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: radial-gradient(120% 90% at 20% 10%, #4b5563 0%, #1f2937 55%, #111827 100%);
    color: rgba(255,255,255,.25); font-size: 4rem;
}
.tg-card-num {
    position: absolute; top: .9rem; left: .9rem;
    min-width: 44px; height: 44px; padding: 0 .5rem; border-radius: 12px;
    display: grid; place-items: center; font-weight: 700; font-size: 1.15rem;
    background: var(--tg-yellow); color: #1a1a1a; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.tg-card-body { padding: 1.5rem 1.6rem 1.6rem; display: flex; flex-direction: column; }
.tg-card-tags { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin-bottom: .55rem; font-size: .82rem; }
.tg-tag { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; padding: .2rem .65rem; border-radius: 999px; }
.tg-tag-iconic  { background: #fff3cd; color: #7a5600; }
.tg-tag-nature  { background: #e3f4e8; color: #1e6b3a; }
.tg-tag-coast   { background: #e0f0fb; color: #145a86; }
.tg-tag-food    { background: #fde8e4; color: #9a3412; }
.tg-tag-culture { background: #ede9fe; color: #5b21b6; }
.tg-loc { color: var(--tg-muted); }
.tg-loc i { margin-right: .25rem; }
.tg-card h3 { font-size: 1.32rem; line-height: 1.25; color: var(--tg-ink); margin: 0 0 .65rem; }
.tg-card-body p { margin: 0 0 .75rem; }
.tg-card-body em { font-style: italic; }
.tg-card-facts {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem;
    margin: .5rem 0 0; padding: .9rem 0 0; border-top: 1px dashed var(--tg-line);
}
.tg-card-facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tg-muted); }
.tg-card-facts dt i { color: #b88a00; margin-right: .2rem; }
.tg-card-facts dd { margin: .1rem 0 0; font-size: .9rem; font-weight: 600; color: var(--tg-ink); line-height: 1.35; }

.tg-card-tour {
    margin-top: 1rem; display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; align-items: center;
    padding: .85rem 1rem; border-radius: 12px; text-decoration: none;
    background: #1f1f22; color: #fff; transition: background-color .15s;
}
.tg-card-tour:hover { background: #000; }
.tg-card-tour-label { grid-column: 1; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tg-yellow); font-weight: 700; }
.tg-card-tour-name { grid-column: 1; font-weight: 600; }
.tg-card-tour-meta { grid-column: 2; grid-row: 1 / span 2; font-size: .9rem; color: rgba(255,255,255,.8); white-space: nowrap; }
.tg-card-tour-meta strong { color: var(--tg-yellow); font-size: 1.05rem; }

/* Mid-list banner */
.tg-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap;
    padding: 1.5rem 1.75rem; border-radius: var(--tg-radius); color: #fff;
    background: linear-gradient(120deg, #1c1c1e 0%, #2d2d31 60%, #3b3320 100%);
}
.tg-banner strong { display: block; font-size: 1.25rem; margin-bottom: .2rem; }
.tg-banner span { color: rgba(255,255,255,.8); }

/* ---------------- Itineraries ---------------- */
.tg-itins { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.tg-itin { background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); padding: 1.4rem; display: flex; flex-direction: column; border-top: 4px solid var(--tg-yellow); }
.tg-itin h3 { font-size: 1.1rem; color: var(--tg-ink); margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.tg-itin h3 i { color: #b88a00; }
.tg-itin ol { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--tg-line); flex: 1; }
.tg-itin li { position: relative; padding: 0 0 .9rem .6rem; font-size: .93rem; }
.tg-itin li::before { content: ""; position: absolute; left: -1.43rem; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--tg-yellow); box-shadow: 0 0 0 3px #fff; }
.tg-itin li strong { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--tg-muted); }
.tg-itin-link { margin-top: .5rem; font-weight: 700; font-size: .92rem; color: var(--tg-ink); text-decoration: none; }
.tg-itin-link:hover { text-decoration: underline; text-decoration-color: var(--tg-yellow); text-decoration-thickness: 2px; }

/* ---------------- Tips ---------------- */
.tg-tips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.tg-tip { background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); padding: 1.3rem; }
.tg-tip i { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #fff6d6; color: #8a6400; margin-bottom: .75rem; }
.tg-tip h3 { font-size: 1.02rem; color: var(--tg-ink); margin: 0 0 .4rem; }
.tg-tip p { margin: 0; font-size: .92rem; }

/* ---------------- Tours ---------------- */
.tg-tours { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.tg-tour { background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.tg-tour:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.12); }
.tg-tour img { width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; }
.tg-tour-body { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.tg-tour-name { font-weight: 700; color: var(--tg-ink); line-height: 1.3; }
.tg-tour-meta { margin-top: auto; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--tg-muted); }
.tg-tour-price { font-weight: 700; color: var(--tg-ink); background: #fff3cd; padding: .15rem .5rem; border-radius: 6px; }
.tg-center { text-align: center; margin-top: 1.5rem; }

/* ---------------- FAQ ---------------- */
.tg-faq { display: grid; gap: .6rem; margin-top: 1rem; }
.tg-faq details { background: var(--tg-card); border-radius: 12px; box-shadow: var(--tg-shadow); overflow: hidden; }
.tg-faq summary { list-style: none; cursor: pointer; padding: 1.05rem 3rem 1.05rem 1.25rem; position: relative; }
.tg-faq summary::-webkit-details-marker { display: none; }
.tg-faq summary::after {
    content: "+"; position: absolute; right: 1.1rem; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    background: var(--tg-bg); font-weight: 700; color: var(--tg-ink);
}
.tg-faq details[open] summary::after { content: "–"; background: var(--tg-yellow); }
.tg-faq summary h3 { font-size: 1.02rem; margin: 0; color: var(--tg-ink); }
.tg-faq details p { margin: 0; padding: 0 1.25rem 1.15rem; }

/* ---------------- Related ---------------- */
.tg-related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.tg-related-card { background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); overflow: hidden; text-decoration: none; color: var(--tg-ink); font-weight: 600; line-height: 1.35; }
.tg-related-card img { width: 100%; aspect-ratio: 16 / 10; height: auto; object-fit: cover; }
.tg-related-card span { display: block; padding: .85rem 1rem 1rem; }
.tg-related-card:hover span { text-decoration: underline; text-decoration-color: var(--tg-yellow); text-decoration-thickness: 2px; }

/* ---------------- Final CTA ---------------- */
.tg-final {
    margin-top: 3.5rem; border-radius: 20px; padding: 2.5rem 2rem; text-align: center; color: #fff;
    background: linear-gradient(rgba(20,20,22,.78), rgba(20,20,22,.86)), url('/img/guide/sunset.webp') center / cover;
}
.tg-final h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 .5rem; }
.tg-final p { color: rgba(255,255,255,.85); margin: 0 auto 1.4rem; max-width: 52ch; }
.tg-final .tg-hero-cta { justify-content: center; }

/* ---------------- Sidebar ---------------- */
.tg-aside { position: sticky; top: 90px; display: grid; gap: 1rem; }
.tg-toc, .tg-aside-cta { background: var(--tg-card); border-radius: var(--tg-radius); box-shadow: var(--tg-shadow); padding: 1.25rem; }
.tg-toc-title, .tg-aside-cta-title { font-weight: 700; color: var(--tg-ink); margin: 0 0 .75rem; }
.tg-toc-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tg-muted); }
.tg-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.tg-toc li { counter-increment: toc; }
.tg-toc a {
    display: flex; gap: .6rem; padding: .45rem .6rem; border-radius: 8px;
    text-decoration: none; color: var(--tg-text); font-size: .95rem; border-left: 3px solid transparent;
}
.tg-toc a::before { content: counter(toc, decimal-leading-zero); color: var(--tg-muted); font-size: .8rem; padding-top: .1rem; }
.tg-toc a:hover { background: var(--tg-bg); }
.tg-toc a.is-current { background: #fff8e1; border-left-color: var(--tg-yellow); color: var(--tg-ink); font-weight: 600; }
.tg-aside-cta { background: var(--tg-dark); color: #fff; }
.tg-aside-cta-title { color: #fff; font-size: 1.1rem; }
.tg-aside-cta ul { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .45rem; font-size: .92rem; color: rgba(255,255,255,.85); }
.tg-aside-cta ul i { color: var(--tg-yellow); margin-right: .4rem; }
.tg-aside-cta .tg-btn { width: 100%; }
.tg-aside-phone { display: block; text-align: center; margin-top: .75rem; color: rgba(255,255,255,.8); text-decoration: none; font-size: .92rem; }
.tg-aside-phone:hover { color: #fff; }

/* Mobile sticky booking bar */
.tg-sticky-cta { display: none; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1080px) {
    .tg-layout { grid-template-columns: minmax(0, 1fr); }
    .tg-aside { position: static; grid-row: 1; grid-template-columns: 1fr 1fr; }
    .tg-tours { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .tg-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tg-itins, .tg-tips { grid-template-columns: minmax(0, 1fr); }
    .tg-card { grid-template-columns: minmax(0, 1fr); }
    .tg-card-media { min-height: 0; aspect-ratio: 16 / 10; }
    .tg-related { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .tg-hero { min-height: 560px; }
    .tg-hero-inner { padding: 1rem 1rem 5.5rem; }
    .tg-breadcrumb { position: static; padding: 0; margin: 0 0 1rem; }
    .tg-facts { padding: 0 1rem; margin-top: -3.5rem; gap: .5rem; }
    .tg-facts > div { padding: .85rem; grid-template-columns: minmax(0, 1fr); row-gap: .3rem; }
    .tg-facts i { grid-row: auto; width: 36px; height: 36px; font-size: .95rem; }
    .tg-layout { padding: 2rem 1rem 5.5rem; }
    .tg-aside { grid-template-columns: minmax(0, 1fr); }
    .tg-aside-cta { display: none; }
    .tg-card-body { padding: 1.2rem; }
    .tg-card-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .tg-card-tour { grid-template-columns: minmax(0, 1fr); }
    .tg-card-tour-meta { grid-column: 1; grid-row: auto; }
    .tg-tours { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .6rem; }
    .tg-table td:nth-child(3) { display: none; }
    .tg-table th:nth-child(3) { display: none; }
    .tg-hero-cta .tg-btn { flex: 1 1 100%; }
    .tg-sticky-cta {
        display: flex; align-items: center; justify-content: center; gap: .5rem;
        position: fixed; left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); z-index: 900;
        min-height: 52px; border-radius: 999px; background: var(--tg-yellow); color: #1a1a1a;
        font-weight: 700; text-decoration: none; box-shadow: 0 8px 24px rgba(0,0,0,.25);
    }
}
@media (prefers-reduced-motion: reduce) {
    .tg-btn, .tg-tour { transition: none; }
    .tg-btn:hover, .tg-tour:hover { transform: none; }
}
