/* ==========================================================================
   Joanna Cheung — portfolio
   Built from Figma: Desktop/Mobile Homepage + Desktop/Mobile Detail Page
   Mobile-first. Desktop layout kicks in at 768px.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts
   "JHA Times Now Condensed" is a licensed font — drop the .woff2 files into
   /assets/fonts/ using the names below. Until then it falls back to Times.
   Inter is loaded from Google Fonts in each page's <head>.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "JHA Times Now Cn Regular";
  src: url("../assets/fonts/JHA_Times_Now_Cn_Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JHA Times Now Cn Extra Light";
  src: url("../assets/fonts/JHA_Times_Now_Cn_ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  --color-bg: #ffffff;
  --color-text: #000000;
  --color-placeholder: #FFFFFF;
  --color-rule: #000000;
  --color-desc: #313131;   /* project one-liner on homepage cards */

  --font-display: "JHA Times Now Cn Regular", "Times New Roman", Times, serif;
  --font-serif-body: "JHA Times Now Cn Extra Light", "Times New Roman", Times, serif;
  --font-body: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --fs-display: 22px;   /* names, project titles, "Contact" */
  --fs-lede: 22px;      /* detail page paragraph (Cn ExtraLight) — 28px on desktop */
  --fs-body: 14px;
  --fs-skill: 11px;     /* uppercase skill line — 12px on desktop */

  --page-gutter: 20px;  /* 80px on desktop */
  --page-max: 1280px;
  --gap: 40px;          /* space between cards / images, both breakpoints */
}

@media (min-width: 768px) {
  :root {
    --fs-lede: 28px;
    --fs-skill: 12px;
    --page-gutter: clamp(24px, 5.5vw, 80px);
  }
}

/* --------------------------------------------------------------------------
   Reset + base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
img { display: block; max-width: 100%; }
ul { list-style: none; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.desktop-only { display: none; }
@media (min-width: 768px) {
  .desktop-only { display: inline; }
  .mobile-only { display: none; }
}

.page {
  width: 100%;
  max-width: calc(var(--page-max) + var(--page-gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}

/* --------------------------------------------------------------------------
   Site header  (name + bio)
   -------------------------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-top: 24px;
  max-width: 620px;
}
.page-detail .site-header { gap: 24px; }

.site-header__id { flex-shrink: 0; white-space: nowrap; }
.site-header__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 1;
}
.page-detail .site-header__name { line-height: 30px; }
.site-header__since { display: block; }
.site-header__bio { flex: 1 1 0; min-width: 0; }
.site-header__bio br { display: none; }   /* line break is desktop-only */

@media (min-width: 768px) {
  .site-header,
  .page-detail .site-header { gap: 24px; align-items: flex-end; }
  .site-header,
  .page-detail .site-header { padding-top: 48px; }
  .site-header__bio br { display: inline; }
}

/* --------------------------------------------------------------------------
   Homepage — project grid
   -------------------------------------------------------------------------- */
.work {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin-top: 40px;
}

.card { display: flex; flex-direction: column; gap: 8px; }
.card__link { display: contents; }

.card__media {
  background: var(--color-placeholder);
  aspect-ratio: 362 / 270;          /* mobile: landscape */
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.card__media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__text { display: flex; flex-direction: column; gap: 4px; }
.card__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  font-weight: 300;
}
.card__name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 30px;
  white-space: nowrap;
}
.card__desc { font-size: var(--fs-body); line-height: 1.5; padding-bottom: 4px; color: var(--color-desc); }
.card__skills {
  font-size: var(--fs-skill);
  line-height: 1.2;
  text-transform: uppercase;
}

.card:hover .card__media,
.card:focus-within .card__media { opacity: 0.8; }

@media (min-width: 768px) {
  .work { grid-template-columns: repeat(3, 1fr); }   /* 1 column on mobile, 3 from 768px up */
  .card__media { aspect-ratio: 400 / 535; }   /* desktop: portrait */
  .card__title { column-gap: 16px; }
}

/* --------------------------------------------------------------------------
   Detail page
   -------------------------------------------------------------------------- */
.lede {
  font-family: var(--font-serif-body);
  font-weight: 200;
  font-size: var(--fs-lede);
  line-height: 30px;
  max-width: 620px;
}


.project {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin-top: 40px;
}

/* On mobile the intro sits inside the flow, after the first two images */
.project__intro--top { display: none; }

.shot {
  background: var(--color-placeholder);
  aspect-ratio: 362 / 485;           /* mobile: tall */
  overflow: hidden;
}
.shot--short { aspect-ratio: 362 / 270; }
.shot--shorter { aspect-ratio: 362 / 210; }
.shot--full  { aspect-ratio: 1280 / 720; }   /* 16:9, full width on both breakpoints */
.shot img { width: 100%; height: 100%; object-fit: contain; }
.shot video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;   /* use "contain" to show the whole frame instead of cropping */
}

.shot--video { background: #000; }
.shot--video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (min-width: 768px) {
  .project__intro--top {
    display: block;
    margin-top: 36px;
  }
  .project { grid-template-columns: repeat(2, 1fr); margin-top: 40px; }
  .project .lede--flow { padding-top: 40px; line-height: 1.2; }
  .shot--full { grid-column: 1 / -1; }
  .shot { aspect-ratio: 620 / 704; }
  .shot--short { aspect-ratio: 620 / 546; }
  .shot--shorter { aspect-ratio: 620 / 380; }
  .shot--full  { aspect-ratio: 1280 / 720; }
}

/* --------------------------------------------------------------------------
   Footer — contact
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 40px;
  padding-bottom: 40px;
}
.site-footer__inner {
  border-top: 1px solid var(--color-rule);
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 8px;
  white-space: nowrap;
}

/* Hide images that haven't been added yet so the grey placeholder shows */
img.is-missing { visibility: hidden; }
.site-footer__heading {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 30px;
}
.site-footer a:hover { text-decoration: underline; }

@media (min-width: 768px) {
  .site-footer { margin-top: 80px; padding-bottom: 80px; }
  .site-footer__inner { justify-content: flex-start; column-gap: 24px; }
}

.page-detail main a {
  font-family: var(--font-body);   /* Inter */
  font-weight: 300;                /* Light */
  font-size: var(--fs-body);       /* 14px */
  line-height: 1.5;
  color: var(--color-desc);        /* #313131 */
  text-decoration: underline;      /* remove this line if you don't want underlines */
  text-underline-offset: 3px;
}
.page-detail main a:hover { color: var(--color-text); }

.detail-link {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--color-desc);
}