/* ======================================================
   COLORS AND FONTS
   Change a value here and it changes everywhere it's used.
   ====================================================== */
:root {
  --navy: #13294B;      /* main dark blue */
  --carolina: #7BAFD4;  /* Carolina blue */
  --white: #FFFFFF;
  --sky: #E6F0F8;       /* very pale blue for small tags */
  --deep: #0C1C36;      /* darkest blue: book spine and footer */

  --font-display: "Fraunces", Georgia, serif;          /* big, bouncy lettering */
  --font-body: "Figtree", "Helvetica Neue", Arial, sans-serif; /* everything else */

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* a motion that overshoots a little, like a bounce */
}


/* ======================================================
   WHOLE PAGE
   ====================================================== */
html {
  scroll-behavior: smooth; /* nav links glide to each section */
}

body {
  margin: 0;
  background-color: var(--white);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Stops the page from scrolling while the cover is closed */
body.cover-is-closed {
  overflow: hidden;
}

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

/* A clear outline when someone moves through the page with the Tab key */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--carolina);
  outline-offset: 4px;
}

/* Settings shared by all the big Fraunces lettering */
.cover-name,
.section-title,
.header-name,
.project-title,
.contact-value,
.about-text p:first-child {
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "SOFT" 50, "WONK" 0; /* softly rounded, upright letter shapes */
}

/* The biggest lettering uses Fraunces' "display" shapes:
   sharper, with thin and thick strokes, like your screenshot */
.cover-name,
.section-title {
  font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0;
}


/* ======================================================
   BOUNCY LETTERS
   JavaScript wraps each letter of anything marked "bouncy"
   in its own box, so each letter can drop in and hop on its own.
   The letters always sit straight and in line.
   ====================================================== */
.word {
  display: inline-block;
  white-space: nowrap; /* keeps each word in one piece */
}

.letter {
  display: inline-block;
  transition: transform 0.3s var(--spring);
}

/* Point at a letter and it hops up (only on computers with a mouse) */
@media (hover: hover) {
  .letter:hover {
    transform: translateY(-0.14em);
  }
}


/* ======================================================
   THE COVER
   A navy book cover that swings open from its left edge.
   ====================================================== */
.cover-stage {
  position: fixed;     /* sits on top of the whole screen */
  inset: 0;
  z-index: 100;
  perspective: 2500px; /* gives the swing its 3D depth */
}

.cover {
  position: absolute;
  inset: 0;
  background-color: var(--navy);
  /* two faint stripe patterns that look like book cloth */
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px);
  transform-origin: left center; /* the "hinge" is on the left */
  backface-visibility: hidden;
  /* closing: the cover reappears quickly, then swings shut over 1.3 seconds */
  transition:
    transform 1.3s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.3s ease;
}

/* The darker strip down the left side, like a book spine */
.cover::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 22px;
  background: linear-gradient(90deg, var(--deep), #1A3561 70%, #0F2242);
  border-right: 1px solid rgba(123, 175, 212, 0.4);
}

/* The border inside the cover */
.cover-frame {
  position: absolute;
  top: clamp(24px, 5vw, 56px);
  right: clamp(24px, 5vw, 56px);
  bottom: clamp(24px, 5vw, 56px);
  left: calc(22px + clamp(24px, 5vw, 56px));
  border: 2px solid var(--carolina);
  display: flex;             /* stacks the name and button and centers them */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  text-align: center;
}

/* Your name: big and white, with a Carolina blue shadow */
.cover-name {
  margin: 0;
  color: var(--white);
  font-size: clamp(3.5rem, 13vw, 11rem);
  line-height: 1.05;
  white-space: nowrap;       /* keeps your whole name on one line */
  text-shadow: 0.05em 0.05em 0 var(--carolina);
}

/* On the cover, the letters drop in one after another when the page loads */
.cover-name .letter {
  animation: letter-drop 0.8s var(--spring) backwards;
  animation-delay: calc(var(--i) * 70ms + 150ms);
}

@keyframes letter-drop {
  from {
    transform: translateY(-1.2em);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* The "Open" button */
.cover-button {
  margin-top: clamp(2.5rem, 7vh, 4rem);
  padding: 0.75em 2.6em;
  background-color: var(--white);
  border: none;
  border-radius: 999px; /* fully rounded ends */
  color: var(--navy);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.3s var(--spring);
}

.cover-button:hover {
  background-color: var(--carolina);
  transform: scale(1.06);
}

/* When "Open" is clicked, JavaScript adds "cover-is-open" to the page,
   and these rules swing the cover away and fade it out */
body.cover-is-open .cover {
  transform: rotateY(-105deg);
  opacity: 0;
  transition:
    transform 1.3s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.5s ease 0.8s;
}

/* The site starts slightly small, then settles into place as the cover opens */
.site {
  transform: scale(0.96);
  transition: transform 1.3s cubic-bezier(0.65, 0, 0.35, 1);
}

body.cover-is-open .site {
  transform: none;
}


/* ======================================================
   HEADER (top bar)
   ====================================================== */
.site-header {
  position: sticky;  /* stays at the top while you scroll */
  top: 0;
  z-index: 10;
  display: flex;     /* name on the left, links on the right */
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem clamp(1.25rem, 4vw, 3rem);
  background-color: var(--navy);
}

.header-name {
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.site-nav a {
  color: var(--white);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.site-nav a:hover {
  color: var(--carolina);
  border-bottom-color: var(--carolina);
}


/* ======================================================
   SECTIONS (Work, About and Contact share these)
   ====================================================== */
.work,
.about,
.contact {
  padding: clamp(3.5rem, 8vw, 6.5rem) clamp(1.25rem, 4vw, 3rem);
  scroll-margin-top: 3.5rem; /* so the header doesn't cover the section title */
}

/* Keeps the content of every section lined up on the same edges */
.section-title,
.project-grid,
.about-content,
.contact-links {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

/* "work", "about" and "contact": huge, bouncy, with a shadow */
.section-title {
  --title-shadow: var(--carolina); /* shadow color; changed per section below */
  margin-top: 0;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  color: var(--navy);
  font-size: clamp(3.25rem, 9vw, 6.5rem);
  line-height: 1;
  text-shadow: 0.05em 0.05em 0 var(--title-shadow);
}


/* ======================================================
   WORK
   ====================================================== */
/* Lines the cards up in rows. When the screen gets narrow,
   cards wrap onto the next row automatically. */
.project-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3.5rem 2.5rem;
}

.project-card {
  flex: 1 1 280px;   /* each card is about 280px wide or more */
  max-width: 360px;  /* but never wider than 360px */
  display: flex;
  flex-direction: column;
  transition: transform 0.35s var(--spring);
}

/* All project images are cropped to the same shape (4 wide by 3 tall) */
.project-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 2px solid var(--navy);
  border-radius: 12px;
  transition: box-shadow 0.35s var(--spring);
}

/* On hover, the card lifts and a Carolina blue block appears behind the image */
@media (hover: hover) {
  .project-card:hover {
    transform: translateY(-6px);
  }

  .project-card:hover .project-image {
    box-shadow: 10px 10px 0 var(--carolina);
  }
}

/* Same block when someone reaches the card's link with the Tab key */
.project-card:focus-within .project-image {
  box-shadow: 10px 10px 0 var(--carolina);
}

/* The small rounded tag above each title */
.project-type {
  align-self: flex-start;
  margin: 1.25rem 0 0.6rem;
  padding: 0.25em 0.85em;
  background-color: var(--sky);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.project-title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  line-height: 1.15;
}

.project-description {
  margin: 0 0 1.1rem;
}

/* "View project" link, always at the bottom of the card */
.project-link {
  margin-top: auto;
  align-self: flex-start;
  color: var(--navy);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--carolina);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.project-link:hover {
  text-decoration-color: var(--navy);
}


/* ======================================================
   ABOUT
   ====================================================== */
.about {
  background-color: var(--carolina);
}

.about .section-title {
  --title-shadow: var(--white);
}

/* Photo on the left, words on the right */
.about-content {
  display: flex;
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
}

/* Your photo in a white frame with a navy block behind it.
   When you point at it, it lifts and the block grows. */
.about-photo-frame {
  width: 300px;
  flex: none;
  padding: 12px;
  background-color: var(--white);
  border-radius: 6px;
  box-shadow: 12px 12px 0 var(--navy);
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--spring);
}

@media (hover: hover) {
  .about-photo-frame:hover {
    transform: translate(-4px, -4px);
    box-shadow: 16px 16px 0 var(--navy);
  }
}

.about-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
}

.about-text {
  max-width: 36em;
}

.about-text p {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  line-height: 1.7;
}

/* The first paragraph is bigger and in Fraunces, like an opening line */
.about-text p:first-child {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  line-height: 1.3;
}


/* ======================================================
   CONTACT
   ====================================================== */
.contact {
  background-color: var(--navy);
  color: var(--white);
}

.contact .section-title {
  color: var(--white);
}

/* Three big link boxes in a row; they stack on small screens */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.contact-card {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.6rem 1.75rem;
  border: 2px solid var(--carolina);
  border-radius: 16px;
  color: var(--white);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, transform 0.35s var(--spring);
}

.contact-label {
  color: var(--carolina);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.contact-value {
  font-size: clamp(1.2rem, 1.9vw, 1.45rem);
  line-height: 1.2;
  overflow-wrap: anywhere; /* long email addresses wrap instead of spilling out */
}

/* On hover, the box fills with Carolina blue and lifts */
.contact-card:hover,
.contact-card:focus-visible {
  background-color: var(--carolina);
  color: var(--navy);
  transform: translateY(-4px);
}

.contact-card:hover .contact-label,
.contact-card:focus-visible .contact-label {
  color: var(--navy);
}


/* ======================================================
   FOOTER
   ====================================================== */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
  background-color: var(--deep);
  color: var(--white);
}

.footer-copyright {
  margin: 0;
  font-size: 0.95rem;
}

/* "Close the book" button */
.close-book-button {
  padding: 0.55em 1.4em;
  background-color: transparent;
  border: 2px solid var(--carolina);
  border-radius: 999px;
  color: var(--carolina);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.close-book-button:hover {
  background-color: var(--carolina);
  color: var(--navy);
}


/* ======================================================
   PHONES AND SMALL SCREENS
   These rules only apply when the screen is 700px wide or less.
   ====================================================== */
@media (max-width: 700px) {
  /* Header: name on top, links underneath */
  .site-header {
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
  }

  .work,
  .about,
  .contact {
    scroll-margin-top: 5.5rem;
  }

  /* About: photo on top, words underneath */
  .about-content {
    flex-direction: column;
  }

  .about-photo-frame {
    width: min(260px, 75%);
  }

  /* Footer: stacked and centered */
  .site-footer {
    flex-direction: column;
    text-align: center;
  }

  .cover::before {
    width: 14px;
  }

  .cover-frame {
    left: calc(14px + clamp(24px, 5vw, 56px));
    padding: 0.75rem;
  }

  /* Name size on phones, sized so "emery king" fills the cover on one line */
  .cover-name {
    font-size: clamp(2.5rem, 15vw, 5rem);
  }
}


/* ======================================================
   For visitors whose computers ask for less motion:
   no swinging, dropping or tilting. The cover simply fades.
   ====================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cover,
  body.cover-is-open .cover {
    transform: none;
    transition: opacity 0.4s ease;
  }

  .site {
    transform: none;
    transition: none;
  }

  .cover-name .letter {
    animation: none;
  }

  .letter,
  .project-card,
  .contact-card,
  .about-photo-frame {
    transition: none;
  }
}
