/*
 * identity-core.css
 * Core layout enhancements for the BIRI theme system layered over Omeka S Freedom theme.
 * This file provides structural guidance and styling hooks via CSS variables.
 * It does not replicate Freedom's layout, but adds styling consistency and flexibility.
 */

/* ===== Base Layout Enhancements ===== */


body {
  font-family: var(--font-body, "Open Sans", sans-serif);
  color: var(--text-color, #111);
  background-color: var(--background-body, #fff);
  line-height: var(--line-height, 1.6);
  font-size: var(--font-size, 1rem);
}

.biri-full-width {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background-color: inherit;
}

.biri-full-width .main-header__top-bar.container {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.biri-full-width .main-header__main-bar.container {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

.page-content,
.resource-detail,
.browse-controls,
.content-block {
  margin-bottom: var(--content-spacing);
}

/* ===== Typography Overrides ===== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--heading-margin-bottom, 2rem);
  padding: 0;
  color: var(--heading-color, var(--primary));
  font-family: var(--font-headings, Georgia, serif);
  line-height: var(--heading-line-height, 1.25);
  font-weight: var(--heading-weight, 500);
}

h1 { font-size: var(--h1-size, 2.5rem); }
h2 { font-size: var(--h2-size, 2rem); }
h3 { font-size: var(--h3-size, 1.75rem); }
h4 { font-size: var(--h4-size, 1.5rem); }
h5 { font-size: var(--h5-size, 1.25rem); }
h6 { font-size: var(--h6-size, 1rem); }

.section-title {
  font-size: var(--h2-size, 2rem);
  font-family: var(--font-headings);
  color: var(--heading-color);
  margin-bottom: var(--content-spacing, 2rem);
}


/* ===== Links ===== */
a {
  color: var(--link-color, var(--primary));
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--link-hover-color, var(--primary-dark));
  text-decoration: underline;
}

.resource-link {
  color: var(--link-color);
  font-weight: 500;
}

.resource-link:hover .resource-name {
  color: var(--link-hover-color);
}


/* ===== Header Styling ===== */
.main-header__top-bar {
  background-color: var(--background-header-top-bar);
  color: var(--header-top-bar-text-color);
  padding-top: var(--header-vertical-padding);
  padding-bottom: var(--header-vertical-padding);
}

.main-header__main-bar {
  background-color: var(--background-header-main-bar);
  color: var(--header-main-bar-text-color);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--card-shadow);
  padding-top: var(--header-vertical-padding);
  padding-bottom: var(--header-vertical-padding);
}

/* Top bar links */
.main-header__top-bar a {
  color: var(--header-top-bar-link-color);
}

.main-header__top-bar a:hover {
  color: var(--header-top-bar-link-hover-color);
  /* Add subtle highlight for better visibility on dark backgrounds */
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
}

/* Main bar links */
.main-header__main-bar a {
  color: var(--header-main-bar-link-color);
}

.main-header__main-bar a:hover {
  color: var(--header-main-bar-link-hover-color);
  /* Add subtle highlight for better visibility on dark backgrounds */
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
}

.main-header__site-title a {
  font-family: var(--font-headings);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--highlight-color);
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
}

.main-header__site-title a:hover {
  color: var(--site-title-hover-color, var(--header-main-bar-link-hover-color));
  text-decoration: none;
  /* No background needed for site title - it's already prominent */
  background-color: transparent;
}

/* ===== Hero image ===== */
.hero {
  width: 100%;
  margin-bottom: var(--content-spacing, 2rem);
  position: relative;
  overflow: hidden;
  border-radius: var(--border-radius);
}

.hero-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* ===== Header Enhancements ===== */
/* tighten size */
.main-header__top-bar.container,
.main-header__main-bar.container {
  padding: 0;
  margin: 0;
}

/* Create inner containers for content alignment */
.main-header__top-bar.container > :not(hr):not(.alignfull) {
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-sizing: border-box;
}
.main-header__main-bar.container > :not(hr):not(.alignfull) {
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: var(--header-vertical-padding);
  padding-bottom: var(--header-vertical-padding);
  box-sizing: border-box;
}

/* Ensure search form elements are properly contained */
.main-header__search-form {
  margin-left: auto;
  margin-right: auto;
}

/* Ensure horizontal rules remain full-width */
.main-header hr.alignfull {
  max-width: 100%;
  padding: 0;
  margin: 0;
}


/* ===== Navigation Enhancements ===== */
.main-navigation .navigation li a {
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.03em;
  padding: 0.5rem 0.8rem;
  transition: color 0.2s ease;
  color: var(--nav-text-color);
}

.main-navigation .navigation li.active a {
  font-weight: 700;
  color: var(--nav-text-color);
  border-bottom: 2px solid var(--nav-indicator-color);
}

.main-navigation .navigation li a:hover {
  color: var(--nav-hover-color);
  text-decoration: none;
  /* Add subtle background for better visibility on any color */
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
}

.main-navigation .navigation > li > a::after {
  background-color: var(--nav-hover-indicator-color);
}

/* Make hamburger menu visible against header background */
.main-navigation__toggle span {
  background-color: var(--text-on-primary); /* Use text-on-primary to ensure visibility */
}

/* ===== Search Form ===== */
.main-header__search-form button {
  background-color: transparent;
  border-radius: var(--border-radius);
  /* Use primary-dark directly for visibility on white search field */
  color: var(--primary-dark);
}

.main-header__search-form button:hover {
  /* Use secondary color for hover state - simple and direct */
  background-color: var(--secondary);
  /* Text should be visible against secondary color */
  color: var(--text-on-secondary, #fff);
}
.main-header__search-form input {
  border: 1px solid rgba(255, 255, 255, 0.5);
}


/* ===== Button Colors with Contrast Awareness ===== */
.button:not(.main-header__search-form button),
button:not(.main-header__search-form button) {
  background-color: var(--primary);
  color: var(--button-text-color, #fff);
  transition: background-color 0.2s ease;
  border-radius: var(--border-radius);
}

.button:hover:not(.main-header__search-form button),
button:hover:not(.main-header__search-form button) {
  background-color: var(--primary-dark);
  color: var(--button-hover-text-color, #fff);
}

.button.secondary:not(.main-header__search-form button) {
  background-color: var(--secondary);
  color: var(--button-secondary-text-color, #fff);
}

/* ===== Cards & Blocks ===== */
.resource,
.field,
fieldset {
  box-shadow: var(--card-shadow);
  border-radius: var(--border-radius);
  padding: 1rem;
  background-color: var(--background-alt);
  margin-bottom: var(--content-spacing);
}

/* ===== Card Grid Containers ===== */
.featured-cards .cards-grid-container {
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}
.realm-cards .cards-grid-container {
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.meta-cards .cards-grid-container {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.cards-grid-container {
  display: grid;
  gap: var(--grid-gap, 1.5rem);
  margin-bottom: var(--content-spacing, 2rem);
}


/* ===== Base Card ===== */
.card {
  background-color: var(--background-card-light);
  border-radius: var(--border-radius);
  transition: all 0.3s ease;
  border: 1px solid transparent;
  overflow: hidden;
}

/* ===== Start Grid Debug ===== */
/* .card {
    border: 3px solid red !important;
    background: yellow !important;
}

.cards-grid-container {
    border: 3px solid blue !important;
    background: lightblue !important;
}

.card-image {
    border: 2px solid green !important;
} */
/* ===== End Grid Debug ===== */

.card-content {
  padding: 1rem;
}

.card-title {
  font-family: var(--font-headings);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 0.5rem;
}

.card-text {
  font-size: 1rem;
  color: var(--text-color);
  line-height: 1.4;
}

.card-link {
  font-weight: 600;
  color: var(--link-color, var(--primary));
  text-decoration: none;
  display: inline-block;
  margin-top: 0.75rem;
  transition: color 0.2s ease;
}

.card-link:hover {
  text-decoration: underline;
  color: var(--link-hover-color, var(--primary-dark));
}

.card-image {
width: 100%;
object-fit: cover;
display: block;
}

.card:visited {
    color: inherit;
    text-decoration: none;
    outline: none;
    border: none;
    box-shadow: none;
}

/* ===== Featured Card ===== */
.featured-card {
    max-width: 450px;
    height: 500px;
    margin: 0 auto;
    width: 100%;
    display: block; /* Change back to block */
    overflow: hidden;
    position: relative;
}

.featured-card .card-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.featured-card .card-content {
    height: 220px; /* Fixed height for content area */
    padding: 2rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.featured-card .card-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    height: auto;
}

.featured-card .card-text {
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    font-size: 1.1rem;
}

.featured-card:hover {
    transform: scale(1.02);
    background-color: var(--featured-hover-bg, var(--primary));
    border: 20px solid var(--featured-hover-border, var(--primary));
    color: var(--text-on-primary, #fff);
}

.featured-card:hover .card-title,
.featured-card:hover .card-text,
.featured-card:hover .card-link {
    color: var(--text-on-primary, #fff);
    text-decoration: underline;
}

/* ===== Realm Card (Medium) ===== */
.realm-card {
max-width: 320px;
height: 360px;
margin: 0 auto;
width: 100%;
display: block;
overflow: hidden;
position: relative;
}

.realm-card .card-image {
width: 100%;
height: 200px;
object-fit: cover;
display: block;
}

.realm-card .card-content {
height: 160px;
padding: 1.5rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
}

.realm-card .card-title {
font-size: 1.4rem;
margin-bottom: 0.5rem;
height: auto;
}

.realm-card .card-text {
flex: 1;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
line-height: 1.4;
font-size: 1rem;
}

.realm-card:hover {
transform: scale(1.02);
background-color: var(--realm-hover-bg, var(--primary));
border: 15px solid var(--realm-hover-border, var(--border-color));
}

.realm-card:hover .card-link {
text-decoration: underline;
}

/* ===== Meta Card (Smallest - ~1/3 of Featured) ===== */

/* --- background color for this grid section ---*/
.meta-cards {
    background-color: var(--meta-grid-bg);
    padding: 2rem;
    border-radius: var(--border-radius, 8px);
    margin-bottom: var(--content-spacing, 2rem);
}

.meta-card {
background-color:#fff ;
max-width: 240px;
height: 280px;
margin: 0 auto;
width: 100%;
display: block;
overflow: hidden;
position: relative;
}

.meta-card .card-image {
width: 100%;
height: 140px;
object-fit: contain; /* Shows full logo */
object-position: center;
padding: 0.5rem;
box-sizing: border-box;
}

.meta-card .card-content {
height: 140px;
padding: 1rem;
box-sizing: border-box;
display: flex;
flex-direction: column;
}

.meta-card .card-title {
font-size: 1.1rem;
margin-bottom: 0.5rem;
height: auto;
}

.meta-card .card-text {
flex: 1;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
line-height: 1.4;
font-size: 0.9rem;
}

.meta-card:hover {
transform: scale(1.02);
background-color: var(--meta-hover-bg);
border: 15px solid var(--meta-hover-border);
}

.meta-card:hover .card-link {
text-decoration: underline;
}

/* ===== Card Sizing ===== */
.featured-card .card-title { font-size: 1.5rem; }
.realm-card .card-title { font-size: 1.25rem; }
.meta-card .card-title { font-size: 1.1rem; }

.featured-card .card-content { padding: 1.5rem; }
.realm-card .card-content { padding: 1.25rem; }
.meta-card .card-content { padding: 1rem; }

/* ===== Digital Home Layout ===== */
.digital-home-container {
  position: relative;
  min-height: 100vh;
}

/* Full-width background sections that break out of container */
.background-slice {
  height: 160px;
  position: relative;
  z-index: 1;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

.content-section {
  position: relative;
  z-index: 2;
  padding: 60px 0;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
}

/* Responsive background slice heights */
@media (min-width: 769px) {
  .background-slice {
    height: 200px;
  }
}

@media (min-width: 1200px) {
  .background-slice {
    height: 300px;
  }
}

/* ===== Digital Home Section Backgrounds ===== */
/* Progressive background colors using CSS variables for consistency */
.featured-section {
  background-color: var(--background-featured-section, #f8f8f8);
}

.gateways-section {
  background-color: var(--background-gateways-section, #f0f0f0);
}

.meta-section {
  background-color: var(--background-meta-section, #e8e8e8);
}

/* ===== Digital Home Section Headers ===== */
.section-header .section-title {
  position: relative;
}

.section-divider {
  margin: 1rem 0 2rem;
  border: none;
  height: 2px;
  background: var(--primary, #333);
  border-radius: var(--border-radius, 4px);
}


/* Action Cards Container */
.action-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: var(--content-spacing);
  background-color: var(--background-alt);
  padding: 1.5rem;
  border-radius: var(--border-radius);
}

/* Individual Action Card */
.action-card {
  background-color: var(--background-body);
  color: var(--text-color);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.3s ease;
  border-radius: var(--border-radius);
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.action-card:hover {
  transform: scale(1.05);
  border: 1px solid var(--small-card-border, var(--border-color));
}

.action-card-icon {
  color: var(--secondary);
  font-size: 2rem;
  margin-bottom: 1rem;
}

.action-card-title {
  font-family: var(--font-headings);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Apply card styles to Omeka resource structures */
/* These classes can be added to resource-list and resource-grid items */
.resource-list .resource.card-featured,
.resource-grid .resource.card-featured {
  background-color: var(--background-body);
}

.resource-list .resource.card-medium,
.resource-grid .resource.card-medium {
  background-color: var(--background-body);
}

.resource-list .resource.card-small,
.resource-grid .resource.card-small {
  background-color: var(--background-alt);
}

/* Integration with existing Freedom classes */
/* For item showcase block */
.item-showcase .resource.item.card-featured,
.item-showcase .resource.item.card-medium,
.item-showcase .resource.item.card-small {
  transition: all 0.3s ease;
  overflow: hidden;
}

.item-showcase .resource.item.card-featured::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, transparent 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.item-showcase .resource.item.card-featured:hover::before {
  opacity: 0.7;
  background: linear-gradient(135deg, 
    var(--featured-hover-gradient-1, var(--secondary)) 0%, 
    var(--featured-hover-gradient-2, var(--highlight-color)) 50%, 
    var(--featured-hover-gradient-3, var(--accent-1)) 100%);
}

.item-showcase .resource.item.card-medium:hover {
  transform: scale(1.02);
  border: 1px solid var(--medium-card-border, var(--border-color));
  box-shadow: 0 4px 12px var(--shadow-color);
}

.item-showcase .resource.item.card-small {
  background-color: var(--background-alt);
}

.item-showcase .resource.item.card-small:hover {
  transform: scale(1.02);
  border: 1px solid var(--small-card-border, var(--border-color));
  box-shadow: 0 4px 12px var(--shadow-color);
}

/* Ensure card content stays visible on hover */
.card-featured .resource__content,
.card-featured .item-showcase__content,
.card-featured .card-content {
  position: relative;
  z-index: 1;
}

/* Media Queries for responsive design */
@media (max-width: 768px) {
  .action-cards {
    flex-direction: column;
  }
  
  .action-card {
    width: 100%;
  }
}

/* ===== Metadata ===== */
dl.property dt {
  color: var(--heading-color);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.property dd .value-content {
  color: var(--text-color);
}

.property {
  margin-bottom: var(--content-spacing);
}

/* ===== Horizontal Rules ===== */
hr.alignfull {
  background-color: var(--border-color);
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2rem 0;
}

hr {
  border: none;
  border-bottom: 1px solid var(--border-color);
  margin: 2rem 0;
}

/* ===== Form Styling Enhancements ===== */
input[type="text"],
input[type="email"],
input[type="search"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.5rem;
  font-size: 1rem;
  background-color: white;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 4px rgba(116, 22, 12, 0.2);
  outline: none;
}

/* ===== Footer Enhancements ===== */
.main-footer__top {
  background-color: var(--background-footer-top);
  padding-top: var(--footer-top-padding-top);
  padding-bottom: var(--footer-top-padding-bottom);
}

.main-footer__bottom {
  background-color: var(--background-footer-bottom);
  padding-top: var(--footer-bottom-padding);
  padding-bottom: var(--footer-bottom-padding);
}

.main-footer__copyright {
  font-size: var(--font-size-small);
  text-align: center;
}

.main-footer hr.alignfull {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0;
}

/* Footer text color enhancements */

/* Footer Top - Column 1 (Logo and Site Info) */
.main-footer__top .main-footer__col1 .footer_site_info {
  color: var(--background-footer-top-text-color);
}

.main-footer__top .main-footer__col1 .footer_site_info h1,
.main-footer__top .main-footer__col1 .footer_site_info h2,
.main-footer__top .main-footer__col1 .footer_site_info h3,
.main-footer__top .main-footer__col1 .footer_site_info h4,
.main-footer__top .main-footer__col1 .footer_site_info h5,
.main-footer__top .main-footer__col1 .footer_site_info h6 {
  color: var(--background-footer-top-text-color);
}

.main-footer__top .main-footer__col1 .footer_site_info p {
  color: var(--background-footer-top-text-color);
}

/* Footer Top - Column 2 (Menu) */
.main-footer__top .main-footer__col2 a {
  color: var(--background-footer-top-text-color);
}

.main-footer__top .main-footer__col2 a:hover {
  color: var(--interactive-on-accent-1);
}

/* Footer Top - Column 3 (Custom Content) */
.main-footer__top .main-footer__col3 {
  color: var(--background-footer-top-text-color);
}

.main-footer__top .main-footer__col3 h1,
.main-footer__top .main-footer__col3 h2,
.main-footer__top .main-footer__col3 h3,
.main-footer__top .main-footer__col3 h4,
.main-footer__top .main-footer__col3 h5,
.main-footer__top .main-footer__col3 h6 {
  color: var(--background-footer-top-text-color);
}

.main-footer__top .main-footer__col3 p {
  color: var(--background-footer-top-text-color);
}

/* Footer Bottom */
.main-footer__bottom {
  color: var(--background-footer-bottom-text-color);
}

/* Social Networks */
.main-footer__bottom .main-footer__social-network a {
  color: var(--background-footer-bottom-text-color);
}

.main-footer__bottom .main-footer__social-network img {
  /* Ensure icons are visible against dark backgrounds */
  filter: brightness(0) invert(1);
}

/* Copyright Text */
.main-footer__bottom .main-footer__copyright {
  color: var(--background-footer-bottom-text-color);
}

/* ===== Blockquotes ===== */
blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  color: #555;
}

/* ===== Mobile Menu ===== */
.menu-drawer {
  background-color: var(--primary-dark);
}

.menu-drawer a {
  color: var(--text-on-primary-dark);
}

.menu-drawer a:hover {
  color: var(--interactive-on-primary-dark);
  /* Add subtle background for better visibility */
  background-color: rgba(255, 255, 255, 0.1);
}

/* ===== Visually hidden, e.g. site name for SEO (see header.phmtl) ===== */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ===== set logo size ===== */
@media (min-width: 1024px) {
  .main-header__site-title img {
    height: 100px;
    width: auto;
    max-height: none; /*  override Freedom constraint */
    max-width: none; /*  override Freedom constraint */
  }
}
