/* =====================================================================
   DAR AL OFOQ · NativePress field presentation
   The theme owns every rule in this file. It documents how image slots keep a
   replaced image from moving the layout, and styles the internals of
   client-edited rich text.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Fixed image slots · how the frame is enforced

   Every client-editable image slot declares an aspect ratio, which
   ofoq_image() writes as an inline `aspect-ratio` on the <img>, with the
   slot's `object-fit` and `object-position`. Each component then fixes one
   dimension in theme.css or pages.css:

     width: 100%            .arch-img, .soft-img, .collage img …
     width: 64px / 210px    .brand__mark, .footer__logo, .brandplate__logo
     height: clamp(…)       .collage__b img, .feature__media .arch-img …
     position: absolute     .hero1__img, .door1__view, .rooms__view img …
       + inset: 0

   One fixed dimension plus the declared ratio means the rendered box comes
   entirely from the design. A client can replace any slot with a landscape,
   portrait or square file: the box keeps its dimensions and the new file is
   cropped by object-fit, so the layout cannot move. The uploaded file's natural
   size is never used, so this file needs no rules of its own for the slots.
   --------------------------------------------------------------------- */

/* ---------------------------------------------------------------------
   Rich text internals
   ofoq_richtext() always renders a <div class="ofoq-richtext">, and a
   room's ACF description renders as .ofoq-prose. The theme styles what a client
   can put inside either: paragraphs, lists, links, emphasis.
   The design's own type classes (.lede, .muted, .plate__note …) are passed to
   the helper and style the block itself.
   --------------------------------------------------------------------- */
/* The design's own spacing for an editable block lives on the wrapper, which
   carries the type classes (.lede, .muted, .faq answer padding …). A rule
   written for the prototype's bare paragraph, such as `.faq details p`, also
   matches the paragraph wpautop() puts inside the wrapper, so the inner one
   must contribute no spacing of its own. */
.ofoq-site .ofoq-richtext > p,
.ofoq-site .ofoq-prose > p {
  margin: 0;
  padding: 0;
}

.ofoq-site .ofoq-richtext > p + p,
.ofoq-site .ofoq-prose > p + p {
  margin-top: .85em;
}

.ofoq-site .ofoq-richtext ul,
.ofoq-site .ofoq-richtext ol,
.ofoq-site .ofoq-prose ul,
.ofoq-site .ofoq-prose ol {
  margin: .7em 0 0;
  padding-left: 1.25em;
}

.ofoq-site .ofoq-richtext ul, .ofoq-site .ofoq-prose ul { list-style: disc; }
.ofoq-site .ofoq-richtext ol, .ofoq-site .ofoq-prose ol { list-style: decimal; }

.ofoq-site .ofoq-richtext li + li,
.ofoq-site .ofoq-prose li + li {
  margin-top: .35em;
}

.ofoq-site .ofoq-richtext a,
.ofoq-site .ofoq-prose a {
  color: var(--terra, #B4572A);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.ofoq-site .ofoq-richtext a:hover,
.ofoq-site .ofoq-richtext a:focus-visible,
.ofoq-site .ofoq-prose a:hover,
.ofoq-site .ofoq-prose a:focus-visible {
  color: var(--green-deep, #0E332B);
}

.ofoq-site .ofoq-richtext strong,
.ofoq-site .ofoq-richtext b,
.ofoq-site .ofoq-prose strong,
.ofoq-site .ofoq-prose b {
  font-weight: 600;
}

/* Rich text on the dark plates and footer inherits their light link colour. */
.ofoq-site .plate .ofoq-richtext a,
.ofoq-site .section-footer .ofoq-richtext a,
.ofoq-site .menu-overlay .ofoq-richtext a {
  color: inherit;
}

/* ---------------------------------------------------------------------
   The arrow inside an editable button

   ofoq_button() runs `before` and `after` through wp_kses_post(), which
   allows no <svg>, so an inline arrow passed there is silently dropped along
   with the link's text wrapper. ofoq_arrow_markup() sends a <span> instead and
   it is drawn here from the same path as ofoq_icon( 'arrow-right' ), masked so
   it still takes its colour from the button text. The box and the hover shift
   match `.btn svg` / `.textlink svg` in theme.css.
   --------------------------------------------------------------------- */
.ofoq-site .ofoq-arrow {
  display: block;
  flex: none;
  width: 16px;
  height: 16px;
  background: currentColor;
  transition: transform .2s;
  -webkit-mask: var(--ofoq-arrow) center / contain no-repeat;
          mask: var(--ofoq-arrow) center / contain no-repeat;
}

.ofoq-site .btn:hover .ofoq-arrow,
.ofoq-site .textlink:hover .ofoq-arrow {
  transform: translateX(3px);
}

/* ---------------------------------------------------------------------
   Managed regions

   ofoq_managed_region_open() always renders a <div>, in visitor mode too,
   and the editor outlines a region from its box, so a region must be a real
   box -- display: contents is not an option. Templates either pass the
   design's own class for the element the region replaces (rcard__line,
   room-row__name, plate__big …) or wrap a whole block from outside, never
   inside a <p>. These rules cover the places that leaves.
   --------------------------------------------------------------------- */

/* A region standing in for an inline element. */
.ofoq-site .ofoq-managed-region.ofoq-region-inline {
  display: inline;
}

/* A region standing in for <span lang="ar"> as a block carries the Arabic face
   itself, so its line box keeps the metrics the span gave it. */
.ofoq-site .ofoq-managed-region.ofoq-ar {
  font-family: var(--arabic);
  font-weight: 500;
}

/* The arched card's name spans both columns of the card body. */
.ofoq-site .rcard2__body > .rcard2__name-region {
  grid-column: 1 / -1;
}

/* The comparison table's room link stays a flex item, as it was. */
.ofoq-site .compare .rname > .ofoq-managed-region {
  display: flex;
}

/* As a flex row, the current crumb draws none of the whitespace a region
   carries, so no gap opens after the "/" separator. */
.ofoq-site .crumbs__current {
  display: flex;
  align-items: baseline;
}

/* A gallery slide's photo fills the slide's height through its region. */
.ofoq-site .rg__slide > .ofoq-managed-region {
  height: 100%;
}

/* The home room index stacks one photo per room. Each region takes its photo's
   place and box, and only the room on show can be pointed at. */
.ofoq-site .rooms__view > .rooms__shot {
  position: absolute;
  inset: 0;
}

.ofoq-site .rooms__view > .rooms__shot:not(.is-on) {
  pointer-events: none;
}

/* ---------------------------------------------------------------------
   Editing: reaching a photo beneath the design's layers

   NativePress edits whatever is under the pointer. Many photos sit beneath
   gradients, frames, door leaves, a card's full-size link or a block of text,
   so a click on them reached those layers and never the photo. While the
   editing is on (NativePress marks <html> with .npf-editing), those
   layers let the click through: clicking any empty part of a hero slide, a
   door or a photo band selects its photo, and the words, links and buttons on
   top stay selectable themselves. Visitors are unaffected.
   --------------------------------------------------------------------- */

/* Layers drawn over a photo. pointer-events is inherited, so a door leaf's
   carving and rings let the click through with it. */
html.npf-editing .ofoq-site :is(.hero1__scrim, .door1__shade, .door2__shade, .door3__shade, .horizon-band__shade, .leaf, .door3__leaf, .hp2-hero__shade, .hp2-band__shade, .hp3-hero__shade, .hp3-band__shade),
html.npf-editing .ofoq-site :is(.rcard__name, .rcard2__name, .hp3-space__title) a::after,
html.npf-editing .ofoq-site .xp--photo::before {
  pointer-events: none;
}

/* The door 3 leaves are a photograph of their own (home.door3.leaf): while the
   doors are closed, a click on a leaf edits it; the knockers and shading let
   the click through to it. Open the doors with the button below to reach the
   Grand Salon photo behind them. */
html.npf-editing .ofoq-site .section-door-3:not(.is-open) .door3__leaf-img {
  pointer-events: auto;
}

/* Text set over a photo: only the words, links and buttons catch a click. */
html.npf-editing .ofoq-site :is(.hero1__caption, .door1__caption, .door2__caption, .door3__caption, .horizon-band__in, .xp--photo > div, .hp2-hero__in, .hp2-band__in, .hp3-hero__in, .hp3-band__in) {
  pointer-events: none;
}

html.npf-editing .ofoq-site :is(.hero1__caption, .door1__caption, .door2__caption, .door3__caption, .horizon-band__in, .xp--photo > div, .hp2-hero__in, .hp2-band__in, .hp3-hero__in, .hp3-band__in) :is([data-npf-field], a, button) {
  pointer-events: auto;
}

/* ---------------------------------------------------------------------
   The enquiry forms (Contact Form 7)

   Each doorplate card holds its NativePress heading, subheading and note, then
   the Contact Form 7 form, whose markup the theme wrote with the design's own
   classes (see inc/forms.php). These rules cover what Contact Form 7 adds
   around that markup: wrappers, its list markup for choices, a submit <input>
   in place of a <button>, and its messages. The pill choices and the inline
   "flexible dates" box share the design's rules in pages.css.
   --------------------------------------------------------------------- */

/* The form's own children keep the card's 16px rhythm. */
.ofoq-site .doorplate__fields {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* Contact Form 7 wraps every field in a span. As a grid, the wrapper lets the
   field fill it, so a field in a row with a taller neighbour stretches exactly
   as it did when it was the label's own child (the Adults list beside Phone). */
.ofoq-site .doorplate .wpcf7-form-control-wrap {
  display: grid;
  min-width: 0;
}

.ofoq-site .doorplate .wpcf7-list-item {
  margin: 0;
}

/* Contact Form 7's own stylesheet hides this; the card's fieldset rule must
   not bring it back if that stylesheet is ever turned off. */
.ofoq-site .doorplate .hidden-fields-container {
  display: none;
}

/* The submit is an <input>, so the card's rule for its fields
   (`.doorplate input`) reaches it and outranks .btn. The gold button is
   restated here, more specifically, with the same box as the design's
   <button>; an <input> cannot hold the arrow icon, so it is drawn as the
   background, where the icon sits. */
.ofoq-site .doorplate input.wpcf7-submit {
  -webkit-appearance: none;
  appearance: none;
  width: auto;
  min-width: 0;
  min-height: 50px;
  padding: 0 52px 0 26px;
  font: 700 13px/1 var(--body);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-deep);
  background-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230E332B' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15M13 6l6 6-6 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 26px center;
  background-size: 16px 16px;
  border: 1px solid transparent;
  border-radius: 2px;
  color-scheme: light;
  cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, transform .25s;
}

.ofoq-site .doorplate input.wpcf7-submit:hover {
  background-color: var(--gold-l);
  transform: translateY(-2px);
}

/* While it sends, the button dims instead of Contact Form 7's spinner, which
   would push the hint beside it out of place. */
.ofoq-site .doorplate .wpcf7-spinner {
  display: none;
}

.ofoq-site .doorplate .wpcf7-form.submitting .wpcf7-submit {
  opacity: .6;
  cursor: progress;
}

/* A field's message sits under it, in the card's error colour. */
.ofoq-site .doorplate .wpcf7-not-valid-tip {
  display: block;
  margin-top: 6px;
  color: #F7C2A8;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.ofoq-site .doorplate .wpcf7-not-valid {
  border-color: #F7C2A8;
}

/* The form's overall message, after it is sent or when something is wrong. */
.ofoq-site .doorplate .wpcf7-form .wpcf7-response-output {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(231, 188, 99, .5);
  border-radius: 2px;
  color: var(--paper);
  font-size: 14px;
  line-height: 1.5;
}

.ofoq-site .doorplate .wpcf7-form:is(.invalid, .unaccepted, .spam, .failed, .aborted, .payment-required) .wpcf7-response-output {
  border-color: #F7C2A8;
  color: #F7C2A8;
}

.ofoq-site .doorplate .wpcf7-form.sent .wpcf7-response-output {
  border-color: var(--gold);
  color: var(--gold-l);
}

/* ---------------------------------------------------------------------
   Editing: whole-section Feedback control

   NativePress refuses a large unregistered wrapper as a Feedback target, so
   site.js adds one real <button class="ofoq-sfb"> per section while editing is
   on, and removes it when editing ends. It is a small corner control that
   never overlays the section, so the fields inside stay individually
   selectable. Visitors and anonymous browsers never receive it.
   --------------------------------------------------------------------- */
html.npf-editing .ofoq-site [data-ofoq-sfb-host] {
  position: relative;
}

.ofoq-site .ofoq-sfb {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 999px;
  background: rgba(14, 51, 43, .92);
  color: #fff;
  font: 700 11px/1.2 var(--body);
  letter-spacing: .02em;
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  opacity: .72;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.ofoq-site .ofoq-sfb::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  box-sizing: border-box;
}

.ofoq-site .ofoq-sfb--below-header {
  inset-block-start: calc(var(--hdr) + 14px);
}

.ofoq-site .ofoq-sfb[data-pos~="bottom"] {
  inset-block-start: auto;
  inset-block-end: 10px;
}

.ofoq-site .ofoq-sfb[data-pos~="start"] {
  inset-inline-start: 10px;
  inset-inline-end: auto;
}

.ofoq-site .ofoq-sfb:is(:hover, :focus-visible) {
  opacity: 1;
}

.ofoq-site .ofoq-sfb:focus-visible {
  outline: 2px solid var(--gold-l);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .ofoq-site .ofoq-sfb {
    min-height: 44px;
    padding-inline: 14px;
    font-size: 12px;
  }
}

html:not(.npf-editing) .ofoq-site .ofoq-sfb {
  display: none;
}

/* ---------------------------------------------------------------------
   Editing: the empty-area Feedback target

   .ofoq-sfb-area is an empty span covering a section. It never receives a
   pointer event (site.js hands NativePress an unhandled empty-area click on
   its behalf), so it cannot block anything inside the section. Its outlines
   sit inside the section because many sections clip their overflow.
   --------------------------------------------------------------------- */
.ofoq-site .ofoq-sfb-area {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  pointer-events: none;
}

html.npf-editing .ofoq-site .ofoq-sfb-area.npf-selected,
html.npf-editing .ofoq-site .ofoq-sfb-area.npf-hovered:not(.npf-selected) {
  outline-offset: -4px;
}

html:not(.npf-editing) .ofoq-site .ofoq-sfb-area {
  display: none;
}

/* ---------------------------------------------------------------------
   Editing: "Edit room / form / activity / house photos"

   ofoq_managed_region_open() prints this link only for a user who may open
   the owning WordPress screen. Visitors, and editors outside Edit mode,
   never see it. :where() keeps a region's own positioning rules in charge.
   --------------------------------------------------------------------- */
.ofoq-site .ofoq-region-edit {
  display: none;
}

html.npf-editing .ofoq-site .ofoq-managed-region:where(:has(> .ofoq-region-edit)) {
  position: relative;
}

html.npf-editing .ofoq-site .ofoq-region-edit {
  position: absolute;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  z-index: 41;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 999px;
  background: rgba(14, 51, 43, .92);
  color: #fff;
  font: 700 11px/1.2 var(--body);
  letter-spacing: .02em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

html.npf-editing .ofoq-site .ofoq-region-edit:focus-visible {
  outline: 2px solid var(--gold-l);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  html.npf-editing .ofoq-site .ofoq-region-edit {
    min-height: 44px;
  }
}
