/* ==========================================================================
   TOKENS
   ========================================================================== */
:root {
  --bg: #f2ede4;
  --card: #ffffff;
  --ink: #2b241c;
  --dim: #7a6f60;
  --faint: #a89d8c;
  --line: rgba(43, 36, 28, 0.10);
  --line-strong: rgba(43, 36, 28, 0.20);
  --accent: #b5502e;
  --accent-deep: #96401f;
  --onaccent: #fdf3ee;

  /* category colors — extend this list if you add a new project type */
  --dot-web: #3f7a68;
  --dot-vst: #b5502e;
  --dot-mobile: #6b5b95;
  --dot-default: #7a6f60;

  --font-display: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --container: 1200px;
  --radius: 10px;
  --ease: cubic-bezier(.22, .68, .18, 1);
}

/* ==========================================================================
   RESET
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }

.skip-link {
  position: absolute; left: 1rem; top: -60px;
  background: var(--accent); color: var(--onaccent); font-weight: 600;
  padding: .6rem 1rem; border-radius: 6px; z-index: 200;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }

/* ==========================================================================
   TOP / HERO
   No nav — this is a single-page portfolio, there's nowhere else to go.
   ========================================================================== */
.top { padding-block: clamp(2.5rem, 8vh, 4.5rem) clamp(1.5rem, 4vh, 2.5rem); text-align: center; }
.wordmark {
  font-size: clamp(1.6rem, 1.4vw + 1.2rem, 2.1rem);
  letter-spacing: .01em;
  background: linear-gradient(100deg, var(--ink) 25%, var(--accent) 105%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: .6rem;
}
.tagline { color: var(--dim); font-size: clamp(1rem, .6vw + .85rem, 1.15rem); }

/* ==========================================================================
   FILTERS
   ========================================================================== */
.work { padding-block: .5rem clamp(2.5rem, 6vh, 4rem); }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; margin-bottom: 2rem; }
.filter-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 44px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--dim);
  border-radius: 999px;
  padding: .68rem 1.15rem;
  font-size: .85rem;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.filter-pill .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.filter-pill:hover { color: var(--ink); border-color: var(--accent); }
.filter-pill[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--onaccent); font-weight: 600;
}
.filter-pill[aria-pressed="true"] .dot { background: var(--onaccent) !important; }

/* ==========================================================================
   GRID / CARDS
   ========================================================================== */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(1rem, 2vw, 1.5rem); }
@media (max-width: 980px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  display: flex; flex-direction: column; overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card:hover, .card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 14px 30px -20px rgba(43,36,28,0.35);
  transform: translateY(-2px);
}

/* Thumbnail: three fit modes, chosen automatically per image (see main.js)
   - default: crop-to-fill (normal landscape screenshot)
   - .fit-contain: full image shown, letterboxed (square/tall plugin windows)
   - .has-phone: image wrapped in a phone bezel (mobile app screenshots) */
.card-thumb {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb.fit-contain img { object-fit: contain; padding: 10%; }
.card-thumb.has-phone { padding: .6rem 0; }
.card-thumb.has-phone img { width: auto; height: 100%; object-fit: cover; }
.phone-frame {
  height: 100%; aspect-ratio: 9 / 17.5;
  border-radius: 16px;
  border: 3px solid rgba(43, 36, 28, 0.18);
  overflow: hidden;
  box-shadow: 0 8px 20px -12px rgba(43,36,28,0.4);
  background: var(--ink);
}
.phone-frame img { width: 100%; height: 100%; object-fit: cover; }

.thumb-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.thumb-fallback span { font-family: var(--font-display); font-weight: 700; font-size: 3rem; color: rgba(43,36,28,0.10); }
.card-year {
  position: absolute; top: .7rem; right: .7rem;
  font-size: .72rem; color: var(--ink);
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line-strong);
  border-radius: 4px; padding: .15rem .45rem;
}

.card-body { padding: 1.1rem 1.25rem 1.3rem; display: flex; flex-direction: column; flex: 1; }
.card-type { display: flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--dim); margin-bottom: .5rem; }
.card-type .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.card-title { font-size: 1.05rem; margin-bottom: .35rem; }
.card-tagline { color: var(--dim); font-size: .88rem; margin-bottom: .8rem; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; }
.tag { font-family: var(--font-mono); font-size: .66rem; color: var(--dim); border: 1px solid var(--line-strong); border-radius: 4px; padding: .2rem .45rem; }

.empty-state { color: var(--faint); padding: 3rem 0; text-align: center; grid-column: 1 / -1; }

/* ==========================================================================
   ABOUT (one short block, below the work — not repeated)
   ========================================================================== */
.about { padding-block: 0 clamp(1.5rem, 4vh, 2.5rem); text-align: center; }
.about p { color: var(--dim); font-size: .92rem; max-width: 52ch; margin-inline: auto; line-height: 1.65; }

/* ==========================================================================
   SOCIAL
   ========================================================================== */
.social { padding-block: 0 clamp(2rem, 5vh, 3rem); }
.social-inner { display: flex; justify-content: center; gap: 1.4rem; }
.social-inner a {
  color: var(--dim); display: flex; padding: .4rem;
  transition: color .2s var(--ease);
}
.social-inner a:hover, .social-inner a:focus-visible { color: var(--accent); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.5rem; }
.footer-inner p { color: var(--faint); font-size: .85rem; text-align: center; }

/* ==========================================================================
   MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(43, 36, 28, 0.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.modal-overlay[hidden] { display: none; }
.modal {
  position: relative; width: min(640px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  animation: modalIn .2s var(--ease);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 1rem; right: 1rem; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line-strong); border-radius: 50%;
  color: var(--dim); cursor: pointer; transition: color .2s var(--ease), border-color .2s var(--ease);
}
.modal-close:hover { color: var(--ink); border-color: var(--accent); }

.modal-thumb {
  width: 100%; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; margin-bottom: 1.5rem;
  border: 1px solid var(--line); position: relative;
  display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.modal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.modal-thumb.fit-contain img { object-fit: contain; padding: 6%; }
.modal-thumb.has-phone { padding: 1rem 0; }
.modal-thumb.has-phone .phone-frame { height: 100%; }
.modal-meta { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; font-size: .85rem; color: var(--dim); }
.modal-meta .dot { width: 7px; height: 7px; border-radius: 50%; }
.modal h3 { font-size: 1.4rem; margin-bottom: .7rem; padding-right: 2rem; }
.modal-desc { color: var(--dim); margin-bottom: 1.2rem; max-width: 60ch; }
.modal-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.4rem; }
.modal-links { display: flex; flex-wrap: wrap; gap: .7rem; }
.modal-links a {
  text-decoration: none; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: .6rem 1.1rem; font-size: .88rem; color: var(--ink);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.modal-links a:hover { border-color: var(--accent); background: rgba(181,80,46,0.06); }
.modal-links a.is-primary { background: var(--accent); border-color: var(--accent); color: var(--onaccent); font-weight: 600; }
.modal-links a.is-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

@media (max-width: 560px) {
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 14px 14px 0 0; animation: sheetIn .22s var(--ease); }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
}
