/*
  Global styles and variables
  Colour palette inspired by the original portfolio:
    --primary: deep teal used for backgrounds
    --secondary: mid teal used for highlights and shapes
    --accent: warm orange used for titles and buttons
    --light: off‑white used for backgrounds and panels
    --dark: near‑black used for text

  The layout adapts automatically via CSS Grid and Flexbox to ensure
  responsiveness across screen sizes. Focus outlines and accessible
  colour contrasts are provided for keyboard users.
*/

:root {
  --primary: #013d4a;
  --secondary: #1f6f8b;
  --accent: #f1a208;
  --light: #f7f7f7;
  --dark: #0a0a0a;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--dark);
  line-height: 1.6;
  background-color: var(--light);
  scroll-behavior: smooth;
}

header {
  background-color: var(--primary);
  color: #fff;
}

/* Navigation */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

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

.nav-links a {
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  transition: opacity 0.2s;
}

.nav-links a:hover,
.nav-links a:focus {
  opacity: 0.8;
}

/* Hero */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
}

.hero-text {
  flex: 1 1 300px;
  padding: 1rem;
}

.hero-text h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--accent);
}

.hero-text p {
  font-size: 1.25rem;
}

.hero-image {
  flex: 1 1 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* About & other sections */
section {
  padding: 3rem 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary);
}

.about-section {
  background-color: var(--light);
}

.about-section p {
  margin-bottom: 1rem;
}

/* Projects */
.projects-section {
  background-color: #fff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background-color: var(--light);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.project-card:focus {
  outline: 3px solid var(--accent);
  outline-offset: 0;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.project-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.project-card h3 {
  padding: 0.75rem 1rem 0 1rem;
  color: var(--primary);
  font-size: 1.25rem;
}

.project-card .project-summary {
  padding: 0 1rem 1rem 1rem;
  flex-grow: 1;
  color: var(--dark);
  font-size: 0.95rem;
}

/* Contact form */
.contact-section {
  background-color: var(--light);
}

.contact-section form {
  max-width: 600px;
  margin-top: 1rem;
}

.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 0.5rem;
  font-weight: bold;
  color: var(--primary);
}

.form-group input,
.form-group textarea {
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  transition: border-color 0.2s;
}

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

.btn {
  display: inline-block;
  background-color: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.25rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn:hover,
.btn:focus {
  background-color: #d98c06;
}

.form-message {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.form-message.error {
  color: #d9534f;
}

.form-message.success {
  color: #5cb85c;
}

/* Footnotes */
.footnotes {
  font-size: 0.8rem;
  border-top: 1px solid #ddd;
  padding-top: 1rem;
  margin-top: 2rem;
}

.footnotes ol {
  margin-left: 1.5rem;
}

.footnotes li {
  margin-bottom: 0.5rem;
}

/* Footer */
.footer {
  background-color: var(--primary);
  color: #fff;
  text-align: center;
  padding: 1rem;
  margin-top: 2rem;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: #fff;
  border-radius: 0.5rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 1.5rem;
}

.modal-content h2 {
  margin-top: 0;
  color: var(--primary);
}

.modal-content img {
  width: 100%;
  height: auto;
  margin-bottom: 1rem;
  border-radius: 0.25rem;
}

.modal-content p {
  margin-bottom: 0.5rem;
}

.modal .close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--primary);
}

.modal .close:hover,
.modal .close:focus {
  color: var(--accent);
  outline: none;
}

/* Media queries for responsiveness */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--primary);
    flex-direction: column;
    width: 200px;
    padding: 1rem;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links li {
    margin-bottom: 1rem;
  }
  .hero {
    flex-direction: column;
    text-align: center;
  }
  .hero-image {
    order: -1;
    margin-bottom: 1rem;
  }
}