/**
 * myLogbook content component styles — Zone 0 (minimal, completing the
 * ported patterns so they don't look broken; full card/component system
 * comes in Zone 3).
 */

.ml-code-block {
  background-color: var(--ml-code-bg);
  color: var(--ml-code-text);
  font-family: var(--ml-font-mono);
  font-size: var(--ml-text-sm);
  line-height: var(--ml-leading-normal);
  padding: var(--ml-space-md) var(--ml-space-lg);
  border-radius: var(--ml-radius-md);
  border: 1px solid var(--ml-accent);
  box-shadow: 0 0 0 1px rgba(194, 118, 12, 0.12), 0 0 16px rgba(194, 118, 12, 0.1);
  overflow: auto;
  max-height: 24rem;
  resize: vertical;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

[data-mode="dark"] .ml-code-block {
  border-color: var(--ml-accent);
  box-shadow: 0 0 0 1px rgba(232, 162, 61, 0.18), 0 0 20px rgba(232, 162, 61, 0.12);
}

.ml-code-block code {
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  margin: 0;
}

/* ---- Code block toolbar (copy/download) ---- */

.ml-code-toolbar {
  position: sticky;
  top: 0;
  float: right;
  display: flex;
  gap: 4px;
  margin: calc(var(--ml-space-md) * -1) calc(var(--ml-space-lg) * -0.5) var(--ml-space-sm) var(--ml-space-sm);
}

.ml-code-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid rgba(241, 236, 226, 0.2);
  border-radius: var(--ml-radius-sm);
  background-color: rgba(241, 236, 226, 0.08);
  color: var(--ml-code-text);
  cursor: pointer;
  transition: background-color var(--ml-dur-fast) var(--ml-ease);
}

.ml-code-btn:hover {
  background-color: rgba(241, 236, 226, 0.18);
}

.ml-code-btn.is-confirmed {
  background-color: rgba(63, 107, 79, 0.5);
  border-color: rgba(127, 174, 143, 0.6);
  color: #C8E6D2;
}

/* ---- Image download button ---- */

.ml-photo-download {
  position: absolute;
  top: var(--ml-space-xs);
  right: var(--ml-space-xs);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--ml-radius-sm);
  background-color: rgba(23, 20, 15, 0.6);
  color: #fff;
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--ml-dur-fast) var(--ml-ease), background-color var(--ml-dur-fast) var(--ml-ease);
}

.ml-content-photo:hover .ml-photo-download,
.ml-photo-download:focus-visible {
  opacity: 1;
}

.ml-photo-download:hover {
  background-color: rgba(23, 20, 15, 0.85);
}

.ml-content-photo {
  position: relative;
  border-radius: var(--ml-radius-md);
  overflow: hidden;
  border: 1px solid var(--ml-accent);
  box-shadow: 0 0 0 1px rgba(194, 118, 12, 0.12), 0 0 16px rgba(194, 118, 12, 0.1);
  margin: 0 0 var(--ml-space-md);
}

[data-mode="dark"] .ml-content-photo {
  box-shadow: 0 0 0 1px rgba(232, 162, 61, 0.18), 0 0 20px rgba(232, 162, 61, 0.12);
}

.ml-content-photo img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
}

/* Caption overlay — subtitle anchors to the very bottom, title stacks
   directly above it via translateY(-100%), which shifts by the title's
   OWN rendered height. This is robust regardless of how long either
   line of text is or whether it wraps — no hardcoded height/spacing
   assumptions, unlike positioning both independently against the same
   edge (which would need to guess the other element's height). */
.ml-content-photo .ml-photo-subtitle,
.ml-content-photo .wp-block-heading {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  padding: var(--ml-space-2xs) var(--ml-space-md);
  background-color: rgba(23, 20, 15, 0.72);
  color: #F5F1E8;
}

.ml-content-photo .ml-photo-subtitle {
  bottom: 0;
  font-size: var(--ml-text-sm);
  padding-top: 0;
  padding-bottom: var(--ml-space-sm);
}

.ml-content-photo .wp-block-heading {
  bottom: 0;
  transform: translateY(-100%);
  padding-top: var(--ml-space-xs);
  padding-bottom: var(--ml-space-2xs);
  font-size: var(--ml-text-lg);
}
