@font-face {
  font-family: BarlowBold; /* set name */
  src: url(/static/fonts/BarlowCondensed-SemiBold.ttf); /* url of the font */
}

@font-face {
  font-family: BarlowRegular; /* set name */
  src: url(/static/fonts/BarlowSemiCondensed-Regular.ttf); /* url of the font */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* TYPOGRAPHY */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: BarlowBold;
  color: black;
}

b,
strong {
  font-family: BarlowBold;
}

/* BUTTONS */

.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.btn-white {
  background: #fff;
  font-family: BarlowBold;
  font-size: 1.1rem;
  color: black;
}
.btn-white:hover {
  background: #d0a600;
}
.btn-primary {
  background: #fed434;
  color: #fff;
}
.btn-primary:hover {
  background: #d0a600;
}
.btn-secondary {
  background: #e2e8f0;
  color: #333;
}
.btn-secondary:hover {
  background: #cbd5e1;
}
button {
  font-family: BarlowRegular;
}
button,
a {
  -webkit-tap-highlight-color: #fdd43333;
}

/* BODY */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: BarlowRegular;
  background: #f5f5f5;
  color: #434343;
  line-height: 1.6;
}

body.nav-menu-open {
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

body .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100vw;
  margin: 0 auto;
  padding: 1rem;
}

body:not(.page-locations):not(.page-landing):not(.page-login) {
  @media (min-width: 640px) {
    .container {
      width: 640px;
    }
  }
}

@media (min-width: 880px) {
  body.page-landing,
  body.page-login {
    .container {
      width: 880px;
    }
  }
}

/* NAVIGATION. HEADER & FOOTER */

nav {
  &.header {
    position: sticky;
    top: 0;
    z-index: 2000;

    .header-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: #ffffffcc;
      z-index: -1;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;

      &.visible {
        opacity: 1;
        pointer-events: auto;
        touch-action: none;
      }
    }

    .header-buttons {
      background: #ffffff;
      border-bottom: 2px solid #fdd433;
      padding: 0 1rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .nav-brand {
      background-image: url(/static/images/ic-logotype.svg);
      width: 90px;
      height: 48px;
      background-size: auto 24px;
      background-repeat: no-repeat;
      background-position: 50% 53%;
    }

    .nav-filter {
      height: 48px;
      width: 48px;
      background-repeat: no-repeat;
      background-size: auto 26px;
      background-position: center;
      margin-left: -1em;
      -webkit-tap-highlight-color: transparent;

      &.dropdown::after {
        content: "";
        display: inline-block;
        width: 12px;
        height: 48px;
        background-image: url(/static/images/ic-chevron-down.svg);
        background-repeat: no-repeat;
        background-size: contain;
        background-position: center;
        margin-left: 38px;
        transition: transform 0.2s ease;
      }

      &.dropdown.active::after {
        transform: rotate(180deg);
      }
    }

    .nav-right {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .nav-updates {
      height: 48px;
      aspect-ratio: 1;
      background-repeat: no-repeat;
      background-size: auto 26px;
      background-position: center;
      background-image: url(/static/images/ic-bell.svg);
      margin-right: -1em;
    }

    .nav-login {
      color: black;
      text-decoration: none;
      font-family: BarlowBold;
    }
  }

  &.footer {
    background: #ffffff;
    border-top: 2px solid #fdd433;
    padding: 0 1rem env(safe-area-inset-bottom);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    bottom: 0;
    z-index: 2000;

    .nav-btn {
      position: relative;
      width: 42px;
      height: 42px;
      background-repeat: no-repeat;
      background-size: auto 22px;
      background-position: center;

      &.nav-home {
        background-image: url(/static/images/ic-home.svg);
      }
      &.nav-map {
        background-image: url(/static/images/ic-map.svg);
      }
      &.nav-post {
        background-image: url(/static/images/ic-add.svg);
      }
      &.nav-collection {
        background-image: url(/static/images/ic-collection.svg);
      }

      &::after {
        content: "";
        display: block;
        height: 3px;
        border-radius: 100px;
        background-color: #fed434;
        position: absolute;
        bottom: 4px;
        left: 41%;
        right: 41%;
        opacity: 0;
      }
    }

    .nav-profile {
      position: relative;
      border: 8px solid #ffffff;
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background-repeat: no-repeat;
      background-size: cover;
      background-position: center;

      &.has-badge::before {
        content: "";
        display: block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #ff5700;
        border: 2px solid #ffffff;
        position: absolute;
        top: -3px;
        right: -3px;
        z-index: 1;
      }
    }
  }

  .filter-icon {
    &.worldwide {
      background-image: url(/static/images/ic-worldwide.svg);
    }
    &.nearby {
      background-image: url(/static/images/ic-nearby.svg);
    }
    &.followed {
      background-image: url(/static/images/ic-followed.svg);
    }
  }
}

nav a {
  color: #fff;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  opacity: 0.9;
  transition: opacity 0.2s;
}

.nav-links a:hover {
  opacity: 1;
}

/* FOOTER BUTTON STATE */

body.page-home .footer .nav-home::after {
  opacity: 1;
}
body.page-locations .footer .nav-map::after {
  opacity: 1;
}
body.page-post_new_standalone .footer .nav-post::after {
  opacity: 1;
}
body.page-collections .footer .nav-collection::after {
  opacity: 1;
}
body.page-user .footer .nav-profile::after {
  content: "";
  display: block;
  height: 3px;
  border-radius: 100px;
  background-color: #fed434;
  position: absolute;
  bottom: -5px;
  left: 35.5%;
  right: 35.5%;
}

/* NAVBAR FILTERS DROPDOWN */

.nav-location-filters {
  display: flex;
  flex-direction: column;
  padding: 0 1.5em;
  gap: 0.5em;
  background: white;
  border-bottom-left-radius: 24px;
  border-bottom-right-radius: 24px;
  box-shadow: 0px 10px 30px rgba(0, 0, 0, 0.1);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.25s ease,
    opacity 0.2s ease,
    padding 0.25s ease;

  &.open {
    max-height: 500px;
    opacity: 1;
    padding: 1.5em;
  }

  .nav-location-filter {
    background-color: #f4f4f4;
    border-radius: 6px;
    display: flex;
    flex-direction: row;

    .icon {
      width: 48px;
      background-repeat: no-repeat;
      background-size: 24px;
      background-position: 55% 50%;
    }

    .filter-text {
      padding: 0.5em 1em 0.5em 0;
      display: flex;
      flex-direction: column;

      .title {
        font-family: BarlowBold;
        font-size: 1rem;
        margin-bottom: -0.25em;
      }
      .desc {
        font-size: 0.8rem;
        opacity: 0.7;
      }
    }

    &.selected {
      background-color: #fed434;
    }
  }
}

/* LOGIN */

body.page-login {
  .login-logo {
    display: block;
    background-image: url(/static/images/ic-logotype-black.svg);
    height: 2em;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: left top;
  }

  .login-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(370px, 1fr));
    margin-bottom: 2em;

    .login-hero-media {
      background: #fed434;
      background-image: url(/static/images/login_bg.jpg);
      background-size: cover;
      background-position: left;
      background-repeat: no-repeat;
      min-height: 20em;
    }

    .login-hero-body {
      background: #fed434;
      padding: 3rem;
    }

    h1 {
      text-transform: uppercase;
      font-size: 3em;
      line-height: 0.9em;
      text-wrap: balance;
      margin: 0;
    }

    p {
      font-size: 1.2em;
      line-height: 1.1em;
      margin-top: 1.5em;
      margin-bottom: 2em;
      color: black;
    }
  }
}

#firebaseui-auth-container {
  .firebaseui-id-page-sign-in {
    background: none;
    background-color: transparent;
    box-shadow: none;

    .firebaseui-card-header {
      display: none;
    }

    .firebaseui-label {
      font-family: BarlowBold;
      color: black;
    }

    .firebaseui-id-email {
      font-family: BarlowRegular;
      font-size: 1.1rem;
      color: black;
    }

    .firebaseui-form-actions {
      .firebaseui-id-secondary-link {
        font-family: BarlowBold;
        font-size: 1.1rem;
        color: black;
        border-radius: 6px;
      }

      .firebaseui-id-submit {
        font-family: BarlowBold;
        font-size: 1.1rem;
        background: white;
        border: none;
        border-radius: 6px;
        color: black;
        box-shadow: none;
      }
    }
  }

  .firebaseui-card-content,
  .firebaseui-card-footer {
    padding: 0;
  }

  .firebaseui-idp-button {
    max-width: 100%;
    background-color: #ffffff !important;
    color: black;
    border: none;
    border-radius: 6px;
    box-shadow: none;

    .firebaseui-idp-text {
      font-family: BarlowBold;
      font-size: 1.1rem;
      color: black;
    }
  }

  .firebaseui-idp-password .firebaseui-idp-icon {
    filter: invert(1);
  }
}

/* LANDING */

body.page-landing {
  .landing-hero {
    margin-top: -1em;
    /* break out of the layout .container to span the full viewport width */
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-bottom: -1rem;

    .landing-hero-media {
      background: #fed434;
      background-image: url(/static/images/landing_bg.jpg);
      background-size: auto 100%;
      background-position: right;
      background-repeat: no-repeat;
    }

    .landing-hero-body {
      padding-top: 2.5rem;
      padding-bottom: 2.5rem;
    }

    h1 {
      text-transform: uppercase;
      font-size: 2.5em;
      line-height: 0.95em;
      margin: 0 0 0.5em;
      color: black;
    }

    p {
      font-size: 1.1em;
      line-height: 1.3em;
      margin-bottom: 1.5em;
      max-width: 32em;
      text-wrap: balance;
      color: black;
    }
  }

  .landing-features-section {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;

    h2 {
      font-size: 2.1rem;
      text-transform: uppercase;
      margin-bottom: 1rem;
    }

    .landing-features {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
      gap: 2rem;
    }
  }

  .landing-feature {
    .landing-feature-text {
      .title {
        font-family: BarlowBold;
        text-transform: uppercase;
        font-size: 1.1rem;
      }
      .desc {
        font-size: 0.9rem;
      }
    }
  }

  .landing-cta {
    background: #fed434;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-bottom: 1.5rem;

    .landing-cta-container {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
      gap: 1rem;
    }

    .landing-cta-portrait {
      flex-basis: 8em;
      border: 4px solid white;
      border-radius: 50%;
      overflow: hidden;
    }
    .landing-cta-body {
      flex: 1;
      a {
        color: black;
        text-decoration: none;
        text-transform: uppercase;
        font-family: BarlowBold;
        font-size: 1.1rem;
      }
    }

    p {
      margin-bottom: 1.2em;
    }
  }

  .landing-footer {
    margin-bottom: 0.5rem;
  }
}

/* LOCATIONS / MAP */

body.page-locations {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;

  .container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100vw;
  }

  #add-location-bar {
    display: none;
    position: absolute;
    flex-direction: column;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #fff;
    padding: 1.25rem 1.5rem;
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    gap: 0.5rem;

    .btns {
      display: flex;
      gap: 0.5rem;
    }
    .btn {
      color: black;
      padding: 0.4rem 1rem;
      font-size: 0.85rem;
    }
    .btn-cancel {
      background: #f4f4f4;
      border: none;
      cursor: pointer;
    }
  }
}

/*  */

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}
.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}
.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}
.card img {
  width: 100%;
  height: auto;
  display: block;
}
.card-body {
  padding: 1.2rem;
}

.post-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.post-actions {
  display: flex;
  gap: 1rem;
  a,
  button {
    display: flex;
    font-family: BarlowBold;
    text-decoration: none;
    font-size: 1.2em;
    line-height: 1.2em;
    height: 34px;
    color: black;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    align-items: center;

    &:before {
      content: "";
      display: inline-block;
      width: 24px;
      height: 24px;
      margin-right: 0.3rem;
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center;
    }
    &.post-like:before {
      background-image: url(/static/images/ic-like.svg);
    }
    &.post-like.active:before {
      background-image: url(/static/images/ic-liked.svg);
    }
    &.post-comment:before {
      background-image: url(/static/images/ic-comments.svg);
    }
    &.post-request:before {
      background-image: url(/static/images/ic-edit.svg);
    }
    &.post-save:before {
      background-image: url(/static/images/ic-save.svg);
    }
    &.post-save.active:before {
      background-image: url(/static/images/ic-saved.svg);
    }
    &.post-share:before {
      background-image: url(/static/images/ic-share.svg);
    }
    &.post-follow:before {
      background-image: url(/static/images/ic-follow.svg);
    }
    &.post-follow.active:before {
      background-image: url(/static/images/ic-following.svg);
    }
  }
}

.follow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  &:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url(/static/images/ic-follow.svg);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
  }

  &.active:before {
    background-image: url(/static/images/ic-following.svg);
  }
}
.post-location {
  display: flex;
  font-family: BarlowBold;
  text-decoration: none;
  font-size: 1.2em;
  line-height: 1.2em;
  height: 34px;
  color: black;
  max-width: 30%;

  &:before {
    content: "";
    display: inline-block;
    width: 28px;
    height: 24px;
    margin-right: 0.3rem;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    background-image: url(/static/images/ic-pin.svg);
  }

  .location-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.post-caption {
  a {
    color: black;
    text-decoration: none;
  }

  .author-photo {
    display: inline-block;
    width: 1.3em;
    height: 1.3em;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.2rem;
    line-height: 1em;
    vertical-align: middle;
  }

  .author-username {
    font-family: BarlowBold;
    margin-right: 0.1rem;
  }
}

.post-date {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 0.5em;
  margin-bottom: -5px;
}

.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
}
.form-row {
  display: flex;
  gap: 1rem;
}
.form-row .form-group {
  flex: 1;
}

.meta {
  font-size: 0.85rem;
  color: #6b7280;
}
h1 {
  margin-bottom: 1.5rem;
}
h2 {
  margin-bottom: 1rem;
}

/* TABS */

.tabs {
  .tab-header {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
  }
  .tab-btn {
    flex: 1;
    padding: 0.8rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: BarlowBold;
    font-size: 1rem;
    color: #6b7280;
    cursor: pointer;
    transition:
      color 0.2s,
      border-color 0.2s;

    &.active {
      color: #434343;
      border-bottom-color: #fdd433;
    }
  }
  .tab-content {
    display: none;
    &.active {
      display: block;
    }
  }
}

/* COMMENTS */

.comments-section {
  margin-top: 1.5rem;

  h3 {
    margin-bottom: 1rem;
  }
}

.comment {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f0f0f0;

  .comment-author {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: inherit;

    .author-photo {
      width: 1.3em;
      height: 1.3em;
      border-radius: 50%;
      object-fit: cover;
    }
    .author-username {
      font-family: BarlowBold;
    }
  }

  .comment-text {
    flex: 1;
  }

  .comment-date {
    font-size: 0.8rem;
    color: #6b7280;
    width: 100%;
  }
}

.no-comments {
  text-align: center;
  padding: 1.5rem;
  color: #6b7280;
}

.comment-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;

  .comment-input-row {
    display: flex;
    gap: 0.5rem;

    input {
      flex: 1;
      padding: 0.6rem 0.8rem;
      border: 1px solid #d1d5db;
      border-radius: 6px;
      font-size: 0.95rem;
      font-family: inherit;
    }
  }
}

/* NEW POST */

body.page-post_new_standalone {
  background: white;

  &.no-photo .container {
    background: #fed434;
    justify-content: center;
  }
}

.photo-dropzone {
  position: relative;
  width: 70%;
  margin: 0 auto;
  aspect-ratio: 1.2;
  overflow: hidden;

  &.drag-over {
    border-color: #fed434;
    background: #fffbea;
  }

  &.has-image {
    width: 100%;
    margin: 0;
    border-style: solid;
    border-color: transparent;
  }

  input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
  }

  .dropzone-empty {
    position: absolute;
    border: 6px dashed #0000000f;
    border-radius: 24px;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    pointer-events: none;

    .dropzone-icon {
      width: 48px;
      height: 48px;
      background-image: url(/static/images/ic-photo-add.svg);
      background-repeat: no-repeat;
      background-size: contain;
      background-position: center;
      opacity: 0.2;
    }
    .dropzone-text {
      font-family: BarlowBold;
      color: black;
      text-transform: uppercase;
      margin-bottom: -0.25em;
      font-size: 1.1rem;
    }
    .dropzone-hint {
      font-size: 0.85rem;
      opacity: 0.8;
      margin: 0;
    }
  }

  .dropzone-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    pointer-events: none;
  }
}

.change-photo-btn {
  width: 100%;
  margin-top: 0.8rem;
}

#location-options {
  display: flex;
  flex-direction: column;
  gap: 0.5em;

  .location-option {
    input[type="radio"] {
      display: none;
    }

    label {
      position: relative; /* Makes it show above the #new-location-fields */
      background-color: #f4f4f4;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
      padding: 0.5rem;
      border-radius: 6px;
    }

    &.selected label {
      background-color: #fed434;
    }

    #new-location-fields {
      background-color: #f4f4f4;
      border-bottom-left-radius: 6px;
      border-bottom-right-radius: 6px;
      padding: 1em 0.5em 0.5em 0.5em;
      margin-top: -0.5em;

      input[type="text"] {
        font-family: "BarlowRegular";
        font-size: 1em;
        width: 100%;
        padding: 0.5em;
        border: none;
        border-radius: 2px;
      }
    }
  }
}
