I just got back from SF (my first time there ever!)... I went in mid-June. And I had the same dilemma over what to bring. So here's what I learned:
They are NOT KIDDING about the layers! I decided reluctantly (I didn't want to take up precious carry-on space with something bulky) to bring a jean jacket the night before; and I threw a light scarf in my bag as I was leaving for the airport "because I might get chilly on the plane". I ended up wearing the jacket and scarf every day I was there, along with a fitted zip-up active jacket underneath those most days too! When I was packing I had been thinking in "outfits" and really I should have been thinking about layer options... my photos would have been less repetitive! Also when you think about the top layers, think about stuff that won't blow around in the wind. I brought my new Zara kimono and didn't wear it once because it doesn't have a belt to keep it closed. I definitely would have brought more scarves to change things up. It worked well for me to have two thinner jackets than one heavier coat so I could wear one, or the other, or both at once.
The funny thing is that you can be in one part of the city and it'll be 80 F and sunny - and you're down to bare arms - and then you move to another part of the city and it's 55 F - and you're buttoning up your jacket and winding your scarf tighter an hour later. So whatever you bring think about having to carry it around too, because you'll be taking it off and putting it on over and over!
We did a lot of walking, and there's a lot of hills and steps. Wear really comfortable shoes - I have Crocs that don't look like classic Crocs and I was so grateful for them. I brought open-toe sandals and shoes because hey it's summertime!... I wish I'd brought a closed-toe option. Boots would be fine, not dressy boots though. I used Band-Aid friction block religiously.
All my outfits were based on jeans but I had this idea since it was a big city it would be more sharp overall so I tried to pack with an eye to being a little dressier. But SF really is quite casual - stylish in a different way than I'm used to (I'm in Ontario and stylish here is a more Euro look to me); there's a lot of what I consider outdoorsy dressing (REI, Patagonia, North Face). We wore jeans to a higher-end restaurant and we were not out of place among the other people eating there. I saw very few heels and dresses; I saw a lot of flat sporty shoes. I did not see that sort of polished, designer, big-city look that I associate with, say, NYC - people's clothes were definitely more neutral colours (not so much black or bright) and definitely comfort-focused.
Betti is right about the sunscreen. I got both windburned and sunburnt on my face because it was chilly and gray and to be honest I don't think about putting on sunscreen if it's not warm and sunny out (I know, I know!). After a couple days I put it on every morning - and reapplied halfway through the day too. Oh, and I have long hair and I do wish I'd brought more options in keeping my hair back and out of my face. I had a headband which is normally fine but it wasn't secure in the wind and I had to keep adjusting it.
Have fun! I loved my trip there. The food is to die for - every single meal I ate blew my mind. I can't wait to go back =)