.cafe-profile-page {
  --profile-bg: var(--brand-paper);
  --profile-panel: var(--brand-surface);
  --profile-ink: var(--brand-ink);
  --profile-muted: var(--brand-muted);
  --profile-rule: var(--brand-rule);
  --profile-accent: var(--brand-clay);
  color: var(--profile-ink);
  background: var(--profile-bg);
  overflow: clip;
}

html[data-theme="dark"] .cafe-profile-page {
  --profile-bg: var(--brand-paper);
  --profile-panel: var(--brand-surface);
  --profile-ink: var(--brand-ink);
  --profile-muted: var(--brand-muted);
  --profile-rule: var(--brand-rule);
  --profile-accent: var(--brand-clay);
}

.cafe-profile-page a {
  text-underline-offset: 0.25em;
}

.cafe-profile-page a:focus-visible,
.cafe-profile-page button:focus-visible {
  outline: 2px solid var(--profile-accent);
  outline-offset: 4px;
}

.cafe-profile-page .profile-back {
  color: var(--profile-muted);
  text-decoration: none;
}

.profile-hero {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  align-items: stretch;
  height: calc(100svh - 62px);
  min-height: 0;
  border-bottom: 1px solid var(--profile-rule);
  background: var(--profile-bg);
}

.profile-hero.is-text-only {
  grid-template-columns: 1fr;
}

.profile-hero.is-text-only .profile-hero-copy {
  max-width: 72rem;
}

.profile-hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding: clamp(52px, 7vw, 112px) clamp(34px, 6vw, 96px);
}

.profile-hero h1 {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(2.8rem, 4vw, 4.65rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.profile-name-secondary {
  margin: 1rem 0 0;
  color: var(--profile-muted);
  font-family: var(--camel);
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.profile-location {
  margin: 1.5rem 0 0;
  padding-top: 0.75rem;
  border-top: 2px solid var(--profile-accent);
  color: var(--profile-accent);
}

.profile-score {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 1.25rem;
}

.profile-score strong {
  color: var(--profile-accent);
  font-family: var(--camel);
  font-size: clamp(2.4rem, 4vw, 3.75rem);
  font-weight: 400;
}

.profile-score span {
  color: var(--profile-muted);
  font-size: 0.82rem;
}

.profile-map {
  display: inline-flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 3rem;
  margin-top: 1.25rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--profile-rule);
  color: var(--profile-ink);
  text-decoration: none;
}

.profile-map:hover {
  border-color: var(--profile-accent);
  color: var(--profile-accent);
}

.profile-hero-media {
  position: relative;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  background: var(--profile-panel);
  overflow: hidden;
}

.profile-hero-media picture,
.profile-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-hero-media img {
  min-height: 0;
  object-fit: cover;
}

.profile-hero-media figcaption {
  position: absolute;
  inset-inline: 1rem;
  bottom: 1rem;
  width: fit-content;
  max-width: calc(100% - 2rem);
  padding: 0.4rem 0.6rem;
  color: #f8f1e8;
  background: rgba(18, 15, 13, 0.78);
  font-size: 0.78rem;
}

.profile-editorial {
  width: min(960px, calc(100% - 44px));
  margin-inline: auto;
  padding: clamp(68px, 8vw, 108px) 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.36fr) minmax(0, 0.64fr);
  gap: 32px clamp(48px, 7vw, 86px);
  align-items: start;
  border-bottom: 1px solid var(--profile-rule);
}

.profile-editorial-heading {
  grid-row: 1 / span 2;
}

.profile-editorial h2,
.profile-orders h2,
.profile-section-heading h2 {
  max-width: 13ch;
  margin: 0.25rem 0 0;
  font-size: clamp(1.5rem, 2.2vw, 2.25rem);
  font-weight: 400;
  line-height: 1;
}

.profile-opinion {
  margin: 0;
  color: var(--profile-ink);
  font-size: clamp(1.05rem, 1.25vw, 1.18rem);
  line-height: 2;
}

.profile-editorial-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 5vw, 56px);
}

.profile-label,
.profile-branch-status,
.profile-story-meta {
  color: var(--profile-accent);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.profile-visits {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.profile-visits li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--profile-rule);
}

.profile-visits strong {
  color: var(--profile-accent);
  direction: ltr;
  font-family: var(--camel);
  font-weight: 400;
  unicode-bidi: isolate;
}

.profile-visits time {
  color: var(--profile-muted);
  font-size: 0.8rem;
  text-align: end;
}

.profile-visits p {
  grid-column: 1 / -1;
  margin: 0.4rem 0 0;
  color: var(--profile-muted);
  line-height: 1.5;
}

.profile-orders {
  padding: 0;
  border-bottom: 1px solid var(--profile-rule);
}

.profile-orders ul {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.profile-orders li {
  padding: 0.45rem 0;
  border-top: 1px solid var(--profile-rule);
  font-size: 1.05rem;
}

.profile-orders .profile-empty {
  margin: 0.75rem 0 0;
}

.profile-empty {
  color: var(--profile-muted);
  line-height: 1.55;
}

.profile-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  margin-bottom: clamp(28px, 4vw, 48px);
}

.profile-branches,
.profile-gallery,
.profile-majlis {
  width: min(1120px, calc(100% - 44px));
  margin-inline: auto;
  padding: clamp(68px, 8vw, 112px) 0;
  border-bottom: 1px solid var(--profile-rule);
}

.profile-branch-list {
  border-top: 1px solid var(--profile-rule);
}

.profile-branch {
  display: grid;
  grid-template-columns: 10rem minmax(12rem, 0.8fr) minmax(12rem, 1.4fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--profile-rule);
}

.profile-branch h3,
.profile-branch p {
  margin: 0;
}

.profile-branch p {
  color: var(--profile-muted);
}

.profile-branch a,
.profile-featured-story a,
.profile-older-stories a {
  color: var(--profile-accent);
}

.profile-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 14px;
}

.profile-gallery-grid figure {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: var(--profile-panel);
  aspect-ratio: 4 / 3;
}

.profile-gallery-grid picture,
.profile-gallery-grid img {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-gallery-grid img {
  object-fit: cover;
}

.profile-gallery-grid figcaption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 0.8rem;
  color: #f8f1e8;
  background: rgba(18, 15, 13, 0.78);
  font-size: 0.8rem;
}

.profile-featured-story {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(12rem, 0.95fr);
  min-height: 15rem;
  border-top: 1px solid var(--profile-rule);
  border-bottom: 1px solid var(--profile-rule);
}

.profile-story-media picture,
.profile-story-media img {
  display: block;
  width: 100%;
  height: 100%;
}

.profile-story-media img {
  min-height: 15rem;
  object-fit: cover;
}

.profile-story-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 2vw, 2rem);
}

.profile-story-copy h3 {
  margin: 0.6rem 0 1rem;
  font-size: clamp(1.45rem, 2.2vw, 2.25rem);
  font-weight: 400;
  line-height: 1.05;
}

.profile-story-copy > p:not(.profile-story-meta) {
  color: var(--profile-muted);
  line-height: 1.55;
}

.profile-older-heading {
  margin: 1.25rem 0 0.35rem;
  color: var(--profile-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.profile-older-stories article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10rem auto;
  gap: 1.5rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--profile-rule);
}

.profile-older-stories h4,
.profile-older-stories time {
  margin: 0;
}

.profile-older-stories time {
  color: var(--profile-muted);
  font-size: 0.8rem;
}

.community-ledger {
  display: block;
  width: min(1120px, calc(100% - 44px));
  margin: clamp(68px, 8vw, 112px) auto;
}

.profile-secondary-grid {
  display: block;
}

.profile-secondary-grid.is-single {
  grid-template-columns: 1fr;
}

.profile-secondary-grid > section + section {
  border-inline-start: 0;
}

.cafe-profile-page .site-footer {
  display: flex;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 4rem);
}

.cafe-profile-page .site-footer a {
  color: var(--profile-muted);
}

@media (max-width: 860px) {
  .profile-hero {
    display: flex;
    flex-direction: column-reverse;
    height: auto;
    min-height: 0;
  }

  .profile-hero-media {
    width: 100%;
    min-height: 0;
    height: 54svh;
    max-height: 560px;
  }

  .profile-hero-media img {
    min-height: 370px;
  }

  .profile-editorial {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .profile-editorial-heading {
    grid-row: auto;
  }

  .profile-editorial-notes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px;
  }

  .profile-branch {
    grid-template-columns: 1fr auto;
  }

  .profile-branch p {
    grid-column: 1 / -1;
  }

  .profile-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-featured-story {
    grid-template-columns: 1fr;
  }

  .profile-secondary-grid {
    grid-template-columns: 1fr;
  }

  .profile-secondary-grid > section + section {
    border-inline-start: 0;
  }
}

@media (max-width: 560px) {
  .cafe-profile-page {
    min-width: 0;
  }

  .profile-hero-copy {
    padding: 38px 20px 50px;
  }

  .profile-editorial,
  .profile-branches,
  .profile-gallery,
  .profile-majlis {
    width: calc(100% - 36px);
    padding-block: 52px;
  }

  .profile-hero h1 {
    max-width: 100%;
    font-size: clamp(3.2rem, 18vw, 5.5rem);
  }

  .profile-section-heading {
    display: block;
  }

  .profile-gallery-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    grid-auto-rows: 14rem;
    padding-bottom: 0.5rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
  }

  .profile-editorial-notes {
    grid-template-columns: 1fr;
  }

  .community-ledger {
    width: calc(100% - 36px);
    margin-block: 52px;
  }

  .profile-gallery-grid figure {
    scroll-snap-align: start;
  }

  .profile-older-stories article,
  .profile-branch {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .profile-older-stories article > *,
  .profile-branch > * {
    min-width: 0;
  }
}

@media (max-width: 340px) {
  .profile-hero-copy,
  .profile-editorial,
  .profile-branches,
  .profile-gallery,
  .profile-majlis {
    padding-inline: 0.85rem;
  }

  .profile-score {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cafe-profile-page *,
  .cafe-profile-page *::before,
  .cafe-profile-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
