/* -----------------------------------------------------------------------------
 * 20-templates.css — the non-homepage template layer.
 *
 * Styles 404.php, search.php, archive.php, single.php, index.php, page.php and
 * dg-fullwidth.php. Enqueued automatically after style.css by dg_enqueue_scripts().
 *
 * Findings: DGA-102, DGA-106, DGA-158, DGA-160, DGA-167.
 *
 * Everything is namespaced .dg-* except the two legacy hooks .page-content and
 * .page-title, which page.php has always emitted and which are kept so nothing
 * relying on them breaks. No rule here is global: the front page, the header and
 * the footer are untouched.
 * -------------------------------------------------------------------------- */

:root {
  --dg-green:        #2f8d46;
  --dg-green-bright: #4caf50;
  --dg-green-deep:   #1e3a1e;
  --dg-green-mist:   #f8fdf7;
  --dg-green-line:   #d0e6d0;
  --dg-ink:          #2b332c;
  --dg-muted:        #5c6b60;
}

/* --- shell -------------------------------------------------------------- */

.dg-main {
  font-family: 'Segoe UI', sans-serif;
  color: var(--dg-ink);
}

.dg-shell {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.dg-shell--wide {
  max-width: 1400px;
}

/* page.php's historic box: 60px 20px, 800px, centred. Kept identical. */
.page-content {
  padding: 60px 0;
}

.dg-body {
  padding: 40px 20px 70px;
}

/* --- page head band ----------------------------------------------------- */

.dg-page-head {
  background: var(--dg-green-mist);
  border-bottom: 1px solid var(--dg-green-line);
  padding: 46px 0 40px;
  text-align: center;
}

.dg-eyebrow {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dg-green);
}

.dg-page-title,
.page-title {
  margin: 0;
  font-size: 2rem;
  line-height: 1.25;
  color: var(--dg-green-deep);
}

/* page.php used to carry these three as an inline style attribute. */
.page-title {
  text-align: center;
  color: var(--dg-green);
  margin-bottom: 30px;
}

.dg-page-sub {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--dg-muted);
  font-size: 1.05rem;
}

.dg-page-sub code {
  background: #fff;
  border: 1px solid var(--dg-green-line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.95em;
  word-break: break-all;
}

.dg-section-heading {
  margin: 0 0 18px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dg-green-deep);
}

/* --- the "what were you looking for" card on 404 ------------------------ */

.dg-lead-card {
  background: #fff;
  border: 1px solid var(--dg-green-line);
  border-left: 5px solid var(--dg-green-bright);
  border-radius: 12px;
  padding: 24px 26px;
  margin-bottom: 34px;
  box-shadow: 0 4px 14px rgba(31, 66, 31, 0.06);
}

.dg-lead-card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--dg-green-deep);
}

.dg-lead-card p {
  margin: 0 0 16px;
  color: var(--dg-muted);
}

.dg-lead-card p:last-child {
  margin-bottom: 0;
}

/* --- route grid --------------------------------------------------------- */

.dg-routes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 0 0 34px;
  padding: 0;
  list-style: none;
}

.dg-route {
  display: block;
  background: #F6FFFA;
  border: 1px solid var(--dg-green-line);
  border-radius: 12px;
  padding: 18px 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.dg-route:hover,
.dg-route:focus-visible {
  transform: translateY(-3px);
  border-color: var(--dg-green-bright);
  box-shadow: 0 8px 20px rgba(47, 141, 70, 0.14);
}

.dg-route strong {
  display: block;
  color: var(--dg-green-deep);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.dg-route span {
  display: block;
  color: var(--dg-muted);
  font-size: 0.92rem;
}

/* --- result / post lists ------------------------------------------------ */

.dg-list {
  margin: 0 0 34px;
  padding: 0;
  list-style: none;
}

.dg-list li + li {
  margin-top: 6px;
  border-top: 1px solid #eaf1ea;
  padding-top: 22px;
}

.dg-list li {
  padding-bottom: 16px;
}

.dg-list h2,
.dg-list h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  line-height: 1.35;
}

.dg-list a {
  color: var(--dg-green);
  text-decoration: none;
}

.dg-list a:hover,
.dg-list a:focus-visible {
  text-decoration: underline;
}

.dg-list p {
  margin: 0;
  color: var(--dg-muted);
}

.dg-meta {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--dg-muted);
}

.dg-empty {
  margin: 0 0 26px;
  color: var(--dg-muted);
  font-size: 1.05rem;
}

.dg-inline-links {
  margin: 0 0 34px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.dg-inline-links a {
  color: var(--dg-green);
  font-weight: 600;
  text-decoration: none;
}

.dg-inline-links a:hover,
.dg-inline-links a:focus-visible {
  text-decoration: underline;
}

/* --- search form -------------------------------------------------------- */

.dg-searchform {
  display: flex;
  gap: 10px;
  margin: 0 0 32px;
  flex-wrap: wrap;
}

.dg-searchform label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.dg-searchform input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  border: 1px solid var(--dg-green-line);
  border-radius: 8px;
  background: #fff;
}

.dg-searchform input[type="search"]:focus {
  outline: 2px solid var(--dg-green-bright);
  outline-offset: 1px;
}

.dg-searchform button {
  padding: 12px 24px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(135deg, #2f8d46, #4caf50);
  transition: all 0.3s ease;
}

.dg-searchform button:hover {
  background: linear-gradient(135deg, #256c36, #3a9f40);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(47, 141, 70, 0.3);
}

/* --- article ------------------------------------------------------------ */

.dg-article {
  padding: 46px 20px 60px;
}

.dg-article > * + * {
  margin-top: 1rem;
}

.dg-article h2 {
  margin-top: 2rem;
  color: var(--dg-green-deep);
}

.dg-article h3 {
  margin-top: 1.6rem;
  color: var(--dg-green);
}

.dg-article img {
  max-width: 100%;
  height: auto;
}

.dg-article a {
  color: var(--dg-green);
}

.dg-postscript {
  margin-top: 46px;
  padding-top: 26px;
  border-top: 1px solid var(--dg-green-line);
}

.dg-postscript p {
  margin: 0 0 16px;
  color: var(--dg-muted);
}

/* --- pagination --------------------------------------------------------- */

.dg-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.dg-pagination .page-numbers {
  display: inline-block;
  min-width: 40px;
  padding: 8px 12px;
  text-align: center;
  text-decoration: none;
  color: var(--dg-green);
  background: #F6FFFA;
  border: 1px solid var(--dg-green-line);
  border-radius: 8px;
}

.dg-pagination .page-numbers.current {
  color: #fff;
  background: var(--dg-green);
  border-color: var(--dg-green);
}

.dg-pagination .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- DGA-106 -------------------------------------------------------------
 * Four orphan pages (/testimonials/, /contact-us/, /booking/, /book-appointment/)
 * carry stripped page-builder icons as bare <svg viewBox> elements with no
 * width, height, class or fill. The theme defined no svg rule, so each one
 * filled the 760px content column in solid black at a proportional height of
 * 676-2027px, giving pages 7,700-26,100px tall at every viewport.
 *
 * Sized only where an SVG carries neither a width nor a height attribute, and
 * only inside rendered post content, so plugin and block SVGs that size
 * themselves are untouched.
 * ---------------------------------------------------------------------- */

.dg-prose svg:not([width]):not([height]),
.dg-article svg:not([width]):not([height]) {
  width: 1.4em;
  height: 1.4em;
  max-width: 100%;
  vertical-align: -0.2em;
  fill: var(--dg-green);
}

/* Any image inside rendered content stays inside the column. */
.dg-prose img {
  max-width: 100%;
  height: auto;
}

/* --- dg-fullwidth.php ----------------------------------------------------
 * Lifted verbatim out of the template's inline <style>, but scoped to the
 * wrapper instead of applying to the whole document. The h1/h2/h3 colour used
 * to hit the header and footer too; nothing there uses those tags, so the
 * rendered result is unchanged.
 * ---------------------------------------------------------------------- */

.dg-fullwidth-wrapper {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.dg-fullwidth-wrapper .dg-content {
  width: 100%;
  max-width: 1400px;
  margin: auto;
  padding: 20px;
}

.dg-fullwidth-wrapper h1,
.dg-fullwidth-wrapper h2,
.dg-fullwidth-wrapper h3 {
  color: #2e7d32;
}

.page-template-dg-fullwidth .sidebar,
.page-template-dg-fullwidth #sidebar,
.page-template-dg-fullwidth .widget-area {
  display: none;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 768px) {
  .dg-page-head {
    padding: 34px 0 30px;
  }

  .dg-page-title {
    font-size: 1.6rem;
  }

  .dg-body {
    padding: 30px 20px 50px;
  }

  .dg-lead-card {
    padding: 20px;
  }
}
