/*
  Theme Name: Godhuli
  File Description: CSS file for Gutenberg blocks (refactored with CSS variables)
  Depends on: godhuli-tokens.css
*/

/* ── Alignment helpers ────────────────────────────────────────── */

.entry-content > .alignwide,
.wp-block-group > .alignwide {
  max-width: var(--content-wide);
  width: 100%;
}

.entry-content > .alignfull {
  margin-bottom: 3rem;
  margin-top: 3rem;
}

.full-width-contain .entry-content > .alignfull {
  width: 100vw;
  margin-left: calc(-50vw + 50% - 8px);
  max-width: 100vw;
}

.sidebar-contain .entry-content > .alignfull {
  width: 100%;
  max-width: 100%;
}

.entry-content > .alignleft,
.entry-summary > .alignleft {
  max-width: calc(4 * (100vw / 12));
  margin-right: calc(2 * 1rem);
}

/* #content full-width alignfull fix */
#content .col-lg-12 .entry-content .alignfull {
  width: 100vw;
  overflow: visible;
  max-width: 100vw;
  margin-left: calc(-50vw + 50%);
  z-index: var(--z-block);
  position: relative;
}

/* ── Block content defaults ───────────────────────────────────── */

.entry .entry-content p {
  word-wrap: break-word;
}

.entry-content > * {
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.25em;
}

/* ── Images & Media ───────────────────────────────────────────── */

.alignfull img,
.wp-block-image.alignfull img {
  width: 100vw;
}

.wp-block-video video {
  max-width: 100%;
  width: 100%;
}

.wp-block-image .aligncenter {
  text-align: center;
}

.wp-block-image.alignleft,
.wp-block-image.alignright {
  width: 100%;
}

.wp-block-image a:focus {
  display: block;
}

/* ── Gallery ──────────────────────────────────────────────────── */

.post-content ul.wp-block-gallery,
.post-content ol.wp-block-gallery {
  margin-left: 0;
}

.wp-block-gallery ul {
  list-style: none;
  margin: 0 0 -1.6rem;
}

.wp-block-gallery .blocks-gallery-item figcaption {
  padding: 15px 20px 15px 15px;
  line-height: var(--leading-tight);
}

.wp-block-gallery .blocks-gallery-item figcaption:focus {
  overflow: hidden;
}

.wp-block-gallery .blocks-gallery-item figure a:focus {
  border: 2px solid var(--color-primary);
}

.blocks-gallery-caption,
.wp-block-embed figcaption,
.wp-block-image figcaption {
  padding-top: 20px;
}

.alignfull > figcaption,
.alignfull > .wp-caption-text {
  margin-left: auto;
  margin-right: auto;
  max-width: 58rem;
  width: calc(100% - 4rem);
}

/* ── Cover block ──────────────────────────────────────────────── */

.wp-block-cover-text p {
  padding: 1.5em 14px;
}

/* ── Latest Posts / Archives / RSS ───────────────────────────── */

ul.wp-block-latest-posts.alignwide,
ul.wp-block-latest-posts.alignfull,
ul.wp-block-latest-posts.is-grid.alignwide {
  padding: 0 14px;
}

ul.wp-block-archives-list {
  list-style: none !important;
}

ul.wp-block-archives-list li,
ul.wp-block-rss li {
  padding-bottom: 10px;
}

ul.wp-block-archives-list li a,
ul.wp-block-rss li a,
.wp-block-tag-cloud a,
.wp-block-latest-posts a {
  text-decoration: none !important;
}

ul.wp-block-rss {
  list-style: none !important;
}

/* ── Table ────────────────────────────────────────────────────── */

.wp-block-table {
  display: block;
  overflow-x: auto;
}

.wp-block-table table {
  border-collapse: collapse;
  width: 100%;
}

.wp-block-table td,
.wp-block-table th {
  padding: 0.5em;
}

.entry .entry-content .wp-block-table th,
.entry .entry-content .wp-block-table td {
  border-color: #767676;
}

.wp-block-table.is-style-stripes td {
  border-color: inherit;
}

.wp-block-table.is-style-stripes td,
.wp-block-table.is-style-stripes th {
  border-color: transparent;
}

.wp-block-table .has-fixed-layout td,
.wp-block-table .has-fixed-layout th {
  word-break: break-word;
}

.wp-block-table.is-style-stripes table {
  border: 2px solid var(--color-border-quote);
}

/* ── Calendar ─────────────────────────────────────────────────── */

.wp-block-calendar table th {
  background: var(--color-primary);
}

/* ── Video embed ──────────────────────────────────────────────── */

.wp-block-embed.type-video > .wp-block-embed__wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 56.25%; /* 16:9 */
}

.wp-block-embed.type-video > .wp-block-embed__wrapper > iframe {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
}

/* ── Quotes ───────────────────────────────────────────────────── */

.wp-block-quote.is-large {
  margin: 0 auto 16px;
}

.wp-block-pullquote > p:first-child {
  margin-top: 0;
}

.wp-block-pullquote.is-style-solid-color blockquote cite {
  text-transform: none;
  font-style: normal;
  padding-left: 30px;
  margin-top: 12px;
  display: block;
}

/* ── Separator ────────────────────────────────────────────────── */

.wp-block-separator {
  margin: 3em auto;
  padding: 0;
}

/* ── More link ────────────────────────────────────────────────── */

.more-link {
  display: block;
}

/* ── Block group ──────────────────────────────────────────────── */

.wp-block-group > * {
  max-width: var(--content-narrow);
  margin-left: auto;
  margin-right: auto;
}

.wp-block-group > .alignfull {
  max-width: 100%;
}

.wp-block-group.has-background > .alignfull {
  width: calc(100% + 60px);
  max-width: calc(100% + 60px);
  position: relative;
  left: -30px;
}

.wp-block-group.has-background {
  margin-bottom: 15px;
}

/* ── Columns ──────────────────────────────────────────────────── */

.wp-block-columns.alignfull,
.alignfull:not(.has-background) .wp-block-columns {
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ── Lists inside entry content ───────────────────────────────── */

.entry-content ul ul,
.entry-content ol ol,
.entry-content ul ol,
.entry-content ol ul {
  margin-left: 0;
  padding-left: 20px;
}

/* ── Buttons ──────────────────────────────────────────────────── */

button:not(.toggle),
.button,
.faux-button,
.wp-block-button__link,
.wp-block-file .wp-block-file__button,
input[type="button"],
input[type="reset"],
input[type="submit"],
.bg-accent,
.bg-accent-hover:hover,
.bg-accent-hover:focus,
:root .has-accent-background-color {
  background-color: var(--color-primary);
  color: var(--color-white) !important;
}

.is-style-outline .wp-block-button__link {
  background-color: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-heading) !important;
}

/* Focus states for buttons */
.wp-block-button__link:focus,
.wp-block-file .wp-block-file__button:focus {
  background: transparent;
  color: var(--color-body-text) !important;
  text-decoration: underline;
}

.is-style-outline .wp-block-button__link:focus {
  color: var(--color-white) !important;
  text-decoration: underline;
}

/* ── Search block ─────────────────────────────────────────────── */

.wp-block-search .wp-block-search__input:focus,
input:focus,
textarea:focus {
  border: 1px dashed var(--color-primary);
}

.wp-block-search .wp-block-search__button:hover {
  cursor: pointer;
  opacity: 0.9;
}

.wp-block-search .wp-block-search__button:focus,
[type="submit"]:focus {
  border: 1px dashed var(--color-primary) !important;
  background-color: var(--color-white);
  color: var(--color-heading);
}

.wp-block-search .wp-block-search__button:focus,
[type="submit"]:focus {
  color: var(--color-body-text) !important;
}

/* ── Typography helpers ───────────────────────────────────────── */

.has-large-font-size {
  line-height: 1em !important;
}

/* ── Color palette classes ────────────────────────────────────── */

.has-strong-blue-color           { color: var(--color-block-blue-dark); }
.has-strong-blue-background-color{ background-color: var(--color-block-blue-dark); }
.has-lighter-blue-color          { color: var(--color-block-blue-light); }
.has-lighter-blue-background-color{ background-color: var(--color-block-blue-light); }
.has-very-light-gray-color       { color: var(--color-border); }
.has-very-light-gray-background-color{ background-color: var(--color-border); }
.has-very-dark-gray-color        { color: var(--color-block-gray-dark); }
.has-very-dark-gray-background-color{ background-color: var(--color-block-gray-dark); }

/* ── Footer inside entry content ──────────────────────────────── */

.entry-content footer {
  background: transparent;
}

/* ── Focus accessibility (video, audio, embeds) ───────────────── */

.wp-block-cover__video-background:focus,
video:focus,
iframe:focus,
.wp-block-embed__wrapper:focus,
.wp-block-audio audio:focus {
  border: 2px solid var(--color-primary);
}

.mejs-container:focus {
  border: 2px solid var(--color-primary);
}

/* ── Responsive ───────────────────────────────────────────────── */

@media screen and (min-width: 768px) {
  .wp-block-cover-text p {
    padding: 1.5em 0;
  }
  .entry-content > * {
    padding-left: 0;
    padding-right: 0;
  }
}