/*
 * layout.css: page frame shared by every page. Container widths, section
 * spacing, header + navigation (desktop dropdowns, mobile slide-down menu) and footer.
 */

/* ---------- Container (same steps as the reference: 1296px content at 1400px+) ---------- */
.tr-container {
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding-inline: 12px;
}
@media (max-width: 1399px) { .tr-container { max-width: 1140px; } }
@media (max-width: 1199px) { .tr-container { max-width: 960px; } }
@media (max-width: 991px)  { .tr-container { max-width: 720px; } }
@media (max-width: 767px)  { .tr-container { max-width: 540px; } }

/* ---------- Sections ---------- */
main {
  display: block;
  padding-top: var(--tr-header-height); /* room for the fixed header */
}

.tr-section {
  padding-block: var(--tr-section-space);
}
.tr-section--surface {
  background: var(--tr-surface);
}
.tr-section--dark {
  background: var(--tr-ink);
}

/* ---------- Header ---------- */
.tr-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  background: var(--tr-white);
  transition: transform 0.4s var(--tr-ease), box-shadow 0.4s var(--tr-ease);
}
/* Scrolled past the header: hide while scrolling down, slide back on scroll up. */
.tr-header.is-sticky {
  transform: translateY(-100%);
  box-shadow: 0 1px 2px rgba(27, 27, 27, 0.1);
}
.tr-header.is-sticky.is-shown {
  transform: translateY(0);
}

.tr-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1320px;
  height: var(--tr-header-height);
  margin-inline: auto;
}

.tr-logo {
  font-family: var(--tr-font-heading);
  font-size: 28px;
  line-height: 1;
  color: var(--tr-ink);
  white-space: nowrap;
}
.tr-logo--light {
  color: var(--tr-white);
}

/* Desktop navigation */
.tr-nav__toggle,
.tr-nav__sub-toggle {
  display: none;
}

.tr-nav__list {
  display: flex;
  gap: 40px;
}

.tr-nav__item {
  position: relative;
}

.tr-nav__link {
  display: flex;
  align-items: center;
  gap: 5px;
  height: var(--tr-header-height);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--tr-ink);
}
.tr-nav__link:hover,
.tr-nav__link.is-current {
  color: var(--tr-accent);
}
.tr-nav__chevron {
  width: 8px;
  height: 5px;
}

.tr-nav__sub {
  position: absolute;
  top: 100%;
  left: -20px;
  min-width: 220px;
  padding: 10px 0;
  background: var(--tr-white);
  box-shadow: 0 10px 30px rgba(27, 27, 27, 0.1);
  border-radius: 0 0 var(--tr-radius) var(--tr-radius);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--tr-speed) var(--tr-ease);
}
.tr-nav__item--parent:hover > .tr-nav__sub,
.tr-nav__item--parent:focus-within > .tr-nav__sub {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.tr-nav__sub-link {
  display: block;
  padding: 8px 20px;
  font-size: 15px;
  color: var(--tr-ink);
}
.tr-nav__sub-link:hover,
.tr-nav__sub-link[aria-current="page"] {
  color: var(--tr-accent);
}

/* Mobile and tablet navigation (reference switches below 1200px) */
@media (max-width: 1199px) {
  .tr-header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 2px rgba(27, 27, 27, 0.1);
  }
  .tr-header__inner {
    max-width: 960px;
    padding-inline: 12px;
  }
  .tr-nav {
    order: 3;
  }
  .tr-nav__toggle {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--tr-ink);
  }
  .tr-nav__toggle .tr-icon {
    width: 26px;
    height: 18px;
  }
  .tr-nav__toggle-close,
  .tr-nav__toggle[aria-expanded="true"] .tr-nav__toggle-open {
    display: none;
  }
  .tr-nav__toggle[aria-expanded="true"] .tr-nav__toggle-close {
    display: block;
  }

  .tr-nav__list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    max-height: calc(100vh - var(--tr-header-height));
    overflow-y: auto;
    padding: 10px 0 20px;
    background: var(--tr-white);
    box-shadow: 0 10px 20px rgba(27, 27, 27, 0.08);
  }
  .tr-nav__list.is-open {
    display: flex;
  }
  .tr-nav__item {
    border-bottom: 1px solid var(--tr-border);
  }
  .tr-nav__link {
    height: auto;
    padding: 10px 24px;
    font-size: 18px;
    font-weight: 500;
    line-height: 22px;
    text-transform: none;
  }
  .tr-nav__chevron {
    display: none;
  }
  .tr-nav__sub-toggle {
    position: absolute;
    top: 0;
    right: 12px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--tr-ink);
  }
  .tr-nav__sub-toggle .tr-icon {
    width: 12px;
    height: 8px;
    transition: transform var(--tr-speed);
  }
  .tr-nav__sub-toggle[aria-expanded="true"] .tr-icon {
    transform: rotate(180deg);
  }
  .tr-nav__sub {
    position: static;
    display: none;
    min-width: 0;
    padding: 0 0 10px 16px;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .tr-nav__sub.is-open {
    display: block;
  }
  .tr-nav__item--parent:hover > .tr-nav__sub:not(.is-open) {
    display: none;
  }
  .tr-header__cta {
    margin-left: auto;
  }
}

@media (max-width: 991px) {
  .tr-header__inner { max-width: 720px; }
}
@media (max-width: 767px) {
  .tr-header__inner { max-width: 540px; }
  .tr-header .tr-header__cta {
    display: none;
  }
}

/* ---------- Footer ---------- */
.tr-footer {
  background: var(--tr-ink);
  color: var(--tr-line);
}

.tr-footer__grid {
  display: grid;
  grid-template-columns: 258px 258px 184px 387px;
  justify-content: space-between;
  gap: 50px 24px;
  padding-block: 100px;
}

.tr-footer__logo {
  display: inline-block;
  font-size: 36px;
  margin-block: 8px 46px;
}

.tr-footer__title {
  margin-bottom: 47px;
  font-size: var(--tr-fs-h4);
  line-height: var(--tr-lh-h4);
  color: var(--tr-white);
}

.tr-footer__text + .tr-footer__contact {
  margin-top: 22px;
}
.tr-footer__contact li {
  color: var(--tr-white);
}
.tr-footer__contact li + li {
  margin-top: 0;
}
.tr-footer__contact a:hover,
.tr-footer__links a:hover {
  color: var(--tr-accent);
}

/* Links get 4px padding so each tap target is over 24px tall. Visible gap between
   items stays about 15px, well under the 47px heading gap (proximity rule). */
.tr-footer__links a,
.tr-footer__contact a {
  display: inline-block;
  padding-block: 4px;
}
.tr-footer__links li + li {
  margin-top: 0;
}

.tr-footer__col--subscribe .tr-footer__text {
  margin-top: 20px;
}

.tr-social {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}
.tr-social__link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(216, 216, 215, 0.5);
  border-radius: 50%;
  font-size: 12px;
  color: var(--tr-line);
  transition: all var(--tr-speed) var(--tr-ease);
}
.tr-social__link:hover {
  background: var(--tr-accent);
  border-color: var(--tr-accent);
  color: var(--tr-white);
}

.tr-footer__bottom {
  background: var(--tr-ink-deep);
}
.tr-footer__bottom-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 90px;
  padding-block: 20px;
}
.tr-footer__policy:hover {
  color: var(--tr-accent);
}

/* Scroll-to-top: solid circle inside a dashed gold ring. */
.tr-scroll-top {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #6b5338;
  color: var(--tr-line);
  transform: translate(-50%, -50%);
  transition: background var(--tr-speed);
}
.tr-scroll-top::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px dashed var(--tr-accent);
  border-radius: 50%;
}
.tr-scroll-top .tr-icon {
  width: 15px;
  height: 8px;
}
.tr-scroll-top:hover {
  background: var(--tr-accent);
  color: var(--tr-white);
}

@media (max-width: 1399px) {
  .tr-footer__grid {
    grid-template-columns: repeat(4, auto);
  }
}
@media (max-width: 1199px) {
  .tr-footer__grid {
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }
}
@media (max-width: 767px) {
  .tr-footer__grid {
    grid-template-columns: 1fr;
    padding-block: 75px;
  }
  .tr-footer__title {
    margin-bottom: 25px;
  }
  .tr-footer__logo {
    margin-bottom: 25px;
  }
}

@media (max-width: 991px) {
  .tr-footer__bottom-inner {
    flex-direction: column;
    text-align: center;
    padding-block: 50px 25px;
  }
  .tr-scroll-top {
    top: 0;
  }
}
