/* Reusable component classes shared by every templ component/page.
   Change a rule here and every page using that component updates. */

/* --- Nav --- */
.site-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);

  & .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-block: var(--size-3);
    gap: var(--size-4);
  }

  & .site-nav-brand {
    display: flex;
    align-items: center;
    font-weight: var(--font-weight-7);
    font-size: var(--font-size-3);
    color: var(--color-primary);
    text-decoration: none;

    & img {
      height: var(--size-9);
      width: auto;
    }
  }

  & .site-nav-links {
    display: flex;
    gap: var(--size-5);
    list-style: none;
    margin: 0;
    padding: 0;

    & a {
      text-decoration: none;
      color: var(--color-text);
      font-weight: var(--font-weight-5);
    }

    & a:hover {
      color: var(--color-primary);
    }
  }
}

/* --- Footer --- */
.site-footer {
  background: var(--color-primary);
  color: var(--brand-cream-1);
  margin-top: var(--size-10);

  & a {
    color: var(--brand-cream-2);
  }

  & .container {
    padding-block: var(--size-6);
  }
}

/* --- Hero --- */
.hero {
  background: linear-gradient(180deg, var(--color-surface), var(--color-bg));
  padding-block: var(--size-9);
  text-align: center;
  position: relative;

  & h1 {
    margin-bottom: var(--size-2);
  }

  & p {
    color: var(--color-text-muted);
    font-size: var(--font-size-3);
    max-width: 40rem;
    margin-inline: auto;
  }
}

/* Hero variants with a real property photo behind the heading — a dark
   scrim (::before) keeps the white text readable over any photo. */
.hero-photo {
  background-size: cover;
  background-position: center;
  padding-block: var(--size-11);

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(0 0 0 / 55%), rgb(0 0 0 / 35%));
  }

  & .container {
    position: relative;
    z-index: 1;
  }

  & h1 {
    color: white;
  }

  & p {
    color: rgb(255 255 255 / 90%);
  }
}

.hero-home {
  background-image: url("/static/photos/exterior-2.jpg");
}

.hero-location {
  background-image: url("/static/photos/exterior-4.jpg");
}

.hero-features {
  background-image: url("/static/photos/hero-exterior-1.jpg");
}

.hero-executive-suites {
  background-image: url("/static/photos/interior-office-1.jpg");
}

.hero-contact {
  background-image: url("/static/photos/exterior-3.jpg");
}

/* --- Sections --- */
.section {
  padding-block: var(--size-8);
}

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

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: var(--size-2) var(--size-5);
  border-radius: var(--radius-2);
  font-weight: var(--font-weight-6);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: var(--font-size-2);
}

.btn-primary {
  background: var(--color-primary);
  color: white;

  &:hover {
    background: var(--color-primary-hover);
    color: white;
  }
}

.btn-accent {
  background: var(--color-accent);
  color: white;

  &:hover {
    background: var(--color-accent-hover);
    color: white;
  }
}

.btn-outline {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);

  &:hover {
    background: var(--color-primary);
    color: white;
  }
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}

/* --- Cards / listings grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: var(--size-6);
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--ease-3, 0.2s) ease;

  &:hover {
    box-shadow: var(--shadow-card-hover);
  }

  /* The whole card is a link (see ListingCard) — the "View Details" pill
     inside it is just a visual cue, not a nested link. */
  &.card-link {
    color: inherit;
    text-decoration: none;
  }

  & .card-photo {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    width: 100%;
    background: var(--color-border);
  }

  & .card-body {
    padding: var(--size-4);
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  & .card-title {
    margin: 0 0 var(--size-1);
    font-size: var(--font-size-3);
  }

  & .card-meta {
    color: var(--color-text-muted);
    font-size: var(--font-size-1);
    margin-bottom: var(--size-3);
  }
}

/* --- Status badges --- */
.badge {
  display: inline-block;
  padding: var(--size-1) var(--size-2);
  border-radius: var(--radius-round);
  font-size: var(--font-size-0);
  font-weight: var(--font-weight-6);
}

.badge-available {
  background: color-mix(in srgb, var(--color-success) 15%, transparent);
  color: var(--color-success);
}

.badge-leased {
  background: color-mix(in srgb, var(--color-text-muted) 20%, transparent);
  color: var(--color-text-muted);
}

.badge-upcoming {
  background: color-mix(in srgb, var(--color-accent) 18%, transparent);
  color: var(--color-accent-hover);
}

.badge-danger {
  background: color-mix(in srgb, var(--color-danger) 15%, transparent);
  color: var(--color-danger);
}

/* --- Forms --- */
.field {
  margin-bottom: var(--size-4);

  & label {
    display: block;
    font-weight: var(--font-weight-6);
    margin-bottom: var(--size-1);
  }

  & label:has(input[type="checkbox"]),
  & label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: var(--size-2);
    font-weight: var(--font-weight-4);
    cursor: pointer;
  }

  & input:not([type="checkbox"]):not([type="radio"]),
  & textarea,
  & select {
    width: 100%;
    padding: var(--size-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2);
    font: inherit;
    background: var(--color-surface);
    color: var(--color-text);
  }

  & input[type="checkbox"],
  & input[type="radio"] {
    width: auto;
    margin: 0;
  }

  & textarea {
    min-height: 8rem;
    resize: vertical;
  }
}

.field-hint {
  font-size: var(--font-size-0);
  color: var(--color-text-muted);
  margin-top: var(--size-1);
  margin-bottom: 0;
}

.form-error {
  color: var(--color-danger);
  font-size: var(--font-size-1);
  margin-bottom: var(--size-4);
}

.form-success {
  color: var(--color-success);
  font-size: var(--font-size-1);
  margin-bottom: var(--size-4);
}

/* --- Admin table --- */
.table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;

  & th,
  & td {
    text-align: left;
    padding: var(--size-2) var(--size-3);
    border-bottom: 1px solid var(--color-border);
  }

  & th {
    color: var(--color-text-muted);
    font-size: var(--font-size-0);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
}

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--size-6);
  gap: var(--size-4);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: var(--size-3);
  margin-block: var(--size-4);

  & img {
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-2);
  }
}

.photo-actions {
  display: flex;
  gap: var(--size-1);
  margin-top: var(--size-1);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--size-7);
  height: var(--size-7);
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;

  &:hover:not(:disabled) {
    background: var(--color-bg);
  }

  &:disabled {
    opacity: 0.35;
    cursor: default;
  }
}

/* --- Lightbox (click a .js-lightbox image to enlarge) --- */
.js-lightbox {
  cursor: zoom-in;
  transition: opacity var(--ease-3, 0.2s) ease;
}

.js-lightbox:hover {
  opacity: 0.85;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(0 0 0 / 88%);
  padding: var(--size-6);
  align-items: center;
  justify-content: center;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-2);
}

.lightbox-close {
  position: absolute;
  top: var(--size-4);
  right: var(--size-5);
  background: none;
  border: none;
  color: white;
  font-size: var(--font-size-6);
  line-height: 1;
  cursor: pointer;
  padding: var(--size-2);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(255 255 255 / 12%);
  border: none;
  color: white;
  cursor: pointer;
  padding: var(--size-2);
  border-radius: var(--radius-round);
}

.lightbox-nav:hover {
  background: rgb(255 255 255 / 25%);
}

.lightbox-nav[hidden] {
  display: none;
}

.lightbox-prev {
  left: var(--size-4);
}

.lightbox-next {
  right: var(--size-4);
}

/* General marketing photo gallery (as opposed to .photo-grid's square
   listing-photo thumbnails) — a gentler 4:3 crop for property photography. */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--size-4);
  margin-block: var(--size-6);

  & img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
  }
}

.feature-photo {
  width: 100%;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.video-player video {
  width: 100%;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  background: black;
}

.map-embed {
  position: relative;
  width: 100%;
  padding-bottom: 45%;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.map-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--size-8);
  align-items: center;
  margin-block: var(--size-8);

  @media (max-width: 48rem) {
    grid-template-columns: 1fr;
  }
}

.split-reverse {
  & > :first-child {
    order: 2;
  }
}

.bullet-columns {
  columns: 2;
  column-gap: var(--size-6);
  list-style: disc;
  padding-left: var(--size-5);

  @media (max-width: 40rem) {
    columns: 1;
  }

  & li {
    margin-bottom: var(--size-1);
    break-inside: avoid;
  }
}

/* --- Utilities ---
   Our CSP (style-src 'self') blocks inline style="" attributes, so one-off
   spacing/sizing tweaks live here as small utility classes instead. */
.mt-1 { margin-top: var(--size-1); }
.mt-4 { margin-top: var(--size-4); }
.mt-6 { margin-top: var(--size-6); }
.mt-8 { margin-top: var(--size-8); }
.mt-9 { margin-top: var(--size-9); }

.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 32rem; }
.max-w-lg { max-width: 36rem; }
.max-w-content { max-width: 48rem; }

.btn-sm { padding: var(--size-1) var(--size-3); }
.btn-xs { padding: var(--size-1) var(--size-2); font-size: var(--font-size-0); }

.inline-form { display: inline; }

.honeypot {
  position: absolute;
  left: -9999px;
}

.auth-container {
  max-width: 24rem;
  padding-block: var(--size-9);
}

.admin-content {
  padding-block: var(--size-6);
}

.card-actions {
  margin-top: auto;
  padding-top: var(--size-4);
}
