/* Freqly site layer. Loaded after styles.css on every page. */

/* Brand lock-up used in the header and footer. */
.freqly-logo {
  gap: 0.65rem;
  line-height: 1;
  color: #fff;
}

.freqly-logo-mark {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border-radius: 0.65rem;
  background: linear-gradient(145deg, #18c28e, #087b61);
  color: #05130f;
  font: 900 1.1rem/1 var(--font-display);
}

.freqly-logo-word {
  font: 700 1.2rem/1 var(--font-display);
  letter-spacing: -0.01em;
}

.footer-grid {
  grid-template-columns: 2fr 1fr 1fr;
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer-link-button[hidden] {
  display: none;
}

[hidden] {
  display: none !important;
}

/* Sticky header offsets. --sticky-offset is the header plus the notify sub-nav,
   so anchors and the CTA scroll never leave a heading or field under them. */
:root {
  --subnav-h: 0px;
  --sticky-offset: calc(var(--nav-h) + var(--subnav-h) + 12px);
}

:root:has(.notify-subnav) {
  --subnav-h: 4.5rem;
}

html {
  scroll-padding-top: var(--sticky-offset);
}

[id] {
  scroll-margin-top: var(--sticky-offset);
}

/* Consent bar: thin, bottom, no overlay, never covers the form. */
html.consent-bar-open body {
  padding-bottom: var(--consent-bar-h, 0px);
}

.consent-bar {
  position: fixed;
  z-index: 900;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 20vh;
  padding: 8px max(16px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  overflow: auto;
  border-top: 1px solid var(--input-border);
  background: var(--surface-2);
  box-shadow: 0 -8px 28px rgb(0 0 0 / 40%);
  color: var(--text);
  font-size: 0.75rem;
  line-height: 1.3;
}

.consent-bar.is-collapsed {
  display: none;
}

.consent-bar__text {
  max-width: 62rem;
  margin: 0 auto 6px;
  color: var(--muted);
}

.consent-bar__text strong {
  color: var(--text);
}

.consent-bar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 62rem;
  margin: 0 auto;
}

.consent-btn {
  min-height: 36px;
  min-width: 6.25rem;
  padding: 0 14px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: 700 0.8125rem/1 var(--font-body, inherit);
  cursor: pointer;
}

.consent-btn:hover {
  background: rgb(255 255 255 / 8%);
}

.consent-bar__actions .consent-btn {
  flex: 0 0 auto;
}

.consent-bar__links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: auto;
  font-size: 0.75rem;
  line-height: 1.25;
  text-align: right;
}

.consent-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.consent-btn:focus-visible,
.consent-link:focus-visible,
.consent-close:focus-visible,
.consent-switch:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Choices sheet. Not a modal: no dimmed overlay, no scroll lock. */
.consent-sheet {
  position: fixed;
  z-index: 950;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 88vh;
  overflow: auto;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border: 1px solid var(--input-border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface-2);
  box-shadow: 0 -12px 40px rgb(0 0 0 / 50%);
  color: var(--text);
}

.consent-sheet > * {
  max-width: 40rem;
  margin-right: auto;
  margin-left: auto;
}

.consent-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.consent-sheet__head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.consent-sheet__head h2:focus {
  outline: none;
}

.consent-close {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.consent-row__label {
  display: grid;
  gap: 2px;
  flex: 1 1 auto;
}

.consent-row__title {
  font-weight: 700;
}

.consent-row__vendor {
  color: var(--muted);
  font-weight: 400;
}

.consent-row__body {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.consent-row__state {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.consent-switch {
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  margin: 4px 0 0;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background: #3a4254;
  appearance: none;
  cursor: pointer;
  position: relative;
}

.consent-switch::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 0.15s ease;
}

.consent-switch:checked {
  background: #18c28e;
}

.consent-switch:checked::after {
  transform: translateX(18px);
}

.consent-sheet__note {
  margin: 12px auto 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.consent-sheet__links {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.consent-sheet__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.consent-sheet__actions .consent-btn {
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
}

/* Keep the three equal actions visible while the sheet body scrolls. */
.consent-sheet__actions {
  position: sticky;
  bottom: calc(-16px - env(safe-area-inset-bottom));
  margin-bottom: calc(-16px - env(safe-area-inset-bottom));
  padding: 10px 0 calc(16px + env(safe-area-inset-bottom));
  background: var(--surface-2);
}

.consent-sheet__actions .consent-btn {
  line-height: 1.15;
  padding-top: 4px;
  padding-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .consent-switch::after {
    transition: none;
  }
}

/* Notify form inline feedback (progressive enhancement). */
.form-feedback {
  margin: 0 0 0.75rem;
  scroll-margin-top: var(--sticky-offset);
}

.form-feedback:empty {
  display: none;
}

.form-feedback ul {
  margin: 0;
  padding: 0.7rem 0.9rem 0.7rem 1.8rem;
  border: 1px solid #f08a8a;
  border-radius: 0.7rem;
  background: rgb(240 138 138 / 10%);
  color: #ffd6d6;
  font-size: 0.88rem;
}

.form-feedback .form-success {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid #18c28e;
  border-radius: 0.7rem;
  background: rgb(24 194 142 / 10%);
  font-size: 0.92rem;
}

.form-feedback .form-success strong {
  display: block;
  margin-bottom: 0.2rem;
}

/* Mobile: header and sub-nav shrink so the form sits on the first screen. */
@media (max-width: 760px) {
  :root {
    --nav-h: 56px;
  }

  :root:has(.notify-subnav) {
    --subnav-h: 2.75rem;
  }

  .site-header .container {
    min-height: var(--nav-h);
  }

  .consent-bar__actions .consent-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: 7.5rem;
    padding: 0 8px;
  }

  .freqly-logo-mark {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 1rem;
  }
}
