/* =======================================================
   GLOBAL RESET & BASE STYLES
   Purpose: Normalise default browser spacing and set
   the core font, background and text colour.
======================================================= */

/* Global reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  background: #f7f7f7;
  color: #333;
}

/* =======================================================
   MAIN LAYOUT CONTAINERS
   Purpose: Set max widths and centring for the main
   page content area.
======================================================= */

.main-container {
  width: 90%;
  max-width: 1100px;
  margin: auto;
  padding: 2rem 0;
}

/* =======================================================
   HEADER & PRIMARY NAVIGATION
   Purpose: Top bar with site title/logo and main
   navigation links.
======================================================= */

header {
  background: #1e4a6d;
  color: #fff;
  padding: 1.2rem 0;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.logo {
  font-size: 1.6rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 0.5rem;
}

nav {
  text-align: center;
}

nav a {
  color: #cfe6f5;
  text-decoration: none;
  margin: 0 0.5rem;
  font-size: 1rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

nav a:hover {
  background: #2d608a;
  color: #fff;
}

.site-nav a.active {
  background: #ffffff;
  color: #1e4a6d;
}

/* =======================================================
   HERO SECTION
   Purpose: Intro area explaining what the page does.
======================================================= */

.hero {
  background: white;
  padding: 2rem;
  margin-bottom: 2.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.hero h1 {
  margin-bottom: 1rem;
  font-size: 2rem;
}

.hero p {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  color: #444;
}

/* =======================================================
   BUTTONS & ACTION LINKS
   Purpose: Shared base button appearance plus primary,
   secondary, danger and link-style variants.
   Works for both <a> and <button>.
======================================================= */

.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-link {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 4px;
  text-decoration: none;
  margin: 0 0.4rem 0.4rem 0;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  border: none;
  cursor: pointer;
  text-align: center;
}

/* Primary (dark filled) button */
.btn-primary {
  background: #1e4a6d;
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #163a55;
  color: #fff;
}

/* Secondary / outline button */
.btn-secondary,
.btn-ghost {
  background: none;
  color: #1e4a6d;
  border: 2px solid #1e4a6d;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-ghost:hover,
.btn-ghost:focus {
  background: #e6f0f7;
  color: #1e4a6d;
}

/* Danger (red) button */
.btn-danger {
  background: #b00020;
  color: #ffffff;
}

.btn-danger:hover,
.btn-danger:focus {
  background: #8a0018;
  color: #ffffff;
}

/* Link-style button (for "Delete" etc.) */
.btn-link {
  background: transparent;
  color: #1e4a6d;
  padding: 0;
  margin: 0;
  border-radius: 0;
  font-weight: normal;
}

.btn-link:hover,
.btn-link:focus {
  text-decoration: underline;
}

/* Toolbar: horizontal row of buttons with gaps */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}

/* Legacy button-row class (kept in case used elsewhere) */
.btn-row {
  margin-top: 1rem;
}

/* =======================================================
   PAGE NAV BUTTONS
   Purpose: Consistent “Back” + “Back to top” controls
   at the bottom of pages.
======================================================= */

.page-nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
}

/* =======================================================
   GENERIC SECTION LAYOUT
   Purpose: White card-like panels used for main sections.
======================================================= */

.section {
  margin-bottom: 3rem;
  padding: 2rem;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  text-align: left;
}

.section h2 {
  margin-bottom: 1rem;
  color: #1e4a6d;
}

/* =======================================================
   CARD GRID LAYOUT
   Purpose: Three-column responsive grid and card styling.
======================================================= */

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.card {
  background: #fdfdfd;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  margin-bottom: 1rem;
  color: #444;
}

.card a {
  color: #1e4a6d;
  text-decoration: none;
  font-weight: bold;
}

.card a:hover {
  text-decoration: underline;
}

/* =======================================================
   INFO BOX (Core Guidance link panels)
   Purpose: Small highlight box used inside sections to
   explain how the content links to Core Guidance.
======================================================= */

.info-box {
  margin-top: 1.2rem;
  padding: 1rem 1.25rem;
  border-left: 4px solid #1e4a6d;
  background: #f0f6fb;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #333;
}

.info-box strong {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: bold;
  color: #1e4a6d;
}

.info-box a {
  color: #1e4a6d;
  font-weight: bold;
  text-decoration: none;
}

.info-box a:hover {
  text-decoration: underline;
}

.info-box ul {
  margin-bottom: 0.5rem;
}

/* =======================================================
   FORMS & INPUTS
   Purpose: Shared styling for all tools with forms.
======================================================= */

form.card {
  padding: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="url"],
textarea,
select {
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  min-height: 3rem;
}

/* For single-line “full width” inputs in tools */
.input-full {
  width: 100%;
}

/* =======================================================
   TABLES (data-table)
   Purpose: For timeline, risk log, cost monitor etc.
======================================================= */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.45rem 0.5rem;
  border: 1px solid #ddd;
  text-align: left;
  vertical-align: top;
}

.data-table thead {
  background: #e6f0f7;
}

.data-table th {
  font-weight: 600;
}

/* =======================================================
   LISTS & TEXT UTILITIES
======================================================= */

ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.small-print {
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
}

/* Highlighted output text (e.g. deadline result) */
.highlight {
  margin-top: 0.75rem;
  font-weight: 600;
  color: #1e4a6d;
}

/* Screen reader only text (for accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* For question blocks on tools pages */
.question-block {
  margin-bottom: 1rem;
  padding: 0.75rem 0.75rem 0.5rem;
  border-radius: 6px;
  background: #f9fbff;
  border: 1px solid #e0e6f2;
}

.question-text {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.options label {
  display: block;
  font-weight: normal;
  margin-bottom: 0.25rem;
}

/* =======================================================
   FOOTER
   Purpose: Bottom bar with copyright notice and
   secondary navigation links.
======================================================= */

footer {
  background: #1e4a6d;
  color: #fff;
  padding: 1.5rem 0;
  margin-top: 3rem;
}

.footer-inner {
  width: 90%;
  max-width: 1100px;
  margin: auto;
  text-align: center;
  font-size: 0.9rem;
}

footer a {
  color: #cfe6f5;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* =======================================================
   RESPONSIVE ADJUSTMENTS
   Purpose: Tweaks for narrower screens.
======================================================= */

/* Ensure button-style links keep their button colour,
   even inside cards or other link styles */
a.btn-primary,
a.btn-danger {
  color: #ffffff !important;
}

a.btn-primary:hover,
a.btn-primary:focus,
a.btn-danger:hover,
a.btn-danger:focus {
  color: #ffffff !important;
}

@media (max-width: 700px) {
  nav a {
    display: inline-block;
    margin: 0.3rem;
  }

  .hero h1 {
    font-size: 1.6rem;
  }

  .toolbar {
    justify-content: flex-start;
  }
}
