/* Layout: centred name, cover grid; project pages are one continuous column of exported frames. */
:root {
  --ink: #f2f1ec;     /* paper colour, shows under the grid background */
  --stage: #e4e7ee;   /* behind images while they load */
  --line: #b8c6dc;    /* placeholder borders, matches the grid lines */
  --text: #4a3b32;    /* logo brown */
  --muted: #7a6c63;
  --gold: #e0a21b;    /* focus ring */
  --shadow: 4px 6px 3px rgba(77, 61, 53, 0.4);    /* from Figma: X4 Y6 blur 3, #4D3D35 40% */
  --inner: inset 0 2px 2px rgba(255, 255, 255, 0.4);  /* Figma inner shadow: Y2 blur 2, #FFFFFF 40% */
  --radius: 8px;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  padding-inline: clamp(16px, 4vw, 64px);
  padding-block: 0;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.wrap { max-width: 1520px; margin-inline: auto; }

/* Header: Work on the left, name centred */
.bar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding-block: clamp(28px, 5vw, 56px);
}
.bar .logo {
  margin: 0; justify-self: center; display: block;
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.25rem, 0.8rem + 1.6vw, 2rem); letter-spacing: 0.02em; text-align: center;
}
.bar .logo img { width: clamp(280px, 28vw + 160px, 620px); max-width: 100%; height: auto; }
.bar:not(:has(nav)) .logo { grid-column: 1 / -1; justify-self: center; }

/* Project pages: Home button on the left, logo on the right at 85% */
.bar:has(nav) { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bar:has(nav) .logo { order: 1; min-width: 0; flex: 0 1 auto; }
.bar:has(nav) nav { order: 0; flex: none; }
.bar:has(nav) .spacer { display: none; }
.bar:has(nav) .logo img { width: clamp(238px, 24vw + 136px, 527px); }

/* Home grid: covers only */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 48px);  /* about 10% of a cover's width */ padding-bottom: clamp(48px, 8vw, 96px); }
.cover { display: block; position: relative; }
.cover .frame { aspect-ratio: 16 / 9; }
.cover .frame { box-shadow: var(--shadow); }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease, filter 0.4s ease; }
.cover .frame { overflow: hidden; border-radius: var(--radius); }
.cover .ph { border-radius: var(--radius); }
.cover:hover img { transform: scale(1.03); }
.cover .frame::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: var(--inner); pointer-events: none; }

/* Hover overlay: project name + year on a paper-coloured veil */
.cover .info {
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-content: center; gap: 6px; padding: 16px; text-align: center;
  background: rgba(242, 241, 236, 0.78);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  color: var(--text);
  opacity: 0; transition: opacity 0.25s ease;
}
.cover .info { font-family: "Titan One", var(--display); font-weight: 400; }
.cover .info strong { font-weight: 400; font-size: clamp(1.05rem, 0.6rem + 1vw, 1.5rem); line-height: 1.15; text-wrap: balance; }
.cover .info span { font-size: clamp(0.95rem, 0.7rem + 0.5vw, 1.15rem); color: var(--muted); }
.cover:hover .info, .cover:focus-visible .info { opacity: 1; }

/* Project page: stacked frames, no gaps so they read as one long board */
.stack { max-width: 1400px; margin-inline: auto; display: grid; gap: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.stack .frame { background: transparent; }
.stack img { width: 100%; height: auto; }

/* Image frame + placeholder shown until the file exists */
.frame { position: relative; background: var(--stage); max-width: 100%; }
.ph {
  aspect-ratio: var(--ar, 16 / 9); max-width: 100%; height: 100%;
  display: grid; place-content: center; gap: 6px; text-align: center; padding: 16px;
  border: 1.5px dashed var(--line); color: var(--muted); font-size: 0.875rem;
}
.ph strong { color: var(--text); font-weight: 600; font-size: 1rem; }
.ph span { overflow-wrap: anywhere; }
.frame:has(img) .ph { display: none; }

/* Custom background image: fixed behind everything; the ink colour shows until/unless the file exists */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: var(--ink) url("images/ui/background.jpg") center / cover no-repeat;
}

/* Image buttons (Work, Back to work, Back to top) with text fallback */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 1rem/1 var(--body); letter-spacing: 0.04em; color: var(--muted);
  transition: transform 0.15s ease, filter 0.15s ease;
  transform: rotate(var(--rot, 0deg));
}
/* Sketchy tilt: Home leans left, UP! leans right */
.bar nav .btn, .after a.btn { --rot: -5deg; }
.to-top { --rot: 5deg; }
.btn img { height: clamp(64px, 3vw + 44px, 92px); width: auto; }
.btn:hover { color: var(--text); filter: brightness(1.06); transform: translateY(-2px) rotate(var(--rot, 0deg)); }
.btn:active { transform: translateY(1px) rotate(var(--rot, 0deg)); }
.btn[aria-current="page"] { color: var(--text); }
.btn:has(img) .fallback, .logo:has(img) .fallback { display: none; }

/* Footer: social icons, centred under the projects */
.foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px 28px; padding-block: 8px 56px; }
.foot .btn img { height: 32px; width: 32px; object-fit: contain; }

/* Notification badge on the featured cover */
.cover .badge {
  position: absolute; top: -18px; right: -18px; z-index: 2; rotate: 5deg;
  width: clamp(36px, 1.5vw + 26px, 48px); height: auto; pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .cover .badge { animation: nudge 2.4s ease-in-out infinite; transform-origin: 50% 80%; }
  @keyframes nudge { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-12deg); } 82% { transform: rotate(10deg); } 88% { transform: rotate(-6deg); } 94% { transform: rotate(3deg); } }
}

/* Bottom of project page */
.after { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding-block: 48px 32px; max-width: 1400px; margin-inline: auto; color: var(--muted); font-weight: 500; }
.after a:hover { color: var(--text); }

@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .cover img, .btn, .cover .info { transition: none; } }
@media (max-width: 560px) { .bar .spacer { display: none; } }
@media (max-width: 560px) { .cover .badge { top: -12px; right: -10px; } }

/* Clickable area on top of a project image (e.g. the gameplay video) */
.hotspot { position: absolute; z-index: 1; border-radius: 12px; cursor: pointer; transition: box-shadow 0.2s ease, background-color 0.2s ease; }
.hotspot:hover { background-color: rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 0 24px rgba(255, 255, 255, 0.5); }
.hotspot:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Locked (NDA) project: lock chip on the cover */
.cover .lock-chip {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: #fffaf0; box-shadow: 2px 3px 2px rgba(77, 61, 53, 0.4);
}
.cover .lock-chip svg { width: 20px; height: 20px; fill: var(--text); }
/* Custom lock PNG replaces the default chip */
.cover .lock-chip:has(img) { background: none; box-shadow: none; width: clamp(25px, 1.05vw + 18px, 34px); height: auto; }
.cover .lock-chip img { width: 100%; height: auto; opacity: 0.7; }
.lock-chip:has(img) svg, .lock-icon:has(img) svg { display: none; }

/* Locked (NDA) project: password card */
.lock { display: grid; place-items: center; padding-block: clamp(32px, 8vw, 96px); }
.lock-card {
  width: min(100%, 440px); display: grid; gap: 14px; justify-items: center; text-align: center;
  padding: 32px 28px; border-radius: 16px; background: #fffaf0; box-shadow: var(--shadow);
}
.lock-icon { display: block; width: 56px; }
.lock-icon svg { width: 44px; height: 44px; fill: var(--text); display: block; margin-inline: auto; }
.lock-icon img { width: 100%; height: auto; display: block; }
.lock-card h2 { margin: 0; font-family: "Titan One", var(--display); font-weight: 400; font-size: 1.6rem; line-height: 1.15; color: var(--text); }
.lock-card p { margin: 0; color: var(--muted); max-width: 34ch; font-family: "Titan One", var(--display); font-weight: 400; line-height: 1.4; }
.lock-card a { color: var(--text); overflow-wrap: anywhere; }
#lock-form { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 6px; }
#lock-pass {
  flex: 1 1 180px; min-width: 0; font: inherit; font-size: 1rem; padding: 12px 14px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
#lock-pass:focus { outline: none; border-color: var(--gold); }
#lock-form button {
  flex: 0 0 auto; font: 400 1.05rem/1 "Titan One", var(--display); padding: 12px 20px; cursor: pointer;
  border: 0; border-radius: 10px; background: #5cc8cf; color: #fff;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18), 2px 3px 2px rgba(77, 61, 53, 0.4);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
#lock-form button:hover { filter: brightness(1.05); }
#lock-form button:disabled { opacity: 0.7; cursor: progress; }
/* Custom Unlock button image: shown at 44px tall, replaces the default button look */
#lock-form .unlock:has(img) { padding: 0; background: none; box-shadow: none; }
#lock-form .unlock img { height: 50px; width: auto; display: block; }
.unlock:has(img) .fallback { display: none; }
.lock-msg { color: #c0392b !important; font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
