/* Page-level layout for the Candijay LGU site.
   Component look lives with the components; this file holds the container,
   the section rhythm, the grids, and the optional polish layer that the
   Display menu switches on and off. */

body { margin: 0; }

.lgu-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--gutter-desktop);
  padding-right: var(--gutter-desktop);
}
.lgu-section { padding-top: var(--section-gap); padding-bottom: var(--section-gap); }
.lgu-h2 { font-size: var(--text-headline-lg); font-weight: var(--weight-bold); margin: 0 0 var(--space-2); }
.lgu-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--text-label); font-weight: 800; text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow); color: var(--color-primary); margin: 0 0 var(--space-3);
}
.lgu-eyebrow::before { content: ''; width: 28px; height: 2px; background: currentColor; display: inline-block; }
.lgu-lead { font-size: var(--text-body-lg); color: var(--text-muted); margin: 0; max-width: 70ch; }

.lgu-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.lgu-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.lgu-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

/* Card hover lift, from the Card component. */
.lgu-card--interactive:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--outline-strong);
  transform: translateY(-2px);
}
.lgu-card--interactive:focus-within { box-shadow: var(--shadow-card-hover); }

/* Every control and compact link has a 44 px hit area. The focus rule is
   repeated here because the generated site imports this file after its base
   tokens. */
button, .ft-links a, .lgu-util-links a, .barangay-back, .register-row a {
  min-height: 44px;
}
.ft-links a, .lgu-util-links a, .barangay-back, .register-row a {
  display: inline-flex;
  align-items: center;
}
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus-ring);
  outline-offset: var(--focus-ring-offset);
}
.table-scroll { margin-top: var(--space-5); overflow-x: auto; }
.table-scroll:focus-visible { outline: var(--focus-ring-width) solid var(--color-focus-ring); outline-offset: var(--focus-ring-offset); }
.table-scroll-cue { margin: 0 0 var(--space-2); font-size: var(--text-label); color: var(--text-muted); }

/* Component styles use inline colors, so keep every button readable when
   the high-contrast setting is active. */
[data-theme="high-contrast"] button {
  background: #000 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}

/* Hero quick actions */
.hero-tasks { display: grid; grid-template-columns: repeat(4, 1fr); }

/* Citizen's Charter teaser banner */
.lgu-charter-teaser { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-6); align-items: center; }
.charter-category-grid--desktop { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-3); margin-top: var(--space-6); }
.charter-category-grid--mobile { display: none; }
.charter-category-panel { margin-top: var(--space-4); background: var(--surface-white); border: var(--border-hairline); border-radius: var(--radius-md); overflow: hidden; }
.charter-category-panel--closed { display: none; }
.charter-category-heading { margin: 0; color: inherit; font: inherit; }

/* Start a Business stepper */
.biz-stepper { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; }
.biz-stepper > li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.biz-stepper .biz-line { position: absolute; top: 19px; right: 50%; width: 100%; height: 3px; background: var(--outline-strong); z-index: 0; }

/* Governance accordions */
#legal details[open] .lgu-acc-chev { transform: rotate(180deg); }
#legal summary::-webkit-details-marker { display: none; }

@media (max-width: 1000px) {
  .lgu-grid-3, .lgu-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 880px) {
  .lgu-container { padding-left: var(--gutter-mobile); padding-right: var(--gutter-mobile); }
  .lgu-section { padding-top: var(--space-8); padding-bottom: var(--space-8); }
  .lgu-grid-2 { grid-template-columns: 1fr; }
  .lgu-charter-teaser { grid-template-columns: 1fr; }
  .lgu-teaser-glyph { display: none; }
  .hero-tasks { grid-template-columns: 1fr 1fr; }
  .hero-tasks > a:nth-child(odd) { border-left: none; }
  .hero-tasks > a:nth-child(n+3) { border-top: var(--border-hairline); }
}
@media (max-width: 760px) {
  .biz-stepper { flex-direction: column; gap: 14px; }
  .biz-stepper > li { flex-direction: row; align-items: flex-start; text-align: left; gap: 12px; }
  .biz-stepper .biz-line { display: none; }
}
@media (max-width: 560px) {
  .lgu-grid-3, .lgu-grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .table-scroll table { min-width: 620px; }
}

/* Source register and barangay profiles. The role column moves below its
   label on a phone so a long official name keeps its full width. */
.barangay-profile { max-width: 980px; }
.barangay-back { display: inline-block; margin-bottom: var(--space-5); font-weight: 700; }
.barangay-profile-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-7); }
.barangay-facts-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-7); }
.barangay-roles { margin: var(--space-4) 0; }
.barangay-role { display: grid; grid-template-columns: minmax(155px, 220px) minmax(0, 1fr); gap: var(--space-2) var(--space-5); padding: var(--space-3) 0; border-top: var(--border-hairline); }
.barangay-role dt { color: var(--text-muted); font-weight: 700; font-size: var(--text-label); }
.barangay-role dd { margin: 0; overflow-wrap: anywhere; }
.barangay-pending { padding: var(--space-4); background: var(--surface-card); border-left: 4px solid var(--color-secondary); }
.barangay-source { color: var(--text-muted); font-size: var(--text-label); }
.register-list { display: grid; gap: var(--space-3); margin-top: var(--space-6); }
.register-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: var(--space-3) var(--space-5); padding: var(--space-4); background: var(--surface-white); border: var(--border-hairline); border-radius: var(--radius-md); }
.register-row .data-mono { margin-top: 4px; font-size: var(--text-fine); color: var(--text-muted); overflow-wrap: anywhere; }
.register-row dl { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-3); margin: 0; }
.register-row dt { color: var(--text-muted); font-size: var(--text-fine); font-weight: 700; text-transform: uppercase; }
.register-row dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: var(--text-label); }
.register-issue { grid-column: 1 / -1; margin: 0; color: var(--text-muted); font-size: var(--text-label); }
@media (max-width: 480px) {
  .barangay-profile-heading { display: block; }
  .barangay-profile-heading > :last-child { margin-top: var(--space-3); }
  .barangay-role { grid-template-columns: 1fr; gap: 4px; }
  .register-row dl { grid-template-columns: 1fr; gap: var(--space-2); }
}
@media (max-width: 520px) {
  .hero-tasks { grid-template-columns: 1fr; }
  .hero-tasks > a { border-left: none; border-top: var(--border-hairline); }
}

/* Polish layer, switched from the Display menu. */

/* Editorial type: a touch bigger and tighter, not oversized. */
.polish-editorial #hero-title { font-size: clamp(2.5rem, 4.4vw, 3.5rem); letter-spacing: -0.022em; line-height: 1.05; }
.polish-editorial .lgu-h2 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); letter-spacing: -0.014em; line-height: 1.1; }
.polish-editorial .lgu-lead { font-size: clamp(1.0625rem, 1.3vw, 1.2rem); }

/* Duotone photos: brand-tinted. */
.polish-duotone .site-photo { filter: grayscale(1) sepia(0.42) hue-rotate(72deg) saturate(1.55) contrast(1.06) brightness(0.97); }
.image-fallback { border: 2px solid var(--outline-strong); }
.image-fallback-alt { position: absolute; left: var(--space-3); bottom: var(--space-3); max-width: calc(100% - 2 * var(--space-3)); padding: 6px 10px; border: 1px solid rgba(255,255,255,.8); background: rgba(0,0,0,.55); color: #fff; font-size: var(--text-label); font-weight: 700; }
.search-page { max-width: 900px; }
.search-form { margin: var(--space-5) 0; }
.search-form label { display: block; margin-bottom: var(--space-2); font-weight: 700; }
.search-form > div { display: flex; gap: var(--space-2); }
.search-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0.625rem 0.75rem; color: var(--text-on-surface); border: var(--border-hairline); border-radius: var(--radius-sm); font: inherit; }
.search-form button { min-height: 44px; padding: 0.625rem 1.25rem; color: #fff; background: var(--color-primary); border: 1px solid var(--color-primary); border-radius: var(--radius-sm); font: inherit; font-weight: 700; cursor: pointer; }
.search-empty, .search-group { margin-top: var(--space-6); padding: var(--space-5); background: var(--surface-white); border: var(--border-hairline); border-radius: var(--radius-md); }
.search-group h2 { margin-top: 0; font-size: var(--text-body-lg); }
.search-group ol { display: grid; gap: var(--space-4); margin: 0; padding-left: 1.25rem; }
.search-group p { margin: var(--space-1) 0; }
.search-group span { color: var(--text-muted); font-size: var(--text-label); }
.offline-page { max-width: 680px; margin: 12vh auto; padding: var(--space-6); color: var(--text-on-surface); }
@media (max-width: 480px) { .search-form > div { flex-direction: column; } .search-form button { width: 100%; } }

/* Terrace texture: faint contour lines on neutral sections only. Colored
   sections set an inline background, which overrides this. */
.polish-terrace .lgu-section {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='96'%3E%3Cg fill='none' stroke='%2300450d' stroke-opacity='0.05' stroke-width='1.4'%3E%3Cpath d='M0 14 C40 3 78 25 150 12'/%3E%3Cpath d='M0 36 C44 24 84 46 150 33'/%3E%3Cpath d='M0 58 C38 46 80 68 150 55'/%3E%3Cpath d='M0 80 C48 68 88 90 150 77'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 150px 96px;
}

/* Scroll reveals for below-fold sections; honors reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .polish-motion #main > section:not(#home) {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  .polish-motion #main > section.is-in:not(#home) { opacity: 1; transform: none; }
}

/* Sticky header refinement: a subtle shadow once the page scrolls. */
header.lgu-scrolled { box-shadow: 0 4px 20px rgba(0, 49, 10, 0.08); }

/* Utility bar on phones (JC, 16 Sep 2026): the public-domain sentence and the
   clock crowd the row, so below 720 px the bar keeps the flag, the Republic
   label and the GOV.PH and Official Gazette links only. */
@media (max-width: 720px) {
  .lgu-util-note, .lgu-util-time { display: none; }
  .lgu-util-links { border-left: 0; padding-left: 0; }
  .charter-category-grid--desktop { display: none; }
  .charter-category-grid--mobile { display: grid; gap: var(--space-3); margin-top: var(--space-6); }
  .charter-category-panel { display: none; }
  .charter-category-panel--search { display: block; }
  .charter-category-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: var(--space-4); text-align: left; font-family: var(--font-sans); color: var(--text-on-surface); background: var(--surface-white); border: var(--border-hairline); border-radius: var(--radius-md); cursor: pointer; }
  .charter-category-card.is-expanded { color: #fff; background: var(--color-primary); border-color: var(--color-primary); border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .charter-category-icon { width: 44px; height: 44px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; color: var(--color-primary); background: var(--surface-card); border-radius: var(--radius-sm); }
  .is-expanded .charter-category-icon { color: #fff; background: rgba(255,255,255,.18); }
  .charter-category-count { display: block; margin-top: 3px; color: var(--text-muted); font-size: var(--text-fine); }
  .is-expanded .charter-category-count { color: rgba(255,255,255,.85); }
  .charter-category-chevron { flex: 0 0 auto; transition: transform .12s; }
  .is-expanded .charter-category-chevron { transform: rotate(180deg); }
  .charter-category-mobile-panel { background: var(--surface-white); border: var(--border-hairline); border-top: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); overflow: hidden; }
  .charter-category-mobile-panel > .charter-category-heading { display: block; padding: 12px var(--space-5); color: var(--text-muted); background: var(--surface-card); border-bottom: var(--border-hairline); font-size: var(--text-label); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); }
}

/* Footer columns (16 Sep): three columns on desktop, two on tablets with the
   government links spanning the row, one column on phones. Lists never share
   a row with a wrapped neighbour; each link sits on its own line. */
.ft-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-6); }
.ft-col { min-width: 0; }
.ft-heading { color: #fff; font-size: var(--text-label); text-transform: uppercase; letter-spacing: var(--tracking-eyebrow); margin: 0 0 12px; }
.ft-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px 24px; }
.ft-links a { color: var(--inverse-fg-muted); }
.ft-links a:hover, .ft-links a:focus-visible { color: #fff; }
.ft-links-portal { grid-template-columns: 1fr; }
.ft-links-gov { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 880px) {
  .ft-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ft-gov { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .ft-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); }
  .ft-links-portal { display: flex; flex-wrap: wrap; gap: 8px 20px; }
  .ft-links-gov { grid-template-columns: 1fr; }
}
