/* =============================================================================
   STYLE.CSS - Modern, Minimalist, Professional Redesign
   ========================================================================== */

/* -----------------------------------------------------------------------------
   1. FONT IMPORT, VARIABLES & GLOBAL RESET
   -------------------------------------------------------------------------- */

/* Google Fonts import removed: Open Sans is self-hosted (fonts.css). */

:root {
    --c-primary-dark: #02532a;
    --c-primary-light: #078847;
    --c-primary-hover: #056a38;
    --c-text: #2b2a29;
    --c-text-light: #555;
    --c-background: #f0f2f5;
    --c-surface: #ffffff;
    --c-border: #dee2e6;
    --c-border-light: #e9ecef;
    --font-primary: 'Open Sans', sans-serif;
    --radius: 4px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Basic Reset */
html, body, div, span, p, blockquote, pre, code, ul, ol, li, h1, h2, h3, h4, h5, h6,
form, fieldset, legend, label, input, textarea, table, caption, tbody, tfoot, thead, tr, th, td {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* -----------------------------------------------------------------------------
   2. BASE TYPOGRAPHY & GLOBAL STYLES
   -------------------------------------------------------------------------- */

body {
  background-color: var(--c-background);
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--c-primary-dark);
  margin-bottom: 0.5em;
}

h1 { font-size: 2.2em; }
h2 { font-size: 1.8em; }
h3 { font-size: 1.4em; }

p {
  margin-bottom: 1em;
  color: var(--c-text-light);
}

a {
  color: var(--c-primary-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

ul, ol {
  padding-left: 20px;
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
  border-radius: 4px;
}

hr {
  border: 0;
  border-top: 1px solid var(--c-border);
  margin: 2em 0;
}

/* -----------------------------------------------------------------------------
   3. LAYOUT & MAIN REGIONS
   -------------------------------------------------------------------------- */

#page {
  max-width: 1200px;
  margin: 2em auto;
  background-color: var(--c-background); /* Use the grey background as the base */
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden; /* Contains floats and rounded corners */
}

#header {
  background-color: var(--c-primary-dark);
  color: white;
  padding: 1.5em;
  position: relative; /* Needed for absolute positioning of children */
  min-height: 140px; /* Ensure enough space for positioned elements */
}

#header-first {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 1em;
}

#header-first #logo {
  float: none;
  margin-right: 1em;
}

#header-first h1 {
  color: white;
  font-size: 2.75em;
  margin-top: 0.2em; /* Space below slogan */
  margin-bottom: 0em;
}

#header-first h1 a {
  color: white;
  text-decoration: none;
}

#header-first #slogan {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.5em;
  margin: 0;
  margin-top: 0.4em; 
}

#main-wrapper {
  display: flex;
  flex-wrap: wrap;
  background-color: var(--c-background);
  padding: 1.5em 0; /* Add padding around the cards */
  gap: 1.5em; /* Add space between cards */
}

#sidebar-first {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 1.5em; /* This will space out the new cards */
  /* Remove card styles from the container itself */
  background-color: transparent;
  padding: 0;
  box-shadow: none;
}

#content-wrapper {
  /* margin-top is no longer needed */
  flex: 1;
  min-width: 0; /* Prevents content from overflowing flex container */
}

/* Card style for main content area */
#content-wrapper {
    background-color: var(--c-surface);
    padding: 2.5em;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#content-wrapper h1.title {
    border-bottom: 2px solid var(--c-primary-light);
    padding-bottom: 0.25em;
    margin-bottom: 1em !important;
}

#content-content table {
  border: none !important;
}

/* Preface (3 cards) */
#preface-wrapper {
  display: flex;
  justify-content: space-between; /* Pushes first/last cards to the edges */
  background-color: var(--c-background);
  padding: 1.5em 0 0 0; /* Remove side padding */
  margin: 0;
  width: 100%;
}

#preface-wrapper .column {
  flex-basis: calc(33.333% - 1em); /* Creates space between cards */
  background-color: var(--c-surface);
  padding: 2.5em;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#preface-wrapper h2.title {
  border-bottom: 2px solid var(--c-primary-light);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}

/* Style preface cards with image on top */
#preface-wrapper .column tr {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center image horizontally */
}

#preface-wrapper .column td {
    width: auto !important; /* Override inline width attribute */
    padding: 0;
}

#preface-wrapper .column td:first-child {
    margin-bottom: 1em;
}

#preface-wrapper .column td:first-child img {
    padding-right: 0 !important; /* Override inline style */
    display: none;
    max-width: 100%;
    height: auto;
}

/* Improve font in preface cards */
#preface-wrapper .column .content,
#preface-wrapper .column .content a {
    font-size: 15px;
    line-height: 1.7;
    text-align: left; /* Keep text left-aligned */
    color: var(--c-text) !important; /* Darker text, override inline styles */
}

#footer {
  /* Hide the old, redundant footer */
  display: none;
}

#legal-notice {
  display: none;
}

/* Style the postscript section as the new main footer */
#postscript-wrapper {
  display: flex;
  gap: 1.5em;
  background-color: var(--c-background);
  color: var(--c-text-light);
  padding: 2em 1.5em;
  text-align: left;
  font-size: 0.9em;
  border-top: 1px solid var(--c-border);
  /* Force full width inside a flex container */
  flex-basis: 100%;
  margin-top: 2em;
}

#postscript-wrapper .column {
  flex: 1;
}

#postscript-wrapper h2.title {
  font-size: 1.1em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-primary-dark);
  border-bottom: 2px solid var(--c-primary-light);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}

#postscript-wrapper ul {
  list-style: none;
  padding: 0;
}

#postscript-wrapper ul li {
  margin-bottom: 0.5em;
}

#postscript-wrapper a {
  color: var(--c-text-light);
}

#postscript-wrapper a:hover {
  color: var(--c-primary-light);
}

/* -----------------------------------------------------------------------------
   4. COMPONENTS (Blocks, Menus, Nodes, Forms)
   -------------------------------------------------------------------------- */

/* Blocks in Sidebar */
#sidebar-first .block-wrapper {
  background-color: var(--c-surface);
  padding: 1.5em;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Hide legacy rounded corner wrappers and their spacing elements */
#sidebar-first .rounded-block,
#sidebar-first .rounded-outside,
#sidebar-first .rounded-inside {
    padding: 0;
    background: none;
    border: none;
}

#sidebar-first .rounded-block-top-left,
#sidebar-first .rounded-block-top-right,
#sidebar-first .rounded-block-bottom-left,
#sidebar-first .rounded-block-bottom-right,
#sidebar-first p.rounded-topspace,
#sidebar-first p.rounded-bottomspace {
    display: none;
}

#sidebar-first .block {
  margin-bottom: 0; /* Remove margin between sidebar blocks */
}

#sidebar-first h2.title {
  font-size: 1.2em;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 2px solid var(--c-primary-light);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
}

#sidebar-first ul.menu {
  list-style: none;
  padding: 0;
}

#sidebar-first ul.menu li {
  list-style-image: none !important;
  list-style-type: none !important;
  background-image: none !important;
  padding: 0 !important;
  margin-bottom: 0.5em;
}

#sidebar-first ul.menu ul {
  list-style: none;
  padding-left: 1.5em; /* Indent nested menus */
  margin-top: 0.5em;
}

#sidebar-first ul.menu a {
  display: block;
  padding: 0.5em 1em;
  border-radius: var(--radius);
  font-weight: 600;
  color: var(--c-text-light);
}


#sidebar-first ul.menu a.active {
  background-color: var(--c-primary-hover);
  color: white;
  text-decoration: none;
}

#sidebar-first ul.menu a:hover {
  background-color: var(--c-primary-light);
  color: white;
  text-decoration: none;
}

/* Node (Article) Styles */
.node h1.title {
  padding-bottom: 0.5em;
  margin-top: 1em;
  border-bottom: 2px solid var(--c-primary-light);
}

.node h2.title {
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 0.5em;
  margin-top: 1em;
  margin-bottom: 1em;
}

.node .submitted {
  font-size: 0.9em;
  color: var(--c-text-light);
  margin-bottom: 1.5em;
}

/* Forms */
input.form-text, textarea.form-textarea, select.form-select {
  width: 100%;
  padding: 0.8em;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background-color: var(--c-background);
  font-family: var(--font-primary);
  font-size: 1em;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input.form-text:focus, textarea.form-textarea:focus, select.form-select:focus {
  border-color: var(--c-primary-light);
  box-shadow: 0 0 0 3px rgba(7, 136, 71, 0.1);
  outline: none;
}

input.form-submit {
  background-color: var(--c-primary-light);
  color: white;
  border: none;
  padding: 0.8em 1.5em;
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s;
}

input.form-submit:hover {
  background-color: var(--c-primary-dark);
}

fieldset {
  border: 1px solid var(--c-border);
  padding: 1.5em;
  border-radius: var(--radius);
  margin-bottom: 1.5em;
}

fieldset legend {
  font-weight: 600;
  color: var(--c-primary-dark);
  padding: 0 0.5em;
}

/* Search Box */
#search-box {
  display: flex;
}
#search-box .form-item {
  margin: 0;
}
#search-box input.form-text {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: none;
}
#search-box input.form-submit {
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* Hide list style in main content menu */
.content ul.menu {
    list-style: none;
    padding: 0;
}

/* -----------------------------------------------------------------------------
   5. RESPONSIVE DESIGN
   -------------------------------------------------------------------------- */

@media (max-width: 992px) {
  #main-wrapper, #postscript-wrapper {
    flex-direction: column;
  }
  #sidebar-first {
    margin-right: 0;
    margin-bottom: 2em;
    flex-basis: auto;
  }
}

@media (max-width: 768px) {
  #page {
    margin: 1em;
  }
  #header {
    padding: 1em;
    min-height: 240px;
  }
  #header-first {
    /* padding-top: 40px; */
    align-items: flex-start;
    text-align: left;
    margin-left: 0.5em;
  }
  #header-first h1 {
  line-height: 1.25;
}
  #header-first #slogan {
    position: static;
    font-size: 1.2em;
    margin-top: 0.5em;
    margin-bottom: 0.25em;
  }
  #header-middle {
    position: absolute !important;
    top: 1em !important;
    right: 1em !important;
  }
  #header-bottom {
    position: absolute !important;
    bottom: 1em !important;
    left: 1em !important;
    right: 1em !important;
    top: auto !important;
  }
  #primary-menu ul.menu {
    justify-content: end !important;
    flex-wrap: wrap;
    gap: 0.5em;
  }
  #preface-wrapper {
    flex-direction: column;
  }
  #preface-wrapper .column {
    margin-bottom: 1em;
  }
  #main-wrapper {
    flex-direction: column;
  }
  #content-wrapper {
    order: 1;
  }
  #sidebar-first {
    order: 2;
  }
  
}

/* 6. CUSTOM HEADER & MENU STYLES */

/* Global Menu Reset */
#primary-menu ul.menu,
#header-middle .block ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Header Alignment */
#header-wrapper {
    /* This is no longer a flex container */
}

#header-first {
    /* flex-grow is no longer needed */
}

#header-middle {
    position: absolute;
    top: 85px;
    right: 1.5em;
}

/* Language Switcher Buttons */
#header-middle .block ul {
    display: flex;
    justify-content: flex-end;
    gap: 0.5em;
}

#header-middle .block a.language-link {
    display: flex;
    align-items: center;
    padding: 0.2em 0.7em;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    transition: background-color 0.2s;
    height: 38px; /* Ensure consistent height */
    box-sizing: border-box; /* Include padding in height calculation */
}

#header-middle .block a.language-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    text-decoration: none;
}

#header-middle .block img.language-icon {
    width: 25px; /* Increased size */
    height: 15px;
    border-radius: 2px !important;
}

/* Primary Menu Buttons */
#header-bottom {
    position: absolute;
    top: 1.5em; /* Position below the language buttons */
    right: 1.5em;
    padding: 0.5em 0;
}

#primary-menu ul.menu {
    display: flex;
    justify-content: flex-end; /* Align to the right */
    gap: 1em;
}

#primary-menu ul.menu > li {
    list-style: none !important;
    list-style-type: none !important;
    background: none !important;
    padding: 0 !important;
}

#primary-menu a {
    display: block;
    padding: 0.6em 1.4em; /* Smaller buttons */
    background-color: var(--c-primary-light);
    color: white;
    font-weight: 700;
    font-size: 1em; /* Smaller text */
    text-transform: uppercase;
    border-radius: var(--radius);
    transition: background-color 0.2s;
    text-decoration: none;
}

#primary-menu a:hover {
    background-color: var(--c-primary-hover); /* Darker green for hover, distinct from header */
    color: white;
    text-decoration: none;
}

/* Hide second-level menu items in the header */
#primary-menu ul ul {
    list-style: none;
    display: none !important;
}

/* 7. ANIMATIONS */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Apply animation to main elements */
#preface-wrapper .column,
#main-wrapper {
  animation: fadeIn 0.3s ease-out forwards;
  opacity: 0; /* Start hidden */
}

/* Staggered delay for preface cards and main content */
#header {
  animation-delay: 0.05s;
}
#preface-wrapper .column:nth-child(1) {
  animation-delay: 0.1s;
}
#preface-wrapper .column:nth-child(2) {
  animation-delay: 0.15s;
}
#preface-wrapper .column:nth-child(3) {
  animation-delay: 0.2s;
}
#main-wrapper {
  animation-delay: 0.25s;
}
