/* Week 8 Assigment Stylesheet: BUILDING A COMPLETE WEBSITE */

/* ==========================
   Base Styles (Mobile-First)
   ========================== */

/* Add this at the very top of your CSS file */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --primary-color: #004F4F;
  --accent-color: #89b389;
  --background-color: url(https://cdn-media-1.freecodecamp.org/imgr/MJAkxbh.png);
  --text-color: #1A1A1A;
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Roboto', sans-serif;
  --font-h2: 'Bavro', 'Lobster', 'Montserrat', sans-serif;
  --font-h3: 'Throw My Hands Up', 'Lobster', 'Montserrat', sans-serif;
}

/* Register local webfonts */
@font-face {
  font-family: 'Bavro';
  src: url('fonts/bavro/bavro-regular-webfont.woff2') format('woff2'),
       url('fonts/bavro/bavro-regular-webfont.woff') format('woff'),
       url('fonts/bavro/bavro-regular-webfont.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Throw My Hands Up';
  src: url('fonts/throw_my_hands_up/ThrowMyHandsUpintheAir.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Throw My Hands Up';
  src: url('fonts/throw_my_hands_up/ThrowMyHandsUpintheAirBold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Update body to prevent overflow and fit viewport */
html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--background-color);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  align-items: stretch; /* changed from center */
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* Ensure main flex containers don't exceed viewport width */
header,
footer,
main,
.about,
.projects,
.contact {
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  margin-left: auto;
  margin-right: auto;
}

/* For content readability, keep max-width on inner containers */
.about,
.projects,
.contact {
  max-width: 900px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 1.5rem .75rem;
}

header {
  background-color: var(--primary-color);
  color: white;
  padding: 0.5rem 0;         /* Reduce vertical padding */
  width: 100%;              /* Ensure full width of viewport */  
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: flex-end;
  min-height: 70px;           /* Reduce min-height */
  position: sticky;      /* Add this line */
  top: 0;                /* Add this line */
  z-index: 100;          /* Ensure it stays above other content */
}

.header-inner {
  display: flex;
  max-width: 60rem;
  width: 100%;
  margin: 0 auto;
  flex-direction: row;
  align-items: center;        /* Vertically center logo and nav */
  justify-content: space-between;
  padding: 0.25em 1em;        /* Reduce vertical padding */
  position: relative;
}

header img {
  width: 4rem;                /* Slightly smaller logo */
  height: auto;
  margin-bottom: 0;           /* Remove extra space below logo */
  border-radius: 25%;
  box-shadow: 0 0 4px 4px rgba(32, 32, 32, 0.527); /* Adds logo border shadow; 1 x axis (horizontal offset); 2 y axis (vertical offset); 3 blur radius; 4 spread radius. */
}

nav {
  display: flex; /* mobile-first: present but collapsed for animation */
  width: 100%;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
  margin: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--primary-color);
  padding: 0.5rem 0.75rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  overflow: hidden;
  pointer-events: none;
  transition: max-height 380ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 240ms ease,
              transform 320ms ease;
}

nav a {
  display: flex;
  position: relative;    /* Make anchor the ripple container */
  overflow: hidden;      /* Keep ripple contained inside link */
  margin: 0;
  padding: 0.25rem .5rem; 
  border-radius: 5px;
  align-items: center;
  justify-content: center;
  color: white;
  text-decoration: none;
  font-weight: bold;
  transition: transform 0.75s ease, background-color 0.3s ease, color 0.3s ease;
  z-index: 0; /* Create stacking context */
  box-shadow: 0 4px 0 #222, 0 2px 8px rgba(0,0,0,0.15); /* 3D border */
}

nav a {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 280ms ease, transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.header-inner.nav-open nav {
  max-height: 18rem;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.header-inner.nav-open nav a {
  opacity: 1;
  transform: translateY(0);
}

.header-inner.nav-open nav a:nth-child(1) { transition-delay: 0ms; }
.header-inner.nav-open nav a:nth-child(2) { transition-delay: 70ms; }
.header-inner.nav-open nav a:nth-child(3) { transition-delay: 140ms; }
.header-inner.nav-open nav a:nth-child(4) { transition-delay: 210ms; }
.header-inner.nav-open nav a:nth-child(5) { transition-delay: 280ms; }

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 2px solid #fff;
  color: #fff;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  z-index: 110;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.menu-toggle:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.menu-icon {
  display: inline-block;
  width: 1.25rem;
  height: 2px;
  background: #fff;
  box-shadow: 0 -6px 0 #fff, 0 6px 0 #fff;
}

nav a:hover {
  transform: scale(1.1);
  background-color: var(--accent-color);  /* #89b389 */
  color: #1A1A1A;
  border: black 1px solid;
  z-index: 5;  /* above normal but below ripple */
}

nav a:active {
  transform: translate3d(1px, 1px, 1px);
  box-shadow: 1.5px 2px 0 #222, 0 1px 4px rgba(0,0,0,0.1);
}

#matrix {  /* matrix code rain on nav button click */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;        /* hidden until triggered */
  z-index: 9999;        /* on top of content */
  pointer-events: none; /* allow clicks through canvas */
  background: transparent; /* no black background */
  transition: opacity 0.6s ease; /* Smooth fade-in/out for JS, instead of instantly fading to 0 */
  opacity: 1; /* Fully visible when active, so JS can fade from this to 0 */
  /* REMOVE this duplicate so the canvas isn't always forced on */
  /* display: block; */
}

.hero {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Make the figure the positioning context for the shades */
.hero-image {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.hero-image img {
  position: inherit;  /* was absolute */
  inset: 0;           /* pin to edges so cropping is stable */
  width: clamp(165px, 22.5vw, 255px);
  height: clamp(200px, 28vw, 320px);
  object-fit: cover; /* cover, not contain */
  object-position: 50% 50%;
  border-radius: 25%;
  box-shadow:
    0 8px 20px rgba(0,0,0,0.55),
    0 0 10px rgba(0,0,0,0.65);
}

.hero-image { cursor: pointer; }

/* Nudge shades alignment after image change */
.glasses {
  position: absolute;
  left: 50.5%;
  top: 48.5%;             
  width: 260px;
  height: 100px;
  transform: translate(-50%, -50%) scale(0.45);
  transform-origin: center;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease;
}

/* Lens clip areas now match rx/ry: 2*48 by 2*22, positioned at (cx-rx, cy-ry) */
.lens {
  position: absolute;
  width: 96px;             /* 2 * 48 */
  height: 44px;            /* 2 * 22 */
  top: 28px;               /* 50 - 22 */
  overflow: hidden;
  border-radius: 48px / 22px;
  z-index: 1;
}

.lens-left  { left: 32px; }  /* 80 - 48 */
.lens-right { left: 132px; } /* 180 - 48 */

.lens canvas {
  position: absolute;
  inset: 0;
  display: block;          /* keep 1:1 with HTML width/height */
  z-index: 1;
}

/* Darker tint inside lenses */
.lens::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
  pointer-events: none;
  z-index: 2;
}

/* Thin frame outline + solid bridge (so nose shows) */
.shades-frame ellipse { fill: none; stroke: #333; stroke-opacity: .6; stroke-width: 2; }
.shades-frame rect   { fill: #111; stroke: none; }

/* Disable old, conflicting shades rules */
.shades-wrap { display: none !important; }
.hero-image .shades,
.hero-image #shadesCanvas { display: none !important; }

/* Reveal shades on click */
.hero-image.glasses-on .glasses {
  opacity: 1;
  visibility: visible;
}

.hero h2,
.hero p,
.hero-btn {
  margin: 0.5rem 0;
}

.hero h2 {
  font-family: var(--font-h2);
  font-size: 3.5rem;
  text-align: center;
}

/* Make all h2 bold (works with Bavro via synthetic bold) */
h2 {
  font-weight: 700;
  font-synthesis: weight;
}

/* Make just the name darker/stronger on the Home page */
.hero h2 .name {
  color: var(--primary-color);
  font-weight: 900;
  -webkit-text-stroke: 0.75px currentColor; /* visual thicken */
}

.hero p {
  font-size: rem;
}

.hero-btn {
  display: flex;
  background-color: var(--accent-color);
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  text-decoration: none;
  color: whitesmoke;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  box-shadow: 1px 4px 0 #222, 0 2px 8px rgba(0,0,0,0.15); /* 3D border */
}

/* "View My Work" button hover effect */
.hero-btn:hover {
    background: #004F4F;
    color: whitesmoke;
    transition: background 0.2s, color 0.2s;

}

.hero-btn:active {
    transform: translate3d(1px, 1px, 1px);
    box-shadow: 1.5px 2px 0 #222, 0 1px 4px rgba(0,0,0,0.1);
}

/* About section as flex column */
/* If .about has a max-width, the image will match it */
.about {
    display: flex;
    flex-direction: column;
    gap: 2em;
    max-width: 700px; /* or your preferred content width */
    margin: 0 auto;
    padding: 0 1em;
}

/* Flex row for image and text wrapping */
.about-flex-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5em;
}

/* Image on the left, text on the right */
.diverse-skills-img {
    max-width: 40%;
    height: auto;
    flex-shrink: 0;
    /* Optional: add border-radius or box-shadow if desired */
}

/* Text will wrap to the right of the image */
.about-flex-text {
    flex: 1;
    align-self: center;
}

.about,
.projects {
  padding: 2rem;
  max-width: 900px;
  width: 100%;
}

/* Remove/override other styles that conflict with section title styling */
.about h3,
.projects h3,
#home-projects > h2,
.resume-preview > h3 {
    font-size: 1.4rem;
    font-weight: bold;
    text-align: left;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    /* Ensure h3s use the new h3 stack */
    font-family: var(--font-h3);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card {
  background-color: white;
  padding: 1rem;
  border-left: 4px solid var(--primary-color);
}

footer {
  display: flex;                 
  justify-content: center; /* centers items together in row */
  align-items: center; /* vertically align items */
  gap: 1rem; /* space between left and right sections */  
  padding: 1rem;
  font-size: 0.875rem;
  color: #888;
  width: 100%;
}

.footer-left {
  flex: 1; /* keeps it on the left */
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 10px; /* space between Contact and LinkedIn icon */
}

footer a {
  text-decoration: none;
  color: inherit;
}

.linkedin-icon {
  width: 20px; /* the size of a tiny icon */
  height: 20px;
  fill: #0A66C2; /* LinkedIn blue if using inline SVG */
}


/* Make images responsive and not wider than text/content */
.about img {
    max-width: 40%;
    height: auto;
    display: block;
    margin: 1em 0;
}

/* Float Diverse_Skills_Image.png right and wrap text */
.diverse-skills-img {
    float: none;
    margin: 0 1em 1em 0;
    max-width: 40%;
    height: auto;
    display: block;
}

/* Flex row for image right, text wraps left */
.flex-wrap-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5em;
}

/* Biodiverse image floats right in flexbox */
.biodiverse-img {
    max-width: 40%;
    height: auto;
    order: 2; /* image on right */
    flex-shrink: 0;
}

/* Text wraps left of image */
.flex-wrap-text {
    flex: 1;
}

/* Ensure woodland clearing image stretches to text width */
.about .woodland-clearing-img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 1em 0;
    box-sizing: border-box;
}

.about-header-flex {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: .25rem;
    margin-bottom: 0; /* Reduced from 1.5em */
}

.about-video-space {
    width: 320px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.resume-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    background-color: var(--primary-color);
    color: whitesmoke;
    padding: 0.4rem 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    text-decoration: none;
    width: auto;
    min-width: 80px;
    max-width: 200px;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 1px 4px 0 #222, 0 2px 8px rgba(0,0,0,0.15); /* 3D border */
    transition: background 0.2s, color 0.2s, box-shadow 0.15s, transform 0.15s;
}

.resume-link:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.resume-link:active {
    transform: translate3d(1px, 1px, 1px);
    box-shadow: 1.5px 2px 0 #222, 0 1px 4px rgba(0,0,0,0.1);
}

/* Make contact section stack content vertically */
.contact {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5em;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.contact form {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.contact label {
    margin-bottom: 0.25em;
    font-weight: bold;
}

.contact input,
.contact textarea {
    padding: 0.5em;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.contact button[type="submit"] {
    align-self: center;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.5em 1.5em;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 1px 4px 0 #222, 0 2px 8px rgba(0,0,0,0.15); /* 3D border */
    transition: background 0.2s, color 0.2s, box-shadow 0.15s, transform 0.15s;
}

.contact button[type="submit"]:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

.contact button[type="submit"]:active {
    transform: translate3d(1px, 1px, 1px);
    box-shadow: 1.5px 2px 0 #222, 0 1px 4px rgba(0,0,0,0.1);
}

/* Center Resume Preview section on Home Page */
.resume-preview {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* changed from center */
    text-align: left;        /* ensure text is left-aligned */
    margin: 2rem auto;
    width: 100%;
    max-width: 900px;
    box-sizing: border-box;
}

.resume-preview > h3 {
    text-align: left;
    width: 100%;
}

/* Projects sections styles */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  padding: 1rem 0;
}

.project-preview {
  display: block;
  text-align: center;
  background: #f9f9f9;
  border-radius: 12px;
  padding: 15px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease;
}

.project-preview:hover {
  transform: scale(1.03);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.project-preview img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Center and add padding to the featured projects preview on the home page */
#home-projects {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 2rem 1rem;
    margin: 0 auto;
    max-width: 1100px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

#home-projects > h2 {
    text-align: left;
    width: 100%;
}

/* Consistent left alignment for section titles, NO extra padding */
.section-title {
    font-size: 1.4rem;
    font-weight: bold;
    text-align: left;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
    width: 100%;
    box-sizing: border-box;
    /* padding-left: 1.5rem;  <-- REMOVE THIS LINE */
}

/* Make sure all main sections use the same horizontal padding */
#home-projects,
.resume-preview,
.about {
    padding: 2rem 1rem;
    margin: 0 auto;
    max-width: 1100px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
  /* Remove extra padding reset that breaks alignment */
    /* padding-left: 0;
    padding-right: 0; */
}

/* Fix: Ensure #home-projects uses the same padding as other sections for title alignment */
#home-projects {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 2rem 1rem;
    margin: 0 auto;
    max-width: 1100px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

/* Center the project preview buttons/cards in the grid */
#home-projects .project-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: center; /* center the previews */
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 1rem 0;
    text-align: left;
}

.resume {
    max-width: 900px;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
}

.about-header-flex h2 {
  font-family: var(--font-h2);
  font-size: 3rem;
  font-weight: inherit;   /* changed from 400 */
  letter-spacing: .1rem;
  text-align: center;
  width: 100%;
  margin: 2rem 0 0;
  margin-bottom: 0;
}

.projects h2 {
  font-family: var(--font-h2);
  font-size: 3rem;
  font-weight: inherit;   /* changed from 400 */
  letter-spacing: .1rem;
  text-align: center;
  margin: 2rem 0;
}

.resume h2 {
  font-family: var(--font-h2);
  font-size: 3rem;
  font-weight: inherit;   /* changed from 400 */
  letter-spacing: .1rem;
  text-align: center;
  margin: 0 0 3.5rem;
}

.contact h2 {
  font-family: var(--font-h2);
  font-size: 3rem;
  font-weight: inherit;   /* changed from 400 */
  letter-spacing: .1rem;
  text-align: center;
  margin: 1.5rem 0;
}

.about p {
  text-indent: 2em; /* Indents the first line of each paragraph */
}

/* Visually hide skip link until focused (no stray 1px line) */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  transform: translateY(-150%); /* hide above viewport */
  background: #fff;
  color: #000;
  padding: 8px 12px;
  border: 0;                    /* no border when hidden */
  border-radius: 4px;
  box-shadow: none;
  z-index: 1000;
  display: inline-block;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);     /* reveal */
  border: 2px solid #000;       /* add border only when visible */
  outline: none;
}

/* Visually hidden (accessible) text utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Confirmation page tweaks (simple, centered, matches site) */
.confirmation {
  display: grid;
  place-items: center;
  min-height: 60vh;
  padding: 2rem 1rem;
}
.confirmation-inner {
  text-align: center;
  max-width: 640px;
  width: 100%;
}
.confirm-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 0.75rem;
}
.confirm-actions {
  margin-top: 1rem;
  display: inline-flex;
  gap: 0.75rem;
}
.confirm-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 2px solid currentColor;
  text-decoration: none;
}
.confirm-btn.secondary {
  opacity: 0.9;
}

/* Make the header logo obviously clickable and accessible */
header .header-inner img[role="button"] {
  cursor: pointer;
  outline: none;
}
header .header-inner img[role="button"]:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* FX overlays (ensure above canvas/ui) */
.fx-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
}

/* Crack effect (SVG-based, no image) */
.fx-crack { opacity: 1; transition: opacity 600ms ease; }
.fx-crack.fade { opacity: 0; }
.fx-crack .crack-impact {
  fill: rgba(255,255,255,0.12);
  stroke: rgba(255,255,255,0.45);
  stroke-width: var(--crack-stroke, 1.5); /* scaled thickness */
}
.fx-crack .crack-ray {
  fill: none;
  stroke: rgba(255,255,255,0.9);
  stroke-width: var(--crack-stroke, 1.5); /* scaled thickness */
  filter: drop-shadow(0 0 2px rgba(255,255,255,0.8));
}
