/*
 * Global styles for Howe Electric website
 *
 * This stylesheet defines a modern, responsive layout using CSS
 * variables, Flexbox and media queries. Colours are chosen to
 * convey trust and professionalism while keeping sufficient
 * contrast for accessibility.
 */

/* Colour palette */
:root {
  --primary-color: #0a192f; /* dark navy */
  --secondary-color: #112240; /* deep blue for sections */
  --accent-color: #64ffda; /* electric teal */
  --text-color: #ccd6f6; /* light grey-blue for body text */
  --heading-color: #e6f1ff; /* off white for headings */
  --card-bg: #112e51; /* slightly lighter panel background */
  --footer-bg: #0a192f; /* same as primary for footer */
  --btn-bg: var(--accent-color);
  --btn-text: #0a192f;
  --btn-secondary-bg: transparent;
  --btn-secondary-text: var(--accent-color);
  /* Custom colour for the company name in the header.
   * A blue hue was chosen to align with the Howe Electric brand colours.
   */
  --logo-color: #64b5f6;
}

/* Global reset and typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Open Sans', Arial, sans-serif;
  color: var(--text-color);
  background-color: var(--primary-color);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  color: var(--heading-color);
  line-height: 1.3;
  margin-bottom: 0.5em;
}

img {
  max-width: 100%;
  display: block;
}

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

a:hover, a:focus {
  text-decoration: underline;
}

/* Utility classes */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 0;
}

.btn-primary,
.btn-secondary,
.services-cta {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--btn-bg);
  color: var(--btn-text);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #52e0c4;
}

.btn-secondary {
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  background-color: transparent;
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--accent-color);
  color: var(--btn-text);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
}

.link-arrow::after {
  content: '→';
  margin-left: 0.25rem;
  transition: transform 0.2s;
}

.link-arrow:hover::after {
  transform: translateX(4px);
}

/* Navigation */
header {
  background-color: var(--primary-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid #0f2a4c;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/*
 * The .logo class is kept for backward compatibility but now uses the logo colour.
 * The actual header uses .logo-container which includes the logo image and text.
 */
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--logo-color);
}

/* Logo container styles for placing the logo image next to the text */
.logo-container {
  display: flex;
  align-items: center;
}
.logo-container img {
  /* Increase logo size further for more prominence */
  width: 60px;
  height: 60px;
  margin-right: 0.75rem;
}
.logo-container span {
  font-size: 2rem;
  font-weight: 700;
  color: var(--logo-color);
}

.nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav a {
  color: var(--text-color);
  font-weight: 600;
  transition: color 0.2s;
}

.nav a:hover,
.nav a.active {
  color: var(--accent-color);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle .hamburger,
.nav-toggle .hamburger::before,
.nav-toggle .hamburger::after {
  width: 24px;
  height: 3px;
  background-color: var(--text-color);
  display: block;
  position: relative;
  transition: transform 0.3s ease;
}

.nav-toggle .hamburger::before,
.nav-toggle .hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}

.nav-toggle .hamburger::before {
  top: -8px;
}

.nav-toggle .hamburger::after {
  top: 8px;
}

/* When nav is open */
.nav.open {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: var(--primary-color);
  border-top: 1px solid #0f2a4c;
  padding: 1rem 0;
}

.nav.open ul {
  /* When the mobile menu is open we switch the list to a vertical flex layout.
   * Explicitly set display:flex to override the "display:none" applied on small screens. */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.nav.open a {
  padding: 0.5rem 1rem;
}

/* Hero section */
.hero {
  position: relative;
  min-height: 60vh;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--heading-color);
}

.hero .overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 10, 27, 0.65);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

/* Section headings */
section h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

/* About preview */
.about-preview {
  text-align: center;
  padding-bottom: 3rem;
}

.about-preview p {
  max-width: 800px;
  margin: 0.5rem auto 1rem auto;
}

/* Services summary */
.services-summary {
  background-color: var(--secondary-color);
  padding: 3rem 0;
  text-align: center;
}

.services-summary .cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 2rem;
}

.services-summary .card {
  background-color: var(--card-bg);
  padding: 1.5rem;
  border-radius: 6px;
  flex: 1 1 250px;
  max-width: 300px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.services-summary .card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.services-summary .card p {
  font-size: 0.95rem;
  color: var(--text-color);
}

.services-summary .services-cta {
  margin-top: 2rem;
}

/* Tagline and award section on the home page */
.tagline-award {
  background-color: var(--secondary-color);
  text-align: center;
  padding: 2rem 0;
}

.tagline-award .tagline {
  font-size: 1.5rem;
  font-style: italic;
  margin-bottom: 0.5rem;
  color: var(--accent-color);
}

.tagline-award .award {
  font-size: 1rem;
  color: var(--text-color);
}

/* Bullet lists in service items */
.service-item ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
}

.service-item ul li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-color);
}

/* Testimonials */
.testimonials {
  background-color: var(--primary-color);
  padding: 3rem 0;
}

.testimonial-list {
  max-width: 800px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
}

.testimonial-list blockquote {
  background-color: var(--secondary-color);
  padding: 1.5rem;
  border-left: 4px solid var(--accent-color);
  border-radius: 4px;
}

.testimonial-list blockquote p {
  font-style: italic;
  margin-bottom: 0.75rem;
}

.testimonial-list cite {
  font-size: 0.9rem;
  color: var(--accent-color);
}

/* CTA section */
.cta {
  background-color: var(--secondary-color);
  padding: 3rem 0;
  text-align: center;
}

.cta p {
  margin-bottom: 1.5rem;
}

/* Footer */
footer {
  background-color: var(--footer-bg);
  padding: 2rem 0;
  color: var(--text-color);
  font-size: 0.9rem;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
}

.footer-content div {
  flex: 1 1 200px;
}

.footer-contact ul,
.footer-links ul {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}

.footer-bottom {
  text-align: center;
  margin-top: 1rem;
  border-top: 1px solid #0f2a4c;
  padding-top: 1rem;
}

/* Page header */
.page-header {
  background-color: var(--secondary-color);
  padding: 3rem 0;
  text-align: center;
}

.page-header p {
  max-width: 700px;
  margin: 0.5rem auto 0;
}

/* Service list */
.service-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
}

.service-item {
  background-color: var(--card-bg);
  padding: 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  /* Position relative to allow preview overlay and corner indicator */
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.service-item h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  /* Center align service headings and allow wrapping on long names */
  text-align: center;
  line-height: 1.2;
}

.service-item p {
  font-size: 0.95rem;
  color: var(--text-color);
}

/* About story and values */
.about-story p,
.about-values p {
  margin-bottom: 1rem;
}

.value-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.value-card {
  background-color: var(--card-bg);
  padding: 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.value-card h3 {
  margin-bottom: 0.5rem;
}

/* Contact page */
.contact-info {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  padding: 2rem 0;
}

.contact-info .info-box {
  flex: 1 1 300px;
}

.appointment-form-section {
  background-color: var(--secondary-color);
  padding: 3rem 0;
}

.appointment-form-section .container {
  max-width: 700px;
}

.appointment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-group {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  flex: 1 1 100%;
}

.form-group label {
  margin-bottom: 0.3rem;
  font-weight: 600;
}

.form-group input,
.form-group textarea {
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #233554;
  background-color: #0e2a47;
  color: var(--text-color);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.appointment-form button[type="submit"] {
  align-self: flex-start;
  margin-top: 0.5rem;
}

/*
 * Preview image overlay for service cards
 * Each service item that supports a preview should include the class
 * `has-preview` and contain a `.preview-corner` element along with
 * a `.service-preview` overlay. The preview overlay is hidden by
 * default and becomes visible on hover, focus or tap. A small
 * triangular corner in the top right corner hints that a preview
 * is available. On desktop, hovering over the card will show the
 * preview. On mobile or with keyboard, tapping/pressing Enter will
 * toggle the preview.
 */

/*
 * Updated preview corner: use a subtler dog‑ear effect instead of a bright green triangle.
 * The folded corner now matches the card background and includes a small inset shadow
 * to suggest a turned page. The optional camera icon is removed for a cleaner look.
 */
/*
 * Updated preview corner: mimic the look of a page corner being folded over. We use a square
 * element at the top right and a pair of gradients to simulate the folded flap. The inner
 * gradient (in the ::before pseudo‑element) picks up the card background colour so the
 * fold blends into the card, while the outer gradient provides a subtle hint of the
 * underside of the page. A slight inset shadow emphasises the crease.
 */
.service-item.has-preview .preview-corner {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  pointer-events: none;
  /* Outer gradient: transparent to a faint highlight to suggest the underside of the folded page */
  background: linear-gradient(-135deg, transparent 45%, rgba(255, 255, 255, 0.08) 45%);
  z-index: 2;
}

/* Inner gradient: pick up the card background colour and cast a subtle shadow along the crease */
.service-item.has-preview .preview-corner::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(-135deg, var(--card-bg) 50%, transparent 50%);
  /* Inset shadow for depth */
  box-shadow: -3px 3px 5px rgba(0, 0, 0, 0.25) inset;
}

/* Remove the camera icon from the corner */
.service-item.has-preview .preview-corner::after {
  display: none;
}

/*
 * Preview label: a hint for touchscreen users that the card can be tapped to reveal a preview.
 * Hidden on devices that support hover (desktop), and when the preview is active.
 */
.service-item .preview-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--accent-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  padding: 0.4rem 0.25rem;
  pointer-events: none;
}

@media (hover: hover) {
  .service-item .preview-label {
    display: none;
  }
}

.service-item.preview-active .preview-label {
  display: none;
}

/* Preview overlay */
.service-preview {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(14, 42, 71, 0.9);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  z-index: 1;
}

.service-preview img {
  max-width: 100%;
  max-height: 60%;
  object-fit: cover;
  margin-bottom: 0.5rem;
  border-radius: 4px;
}

.service-preview .preview-caption {
  font-size: 0.9rem;
  line-height: 1.3;
  margin-top: 0.5rem;
}

/* When the preview overlay is visible */
.service-preview.show {
  opacity: 1;
  pointer-events: auto;
}

/* Ensure headings wrap under the corner fold */
.service-item.has-preview h2 {
  padding-right: 1rem;
}

/* Responsive styles */
@media (max-width: 768px) {
  .nav ul {
    display: none;
  }

  .nav-toggle {
    display: block;
  }
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
  }

  .services-summary .cards {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Additional fine‑tuning for very small screens. When the viewport is narrower than 480px
   we reduce the hero heading size further so long lines wrap comfortably on a single screen without causing horizontal scrolling. */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.6rem;
  }

  .hero p {
    font-size: 0.95rem;
  }
}