/* ==========================================================================
   Murray Hossick — Sound Design Portfolio
   Base styles, layout grid, and shared components
   ========================================================================== */

/* Inter is loaded with <link> tags in each page's <head> (see fonts note there) */

:root {
  --color-bg: #ffffff;
  --color-text: #121212;
  --color-text-secondary: #5f5f5f;  /* AA on white (≈6.3:1) */
  --color-text-faint: #767676;      /* lightest grey that still passes AA on white */
  --color-border: #e6e6e6;
  --color-brand: #0118D8;       /* blue: home hero name, link hovers, focus ring */

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Type scale */
  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-base: 17px;
  --fs-lg: 22px;
  --fs-xl: 26px;
  --fs-display: 56px;

  --nav-height: 64px;
  --col-side-width: 340px;
  --container-max: 1600px;

  --transition-fast: 0.2s ease;
  --transition-med: 0.4s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Visible keyboard focus everywhere (mouse clicks don't trigger it) */
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 12px;
}

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

ul, li {
  list-style: none;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, p {
  margin: 0;
}

/* ---------- Top navigation ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--nav-height);
  padding: 0 32px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-nav__brand {
  grid-column: 1;
  justify-self: start;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.site-nav__brand:hover {
  color: var(--color-brand);
}

.site-nav__links {
  grid-column: 2;
  display: flex;
  gap: 4px;
  font-size: var(--fs-sm);
}

.site-nav__links a {
  position: relative;
  padding: 8px 10px;
  font-weight: 500;
  color: var(--color-text-faint);
  transition: color var(--transition-fast);
}

/* Underline marks the current page; same weight for every state so nothing shifts */
.site-nav__links a::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-fast);
}

.site-nav__links a:hover,
.site-nav__links a.is-active {
  color: var(--color-text);
}

.site-nav__links a:hover::after,
.site-nav__links a.is-active::after {
  transform: scaleX(1);
}

/* Contact icons, top right on every page */
.site-nav__socials {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav__socials a {
  width: 18px;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.site-nav__socials a:hover {
  transform: translateY(-1px);
}

.site-nav__socials a:hover {
  color: var(--color-text);
}

.site-nav__socials svg {
  display: block;
  width: 100%;
}

/* ---------- Three column layout ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--col-side-width) 1fr var(--col-side-width);
  min-height: calc(100vh - var(--nav-height));
  max-width: var(--container-max);
  margin: 0 auto;
}

.layout__col--left,
.layout__col--right {
  border-right: 1px solid var(--color-border);
  padding: 48px 32px;
}

.layout__col--right {
  border-right: none;
  border-left: 1px solid var(--color-border);
}

.layout__col--left {
  position: sticky;
  top: var(--nav-height);
  align-self: start;
  height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.layout__col--right {
  position: sticky;
  top: var(--nav-height);
  align-self: start;
  height: calc(100vh - var(--nav-height));
}

.layout__col--center {
  padding: 48px 40px;
  min-width: 0;
}

/* Single centred column for interior pages (info, contact, projects) */
.layout--single {
  grid-template-columns: 1fr;
}

.layout--single .layout__col--center {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

/* Wider variant so the work grid gets room to breathe */
.layout--wide .layout__col--center {
  max-width: 1280px;
}

/* ---------- Hero (left column, home) ---------- */

.hero-name {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
  color: var(--color-brand);
}

/* Status + contact, pinned to the bottom of the left column */
.hero-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.hero-status a {
  align-self: flex-start;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.hero-status a:hover {
  color: var(--color-brand);
  border-color: var(--color-brand);
}

/* ---------- Right column (portrait / tags) ---------- */

.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  margin-bottom: 16px;
  border-radius: 4px;
}

.portrait-tags {
  text-align: right;
  color: var(--color-text);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* ---------- Intro copy + showreel block ---------- */

.intro-copy {
  font-size: var(--fs-lg);
  line-height: 1.4;
  max-width: 640px;
  margin-bottom: 40px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
  cursor: pointer;
  margin-bottom: 64px;
  border-radius: 4px;
}

.video-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

/* Home showreel: tighter gap so the work grid starts above the fold */
.video-frame--reel {
  margin-bottom: 40px;
}

.video-frame img {
  transition: opacity var(--transition-med), transform var(--transition-med);
}

.video-frame:hover img {
  opacity: 0.95;
}

.video-frame__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.video-frame:hover .video-frame__play,
.video-frame__play:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  background: #fff;
}

.video-frame__play:focus-visible {
  outline-offset: 4px;
  border-radius: 50%;
}

.video-frame__play svg {
  width: 22px;
  height: 22px;
  margin-left: 3px;
}

/* ---------- Page titles ----------
   One style for every page's main heading (work, contact, projects).
   Always black; blue is kept for the home hero name and link hovers. */

.page-title {
  font-size: var(--fs-display);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* ---------- Section labels ---------- */

.section-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
}

/* ---------- Selected work / project list ---------- */

.work-card {
  display: block;
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
}

.work-card:last-child {
  border-bottom: 1px solid var(--color-border);
}

.work-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f2f2f2;
  margin-bottom: 16px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--transition-med), transform var(--transition-med);
}

.work-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-med);
}

.work-card:hover .work-card__thumb,
.work-card:focus-visible .work-card__thumb {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 14px 28px -12px rgba(0, 0, 0, 0.3);
}

.work-card:hover .work-card__thumb img,
.work-card:focus-visible .work-card__thumb img {
  transform: scale(1.04);
}

/* For source images much wider than the 4:3 box: zoom in less than a full
   cover-crop would, trading a thin letterboxed margin for keeping edge
   content (titles, side art) from being cropped off. */
.work-card__thumb--reduced-zoom {
  display: flex;
  align-items: center;
  justify-content: center;
}

.work-card__thumb--reduced-zoom img {
  width: 142%;
  height: auto;
  max-width: none;
  object-fit: unset;
}

.work-card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.work-card:hover .work-card__overlay,
.work-card:focus-visible .work-card__overlay {
  opacity: 1;
}

.work-card__overlay span {
  color: #fff;
  font-weight: 600;
  font-size: 18px;
}

.work-card__meta {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: var(--fs-sm);
}

.work-card__meta .title {
  font-weight: 600;
  transition: color var(--transition-fast);
}

.work-card:hover .work-card__meta .title {
  color: var(--color-brand);
}

/* Category sits next to the title; year is pushed to the right edge */
.work-card__meta .year {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.work-card__meta .category {
  color: var(--color-text-secondary);
}

.work-card__meta .year {
  color: var(--color-text-secondary);
}

/* ---------- Work grid page ---------- */

.work-page-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 40px;
  gap: 20px;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: var(--fs-sm);
}

/* Pill-style filters; weight never changes so the row doesn't jump */
.filter-list button {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font: inherit;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 6px 14px;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.filter-list button:hover {
  color: var(--color-text);
  border-color: var(--color-text-faint);
}

.filter-list button.is-active {
  color: var(--color-bg);
  background: var(--color-text);
  border-color: var(--color-text);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px 24px;
}

.layout--wide .work-grid {
  grid-template-columns: repeat(3, 1fr);
}

.work-grid .work-card {
  border: none;
  padding: 0;
}

.work-grid .work-card__thumb {
  margin-bottom: 12px;
}

/* "View all work" link under the curated homepage grid */
.view-all-link {
  display: inline-block;
  margin-top: 28px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.view-all-link:hover {
  color: var(--color-brand);
  transform: translateX(3px);
}

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

.about-intro {
  font-size: var(--fs-xl);
  line-height: 1.4;
  max-width: 640px;
  margin-bottom: 16px;
}

.about-body {
  color: var(--color-text-secondary);
  font-size: var(--fs-base);
  line-height: 1.6;
  max-width: 640px;
  margin-bottom: 64px;
}

.faq-list {
  border-top: 1px solid var(--color-border);
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-item__question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 500;
  text-align: left;
  padding: 20px 0;
  cursor: pointer;
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.faq-item__question:hover {
  color: var(--color-brand);
}

.faq-item__icon {
  font-size: 20px;
  font-weight: 300;
  color: var(--color-text-secondary);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
  margin-left: 16px;
}

.faq-item.is-open .faq-item__icon {
  transform: rotate(45deg);
}

/* Height is set from JS (scrollHeight) when opened, so long answers never clip */
.faq-item__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-med);
  color: var(--color-text-secondary);
  font-size: 16px;
  line-height: 1.6;
}

.faq-item__answer p {
  padding-bottom: 20px;
  max-width: 600px;
}

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

.contact-heading {
  margin-bottom: 24px;
}

.contact-copy {
  color: var(--color-text-secondary);
  font-size: var(--fs-base);
  line-height: 1.5;
  max-width: 520px;
  margin-bottom: 24px;
}

.contact-note {
  color: var(--color-text-secondary);
  font-size: 16px;
  margin-bottom: 48px;
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 20px 0;
}

.contact-row a.email {
  font-weight: 600;
  font-size: var(--fs-base);
  transition: color var(--transition-fast);
}

.contact-row a.email:hover {
  color: var(--color-brand);
}

.contact-row .socials {
  display: flex;
  gap: 16px;
}

.contact-row .socials a {
  width: 18px;
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.contact-row .socials a:hover {
  color: var(--color-text);
}

/* ---------- Project detail page ---------- */

.project-header {
  margin-bottom: 32px;
}

/* Key facts row: Role · Year · Tools */
.project-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 48px;
  margin: 24px 0 0;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.project-facts dt {
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.project-facts dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.project-section {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--color-text);
  margin: 48px 0 12px;
}

.project-section:first-child {
  margin-top: 0;
}

.project-body {
  max-width: 720px;
  color: var(--color-text-secondary);
  font-size: var(--fs-base);
  line-height: 1.7;
}

.project-body p {
  margin-bottom: 20px;
}

.project-body ul,
.project-body ol {
  margin-bottom: 20px;
  padding-left: 22px;
}

.project-body li {
  list-style: square;
  margin-bottom: 8px;
}

.project-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding: 24px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.prev-project,
.next-project {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.next-project {
  align-items: flex-end;
  text-align: right;
  margin-left: auto;
}

.prev-project:hover .next-project__title {
  color: var(--color-brand);
}

.next-project__label {
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
}

.next-project__title {
  font-size: var(--fs-lg);
  font-weight: 600;
  transition: color var(--transition-fast);
}

.next-project:hover .next-project__title {
  color: var(--color-brand);
}

.back-link {
  display: inline-block;
  margin-bottom: 32px;
  font-size: var(--fs-sm);
  color: var(--color-text-secondary);
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--color-text);
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .layout__col--left,
  .layout__col--right {
    position: static;
    height: auto;
    border: none;
    border-bottom: 1px solid var(--color-border);
    padding: 32px;
  }

  .layout__col--right {
    display: flex;
    align-items: center;
    gap: 24px;
  }

  .layout__col--right .portrait {
    width: 140px;
    margin-bottom: 0;
  }

  .layout__col--center {
    padding: 32px;
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .layout--wide .work-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  :root {
    --fs-display: 38px;
    --fs-lg: 20px;
    --fs-xl: 20px;
  }

  .layout__col--left,
  .layout__col--right {
    padding: 24px 16px;
  }

  .layout__col--center {
    padding: 24px 16px;
  }

  .hero-name {
    margin-bottom: 20px;
  }

  /* Phone: links on the left, icons pinned to the right edge */
  .site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: 4px 12px 0;
  }

  /* Row 1: brand left, icons right. Row 2: page links. */
  .site-nav__brand {
    grid-column: auto;
    order: 1;
    padding: 10px 8px 6px;
  }

  .site-nav__socials {
    order: 2;
  }

  .site-nav__links {
    order: 3;
    width: 100%;
  }

  .site-nav__links {
    grid-column: auto;
    font-size: var(--fs-sm);
    gap: 0;
  }

  .site-nav__socials {
    grid-column: auto;
  }

  .site-nav__links a {
    padding: 12px 8px;
  }

  .site-nav__links a::after {
    left: 8px;
    right: 8px;
  }

  .site-nav__socials {
    gap: 12px;
  }

  .site-nav__socials a {
    width: 16px;
  }

  .layout--wide .work-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .work-card:hover .work-card__thumb,
  .work-card:hover .work-card__thumb img,
  .view-all-link:hover {
    transform: none;
  }
}
