/* ============================================================
   Samana — Global Styles
   Base layout + the reusable building blocks every section is
   made from. Section-specific styles go in their own file
   (e.g. front-page.css), enqueued only where they're used.
   ============================================================ */

/* ============================================================
   BODY
   flex column layout keeps the footer pinned to the bottom on
   short pages — .site-main below takes up the remaining space.
   ============================================================ */
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  background-color: var(--color-background);
}

.site-main {
  flex: 1;
}

/* Anchor targets land below the sticky header instead of under it. */
:target {
  scroll-margin-top: calc(var(--header-height) + var(--space-md));
}

/* ============================================================
   FOCUS
   One consistent, visible keyboard-focus ring site-wide (the
   reset strips the browser default from form controls). Mouse
   clicks don't trigger it — :focus-visible only.
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

.site-main:focus {
  outline: none; /* programmatic focus target of the skip link */
}

/* ============================================================
   SCREEN-READER-ONLY UTILITY
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   SKIP TO CONTENT (Accessibility)
   ============================================================ */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: var(--z-skip-link);
  padding: 12px 20px;
  background-color: var(--color-primary);
  color: var(--color-white);
  transition: top var(--transition);
}

.skip-to-content:focus {
  top: 0;
}

/* ============================================================
   CONTAINER
   1280px max frame, fluid side gutter (variables.css).
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ============================================================
   CONTENT SECTION
   Shared vertical padding for every content section — 40px on
   mobile, 60px from 1024px (--section-space). Background color
   modifiers below so sections can alternate without new CSS.
   ============================================================ */
.content-section {
  padding-block: var(--section-space);
}

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

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

/* Dark bands — white text throughout. */
.section--petrol,
.section--deep-teal {
  color: var(--color-white-a85);
}

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

.section--deep-teal {
  background-color: var(--color-deep-teal);
}

.section--petrol .heading-section,
.section--petrol .section-eyebrow,
.section--deep-teal .heading-section,
.section--deep-teal .section-eyebrow {
  color: var(--color-white);
}

.section--petrol .section-description,
.section--deep-teal .section-description {
  color: var(--color-white-a85);
}

/* ============================================================
   SECTION HEADER
   Eyebrow + title + description centered above a section's main
   content (grid, row, etc).
   ============================================================ */
.section-header {
  text-align: center;
  max-width: var(--container-narrow);
  margin-inline: auto;
  margin-block-end: var(--space-2xl);
}

.section-header:last-child {
  margin-block-end: 0;
}

/* ============================================================
   SECTION EYEBROW
   Small uppercase pre-heading above a .heading-section.
   ============================================================ */
.section-eyebrow {
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--color-primary);
  margin: 0 0 var(--space-sm);
}

/* ============================================================
   HEADINGS
   .heading-display — hero headline.
   .heading-section — section-level h2 (and inner-page h1).
   .heading-card    — card / sub-section titles.
   .heading-small   — body-font bold label heading.
   ============================================================ */
.heading-display {
  font-family: var(--font-heading);
  font-weight: var(--fw-heading);
  text-transform: uppercase;
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  color: var(--color-heading);
}

.heading-section {
  font-family: var(--font-heading);
  font-weight: var(--fw-heading);
  text-transform: uppercase;
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  color: var(--color-heading);
  margin: 0;
}

.heading-card {
  font-family: var(--font-heading);
  font-weight: var(--fw-heading);
  text-transform: uppercase;
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  color: var(--color-heading);
  margin: 0;
}

.heading-small {
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h4);
  line-height: 1.3;
  color: var(--color-heading);
}

/* Ocean-blue headings ("About the Villa", "Follow @edenssamana") */
.heading-section--accent,
.heading-card--accent {
  color: var(--color-heading-accent);
}

.heading-section--inverse,
.heading-card--inverse {
  color: var(--color-heading-inverse);
}

/* ============================================================
   SECTION DESCRIPTION
   ============================================================ */
.section-description {
  font-family: var(--font-body);
  font-size: var(--fs-lead);
  line-height: 1.65;
  color: var(--color-text);
  margin-block-start: var(--space-sm);
}

.section-description p + p {
  margin-block-start: var(--space-md);
}

.section-description--inverse {
  color: var(--color-white-a85);
}

/* ============================================================
   CTA BUTTON
   Primary by default. .cta-button--alt for the secondary
   variant, .cta-button--outline for a bordered ghost button.
   ============================================================ */
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 45px;
  padding-inline: 28px;
  background-color: var(--color-cta);
  color: var(--color-cta-text);
  border: 2px solid transparent;
  border-radius: var(--radius-button);
  font-family: var(--font-body);
  font-weight: var(--fw-medium);
  font-size: var(--fs-nav);
  line-height: 1.2;
  letter-spacing: var(--ls-button);
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition), background-color var(--transition), color var(--transition);
}

.cta-button:hover,
.cta-button:focus-visible {
  filter: brightness(0.94);
  transform: translateY(-1px);
}

.cta-button--alt {
  background-color: var(--color-cta-alt);
  color: var(--color-cta-alt-text);
}

.cta-button--outline {
  background-color: transparent;
  color: var(--color-cta);
  border-color: currentColor;
}

.cta-button--outline:hover,
.cta-button--outline:focus-visible {
  filter: none;
  background-color: var(--color-cta);
  border-color: var(--color-cta);
  color: var(--color-cta-text);
}

/* Group of buttons — stacked full-width on phones, centered inline
   row from 480px. A single button centers itself with no extra
   markup. */
.cta-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-md);
  margin-block-start: var(--space-lg);
}

@media (min-width: 480px) {
  .cta-group {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .cta-group--start {
    justify-content: flex-start;
  }
}

/* ============================================================
   RESPONSIVE ROW
   Reusable 2-column (media + content) layout: stacked below
   1024px, capped to a centered 700px column on tablet, then a
   horizontal row from 1024px. Add .responsive-row--reverse to put
   the media on the right on desktop without changing DOM order.
   ============================================================ */
.responsive-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
}

@media (max-width: 1023px) {
  .responsive-row {
    max-width: 700px;
    margin-inline: auto;
  }
}

@media (min-width: 1024px) {
  .responsive-row {
    flex-direction: row;
    gap: var(--space-3xl);
  }

  .responsive-row--reverse {
    flex-direction: row-reverse;
  }

  .responsive-row > * {
    flex: 1;
  }
}

.responsive-row-media {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.responsive-row-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   CARD GRID
   Flex-wrap grid of equal cards, centered so an incomplete last
   row stays centered. Column count via modifier:
   .card-grid--2 / --3 / --4 (all 1 column on phones).
   ============================================================ */
.card-grid {
  --grid-gap: var(--space-xl);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--grid-gap);
}

.card-grid > * {
  width: 100%;
}

@media (min-width: 668px) {
  .card-grid--2 > *,
  .card-grid--3 > *,
  .card-grid--4 > * {
    width: calc((100% - var(--grid-gap)) / 2);
  }
}

@media (min-width: 1024px) {
  .card-grid--3 > *,
  .card-grid--4 > * {
    width: calc((100% - 2 * var(--grid-gap)) / 3);
  }
}

@media (min-width: 1200px) {
  .card-grid--4 > * {
    width: calc((100% - 3 * var(--grid-gap)) / 4);
  }
}

/* ============================================================
   ENTRY CONTENT (page.php / index.php)
   Generic prose styling for plain WordPress-editor content —
   readable column width, clear vertical rhythm.
   ============================================================ */
.entry-content {
  max-width: var(--container-prose);
  margin-inline: auto;
}

.entry-content > :first-child {
  margin-block-start: 0;
}

.entry-content > :last-child {
  margin-block-end: 0;
}

.entry-content h2 {
  font-family: var(--font-heading);
  font-weight: var(--fw-heading);
  text-transform: uppercase;
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
  color: var(--color-heading);
  margin-block: var(--space-2xl) var(--space-md);
  padding-block-end: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.entry-content h3 {
  font-family: var(--font-heading);
  font-weight: var(--fw-heading);
  text-transform: uppercase;
  font-size: var(--fs-h4);
  line-height: var(--lh-heading);
  color: var(--color-heading);
  margin-block: 1.75rem var(--space-sm);
}

.entry-content p {
  margin-block-end: 1.25rem;
}

.entry-content ul,
.entry-content ol {
  margin-block-end: 1.25rem;
  padding-inline-start: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.entry-content ul {
  list-style: disc;
}

.entry-content ol {
  list-style: decimal;
}

.entry-content li {
  line-height: 1.6;
}

.entry-content li::marker {
  color: var(--color-accent);
}

.entry-content a {
  color: var(--color-primary);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.entry-content img {
  height: auto;
  border-radius: var(--radius-sm);
}

/* Post listings (index.php — blog / archives / search) */
.post-summary + .post-summary {
  margin-block-start: var(--space-2xl);
  padding-block-start: var(--space-2xl);
  border-top: 1px solid var(--color-border);
}

.post-summary h2 {
  margin-block-start: 0;
  border-bottom: 0;
  padding-block-end: 0;
}

.post-summary h2 a {
  font-weight: inherit;
  text-decoration: none;
  color: inherit;
}

/* ============================================================
   404
   ============================================================ */
.error-404-cta {
  margin-block-start: var(--space-lg);
}
