/* Sawyer Nichols portfolio.
   Colors, type and spacing come from the Figma frame "Desktop - 1". */

/* ---------- Design values ---------- */

:root {
  --bg: #232323;
  --text: #ffffff;
  --muted: #8d8d8d;
  --badge-bg: #434343;

  --font-heading: "Arapey", serif;
  --font-body: "Kumbh Sans", sans-serif;

  --column: 800px;    /* text column and divider width */
  --breakout: 1200px; /* project cards run wider than the text column */
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Keeps the hidden attribute working on elements that set their own display. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-variation-settings: "YOPQ" 300;
  overflow-wrap: break-word;
}

h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

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

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

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

/* For text that search engines and screen readers should get but that is
   not part of the visual design. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Buttons that wrap an image should look like the image, not a form control. */
.project__zoom,
.preview__close {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
}

/* ---------- Page layout ---------- */

.page {
  max-width: calc(var(--breakout) + 48px);
  margin: 0 auto;
  padding: 114px 24px 56px;
}

/* Everything sits in the centered 800px column... */
.page > * {
  max-width: var(--column);
  margin-left: auto;
  margin-right: auto;
}

/* ...with text stopping at 796px, as in the Figma frame... */
.page > section {
  padding-right: 4px;
}

/* ...except the project cards, which break out to 1200px. */
.page > .projects {
  max-width: var(--breakout);
  padding-right: 0;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 400;
}

/* The slight tilt is in the Figma frame's lines. */
.divider {
  width: 100%;
  height: 3px;
  transform: rotate(0.14deg);
}

.divider--after-experience {
  margin-top: 26px;
}

.divider--after-projects {
  margin-top: 29px;
}

/* ---------- About ---------- */

.about__header {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.about__photo {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: 50%;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 29px;
  padding: 0 8px;
  border-radius: 31px;
  background: var(--badge-bg);
  font-size: 10px;
  white-space: nowrap;
}

/* One pixel tighter on the right, to match the Figma badge's width. */
.badge--figma {
  padding-right: 7px;
}

.badge__icon {
  flex: none;
  width: 18px;
  height: 18px;
  object-fit: cover;
}

/* Mirrored, as it is in the Figma frame. */
.badge__icon--adobe {
  transform: scaleX(-1);
}

.badge__icon--figma {
  border-radius: 3px;
}

.about__text {
  margin-top: 45px;
  font-size: 20px;
  line-height: 25px;
}

.about__text p + p {
  margin-top: 25px;
}

/* ---------- Experience ---------- */

.experience {
  margin-top: 80px;
}

.entry {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-top: 13px;
  font-size: 22px;
}

.entry__text {
  line-height: 1.36;
}

.entry__name,
.entry__role {
  display: block;
}

.entry__role,
.entry__date {
  color: var(--muted);
}

.entry__date {
  margin-top: 5px;
  white-space: nowrap;
}

/* ---------- Projects ---------- */

.projects {
  margin-top: 32px;
}

/* Rows of projects, and the row of images inside a series.
   A row is one column unless it sets --cols in the HTML. Each --cols value
   is an image's width divided by its height, so every image in the row
   comes out the same height and nothing is cropped. */
.projects__grid,
.project__images {
  display: grid;
  grid-template-columns: var(--cols, minmax(0, 1fr));
  align-items: end; /* keeps the images level if one label wraps */
  margin-top: 19px;
}

.projects__grid {
  gap: 50px;
}

.projects__grid + .projects__grid {
  margin-top: 50px;
}

.project__images {
  gap: 24px;
}

.project__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  font-size: 22px;
}

.project__title {
  font: inherit;
}

.project__client,
.project__name,
.project__type {
  display: block;
}

.project__name,
.project__type,
.project__date {
  color: var(--muted);
}

.project__type {
  font-size: 20px;
  font-weight: 300; /* Kumbh Sans Light */
}

.project__date {
  white-space: nowrap;
}

/* Each image sits inside a button that opens its larger preview. */
.project__zoom {
  width: 100%;
  margin: 19px 0 0;
  border-radius: 29px;
  cursor: zoom-in;
}

.project__images .project__zoom {
  margin-top: 0;
}

.project__zoom:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}

.project__image {
  width: 100%;
  height: auto;
  border-radius: 29px;
  transition: filter 0.15s ease;
}

.project__zoom:hover .project__image {
  filter: brightness(1.08);
}

/* ---------- Image previews ----------
   Built on the browser's own popover feature, so there is no script:
   the browser handles opening, Esc and clicking outside to close. */

.preview {
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.preview::backdrop {
  background: rgba(0, 0, 0, 0.88);
}

.preview__close {
  cursor: zoom-out;
}

.preview__close img {
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 88vh;
  max-height: 88dvh;
  border-radius: 12px;
}

.preview__hint {
  position: fixed;
  top: 16px;
  right: 20px;
  padding: 6px 12px;
  border-radius: 31px;
  background: var(--badge-bg);
  color: var(--text);
  font-size: 13px;
}

/* Stop the page scrolling behind an open preview. */
html:has(.preview:popover-open) {
  overflow: hidden;
}

/* Browsers without popover support: keep the previews hidden. */
@supports not selector(:popover-open) {
  .preview {
    display: none;
  }
}

/* ---------- Scroll reveal ----------
   The script at the bottom of index.html adds these classes, so without
   scripting nothing is ever hidden. Each item is revealed once and stays. */

.reveal {
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.4s ease-out var(--reveal-delay, 0ms),
    transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) var(--reveal-delay, 0ms);
}

/* Labels rise into place. */
.reveal--rise {
  transform: translateY(16px);
}

/* Images jump up and settle with a slight wobble (see jiggle-pop). */
.reveal--pop {
  transform: translateY(40px) scale(0.92);
  transition: none;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.reveal--pop.is-visible {
  animation: jiggle-pop 0.8s ease-in-out var(--reveal-delay, 0ms) both;
}

/* A faint squash and stretch plus a half-degree rock that dies away in
   two swings. --dir (1 or -1, set by the script) alternates which way
   each image rocks first. */
@keyframes jiggle-pop {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.92);
  }
  34% {
    opacity: 1;
    transform: translateY(-5px) scale(1.01, 1.014) rotate(calc(-0.5deg * var(--dir, 1)));
  }
  56% {
    transform: translateY(2px) scale(1.01, 0.99) rotate(calc(0.35deg * var(--dir, 1)));
  }
  78% {
    transform: translateY(-1px) scale(0.997, 1.004) rotate(calc(-0.15deg * var(--dir, 1)));
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

/* Visitors who ask for less motion see the projects straight away. */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--pop.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
    animation: none;
  }
}

/* ---------- Contact ---------- */

.contact {
  margin-top: 32px;
}

.contact__details {
  margin-top: 31px;
  font-size: 20px;
}

/* Each contact line is a row, so the Copy button sits beside the address
   on a wide screen and tucks underneath it on a narrow one. */
.contact__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--muted);
  border-radius: 31px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.copy-button:hover,
.copy-button:focus-visible {
  border-color: var(--text);
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 32px;
  margin-top: 72px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.footer__note {
  max-width: 470px;
}

/* ---------- Page not found (404.html) ---------- */

.not-found__text {
  margin-top: 31px;
  font-size: 20px;
}

.not-found__text a {
  text-decoration: underline;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 700px) {
  .page {
    padding-top: 64px;
    padding-bottom: 48px;
  }

  .page > section {
    padding-right: 0;
  }

  /* The date drops under the job title. */
  .entry {
    flex-direction: column;
    gap: 4px;
  }

  .entry__date {
    margin-top: 0;
  }

  /* Projects, and the images in a series, stack one per row. */
  .projects__grid,
  .project__images {
    grid-template-columns: 1fr;
  }

  .projects__grid {
    gap: 40px;
  }

  .projects__grid + .projects__grid {
    margin-top: 40px;
  }

  .project__images {
    gap: 16px;
  }

  .contact__row + .contact__row {
    margin-top: 10px;
  }

  .footer__note {
    max-width: none;
  }
}
