/* =========================================================================
   Portfolio — Landing
   Spec: harin.design lineage. Sidebar 1:1 with harin.
   Right column diverges: vertical list of 4 wide (16:10) cards.
   System fonts only. No build step. Mobile-aware.
   ========================================================================= */

:root {
  /* ---- Color: greys + ink ---- */
  --bg: #ffffff;
  --white: #ffffff;
  --cream: #ffffff;
  --g50: #f5f4f1;
  --g100: #ebeae5;
  --g200: #d8d6d0;
  --g400: #a8a59e;
  --g500: #8a877f;
  --g700: #4a4842;
  --ink: #161513;

  /* Aliases preserved for existing rules */
  --ink-1: var(--ink);
  --ink-2: var(--g500);
  --ink-3: var(--g400);
  --surface-sticker: var(--white);
  --surface-card: #f5f4f0;
  --halftone-dot: rgba(22, 21, 19, 0.4); /* full alpha; canvas opacity scales it down */

  /* ---- Hairline border (used everywhere) ---- */
  --hairline: 1px solid rgba(0, 0, 0, 0.05);

  /* ---- Success / Copied state ---- */
  --success-bg: rgb(225, 245, 238);
  --success-border: rgba(29, 158, 117, 0.15);
  --success-ink: rgb(29, 158, 117);

  /* ---- Type ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "system-ui", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --fs-display: 28px;
  --lh-display: 1.15;

  --fs-body: 12px;
  --lh-body: 1.55;

  --fs-eyebrow: 11px;
  --fs-pill: 13px;

  --fs-card-title: 16px;
  --lh-card-title: 1.3;

  --fs-card-meta: 12px;
  --fs-footer: 11px;

  --tracking-display: -0.035em;
  --tracking-card-title: -0.015em;
  --tracking-default: -0.01em;
  --tracking-eyebrow: 0.02em;

  /* ---- Layout ---- */
  --page-max: 1200px;
  --page-pad-x: 40px;
  --col-gap: 64px;
  --sidebar-w: 280px;
  --content-w: 776px;
  --eyebrow-to-card: 40px;
  --row-gap-cards: 80px;

  /* ---- Cards ---- */
  --media-aspect: 2 / 1;
  --media-radius: 20px;
  --media-to-caption: 20px;
  --title-to-meta: 6px;

  /* ---- Radii ---- */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-pill: 100px;

  /* ---- Spacing scale (informational) ---- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 28px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 56px;
  --s-11: 64px;
  --s-12: 72px;
  --s-13: 96px;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --island: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-card: 350ms;
}

/* -------------------------------------------------------------------------
   Base & resets
   ------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink-1);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-default);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

::selection {
  background: var(--ink-1);
  color: var(--bg);
}

/* -------------------------------------------------------------------------
   Sticker primitive — every text "stand-off" pill on white page
   Every sticker gets the 1px hairline. Without it the page reads as flat.
   ------------------------------------------------------------------------- */
.sticker {
  display: inline-block;
  width: fit-content;
  background: var(--surface-sticker);
  border: var(--hairline);
  border-radius: var(--r-md);
  padding: 6px 12px;
}

/* -------------------------------------------------------------------------
   Page container
   ------------------------------------------------------------------------- */
.page {
  display: flex;
  flex-direction: row;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad-x);
  column-gap: var(--col-gap);
}

/* -------------------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  /* Right padding moved onto .sidebar-top so the game can run full-bleed
     to the right divider. */
  padding: 72px 0 0 0;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  border-right: var(--hairline); /* vertical divider into content */
}

.sidebar-top {
  padding-right: 48px;
}

/* -------------------------------------------------------------------------
   Sidebar game (Tetris) — full-bleed bottom of the sidebar.
   Internal flex column: hint line above, canvas fills the rest.
   Canvas anchors flush to the bottom of the sidebar (= viewport bottom on
   sticky layout) so the playfield base never gets cut.
   ------------------------------------------------------------------------- */
.sidebar-game {
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 0;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
}

.game-hint {
  margin: 0 0 10px;
  padding: 0 16px 0 4px;
  font-weight: 400;
  letter-spacing: var(--tracking-default);
  user-select: none;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-hint-lead {
  font-size: 11px;
  font-weight: 500;
  color: var(--g500);
}

.game-hint-keys {
  font-size: 10px;
  color: var(--g400);
}

.game-hint-keys span {
  font-weight: 500;
  color: var(--g500);
}

.game-canvas {
  display: block;
  flex: 1 1 auto;
  min-height: 0;       /* flex shrink past intrinsic */
  width: 100%;
  background: transparent;
  cursor: pointer;
  outline: none;
}

/* No visible focus ring — hover engages the game, focus is silent.
   Pure-keyboard users still tab in and play; we trade the visual signal
   for a cleaner sidebar surface. */
.game-canvas:focus,
.game-canvas:focus-visible {
  outline: none;
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

/* Display heading — plain (no sticker treatment) */
.sidebar-name {
  margin: 0 0 24px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: var(--fs-display);
  font-weight: 600;
  line-height: var(--lh-display);
  letter-spacing: var(--tracking-display);
  color: var(--ink-1);
}

.sidebar-name-line-1,
.sidebar-name-line-2 {
  display: block;
}

.sidebar-name em {
  font-style: italic;
  font-weight: 500;
}

/* Bio — three short blocks, plain (no sticker treatment) */
.sidebar-bio {
  margin: 0 0 32px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking-default);
  max-width: 232px;
}

.bio-block {
  display: block;
}

.bio-block + .bio-block {
  margin-top: 12px;
}

.bio-block--quiet {
  color: var(--ink-3);
}

/* Inline pill — the credibility lift (company chips inside bio) */
.inline-pill {
  display: inline-block;
  background: var(--surface-sticker);
  color: var(--ink-1);
  font-weight: 500;
  letter-spacing: var(--tracking-default);
  padding: 1px 6px 2px;
  border: var(--hairline);
  border-radius: var(--r-xs);
}

/* Pill links — round pills, white-on-black flip on hover with spring + icon rotate */
.sidebar-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px 4px;
}

.sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--white);
  color: var(--ink);
  border: var(--hairline);
  border-radius: var(--r-pill);
  font-size: var(--fs-pill);
  font-weight: 500;
  letter-spacing: var(--tracking-default);
  transition: background-color 0.35s var(--spring),
              color 0.35s var(--spring),
              border-color 0.35s var(--spring),
              transform 0.35s var(--spring);
  will-change: transform;
}

.sidebar-link:hover {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
  transform: translateY(-2px);
}

.sidebar-link:hover .link-icon {
  transform: rotate(-8deg) scale(1.15);
}

.sidebar-link:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 0.1s;
}

.link-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  color: currentColor;
  transition: transform 0.35s var(--spring);
}

/* Email row — bottom-left email + animated copy button */
.sidebar-email {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0 4px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: var(--fs-body);
  color: var(--g500);
  letter-spacing: var(--tracking-default);
}

.sidebar-email-text {
  display: inline-block;
  font-size: 12px;
  color: var(--g500);
}

/* Round 26×26 pill that morphs to a mint "Copied ✓" capsule on click */
.sidebar-email-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: 26px;
  padding: 0 6px;
  background: var(--white);
  border: var(--hairline);
  border-radius: var(--r-pill);
  color: var(--g500);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: background-color 0.35s var(--spring),
              color 0.35s var(--spring),
              border-color 0.35s var(--spring),
              padding 0.35s var(--spring),
              transform 0.35s var(--spring);
}

.sidebar-email-copy:hover {
  background: var(--g50);
  color: var(--ink);
}

.sidebar-email-copy:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

.sidebar-email-copy svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.sidebar-email-copy .copy-check {
  display: none;
}

/* Slide-in "Copied" text label */
.sidebar-email-copy .copy-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-default);
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  overflow: hidden;
  transition: max-width 0.35s var(--spring),
              opacity 0.2s ease,
              margin 0.35s var(--spring);
}

/* Copied state — mint capsule, check icon, label slides in */
.sidebar-email-copy.copied {
  padding: 0 10px 0 6px;
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-ink);
}

.sidebar-email-copy.copied .copy-icon {
  display: none;
}

.sidebar-email-copy.copied .copy-check {
  display: block;
}

.sidebar-email-copy.copied .copy-label {
  max-width: 50px;
  opacity: 1;
  margin-left: 4px;
}

/* Footer copyright — plain (no sticker treatment) */
.sidebar-bottom {
  align-self: flex-start;
  width: fit-content;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--g400);
  font-size: var(--fs-footer);
  letter-spacing: var(--tracking-default);
}

/* -------------------------------------------------------------------------
   Content (right column)
   ------------------------------------------------------------------------- */
.content {
  width: var(--content-w);
  flex: 0 0 var(--content-w);
  padding: 72px 0 64px;
  min-width: 0;
}

/* "Selected Works" eyebrow — plain text label, aligns flush to grid */
.content-label {
  display: inline-block;
  width: fit-content;
  margin: 0 0 28px 0;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--g500);
}

/* -------------------------------------------------------------------------
   Work list
   ------------------------------------------------------------------------- */
.work-list {
  display: flex;
  flex-direction: column;
  gap: var(--row-gap-cards);
}

.work-row {
  display: block;
  width: 100%;
  outline: none;
}

.work-row:focus-visible .work-media {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink);
}

/* Card media — 16:10 wide hero. Hairline rim like harin's phone-frame stroke. */
.work-media {
  width: 100%;
  aspect-ratio: var(--media-aspect);
  background: var(--surface-card);
  border: var(--hairline);
  border-radius: var(--media-radius);
  overflow: hidden;
  position: relative;
  transition: transform var(--dur-card) var(--ease);
  will-change: transform;
}

/* Subtle gradient inside placeholder so cards don't read as flat dead surfaces */
.work-media::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(22, 21, 19, 0.04), transparent 60%),
    radial-gradient(120% 80% at 0% 100%, rgba(22, 21, 19, 0.03), transparent 55%);
}

/* Placeholder slug label — visible only while real art isn't dropped in */
.work-media::after {
  content: "[" attr(data-slug) "]";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--g400);
}

/* Card hover: gentle lift, matches harin's translateY(-3px) on .card-media */
.work-row:hover .work-media {
  transform: translateY(-3px);
}

.work-caption {
  margin-top: var(--media-to-caption);
  display: flex;
  flex-direction: column;
  gap: var(--title-to-meta);
}

.work-title {
  margin: 0;
  font-size: var(--fs-card-title);
  font-weight: 500;
  line-height: var(--lh-card-title);
  letter-spacing: var(--tracking-card-title);
  color: var(--ink-1);
  transition: font-weight 160ms var(--ease-out);
}

.work-row:hover .work-title {
  font-weight: 600;
}

.work-meta {
  margin: 0;
  font-size: var(--fs-card-meta);
  font-weight: 400;
  letter-spacing: var(--tracking-default);
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.work-meta .dot {
  color: var(--ink-3);
}

/* -------------------------------------------------------------------------
   Sub-card variant — landing-page nested rows.
   - Indented 48px from the left (signals "child of the row above")
   - Width capped at ~80% so the card visually steps in
   - Smaller title + ↳ glyph prefix for clear hierarchy
   - Pulled UP closer to its parent (24px gap, not 80px)
   ------------------------------------------------------------------------- */
.work-list > .work-item--sub {
  margin-top: -56px;            /* offsets the parent 80px gap to net 24px */
  padding-left: 48px;            /* left indent does the "I'm a child" work */
  /* No width cap — right edge stays aligned with main cards for a consistent
     vertical column down the page. */
}

.work-row--sub .work-media {
  /* Same 2:1 aspect, smaller frame is achieved by parent width capping */
  border-radius: 16px;           /* slightly tighter than main 20px */
}

.work-title--sub {
  font-size: 14px;               /* down from 16px */
  font-weight: 500;
  letter-spacing: var(--tracking-card-title);
}

/* The ↳ glyph signals continuation. Rendered as pseudo-element so it can
   be styled (color, weight) without polluting the title text. */
.work-title--sub::before {
  content: "↳ ";
  color: var(--g500);
  font-weight: 400;
  margin-right: 2px;
}

/* -------------------------------------------------------------------------
   Field Notes — horizontal photo strip variant
   Replaces the .work-media with a flex row of varied-aspect placeholders.
   Image-dump aesthetic: not a polished gallery, just candid shots.
   ------------------------------------------------------------------------- */
.work-row--strip .field-strip {
  display: flex;
  flex-direction: row;
  gap: 12px;
  height: 168px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;          /* Firefox */
  border-radius: 16px;
}

.work-row--strip .field-strip::-webkit-scrollbar {
  display: none;                  /* WebKit */
}

.field-photo {
  height: 100%;
  flex: 0 0 auto;
  background: var(--surface-card);
  border: var(--hairline);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  scroll-snap-align: start;
}

.field-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(22, 21, 19, 0.04), transparent 60%),
    radial-gradient(120% 80% at 0% 100%, rgba(22, 21, 19, 0.03), transparent 55%);
}

.field-photo::after {
  content: "[" attr(data-slug) "]";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--g400);
}

/* Aspect-driven widths: photos vary in shape so the strip feels candid */
.field-photo--4x3 { aspect-ratio: 4 / 3; }
.field-photo--1x1 { aspect-ratio: 1 / 1; }
.field-photo--3x4 { aspect-ratio: 3 / 4; }

/* Strip variant doesn't need the regular media radius — it's its own thing */
.work-row--strip .work-caption {
  margin-top: 16px;
}

/* -------------------------------------------------------------------------
   Tablet / mobile (≤768px)
   ------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .page {
    flex-direction: column;
    padding: 0 20px;
    column-gap: 0;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: calc(40px + env(safe-area-inset-top)) 0 32px;
  }

  .sidebar-halftone {
    display: none;
  }

  .sidebar-bio {
    max-width: none;
  }

  .sidebar-links {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .content {
    width: 100%;
    flex: 1 1 auto;
    padding: 16px 0 calc(56px + env(safe-area-inset-bottom));
  }

  .content-label {
    margin-left: 0;
  }

  .work-list {
    gap: 64px;
  }
}

/* -------------------------------------------------------------------------
   Phone (≤480px)
   ------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .work-list {
    gap: 48px;
  }

  .sidebar-name {
    font-size: 24px;
  }
}

/* -------------------------------------------------------------------------
   Reduced motion
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .work-row:hover .work-media {
    transform: none;
  }
}
