/* Site chrome shared by every page: header, drawer, section rhythm, closing band, footer.
   Layout changes at 600 and 840 only. From 840 the header is one row and the menu never wraps (fit steps: site.js). */

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--duration-normal);
}

.site-header.is-stuck {
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: grid;
  grid-template-columns: var(--size-touch) minmax(0, 1fr) var(--size-touch);
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--size-header);
}

.site-header__logo {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  min-height: var(--size-touch);
}

.site-header__logo img {
  width: auto;
  height: var(--space-xl);
}

.site-header__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.site-header__cta,
.site-nav {
  display: none;
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: var(--size-touch);
  padding-inline: var(--space-sm);
  font-family: var(--font-heading);
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--duration-fast);
}

.site-nav__link::after {
  content: "";
  position: absolute;
  left: var(--space-sm);
  right: var(--space-sm);
  bottom: var(--space-sm);
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-normal) var(--ease-out);
}

.site-nav__link:hover,
.site-nav__link[aria-current="page"] {
  color: var(--color-primary);
}

.site-nav__link:hover::after,
.site-nav__link[aria-current="page"]::after,
.site-nav__link[aria-expanded="true"]::after {
  transform: scaleX(1);
}

.site-nav__link .icon {
  transition: transform var(--duration-normal) var(--ease-out);
}

.site-nav__link[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.mega {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding-block: var(--space-xl);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out),
    visibility var(--duration-normal);
}

.site-nav__item--mega.is-open .mega {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.mega__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-xl) var(--space-lg);
}

.mega__title {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-button-sm);
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
}

.mega__links a {
  display: flex;
  align-items: center;
  min-height: var(--size-button-sm);
  color: var(--color-muted);
  text-decoration: none;
  transition: color var(--duration-fast), transform var(--duration-fast);
}

.mega__links a:hover {
  color: var(--color-accent);
  transform: translateX(4px);
}

@media (min-width: 840px) {
  /* Expanded (kural.md D5): logo · menu · actions on ONE row, menu items never wrap to a second line.
     When the menu does not fit, site.js widens the header step by step instead of wrapping:
       1. .site-header--wide  — the header uses the full window width (logo moves left)
       2. .site-header--tight — less space between items (font size never changes, A)
       3. the last items move into a "Mehr" dropdown at the end of the row
     Without JavaScript the row scrolls sideways inside the menu instead of breaking. */
  .site-header__toggle {
    display: none;
  }

  .site-header__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo nav actions";
    column-gap: var(--space-lg);
    row-gap: 0;
  }

  .site-header__logo {
    grid-area: logo;
    justify-self: start;
    min-height: var(--size-header);
  }

  .site-header__logo img {
    height: var(--size-button-sm);
  }

  .site-header__actions {
    grid-area: actions;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .site-header__cta {
    display: inline-flex;
  }

  .site-nav {
    grid-area: nav;
    display: block;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  /* With JavaScript the fit steps guarantee the row fits, so the dropdowns may hang out of it. */
  .site-nav.is-fitted {
    overflow: visible;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  /* max-content + auto margin (not justify-content: flex-end): overflow must grow to the right,
     where it can be measured and scrolled, never off the left edge. */
  .site-nav__list {
    flex-wrap: nowrap;
    width: max-content;
    margin-left: auto;
  }

  .site-nav__item {
    flex-shrink: 0;
  }

  /* Step 1: the header may use the whole window width. */
  .site-header--wide .site-header__inner {
    max-width: none;
  }

  /* Step 2: tighter spacing between items. */
  .site-header--tight .site-nav__list {
    gap: var(--space-xs);
  }

  .site-header--tight .site-nav__link {
    padding-inline: var(--space-xs);
  }

  .site-header--tight .site-header__inner {
    column-gap: var(--space-md);
  }

  /* Step 3: items that still do not fit move, from the end, into a "Mehr" dropdown at the end of
     the row — the menu stays visible and on one line; no hamburger on Expanded (E1.1). */
  .site-nav__item[data-overflowed] {
    display: none;
  }

  .site-nav__more {
    position: relative;
  }

  .site-nav__more[hidden] {
    display: none;
  }

  .site-nav__more-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .site-nav__more-list {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    margin: 0;
    padding: var(--space-xs);
    list-style: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }

  .site-nav__more-list[hidden] {
    display: none;
  }

  .site-nav__more-list a {
    display: flex;
    align-items: center;
    min-height: var(--size-button-sm);
    padding-inline: var(--space-sm);
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }

  .site-nav__more-list a:hover,
  .site-nav__more-list a[aria-current="page"] {
    background: var(--color-surface-alt);
    color: var(--color-primary);
  }
}

/* ---------------------------------------------------------------- drawer (Compact + Medium) */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 150;
}

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--color-deep) var(--alpha-scrim), transparent); /* karartma (G1) */
  opacity: 0;
  transition: opacity var(--duration-normal);
}

.drawer__panel {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: min(var(--layout-drawer), calc(100vw - var(--space-2xl)));
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform var(--duration-normal) var(--ease-out);
}

.drawer.is-open .drawer__backdrop {
  opacity: 1;
}

.drawer.is-open .drawer__panel {
  transform: none;
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--size-header);
  padding-inline: var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.drawer__head img {
  width: auto;
  height: var(--space-xl);
}

.drawer__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
}

.drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--size-touch);
  padding-block: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-heading);
  font-size: var(--type-body-lg);
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
  list-style: none;
  cursor: pointer;
}

.drawer__link::-webkit-details-marker {
  display: none;
}

.drawer__link[aria-current="page"] {
  color: var(--color-accent);
}

.drawer__group[open] > .drawer__link .icon {
  transform: rotate(180deg);
}

.drawer__sub {
  padding: var(--space-xs) 0 var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.drawer__sub a {
  display: flex;
  align-items: center;
  min-height: var(--size-touch);
  color: var(--color-muted);
  text-decoration: none;
}

.drawer__foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-border);
}

.drawer__phone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: var(--size-touch);
  font-weight: 600;
  text-decoration: none;
}

/* ---------------------------------------------------------------- sections */

.section {
  padding-block: var(--space-3xl);
}

.section--tight {
  padding-block: var(--space-2xl);
}

.section--alt {
  background: var(--color-surface-alt);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
}

.section__head .eyebrow {
  margin-bottom: var(--space-sm);
}

.section__head .t-lead {
  margin-top: var(--space-sm);
}

@media (min-width: 840px) {
  .section {
    padding-block: var(--space-4xl);
  }

  .section--tight {
    padding-block: var(--space-3xl);
  }

  .section__head {
    margin-bottom: var(--space-2xl);
  }
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-slow) var(--ease-out), transform var(--duration-slow) var(--ease-out);
}

.js [data-reveal].is-visible,
.reveal-all [data-reveal] {
  opacity: 1;
  transform: none;
}

/* Anchor targets clear the sticky header (one row from 840px). */
@media (min-width: 840px) {
  html {
    scroll-padding-top: calc(var(--size-header) + var(--space-md));
  }
}

/* ---------------------------------------------------------------- dark bands */


.on-dark {
  color: var(--color-on-dark);
}

.on-dark h1,
.on-dark h2,
.on-dark h3 {
  color: var(--color-on-dark);
}

.on-dark .t-lead,
.on-dark .t-muted {
  color: var(--color-on-dark-muted);
}

/* ---------------------------------------------------------------- contact band */

.contact-band {
  position: relative;
  padding-block: var(--space-3xl);
  background: var(--color-deep);
}

.contact-band::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--space-xs);
  background: linear-gradient(90deg, var(--color-primary) 0 33.300%, var(--color-accent) 33.300% 66.600%, var(--color-positive) 66.600%);
}

.contact-band__inner {
  display: grid;
  gap: var(--space-xl);
}

.contact-band__text {
  min-width: 0;
}

.contact-band__text > * + * {
  margin-top: var(--space-md);
}

.contact-band__text p {
  max-width: var(--layout-readable);
  color: var(--color-on-dark-muted);
}

.contact-band__lines {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
}

.contact-band__lines a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--size-touch);
  font-family: var(--font-heading);
  font-size: var(--type-body-lg);
  font-weight: 600;
  color: var(--color-on-dark);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-band__lines a:hover {
  text-decoration: underline;
}

.contact-band__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

@media (min-width: 840px) {
  .contact-band {
    padding-block: var(--space-4xl);
  }

  /* Expanded: one centred column — title, promise, direct lines, then the two actions. */
  .contact-band__inner {
    justify-items: center;
    gap: var(--space-lg);
    text-align: center;
  }

  .contact-band__text p {
    margin-inline: auto;
  }

  .contact-band__lines,
  .contact-band__actions {
    justify-content: center;
  }
}

.contact-band__lines .icon {
  color: var(--color-accent-on-dark);
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  background: var(--color-deep);
  border-top: 1px solid color-mix(in srgb, var(--color-on-dark) 12%, transparent);
}

.site-footer a {
  color: var(--color-on-dark-muted);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.site-footer a:hover {
  color: var(--color-on-dark);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-lg);
  padding-block: var(--space-2xl);
}

.site-footer__brand > * + * {
  margin-top: var(--space-md);
}

.site-footer__brand img {
  width: auto;
  height: var(--size-button-sm);
}

.site-footer__brand p {
  max-width: var(--layout-form);
  color: var(--color-on-dark-muted);
}

.site-footer__social {
  display: flex;
  gap: var(--space-sm);
}

.site-footer__col summary,
.site-footer__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--size-touch);
  font-family: var(--font-heading);
  font-size: var(--type-body);
  font-weight: 700;
  color: var(--color-on-dark);
  list-style: none;
  cursor: pointer;
}

.site-footer__col summary::-webkit-details-marker {
  display: none;
}

.site-footer__col {
  border-bottom: 1px solid color-mix(in srgb, var(--color-on-dark) 12%, transparent);
}

.site-footer__col[open] summary .icon {
  transform: rotate(180deg);
}

.site-footer__col ul {
  padding-bottom: var(--space-md);
}

.site-footer__col li a,
.site-footer__contact li a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  max-width: 100%;
  min-height: var(--size-button-sm);
  overflow-wrap: anywhere;
}

.site-footer__address {
  display: flex;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  color: var(--color-on-dark-muted);
}

.site-footer__address strong {
  display: block;
  color: var(--color-on-dark);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm) var(--space-lg);
  padding-block: var(--space-md);
  padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  border-top: 1px solid color-mix(in srgb, var(--color-on-dark) 12%, transparent);
  font-size: var(--type-body-sm);
  color: var(--color-on-dark-muted);
}

.site-footer__bottom ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-lg);
}

.site-footer__bottom a {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-button-sm);
}

@media (min-width: 840px) {
  /* Columns wrap on their own when the row gets tight, so no extra breakpoint is needed. */
  .site-footer__grid {
    grid-template-columns: repeat(auto-fit, minmax(var(--layout-footer-column), 1fr));
    gap: var(--space-2xl);
    padding-block: var(--space-3xl);
  }

  .site-footer__col {
    border-bottom: 0;
  }

  .site-footer__col summary {
    pointer-events: none;
  }

  .site-footer__col summary .icon {
    display: none;
  }
}

/* ---------------------------------------------------------------- page state */

body.is-locked {
  overflow: hidden;
}

.has-cookie .fab {
  display: none;
}

/* Logo from Ayarlar → Firma, or the company name as a wordmark until a logo is uploaded (brand_logo()). */
.brand-logo {
  display: block;
  width: auto;
  object-fit: contain;
}

.brand-wordmark {
  display: block;
  max-width: min(16em, 100%);
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: var(--type-title-lg);
  font-weight: 700;
  line-height: var(--leading-title-lg);
  color: var(--color-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.on-dark .brand-wordmark,
.site-footer .brand-wordmark {
  color: var(--color-on-dark);
}

/* The footer column has room for a second line: wrap the company name instead of cutting it. */
.site-footer .brand-wordmark {
  white-space: normal;
  text-overflow: clip;
  overflow: visible;
  overflow-wrap: break-word;
  line-height: 1.2;
}

.site-footer__logo {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-touch);
  max-width: 100%;
}

/* ---------------------------------------------------------------- app feel on phones (kural.md E5)
   Every site type: a bottom tab bar on Compact (0–599), press feedback instead of the grey tap flash,
   a header that steps aside while scrolling down and returns on the way up, and soft page transitions.
   The webshop fills the same bar with its own items (shop-shell.php). */

html {
  -webkit-tap-highlight-color: transparent;
}

a,
button,
summary,
label,
[role="button"] {
  touch-action: manipulation;
}

.btn:active,
.icon-btn:active,
.chip:active,
.tabbar__item:active {
  transform: scale(0.97);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 106;
  padding-bottom: env(safe-area-inset-bottom);
  /* A hairline instead of a border keeps the bar exactly one bottom-nav height tall. */
  box-shadow: 0 -1px 0 var(--color-border);
  background: var(--color-surface);
}

.tabbar__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  height: var(--size-bottom-nav-height);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  min-height: var(--size-touch);
  padding: 0 var(--space-xs);
  border: 0;
  background: none;
  color: var(--color-muted);
  font-size: var(--type-caption);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: color var(--duration-fast), transform var(--duration-fast);
}

.tabbar__item:hover {
  color: var(--color-primary);
}

.tabbar__item[aria-current="page"],
.tabbar__item[aria-expanded="true"] {
  color: var(--color-primary);
}

/* The current tab gets a soft pill behind its icon, as in native apps. */
.tabbar__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 28px;
  border-radius: var(--radius-full);
  transition: background-color var(--duration-fast);
}

.tabbar__item[aria-current="page"] .tabbar__icon {
  background: var(--color-primary-soft);
}

.tabbar__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.has-tabbar {
  --app-bottom: 0px;
}

@media (max-width: 599px) {
  .has-tabbar {
    --app-bottom: calc(var(--size-bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: var(--app-bottom);
  }

  /* Focus and scrolled-to targets never end up under the tab bar (WCAG 2.4.11). */
  html:has(> body.has-tabbar) {
    scroll-padding-bottom: calc(var(--size-bottom-nav-height) + env(safe-area-inset-bottom) + var(--space-md));
  }

  .has-tabbar .fab,
  .has-tabbar .cookie {
    bottom: calc(var(--app-bottom) + var(--space-md));
  }

  /* Product page call-to-action sits on top of the tab bar. */
  .has-tabbar .sticky-cta {
    bottom: var(--app-bottom);
    padding-bottom: var(--space-sm);
  }

  .has-tabbar.has-sticky-cta .cookie {
    bottom: calc(var(--app-bottom) + var(--size-button) + var(--space-xl));
  }

  html:has(> body.has-tabbar.has-sticky-cta) {
    scroll-padding-bottom: calc(var(--size-bottom-nav-height) + env(safe-area-inset-bottom) + var(--size-button) + 2 * var(--space-sm) + var(--space-md));
  }

  /* The keyboard is open: the tab bar steps aside (E3). */
  .has-keyboard .tabbar {
    display: none;
  }

  .has-tabbar.has-keyboard {
    --app-bottom: 0px;
  }

  /* Scrolling down hides the header (more room for content); scrolling up brings it back. */
  .site-header {
    transition: transform var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal);
  }

  .site-header.is-tucked {
    transform: translateY(-100%);
    box-shadow: none;
  }
}

@media (min-width: 600px) {
  .tabbar {
    display: none;
  }
}

/* Soft cross-fade between pages (browsers that support it); header and tab bar stay put. */
@view-transition {
  navigation: auto;
}

.site-header {
  view-transition-name: site-header;
}

.tabbar {
  view-transition-name: tabbar;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--duration-fast);
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .btn:active,
  .icon-btn:active,
  .chip:active,
  .tabbar__item:active {
    transform: none;
  }

  .site-header.is-tucked {
    transform: none;
  }
}
