/* Levi Guo portfolio. Colors and shapes follow SpeckLog's public site (specklog.com):
   warm paper background, outlined rounded cards, grey section titles, light + dark themes. */
:root {
  --bg: #e6e1d7; --card: #f1ede5; --text: #26241f; --muted: #5b574f; --outline: #39362e;
  --fill: #ddd7cb; --accent: #302d26; --callout: #e9e3d8;
  --good: #2f6b3a; --next: #8a5a12;
  --outline-width: 3px;
  --page-width: 880px;
  --gutter: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #2f1d16; --card: #3d2720; --text: #fbefe4; --muted: #dcc0ad; --outline: #9c7158;
  --fill: #533629; --accent: #f2cdb0; --callout: #472d23;
  --good: #8fd49b; --next: #f0c27a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2f1d16; --card: #3d2720; --text: #fbefe4; --muted: #dcc0ad; --outline: #9c7158;
    --fill: #533629; --accent: #f2cdb0; --callout: #472d23;
    --good: #8fd49b; --next: #f0c27a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 475 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 28px var(--gutter) 140px; }
img, video { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
h1 { font-size: clamp(34px, 6vw, 46px); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 21px; font-weight: 700; color: var(--muted); margin: 40px 0 10px 4px; }
h3 { font-size: 23px; line-height: 1.2; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.01em; }
h4 { font-size: 17px; font-weight: 700; margin: 14px 0 4px; }
p { margin: 0 0 12px; }
ul { margin: 0 0 12px; padding-left: 22px; }
li { margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 15px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cards: the SpeckLog outlined card. */
.card {
  background: var(--card); border: var(--outline-width) solid var(--outline); border-radius: 22px;
  padding: 20px 22px; margin: 0 0 18px;
}
.card > :last-child { margin-bottom: 0; }
.callout { background: var(--callout); border: 2px solid var(--outline); border-radius: 16px; padding: 12px 14px; margin: 0 0 12px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; margin-top: 12px; }
.hero .lead { font-size: 20px; line-height: 1.45; margin: 4px 0 14px; }
.portrait { width: 168px; height: 168px; border-radius: 50%; object-fit: cover; border: var(--outline-width) solid var(--outline); }
.seeking { display: inline-block; font-size: 14px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--fill); border: 2px solid var(--outline); margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px;
  font: inherit; font-size: 16px; font-weight: 700; color: var(--text); background: var(--fill);
  border: var(--outline-width) solid var(--outline); border-radius: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--callout); }
.btn.primary { background: var(--accent); color: var(--bg); }
.btn:focus-visible, .site-control:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Project cards */
.project-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; }
.eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; padding: 0; list-style: none; }
.tags li { margin: 0; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--fill); border: 2px solid var(--outline); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.app-icon { width: 64px; height: 64px; border-radius: 23%; flex: none; }
.title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }

/* Stat tiles (a nod to Cruise Control's big-number workout tiles). */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0 14px; }
.stat { background: var(--callout); border: 2px solid var(--outline); border-radius: 16px; padding: 10px 12px; }
.stat b { display: block; font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }

/* Status list */
.status { list-style: none; padding: 0; margin: 0 0 12px; }
.status li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 7px 0; margin: 0; border-top: 1px solid var(--fill); }
.status li:first-child { border-top: 0; }
.pill { justify-self: start; align-self: start; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 999px; border: 2px solid currentColor; }
.pill.done { color: var(--good); }
.pill.next { color: var(--next); }
.pill.later { color: var(--muted); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 6px 0 12px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--fill); }
th { color: var(--muted); font-weight: 700; }

/* Media + placeholders: swap a .placeholder for an <img> or <video> when you have it. */
figure { margin: 0 0 12px; }
figure img, figure video { width: 100%; border-radius: 16px; border: 2px solid var(--outline); }
figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  min-height: 180px; padding: 16px; border: 2px dashed var(--muted); border-radius: 16px; background: var(--callout);
  color: var(--muted); font-size: 14px;
}
.placeholder strong { color: var(--text); font-size: 15px; }
.placeholder.tall { min-height: 300px; }
.phone-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.phone-row .placeholder { min-height: 260px; }

/* Smaller cards grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.grid h3 { font-size: 19px; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.skills .card { margin: 0; }
.skills h3 { font-size: 17px; }

/* Experience rows */
.row-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.row-head h3 { font-size: 19px; }
.entry + .entry { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--fill); }

/* Floating controls, as on specklog.com: page menu + theme, bottom right. */
.site-controls { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 10; display: grid; gap: 4px; width: 170px; }
.site-control {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 12px; font: inherit; font-size: 14px; font-weight: 700; color: var(--text); background: var(--card);
  border: var(--outline-width) solid var(--outline); border-radius: 12px; cursor: pointer; text-decoration: none;
}
.site-control:hover { background: var(--callout); }
.site-pages { position: relative; }
.site-pages summary { list-style: none; }
.site-pages summary::-webkit-details-marker { display: none; }
.site-pages summary::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid; transform: translateY(-2px) rotate(45deg); }
.site-pages[open] summary::after { transform: translateY(2px) rotate(225deg); }
.page-menu {
  position: absolute; bottom: calc(100% + 5px); right: 0; width: 200px; padding: 5px;
  border: var(--outline-width) solid var(--outline); border-radius: 12px; background: var(--card); box-shadow: 0 6px 18px #0002;
}
.page-menu a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); font-size: 14px; text-decoration: none; }
.page-menu a:hover { background: var(--fill); }

footer { text-align: center; color: var(--muted); font-size: 14px; margin-top: 40px; }

@media (max-width: 700px) {
  body { font-weight: 550; -webkit-font-smoothing: auto; }
  .hero { grid-template-columns: 1fr; }
  .portrait { width: 120px; height: 120px; order: -1; }
  .two-col { grid-template-columns: 1fr; }
  .phone-row { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px 16px; }
  main { padding-bottom: 170px; }
}

/* Light/dark screenshot pairs follow the site theme. */
.only-dark { display: none !important; }
:root[data-theme="dark"] .only-dark { display: block !important; }
:root[data-theme="dark"] .only-light { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark { display: block !important; }
  :root:not([data-theme="light"]) .only-light { display: none !important; }
}
.phone-row figure img { border-radius: 14px; aspect-ratio: 9 / 16; object-fit: cover; object-position: top; }
.phone-row figure img.watch { aspect-ratio: auto; object-fit: contain; border-radius: 28%; }

/* Project list (home): each project is an outlined card row linking to its own page in projects/. */
.project-list { display: flex; flex-direction: column; gap: 14px; }
.project-list .card.project-link { margin: 0; }
a.project-link {
  flex-direction: row; align-items: flex-start; gap: 16px; padding: 18px 22px;
  color: inherit; text-decoration: none;
}
a.project-link:hover { background: var(--callout); }
a.project-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.thumb { flex: none; width: 96px; height: 96px; margin: 2px 0 0; border-radius: 16px; }
img.thumb.photo { object-fit: cover; border: 2px solid var(--outline); }
img.thumb.app-icon { border-radius: 23%; }
.thumb.placeholder { min-height: 0; padding: 4px; font-size: 12px; border-radius: 16px; }
.compact .thumb { width: 72px; height: 72px; }
.row-text { flex: 1; min-width: 0; }
.row-text h3 { margin: 0 0 2px; }
.compact .row-text h3 { font-size: 19px; }
.row-meta { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.row-summary { margin: 0; }
.row-text .tags { margin: 10px 0 0; }
.chevron {
  flex: none; align-self: center; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--outline); background: var(--fill); position: relative;
}
.chevron::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  border-right: 2.5px solid var(--text); border-bottom: 2.5px solid var(--text);
  transform: translate(-70%, -50%) rotate(-45deg); transition: transform .15s ease;
}
a.project-link:hover .chevron::after { transform: translate(-45%, -50%) rotate(-45deg); }

/* Project pages (projects/*.html) */
.back-link { align-self: flex-start; display: inline-flex; min-height: 44px; align-items: center; font-weight: 700; text-decoration: none; margin: 0 0 8px; }
.back-link:hover { text-decoration: underline; }
.project-hero { margin: 8px 0 18px; }
.project-hero h1 { font-size: clamp(30px, 5vw, 40px); margin: 0 0 4px; }
.project-hero .title-row { align-items: flex-start; }
.project-hero .title-row .app-icon { margin-top: 4px; }
.project-hero .tags { margin-bottom: 0; }
.project-page .card + .back-link { margin-top: 8px; }
.ci-badge { align-self: flex-start; margin-bottom: 12px; }

@media (max-width: 700px) {
  a.project-link { padding: 16px; gap: 12px; }
  .thumb, .compact .thumb { width: 56px; height: 56px; border-radius: 12px; }
  .chevron { display: none; }
}
@media (prefers-reduced-motion: reduce) { .chevron::after { transition: none; } }

/* Safari fills the gap between selected blocks out to the page edges, except inside flex columns
   (same fix as specklog.com). So the text containers are flex columns; spacing uses margins, which don't collapse here.
   Project rows: the row text and the project-page header are flex columns too. */
body, main, section, article, .card, .entry, figure, .row-text, .project-hero { display: flex; flex-direction: column; }
a.project-link { flex-direction: row; }
.row-text .tags, .project-hero .tags { align-self: stretch; }
.seeking { align-self: flex-start; }
.actions, .links { align-self: stretch; }
