/* /web/themes/custom/substack_inspired/css/style.css */

/* --- VARIABLE DEFINITIONS --- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --text-color: #222222;
  --text-color-light: #666666;
  --accent-color: #007bff; /* A nice blue for the subscribe button */
  --accent-color-hover: #0056b3;
  --background-color: #FFFFFF;
  --border-color: #E5E5E5;
  --max-site-width: 1100px;
}

/* --- GENERAL BODY & TYPOGRAPHY --- */
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--background-color);
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

a {
  color: var(--text-color);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-site-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

/* --- HEADER REGIONS --- */
/* REVISED: Target the inner div that Drupal creates */
.region-header-top > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Allow items to wrap on smaller screens */
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

/* REVISED: Target the branding block specifically */
#block-substack-inspired-site-branding {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0; /* Prevent branding from shrinking */
}
#block-substack-inspired-site-branding a {
  text-decoration: none;
}
#block-substack-inspired-site-branding img {
  max-height: 35px; /* Control logo size */
  width: auto;
}

/* REVISED: Push all items after the branding to the right */
#block-substack-inspired-site-branding + * {
    margin-left: auto;
}

/* REVISED: Style all blocks in the right-hand group */
#block-substack-inspired-account-menu,
.search-block-form,
#block-substack-inspired-syndicate {
    margin-left: 1.5rem;
    position: relative; /* NEW: Create a stacking context for contextual links */
}

/* REVISED: Target the user menu block more specifically */
#block-substack-inspired-account-menu ul {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
#block-substack-inspired-account-menu a {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap; /* Prevent "My account" from wrapping */
}

/* NEW: Style the search form */
.search-block-form .form-item {
  margin: 0; /* Remove default margins */
}
.search-block-form .form-search {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}
.search-block-form .form-submit {
  display: none; /* Hide the "Search" button for a cleaner look */
}


.region-primary-menu {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}
.region-primary-menu ul.menu {
  display: flex;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}
.region-primary-menu a {
  font-weight: 500;
  color: var(--text-color-light);
}
.region-primary-menu a:hover {
  color: var(--text-color);
  text-decoration: none;
}

/* --- MAIN LAYOUT & REGIONS --- */
.layout-main-wrapper {
  display: grid;
  grid-template-columns: 1fr; /* Default to single column */
  gap: 3rem;
  padding: 2rem 0;
}

/* Two-column layout for wider screens */
@media (min-width: 992px) {
  .layout-main-wrapper {
    grid-template-columns: 2fr 1fr;
  }
}

/* --- CONTENT STYLING (ARTICLE TEASERS) --- */
/* This styling targets the default Article teaser display */
.node--view-mode-teaser {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
}
.node--view-mode-teaser .node__content {
  flex-grow: 1;
}
.node--view-mode-teaser h2 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem 0;
}
.node--view-mode-teaser .node__meta,
.node--view-mode-full .node__meta { /* Also target full nodes */
  font-size: 0.85rem;
  color: var(--text-color-light);
  margin-bottom: 1rem;
  text-transform: uppercase; 
  letter-spacing: 0.05em; 
}
.node--view-mode-teaser .field--name-field-image {
  flex-shrink: 0;
  width: 150px;
}
.node--view-mode-teaser img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Featured article in the top region */
.region-content-top .node--view-mode-full {
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 2rem;
  margin-bottom: 2rem;
}
.region-content-top .node--view-mode-full h1 {
  font-size: 2.25rem;
}

/* --- SIDEBAR SUBSCRIBE BOX --- */
.region-sidebar .block {
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 5px;
}
.region-sidebar h2 {
  font-size: 1.1rem;
  margin-top: 0;
}
.region-sidebar input[type="email"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  box-sizing: border-box; /* Important for consistent sizing */
}
.region-sidebar input[type="submit"] {
  width: 100%;
  background-color: var(--accent-color);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
}
.region-sidebar input[type="submit"]:hover {
  background-color: var(--accent-color-hover);
}


/* --- FOOTER --- */
.region-footer {
  margin-top: 2rem;
  padding: 2rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-color-light);
  border-top: 1px solid var(--border-color);
}

/* --- FOOTER MENU --- */
.region-footer .menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap; /* Allows menu to wrap on smaller screens */
  gap: 1.5rem;
}
.region-footer .menu a {
  color: var(--text-color-light);
}
.region-footer .menu a:hover {
  color: var(--text-color);
}


/* --- TABS & CONTEXTUAL LINKS --- */
/* This new block styles the View/Edit/Delete tabs. */
.tabs--primary {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  border-bottom: 1px solid var(--border-color);
}

.tabs__tab {
  margin: 0;
}

.tabs__tab a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: var(--text-color-light);
  font-weight: 600;
  border: 1px solid transparent;
  border-bottom: none;
  position: relative;
  top: 1px;
}

.tabs__tab a:hover {
  background-color: #f5f5f5;
  border-color: var(--border-color);
  text-decoration: none;
  border-radius: 4px 4px 0 0;
}

.tabs__tab.is-active a {
  background-color: var(--background-color);
  border-color: var(--border-color);
  color: var(--text-color);
  border-bottom: 1px solid var(--background-color);
  border-radius: 4px 4px 0 0;
}

/* NEW: Fix for contextual links overlay */
.contextual .contextual-links {
    z-index: 1000;
}
