/* ==========================================================================
   Lynn Do — Portfolio
   Built from Figma file "PORTFOLIO" (frames: HOME, WORK, PROJECT, PLAYGROUND, ABOUT)
   ========================================================================== */

:root {
  /* Colors (from Figma) */
  --navy: #0e192f;
  --muted: #a9a5c1;
  --accent: #846bff;
  --white: #ffffff;

  /* Type */
  --font-display: "DotGothic16", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;

  /* Layout (1920 frame: 375 sidebar + 64 gutter + 1412 content + 69 gutter) */
  --sidebar-w: 375px;
  --content-max: 1412px;
  --gutter-l: 64px;
  --gutter-r: 69px;
  --radius: 10px;
  --col-gap: 24px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin: 0; font-weight: 400; }

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: linear-gradient(to right, var(--navy) var(--sidebar-w), var(--white) 0);
}

/* ---------- Sidebar (locked while scrolling) ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--navy);
  overflow: hidden;
}

.sidebar__logo {
  position: absolute;
  top: 66px;
  left: 35px;
  width: 87px;
  height: 96px;
  overflow: hidden;
  z-index: 2;
}

.sidebar__logo img {
  position: absolute;
  max-width: none;
  width: 191.95%;
  height: 100.26%;
  left: -43.68%;
  top: -0.13%;
}

.nav {
  position: absolute;
  top: 366px;
  left: 54px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  display: flex;
  align-items: flex-start;
  gap: 31px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 35px;
  letter-spacing: 2.4px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] { color: var(--white); }

.nav__star {
  width: 25px;
  height: 25px;
  margin-top: 6px;
  display: flex;
  justify-content: center;
  visibility: hidden;
}

.nav a[aria-current="page"] .nav__star { visibility: visible; }

.sidebar__cloud {
  position: absolute;
  left: -1px;
  bottom: 0;
  width: 376px;
  height: min(666px, 45vh);
  object-fit: cover;
  object-position: top center;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Main ---------- */

.main {
  min-width: 0;
  padding: 70px var(--gutter-r) 68px var(--gutter-l);
}

.main > * { max-width: var(--content-max); }

.rule {
  width: 100%;
  height: 1px;
}

/* Page header: star + big title (WORK / PLAYGROUND / ABOUT) */
.page-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: -4px;
  height: 72px;
}

.page-head__star {
  width: 25px;
  height: 25px;
  display: flex;
  justify-content: center;
  align-self: center;
}

.display-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 2.6vw, 50px);
  letter-spacing: 0.09em;
  line-height: 72px;
  color: var(--navy);
}

.page-head + .rule { margin-top: 62px; }

/* ---------- Media ---------- */

.media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f3f3f1;
}

.media > img,
.media > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--hero { aspect-ratio: 1412 / 794; }
.media--card { aspect-ratio: 694 / 390; }
.media--thumb { aspect-ratio: 458 / 258; }
.media--square { aspect-ratio: 1 / 1; }

/* ---------- Captions ---------- */

.caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.caption__title {
  font-size: 20px;
  color: var(--navy);
}

.caption__meta {
  display: flex;
  gap: 29px;
  font-size: 15px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

/* ---------- Cards ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--col-gap);
}

.card { display: block; }

.card .media > img,
.card .media > video { transition: transform 0.6s cubic-bezier(.2, .7, .2, 1), filter 0.3s ease; }

.card:hover .media > img,
.card:hover .media > video,
.card:focus-visible .media > img,
.card:focus-visible .media > video { transform: scale(1.03); }

.card:hover .caption__title { color: var(--accent); }

/* ---------- Home ---------- */

.reel .caption { margin-top: 20px; }
.reel + .rule { margin-top: 82px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 71px 0 49px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 3px;
  line-height: 42px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  font-size: 15px;
  color: var(--navy);
}

.link-arrow img { transition: transform 0.2s ease; }
.link-arrow:hover img { transform: translateX(4px); }

.selected + .rule { margin-top: 76px; }

/* ---------- Footer / back to top ---------- */

.back-top {
  display: flex;
  justify-content: flex-end;
  margin-top: 55px;
}

.back-top a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.back-top a:hover { color: var(--navy); }

.back-top__arrow {
  width: 8px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-top__arrow img { transform: rotate(-90deg); flex: none; }

/* ---------- Work ---------- */

.work-grid {
  margin-top: 75px;
  row-gap: 87px;
}

.work-grid + .rule { margin-top: 99px; }

/* ---------- Playground (justified rows, mixed dimensions) ---------- */

.gallery {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 73px;
}

.gallery__row {
  display: flex;
  gap: 22px;
}

.gallery__item {
  flex: var(--ratio) 1 0%;
  aspect-ratio: var(--ratio);
}

.gallery__item > img,
.gallery__item > video { object-position: var(--pos, center); }

.gallery + .rule { margin-top: 83px; }

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

.about {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 471px);
  gap: 64px;
  margin-top: 82px;
}

.about__bio {
  font-size: 20px;
  line-height: 1.5;
  max-width: 760px;
}

.about__bio p + p { margin-top: 1em; }

/* ---------- Project ---------- */

.crumbs {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  transition: color 0.2s ease;
}

.crumbs a:hover { color: var(--navy); }
.crumbs a img { transform: rotate(180deg); }

.project-title {
  margin-top: 48px;
  padding-left: 12px;
}

.project-info {
  display: grid;
  grid-template-columns: 428px 1px minmax(0, 1fr);
  gap: 0 48px;
  align-items: start;
  margin-top: 28px;
  padding-left: 3px;
  font-size: 20px;
  line-height: 30px;
}

.vline {
  position: relative;
  width: 1px;
  height: 102px;
  margin-top: -4px;
}

.vline img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.project-hero {
  position: relative;
  margin-top: 32px;
}

.project-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.project-nav:hover { opacity: 1; }
.project-nav--prev { left: -46px; }
.project-nav--prev img { transform: rotate(180deg); }
.project-nav--next { right: -56px; }

.project-gallery {
  margin-top: 42px;
  row-gap: 42px;
}

.project-gallery + .rule { margin-top: 96px; }

.process-title { margin-top: 96px; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 33px 18px;
  margin-top: 33px;
}

.grid-3 + .rule { margin-top: 102px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1440px) {
  :root {
    --sidebar-w: 300px;
    --gutter-l: 48px;
    --gutter-r: 48px;
  }
  .sidebar__cloud { width: 100%; }
  .project-info { grid-template-columns: 340px 1px minmax(0, 1fr); gap: 0 32px; }
}

@media (max-width: 1100px) {
  :root { --sidebar-w: 240px; }
  .nav a { gap: 20px; font-size: 20px; }
  .nav { left: 32px; }
  .sidebar__logo { left: 32px; }
  .project-info { grid-template-columns: 1fr; gap: 16px; }
  .vline { display: none; }
  .project-nav--prev { left: 8px; }
  .project-nav--next { right: 8px; }
  .project-nav { background: rgba(255, 255, 255, 0.85); border-radius: 50%; }
}

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; background: var(--white); }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .sidebar__logo {
    position: relative;
    top: auto;
    left: auto;
    width: 44px;
    height: 48px;
    flex: none;
  }

  .nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 16px;
  }

  .nav a { font-size: 15px; line-height: 22px; gap: 6px; letter-spacing: 1.5px; }
  .nav__star { width: 14px; height: 14px; margin-top: 3px; }
  .nav__star img { width: 14px; height: auto; }
  .sidebar__cloud { display: none; }

  .main { padding: 32px 16px 40px; }

  .grid-2,
  .grid-3 { grid-template-columns: 1fr; }
  .work-grid { row-gap: 48px; margin-top: 40px; }
  .gallery__row { flex-direction: column; }
  .gallery__item { flex: none; }
  .about { grid-template-columns: 1fr; gap: 32px; margin-top: 40px; }
  .about__media { order: -1; }

  .display-title { line-height: 1.2; }
  .page-head { height: auto; }
  .page-head + .rule { margin-top: 28px; }
  .section-head { margin: 40px 0 24px; }
  .section-title { font-size: 22px; }
  .nav { gap: 4px 12px; }
  .reel + .rule,
  .selected + .rule,
  .work-grid + .rule,
  .gallery + .rule,
  .project-gallery + .rule,
  .grid-3 + .rule { margin-top: 48px; }
  .process-title { margin-top: 48px; }
  .back-top { margin-top: 32px; }
  .caption { flex-direction: column; gap: 4px; }
  .caption__meta { gap: 16px; }
  .project-title { margin-top: 24px; padding-left: 0; }
  .project-info { font-size: 16px; line-height: 24px; padding-left: 0; }
  .caption__title { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card .media > img,
  .card .media > video { transition: none; }
}
