/* raw early-web, high-end finish */

@font-face {
  font-family: 'Berkeley Mono';
  src: url('fonts/BerkeleyMono-Regular.otf') format('opentype');
  font-weight: normal;
  font-display: swap;
}

:root {
  --ink: #141414;
  --paper: #fcfcf7;
  --dim: #6f6f68;
  --rule: #d8d8cf;
  --accent: #0000ee;      /* classic link blue */
  --visited: #551a8b;     /* classic visited purple */
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #d9d9d0;
    --paper: #101010;
    --dim: #7c7c74;
    --rule: #2b2b28;
    --accent: #8ab4f8;
    --visited: #b699d6;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  max-width: 74ch;
  font-family: 'Berkeley Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ambient background — dimmed grid collage of all project media,
   with a solid paper column behind the text so edges glow, content stays clean */
#bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  grid-auto-rows: 150px;
  gap: 2px;
  overflow: hidden;
  pointer-events: none;
}
#bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.06;
  filter: grayscale(70%) contrast(110%);
}
#bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    transparent 0,
    var(--paper) 16%,
    var(--paper) 84%,
    transparent 100%
  );
}
@media (prefers-color-scheme: dark) {
  #bg img { opacity: 0.14; }
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 1.5rem 0;
}

a { color: var(--accent); }
a:visited { color: var(--visited); }
a:hover { background: var(--accent); color: var(--paper); text-decoration: none; }

/* header */
header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
header h1 { font-size: 15px; margin: 0; font-weight: normal; letter-spacing: .08em; text-transform: uppercase; }
#home-link { color: var(--ink); text-decoration: none; }
#home-link:hover { background: none; color: var(--accent); }
header nav { display: flex; gap: 1.25rem; font-size: 12px; }

/* footer */
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--dim); font-size: 11px; }

/* ------- index list ------- */
.intro { margin: 0 0 2rem; color: var(--dim); }
.intro b { color: var(--ink); font-weight: normal; }

ul.projects { list-style: none; margin: 0; padding: 0; }
ul.projects li {
  display: grid;
  grid-template-columns: 4.5ch 1fr;
  gap: 1.25ch;
  padding: .45rem 0;
  border-bottom: 1px dotted var(--rule);
}
ul.projects .year { color: var(--dim); font-size: 12px; padding-top: .1em; }
ul.projects .t a { text-decoration: none; }
ul.projects .t a:hover { text-decoration: underline; background: none; color: var(--accent); }
ul.projects .d { display: block; color: var(--dim); font-size: 12.5px; }
ul.projects .tags { color: var(--dim); font-size: 11px; letter-spacing: .04em; }

.section-label {
  margin: 2.25rem 0 .25rem;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ------- clients & credits (native <details>, minimal) ------- */
details.client { border-bottom: 1px dotted var(--rule); }
details.client summary {
  display: grid;
  grid-template-columns: 6ch 1fr auto 4.5ch;
  gap: 1.25ch;
  align-items: baseline;
  padding: .4rem 0;
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
}
details.client summary::-webkit-details-marker { display: none; }
details.client summary::before { content: '+'; position: absolute; margin-left: -1.5ch; color: var(--dim); }
details.client[open] summary::before { content: '−'; }
details.client .cat { color: var(--dim); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
details.client .cname { letter-spacing: .02em; }
details.client .crole { color: var(--dim); font-size: 11.5px; text-align: right; }
details.client .cyear { color: var(--dim); font-size: 11.5px; text-align: right; }
details.client .cbody { padding: .1rem 0 .75rem 7.25ch; font-size: 12.5px; color: var(--dim); }
details.client .cbody p { margin: .25rem 0; }
details.client .cbody ul { margin: .25rem 0 0; padding-left: 2.5ch; }
details.client .cbody li { margin: .1rem 0; }

@media (max-width: 600px) {
  details.client summary { grid-template-columns: 1fr auto; }
  details.client .cat, details.client .crole { display: none; }
  details.client .cbody { padding-left: 0; }
}

/* ------- project page (rendered markdown) ------- */
.backline { font-size: 12px; margin-bottom: 1.75rem; color: var(--dim); }
.backline a { text-decoration: none; }

#md h1 { font-size: 17px; font-weight: normal; letter-spacing: .02em; margin: 0 0 .25rem; }
#md h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--dim); font-weight: normal; margin: 2.25rem 0 .5rem; }
#md h3 { font-size: 13.5px; margin: 1.5rem 0 .25rem; }
#md blockquote {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
  color: var(--dim);
  font-style: italic;
}
#md p { margin: .75rem 0; }
#md ul, #md ol { padding-left: 2.5ch; }
#md li { margin: .2rem 0; }
#md code { font-size: 12.5px; background: var(--rule); padding: .05em .35em; }
#md pre { background: var(--rule); padding: .75rem 1rem; overflow-x: auto; }
#md pre code { background: none; padding: 0; }
#md table { border-collapse: collapse; font-size: 12.5px; width: 100%; display: block; overflow-x: auto; }
#md th, #md td { border: 1px solid var(--rule); padding: .3rem .6rem; text-align: left; }
#md img, #md video {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.25rem 0 .25rem;
  border: 1px solid var(--rule);
}
#md img + em, #md video + em, .caption {
  display: block;
  font-size: 11px;
  color: var(--dim);
  font-style: normal;
  margin-bottom: 1.25rem;
}

/* x/twitter embeds — raw blockquote pre-hydration, iframe after */
blockquote.twitter-tweet,
#md blockquote.twitter-tweet {
  margin: 1.5rem 0;
  padding: .75rem 1rem;
  border: 1px solid var(--rule);
  font-style: normal;
  color: var(--ink);
  font-size: 13px;
}
blockquote.twitter-tweet a { color: var(--accent); }
.twitter-tweet-rendered { margin: 1.5rem 0 !important; }

/* responsive youtube embed */
.yt {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 1.25rem 0;
  border: 1px solid var(--rule);
}
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* vibe-coded disclosure */
.vibe {
  display: block;
  margin: 0.5rem 0 0;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
.vibe a { color: var(--dim); }

.prevnext { display: flex; justify-content: space-between; margin-top: 3rem; font-size: 12px; }
.prevnext a { text-decoration: none; }

.loading { color: var(--dim); }

/* mobile */
@media (max-width: 600px) {
  body { padding: 1.5rem 1rem 3rem; font-size: 13.5px; }
  header { flex-direction: column; gap: 0.35rem; }
  header nav { gap: 1rem; flex-wrap: wrap; }
  ul.projects li { grid-template-columns: 1fr; gap: 0; }
  ul.projects .year { font-size: 11px; }
  #md table { font-size: 11.5px; }
  footer { flex-direction: column; gap: 0.25rem; }
  .twitter-tweet-rendered { max-width: 100% !important; }
}
